";print_r($_SESSION);echo "pre>";echo "LOGGED IN USER DETAILS";echo "";print_r($loggedInUser);echo "pre>";?UserManage.git/objects/27/417fc873112a5ea4c9cf9d62fa2ff9681043d7UserManage.git/objects/27/417fc873112a5ea4c9cf9d62fa2ff9681043d7lob 1384�/* Navicat MySQL Data Transfe Source Server : SMTP Source Server Type : MySQL Source Server Version : 50622 Source Host : localhost Source Database : UserManage Target Server Type : MySQL Target Server Version : 50622 File Encoding : utf-8 Date: 10/28/2015 10:50:11 AM*SET NAMES utf8;SET FOREIGN_KEY_CHECKS = 0;-- ------------------------------ Table structure for `UserDetails`-- ----------------------------DROP TABLE IF EXISTS `UserDetails`;CREATE TABLE `UserDetails` ( `UserID` varchar(120) NOT NULL, `UserName` varchar(150) NOT NULL, `FirstName` varchar(150) DEFAULT NULL, `LastName` varchar(150) DEFAULT NULL, `Email` varchar(150) NOT NULL, `Password` varchar(1000) DEFAULT NULL, `MemberSince` varchar(255) DEFAULT NULL, `Active` int(11) DEFAULT NULL, PRIMARY KEY (`UserName`,`Email`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;-- ------------------------------ Records of `UserDetails`-- ----------------------------BEGIN;INSERT INTO `UserDetails` VALUES ('4frvct', 'JohnSmith', 'John', 'Smith', '[email protected]', '6f4e26455b0f9c987a0009f3c5bd12786300b90fa76fb5399c82f2e63ab7121aa', '1445987595', '1'), ('692g6q', 'PraviinM', 'Praviin', 'Mandhare', '[email protected]', '1e905117d466dc32016cb71e3cb798cea73a942f2221fcbda1b5dc8104c2565ee', '1445961643', '1');COMMIT;SET FOREIGN_KEY_CHECKS = 1;UserManage.git/objects/29/ecc3beec0ef4312b82ecb5742fdff9021a6f50UserManage.git/objects/29/ecc3beec0ef4312b82ecb5742fdff9021a6f50lob 342";?UserManage.git/objects/34/846b22f14b68d30f8f5ff072a00a28466c6c08UserManage.git/objects/34/846b22f14b68d30f8f5ff072a00a28466c6c08commit 223�tree 81dde3dfbea01b8ca81db05e5e167bd6871b0d89parent 50b86c7fa215124f3245d5a39f51d675579f6168author Praviin M 1600961486 -0400committer Praviin M 1600961486 -0400egisttration pageUserManage.git/objects/34/c0bfd3c8c5886a82d643f97b052df42d83e3eUserManage.git/objects/34/c0bfd3c8c5886a82d643f97b052df42d83e3elob 149�equire_once("config.php");Log the user outif (isUserLoggedIn()) { destroySession("ThisUser");;}header("Location:index.php");die();UserManage.git/objects/3e/03da8381705ce5a75f8d812f0242da87bf47e0UserManage.git/objects/3e/03da8381705ce5a75f8d812f0242da87bf47e0UserManage.git/objects/3f/54ee97e3396b4d52b593f22f10313cf884ec0dUserManage.git/objects/3f/54ee97e3396b4d52b593f22f10313cf884ec0dcommit 204�tree cb63b464a06eba77cf409d3b030b8800fe82bc87author Praviin M 1491237353 -0400committer Praviin M 1491237353 -0400Updated Code + echo`d passwords for explanationUserManage.git/objects/40/3b3b4c7b66ebebfa437d0a70850a73e3f38458UserManage.git/objects/40/3b3b4c7b66ebebfa437d0a70850a73e3f38458lob 5488�$password = md5("Smith");echo $password."";$code = md5(uniqid(rand(), TRUE));echo $code;Generate a unique code** * @param string $length * @return string *function getUniqueCode($length = ""){ $code = md5(uniqid(rand(), TRUE)); if ($length != "") { return substr($code, 0, $length); } else { return $code; }}$plainText = getUniqueCode(15);echo $plainText;** * @param $plainText * @param null $salt * @return string *function generateHash($plainText, $salt = NULL){ echo "plain text =" . $plainText . ""; if ($salt === NULL) { $salt = substr(md5(uniqid(rand(), TRUE)), 0, 25); echo "salt when salt is null : " . $salt . ""; } else { echo "salt before substr : " . $salt . "R>"; $salt = substr($salt, 0, 25); echo "just salt : " . $salt . "R>"; } echo "return salt : " . $salt . ""; echo "return sha ( salt ) : " . sha1($salt) . ""; echo "return sha ( plaintext ) : " . sha1($plainText) . ""; echo "return sha ( satl + plaintext ) : " . sha1($salt . $plainText) . ""; echo "return salt . sha1 ( salt + plaintext ) : " . $salt . sha1($salt . $plainText) . ""; return $salt . sha1($salt . $plainText);}echo $newpassword;$compare = generateHash($_POST['password'], $newpassword);echo $compare;** * @param $username * @param $firstname * @param $lastname * @param $email * @param $password * @return bool *function createNewUser($username, $firstname, $lastname, $email, $password){ global $mysqli, $db_table_prefix; Generate A random userid $character_aay = aay_merge(range(a, z), range(0, 9)); $rand_string = ""; for ($i = 0; $i < 6; $i++) { $rand_string .= $character_aay[rand( 0, (count($character_aay) - 1) )]; } $rand_string = getUniqueCode(14); echo $rand_string; echo $username; echo $firstname; echo $lastname; echo $email; echo $password; $newpassword = generateHash($password); echo $newpassword; $stmt = $mysqli->prepare( "INSERT INTO " . $db_table_prefix . "UserDetails ( UserID, UserName, FirstName, LastName, Email, Password, MemberSince, Active ) VALUES ( '" . $rand_string . "', ?, ?, ?, ?, ?, '" . time() . "', 1 )" ); $stmt-ind_param("sssss", $username, $firstname, $lastname, $email, $newpassword); print_r($stmt); $result = $stmt->execute(); print_r($result); $stmt->close(); return $result;}Retrieve complete user information by username** * @param $username * @return aay *function fetchUserDetails($username){ global $mysqli, $db_table_prefix; $stmt = $mysqli->prepare("SELECT UserID, UserName, FirstName, LastName, Email, Password, MemberSince, Active FROM " . $db_table_prefix . "UserDetails WHERE UserName = ? LIMIT 1"); $stmt-ind_param("s", $username); $stmt->execute(); $stmt-ind_result($UserID, $UserName, $FirstName, $LastName, $Email, $Password, $MemberSince, $Active); while ($stmt->fetch()) { $row = aay('UserID' => $UserID, 'UserName' => $UserName, 'FirstName' => $FirstName, 'LastName' => $LastName, 'Email' => $Email, 'Password' => $Password, 'MemberSince' => $MemberSince, 'Active' => $Active); } $stmt->close(); return ($row);}Check if a user is logged in** * @return bool *function isUserLoggedIn(){ global $loggedInUser, $mysqli, $db_table_prefix; $stmt = $mysqli->prepare( "SELECT UserID, Password FROM " . $db_table_prefix . "UserDetails WHERE UserID = ? AND Password = ? AND active = 1 LIMIT 1"); $stmt-ind_param("ss", $loggedInUser->user_id, $loggedInUser->hash_pw); $stmt->execute(); $stmt->store_result(); $num_returns = $stmt->num_rows; $stmt->close(); if ($loggedInUser == NULL) { return false; } else { if ($num_returns > 0) { return true; } else { destroySession("ThisUser"); return false; } }}Destroys a session as part of logout** * @param $name *function destroySession($name){ if (isset($_SESSION[$name])) { $_SESSION[$name] = NULL; unset($_SESSION[$name]); }}Retrieve complete user information of all users** * @return aay *function fetchAllUsers(){ global $mysqli, $db_table_prefix; $stmt = $mysqli->prepare( "SELECT UserID, UserName, FirstName, LastName, Email, Password, MemberSince, Active FROM " . $db_table_prefix . "UserDetails "); $stmt->execute(); $stmt-ind_result( $UserID, $UserName, $FirstName, $LastName, $Email, $Password, $MemberSince, $Active ); while ($stmt->fetch()) { $row[] = aay( 'UserID' => $UserID, 'UserName' => $UserName, 'FirstName' => $FirstName, 'LastName' => $LastName, 'Email' => $Email, 'Password' => $Password, 'MemberSince' => $MemberSince, 'Active' => $Active ); } $stmt->close(); return ($row);}UserManage.git/objects/45/7936d783cd28021cf47438bcc6f3d5c8ab9b62UserManage.git/objects/45/7936d783cd28021cf47438bcc6f3d5c8ab9b62lob 83hello worldUserManage.git/objects/4a/842ab86609e687f428c8fb2fe55cc0d628b59eUserManage.git/objects/4a/842ab86609e687f428c8fb2fe55cc0d628b59elob 5379�$password = md5("Smith");echo $password."";$code = md5(uniqid(rand(), TRUE));echo $code;Generate a unique code** * @param string $length * @return string *function getUniqueCode($length = ""){ $code = md5(uniqid(rand(), TRUE)); if ($length != "") { return substr($code, 0, $length); } else { return $code; }}$plainText = getUniqueCode(15);echo $plainText;** * @param $plainText * @param null $salt * @return string *function generateHash($plainText, $salt = NULL){ echo "plain text =" . $plainText . ""; if ($salt === NULL) { $salt = substr(md5(uniqid(rand(), TRUE)), 0, 25); echo "salt when salt is null : " . $salt . ""; } else { echo "salt before substr : " . $salt . "R>"; $salt = substr($salt, 0, 25); echo "just salt : " . $salt . "R>"; } echo "return salt : " . $salt . ""; echo "return sha ( salt ) : " . sha1($salt) . ""; echo "return sha ( plaintext ) : " . sha1($plainText) . ""; echo "return sha ( satl + plaintext ) : " . sha1($salt . $plainText) . ""; echo "return salt . sha1 ( salt + plaintext ) : " . $salt . sha1($salt . $plainText) . ""; return $salt . sha1($salt . $plainText);}echo $newpassword;$compare = generateHash($_POST['password'], $newpassword);echo $compare;** * @param $username * @param $firstname * @param $lastname * @param $email * @param $password * @return bool *function createNewUser($username, $firstname, $lastname, $email, $password){ global $mysqli, $db_table_prefix; Generate A random userid $character_aay = aay_merge(range(a, z), range(0, 9)); $rand_string = ""; for ($i = 0; $i < 6; $i++) { $rand_string .= $character_aay[rand( 0, (count($character_aay) - 1) )]; } $rand_string = getUniqueCode(14); echo $rand_string; echo $username; echo $firstname; echo $lastname; echo $email; echo $password; $newpassword = generateHash($password); echo $newpassword; $stmt = $mysqli->prepare( "INSERT INTO " . $db_table_prefix . "UserDetails ( UserID, UserName, FirstName, LastName, Email, Password, MemberSince, Active ) VALUES ( '" . $rand_string . "', ?, ?, ?, ?, ?, '" . time() . "', 1 )" ); $stmt-ind_param("sssss", $username, $firstname, $lastname, $email, $newpassword); print_r($stmt); $result = $stmt->execute(); print_r($result); $stmt->close(); return $result;}Retrieve complete user information by username** * @param $username * @return aay *function fetchUserDetails($username){ global $mysqli, $db_table_prefix; $stmt = $mysqli->prepare("SELECT UserID, UserName, FirstName, LastName, Email, Password, MemberSince, Active FROM " . $db_table_prefix . "UserDetails WHERE UserName = ? LIMIT 1"); $stmt-ind_param("s", $username); $stmt->execute(); $stmt-ind_result($UserID, $UserName, $FirstName, $LastName, $Email, $Password, $MemberSince, $Active); while ($stmt->fetch()) { $row = aay('UserID' => $UserID, 'UserName' =>...
";print_r($loggedInUser);echo "pre>";?UserManage.git/objects/27/417fc873112a5ea4c9cf9d62fa2ff9681043d7UserManage.git/objects/27/417fc873112a5ea4c9cf9d62fa2ff9681043d7lob 1384�/* Navicat MySQL Data Transfe Source Server : SMTP Source Server Type : MySQL Source Server Version : 50622 Source Host : localhost Source Database : UserManage Target Server Type : MySQL Target Server Version : 50622 File Encoding : utf-8 Date: 10/28/2015 10:50:11 AM*SET NAMES utf8;SET FOREIGN_KEY_CHECKS = 0;-- ------------------------------ Table structure for `UserDetails`-- ----------------------------DROP TABLE IF EXISTS `UserDetails`;CREATE TABLE `UserDetails` ( `UserID` varchar(120) NOT NULL, `UserName` varchar(150) NOT NULL, `FirstName` varchar(150) DEFAULT NULL, `LastName` varchar(150) DEFAULT NULL, `Email` varchar(150) NOT NULL, `Password` varchar(1000) DEFAULT NULL, `MemberSince` varchar(255) DEFAULT NULL, `Active` int(11) DEFAULT NULL, PRIMARY KEY (`UserName`,`Email`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;-- ------------------------------ Records of `UserDetails`-- ----------------------------BEGIN;INSERT INTO `UserDetails` VALUES ('4frvct', 'JohnSmith', 'John', 'Smith', '[email protected]', '6f4e26455b0f9c987a0009f3c5bd12786300b90fa76fb5399c82f2e63ab7121aa', '1445987595', '1'), ('692g6q', 'PraviinM', 'Praviin', 'Mandhare', '[email protected]', '1e905117d466dc32016cb71e3cb798cea73a942f2221fcbda1b5dc8104c2565ee', '1445961643', '1');COMMIT;SET FOREIGN_KEY_CHECKS = 1;UserManage.git/objects/29/ecc3beec0ef4312b82ecb5742fdff9021a6f50UserManage.git/objects/29/ecc3beec0ef4312b82ecb5742fdff9021a6f50lob 342";?UserManage.git/objects/34/846b22f14b68d30f8f5ff072a00a28466c6c08UserManage.git/objects/34/846b22f14b68d30f8f5ff072a00a28466c6c08commit 223�tree 81dde3dfbea01b8ca81db05e5e167bd6871b0d89parent 50b86c7fa215124f3245d5a39f51d675579f6168author Praviin M 1600961486 -0400committer Praviin M 1600961486 -0400egisttration pageUserManage.git/objects/34/c0bfd3c8c5886a82d643f97b052df42d83e3eUserManage.git/objects/34/c0bfd3c8c5886a82d643f97b052df42d83e3elob 149�equire_once("config.php");Log the user outif (isUserLoggedIn()) { destroySession("ThisUser");;}header("Location:index.php");die();UserManage.git/objects/3e/03da8381705ce5a75f8d812f0242da87bf47e0UserManage.git/objects/3e/03da8381705ce5a75f8d812f0242da87bf47e0UserManage.git/objects/3f/54ee97e3396b4d52b593f22f10313cf884ec0dUserManage.git/objects/3f/54ee97e3396b4d52b593f22f10313cf884ec0dcommit 204�tree cb63b464a06eba77cf409d3b030b8800fe82bc87author Praviin M 1491237353 -0400committer Praviin M 1491237353 -0400Updated Code + echo`d passwords for explanationUserManage.git/objects/40/3b3b4c7b66ebebfa437d0a70850a73e3f38458UserManage.git/objects/40/3b3b4c7b66ebebfa437d0a70850a73e3f38458lob 5488�$password = md5("Smith");echo $password."";$code = md5(uniqid(rand(), TRUE));echo $code;Generate a unique code** * @param string $length * @return string *function getUniqueCode($length = ""){ $code = md5(uniqid(rand(), TRUE)); if ($length != "") { return substr($code, 0, $length); } else { return $code; }}$plainText = getUniqueCode(15);echo $plainText;** * @param $plainText * @param null $salt * @return string *function generateHash($plainText, $salt = NULL){ echo "plain text =" . $plainText . ""; if ($salt === NULL) { $salt = substr(md5(uniqid(rand(), TRUE)), 0, 25); echo "salt when salt is null : " . $salt . ""; } else { echo "salt before substr : " . $salt . "R>"; $salt = substr($salt, 0, 25); echo "just salt : " . $salt . "R>"; } echo "return salt : " . $salt . ""; echo "return sha ( salt ) : " . sha1($salt) . ""; echo "return sha ( plaintext ) : " . sha1($plainText) . ""; echo "return sha ( satl + plaintext ) : " . sha1($salt . $plainText) . ""; echo "return salt . sha1 ( salt + plaintext ) : " . $salt . sha1($salt . $plainText) . ""; return $salt . sha1($salt . $plainText);}echo $newpassword;$compare = generateHash($_POST['password'], $newpassword);echo $compare;** * @param $username * @param $firstname * @param $lastname * @param $email * @param $password * @return bool *function createNewUser($username, $firstname, $lastname, $email, $password){ global $mysqli, $db_table_prefix; Generate A random userid $character_aay = aay_merge(range(a, z), range(0, 9)); $rand_string = ""; for ($i = 0; $i < 6; $i++) { $rand_string .= $character_aay[rand( 0, (count($character_aay) - 1) )]; } $rand_string = getUniqueCode(14); echo $rand_string; echo $username; echo $firstname; echo $lastname; echo $email; echo $password; $newpassword = generateHash($password); echo $newpassword; $stmt = $mysqli->prepare( "INSERT INTO " . $db_table_prefix . "UserDetails ( UserID, UserName, FirstName, LastName, Email, Password, MemberSince, Active ) VALUES ( '" . $rand_string . "', ?, ?, ?, ?, ?, '" . time() . "', 1 )" ); $stmt-ind_param("sssss", $username, $firstname, $lastname, $email, $newpassword); print_r($stmt); $result = $stmt->execute(); print_r($result); $stmt->close(); return $result;}Retrieve complete user information by username** * @param $username * @return aay *function fetchUserDetails($username){ global $mysqli, $db_table_prefix; $stmt = $mysqli->prepare("SELECT UserID, UserName, FirstName, LastName, Email, Password, MemberSince, Active FROM " . $db_table_prefix . "UserDetails WHERE UserName = ? LIMIT 1"); $stmt-ind_param("s", $username); $stmt->execute(); $stmt-ind_result($UserID, $UserName, $FirstName, $LastName, $Email, $Password, $MemberSince, $Active); while ($stmt->fetch()) { $row = aay('UserID' => $UserID, 'UserName' => $UserName, 'FirstName' => $FirstName, 'LastName' => $LastName, 'Email' => $Email, 'Password' => $Password, 'MemberSince' => $MemberSince, 'Active' => $Active); } $stmt->close(); return ($row);}Check if a user is logged in** * @return bool *function isUserLoggedIn(){ global $loggedInUser, $mysqli, $db_table_prefix; $stmt = $mysqli->prepare( "SELECT UserID, Password FROM " . $db_table_prefix . "UserDetails WHERE UserID = ? AND Password = ? AND active = 1 LIMIT 1"); $stmt-ind_param("ss", $loggedInUser->user_id, $loggedInUser->hash_pw); $stmt->execute(); $stmt->store_result(); $num_returns = $stmt->num_rows; $stmt->close(); if ($loggedInUser == NULL) { return false; } else { if ($num_returns > 0) { return true; } else { destroySession("ThisUser"); return false; } }}Destroys a session as part of logout** * @param $name *function destroySession($name){ if (isset($_SESSION[$name])) { $_SESSION[$name] = NULL; unset($_SESSION[$name]); }}Retrieve complete user information of all users** * @return aay *function fetchAllUsers(){ global $mysqli, $db_table_prefix; $stmt = $mysqli->prepare( "SELECT UserID, UserName, FirstName, LastName, Email, Password, MemberSince, Active FROM " . $db_table_prefix . "UserDetails "); $stmt->execute(); $stmt-ind_result( $UserID, $UserName, $FirstName, $LastName, $Email, $Password, $MemberSince, $Active ); while ($stmt->fetch()) { $row[] = aay( 'UserID' => $UserID, 'UserName' => $UserName, 'FirstName' => $FirstName, 'LastName' => $LastName, 'Email' => $Email, 'Password' => $Password, 'MemberSince' => $MemberSince, 'Active' => $Active ); } $stmt->close(); return ($row);}UserManage.git/objects/45/7936d783cd28021cf47438bcc6f3d5c8ab9b62UserManage.git/objects/45/7936d783cd28021cf47438bcc6f3d5c8ab9b62lob 83hello worldUserManage.git/objects/4a/842ab86609e687f428c8fb2fe55cc0d628b59eUserManage.git/objects/4a/842ab86609e687f428c8fb2fe55cc0d628b59elob 5379�$password = md5("Smith");echo $password."";$code = md5(uniqid(rand(), TRUE));echo $code;Generate a unique code** * @param string $length * @return string *function getUniqueCode($length = ""){ $code = md5(uniqid(rand(), TRUE)); if ($length != "") { return substr($code, 0, $length); } else { return $code; }}$plainText = getUniqueCode(15);echo $plainText;** * @param $plainText * @param null $salt * @return string *function generateHash($plainText, $salt = NULL){ echo "plain text =" . $plainText . ""; if ($salt === NULL) { $salt = substr(md5(uniqid(rand(), TRUE)), 0, 25); echo "salt when salt is null : " . $salt . ""; } else { echo "salt before substr : " . $salt . "R>"; $salt = substr($salt, 0, 25); echo "just salt : " . $salt . "R>"; } echo "return salt : " . $salt . ""; echo "return sha ( salt ) : " . sha1($salt) . ""; echo "return sha ( plaintext ) : " . sha1($plainText) . ""; echo "return sha ( satl + plaintext ) : " . sha1($salt . $plainText) . ""; echo "return salt . sha1 ( salt + plaintext ) : " . $salt . sha1($salt . $plainText) . ""; return $salt . sha1($salt . $plainText);}echo $newpassword;$compare = generateHash($_POST['password'], $newpassword);echo $compare;** * @param $username * @param $firstname * @param $lastname * @param $email * @param $password * @return bool *function createNewUser($username, $firstname, $lastname, $email, $password){ global $mysqli, $db_table_prefix; Generate A random userid $character_aay = aay_merge(range(a, z), range(0, 9)); $rand_string = ""; for ($i = 0; $i < 6; $i++) { $rand_string .= $character_aay[rand( 0, (count($character_aay) - 1) )]; } $rand_string = getUniqueCode(14); echo $rand_string; echo $username; echo $firstname; echo $lastname; echo $email; echo $password; $newpassword = generateHash($password); echo $newpassword; $stmt = $mysqli->prepare( "INSERT INTO " . $db_table_prefix . "UserDetails ( UserID, UserName, FirstName, LastName, Email, Password, MemberSince, Active ) VALUES ( '" . $rand_string . "', ?, ?, ?, ?, ?, '" . time() . "', 1 )" ); $stmt-ind_param("sssss", $username, $firstname, $lastname, $email, $newpassword); print_r($stmt); $result = $stmt->execute(); print_r($result); $stmt->close(); return $result;}Retrieve complete user information by username** * @param $username * @return aay *function fetchUserDetails($username){ global $mysqli, $db_table_prefix; $stmt = $mysqli->prepare("SELECT UserID, UserName, FirstName, LastName, Email, Password, MemberSince, Active FROM " . $db_table_prefix . "UserDetails WHERE UserName = ? LIMIT 1"); $stmt-ind_param("s", $username); $stmt->execute(); $stmt-ind_result($UserID, $UserName, $FirstName, $LastName, $Email, $Password, $MemberSince, $Active); while ($stmt->fetch()) { $row = aay('UserID' => $UserID, 'UserName' =>...
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here