<?php
$host="****SECRET*****"; // Host name
$username="****SECRET****"; // Mysql username
$password="****SECRET****"; // Mysql password
$db_name="****SECRET*****"; // Database name
$tbl_name="members"; // Table name
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
//take the username and prevent SQL injections
$username = mysql_real_escape_string($username);
//variables for new/old passess
$newpass = $_POST['newpass'];
$confirmpass = $_POST['confirmpass'];
$id = $POST['id'];
//sure proof denies
$count = 0;
//Checks for the cookie
if (isset($_COOKIE["mycookie"])) {
$count = 1;
} else {
$count = 0;
}
// If result matched $myusername and $mypassword, table row must be 1 row
if ($count==1) {
setcookie('mycookie', 'Test mycookie', time()+3600*24);
//display all users
$display = mysql_query("SELECT * FROM members ORDER BY ID");
//begin the query
$sql = mysql_query("SELECT * FROM $tbl_name WHERE username = '".$username."' LIMIT 1");
//acutal shit
if (isset($_POST['password']))
{
//Prevent SQL injections
$username = mysql_real_escape_string($_POST['username']);
//Get MD5 hash of password
$password = sha256(md5(sha1(sha512(mysql_real_escape_string($_POST['password'])))));
//Check to see if username exists
$sql = ("SELECT * FROM $tbl_name WHERE password = '".$password."' ");
$result = mysql_query($sql);
if (mysql_num_rows($result) < 1) {
echo "That is not your current password";
} else {
if ($confirmpass==$newpass) {
$querynew = ("UPDATE $tbl_name SET password='$newpass' WHERE id='$session[id]'");
$resultnew = mysql_query($querynew) or die(mysql_error());
echo "Password changed!";
} else {
echo "Passwords Do not match!";
}
}
} else {
echo "Change your password";
}
echo "`
<html></html>
<a href='index.php'>Go Back</a>
<center>
<table>
<form action='change.php' method='post'>
<tr><td>Current Password:</td><td><input name='password' type='text' /></tr></td><br />
<tr><td>New Password:</td><td><input name='newpass' type='text' /></td></tr><br />
<tr><td>Confirm Password:</td><td><input name='confirmpass' type='text' /></td></tr><br />
<tr><td><input type='submit' value='Change Password' /></td></tr>
</table>
</form>
</center>
";
//html for display all users
echo "<center><table border='1'>
<tr>
<th>UserName</th>
<th>ID</th>
</tr>";
while($row = mysql_fetch_array($display))
{
echo "<tr>";
echo "<td>" . $row['username'] . "</td>";
echo "<td>" . $row['id'] . "</td>";
echo "</tr>";
}
echo "</table></center>";
} else {
echo "You do not have permissions on this page!";
}
?>
<?php
$host="****SECRET*****"; // Host name
$username="****SECRET****"; // Mysql username
$password="****SECRET****"; // Mysql password
$db_name="****SECRET*****"; // Database name
$tbl_name="members"; // Table name
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
//take the username and prevent SQL injections
$username = mysql_real_escape_string($username);
//variables for new/old passess
$newpass = $_POST['newpass'];
$confirmpass = $_POST['confirmpass'];
$id = $POST['id'];
//sure proof denies
$count = 0;
//Checks for the cookie
if (isset($_COOKIE["mycookie"])) {
$count = 1;
} else {
$count = 0;
}
// If result matched $myusername and $mypassword, table row must be 1 row
if ($count==1) {
setcookie('mycookie', 'Test mycookie', time()+3600*24);
//display all users
$display = mysql_query("SELECT * FROM members ORDER BY ID");
//begin the query
$sql = mysql_query("SELECT * FROM $tbl_name WHERE username = '".$username."' LIMIT 1");
//acutal shit
if (isset($_POST['password']))
{
//Prevent SQL injections
$username = mysql_real_escape_string($_POST['username']);
//Get MD5 hash of password
$password = sha256(md5(sha1(sha512(mysql_real_escape_string($_POST['password'])))));
//Check to see if username exists
$sql = ("SELECT * FROM $tbl_name WHERE password = '".$password."' ");
$result = mysql_query($sql);
if (mysql_num_rows($result) < 1) {
echo "That is not your current password";
} else {
if ($confirmpass==$newpass) {
$querynew = ("UPDATE $tbl_name SET password='$newpass' WHERE id='$session[id]'");
$resultnew = mysql_query($querynew) or die(mysql_error());
echo "Password changed!";
} else {
echo "Passwords Do not match!";
}
}
} else {
echo "Change your password";
}
echo "`
<html></html>
<a href='https://www.nextgenupdate.com/forums/'>Go Back</a>
<center>
<table>
<form action='change.php' method='post'>
<tr><td>Current Password:</td><td><input name='password' type='text' /></tr></td><br />
<tr><td>New Password:</td><td><input name='newpass' type='text' /></td></tr><br />
<tr><td>Confirm Password:</td><td><input name='confirmpass' type='text' /></td></tr><br />
<tr><td><input type='submit' value='Change Password' /></td></tr>
</table>
</form>
</center>
";
//html for display all users
echo "<center><table border='1'>
<tr>
<th>UserName</th>
<th>ID</th>
</tr>";
while($row = mysql_fetch_array($display))
{
echo "<tr>";
echo "<td>" . $row['username'] . "</td>";
echo "<td>" . $row['id'] . "</td>";
echo "</tr>";
}
echo "</table></center>";
} else {
echo "You do not have permissions on this page!";
}
?>
define('
B_USER', 'root'
; // MySQL username
define('
B_PASS', 'pass'
; // MySQL password
define('
B_HOST', 'host'
; // database host
define('
B_NAME', 'name'
; // database name
$con = mysql_connect(DB_HOST, DB_USER, DB_PASS)
or die('Fatal error: could not connect to database'
;
mysql_select_db(DB_NAME, $con)
or die('Fatal error: could not select database'
;
;". Its much easier and more efficient.
.
UPDATE $tbl_name SET password='$newpass' WHERE id='$_SESSION['id']' LIMIT 1

<?php
$host="****"; // Host name
$username="****"; // Mysql username
$password="****"; // Mysql password
$db_name="****"; // Database name
$tbl_name="members"; // Table name
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
//take the username and prevent SQL injections
$username = mysql_real_escape_string($username);
//variables for new/old passess
$newpass = $_POST['newpass'];
$confirmpass = $_POST['confirmpass'];
//sure proof denies unless has cookie
$count = 0;
//Checks for the cookie, or deny access
if (isset($_COOKIE["mycookie"])) {
$count = 1;
} else {
$count = 0;
}
SESSION_START();
$id = SESSION_ID();
// If result matched $myusername and $mypassword, table row must be 1 row
// sets cookie if cookie is found
if ($count==1) {
setcookie('mycookie', 'Test mycookie', time()+3600*24);
//display all users
$display = mysql_query("SELECT * FROM members ORDER BY ID");
//begin the query
$sql = mysql_query("SELECT * FROM $tbl_name WHERE username = '".$username."' LIMIT 1");
//If password is set then check if correct
if (isset($_POST['password']))
{
//Prevent SQL injections
$username = mysql_real_escape_string($_POST['username']);
// UPDATE NEW PASSWORD with the same encryption as the database
$password = sha1(md5(sha1(sha1(mysql_real_escape_string($_POST['password'])))));
//Check to see if username exists
$sql = ("SELECT * FROM $tbl_name WHERE password = '".$password."' ");
$result = mysql_query($sql);
if (mysql_num_rows($result) < 1) {
echo "That is not your current password";
} else {
if ($confirmpass==$newpass) {
$querynew = ("UPDATE $tbl_name SET password='".$_POST['$newpass']."' WHERE id='".$_SESSION['$id']."' LIMIT 1");
$resultnew = mysql_query($querynew) or die(mysql_error());
echo "Password changed!";
} else {
echo "Passwords Do not match!";
}
}
} else {
echo "Change your password";
}
echo "
<a href='index.php'>Go Back</a>
<center>
<table>
<form action='change.php' method='post'>
<tr><td>Current Password:</td><td><input name='password' type='text' /></tr></td><br />
<tr><td>New Password:</td><td><input name='newpass' type='text' /></td></tr><br />
<tr><td>Confirm Password:</td><td><input name='confirmpass' type='text' /></td></tr><br />
<tr><td><input type='submit' value='Change Password' /></td></tr>
</table>
</form>
</center>
";
//html for display all users
echo "<center><table border='1'>
<tr>
<th>UserName</th>
<th>ID</th>
</tr>";
while($row = mysql_fetch_array($display))
{
echo "<tr>";
echo "<td>" . $row['username'] . "</td>";
echo "<td>" . $row['id'] . "</td>";
echo "</tr>";
}
echo "</table></center>";
} else {
echo "You do not have permissions on this page!";
}
?>
mysql_query("UPDATE $tbl_name SET password='$newpass' WHERE id=$_SESSION['id'] LIMIT 1");
session_start();
$query = mysql_query("SELECT user_id, username, password FROM users WHERE username='$username'"); // get the data
$result = mysql_fetch_assoc($query); // fetch the array
// check for correct username and password
if ($username == $result['username'] && $password == $result['password'])
{
session_start(); // start the session
$_SESSION['username'] == $username; // store the username
$_SESSION['user_id'] == $result['user_id']; // store the user's ID
}
// This is BA
if (isset($_COOKIE["mycookie"])) {
$count = 1;
} else {
$count = 0;
}
// This is GOO
if (isset($_COOKIE["mycookie"]))
{
$count = 1;
}
else
{
$count = 0;
}
$query = mysql_query("SELECT user_id, username, password FROM users WHERE username='$username'"); // get the data
$result = mysql_fetch_assoc($query); // fetch the array
// check for correct username and password
if ($username == $result['username'] && $password == $result['password'])
{
session_start(); // start the session
$_SESSION['username'] == $username; // store the username
$_SESSION['user_id'] == $result['user_id']; // store the user's ID
$query = mysql_query("SELECT user_id, username, password FROM users WHERE username='$username'"); // get the data
$result = mysql_fetch_assoc($query); // fetch the array
// check for correct username and password
if ($username == $result['username'] && $password == $result['password'])
{
session_start(); // start the session
$_SESSION['username'] == $username; // store the username
$_SESSION['user_id'] == $result['user_id']; // store the user's ID
<?php
session_start(); // start the session
// check if the session values are NOT set
if (!isset($_SESSION['user_id']) && !isset($_SESSION['isValid']))
{
header('Location: login.php'
; // redirect to login.php (a login form)
die('You are not currently logged in, you are being redirected to the login form. If you are not redirected, <a href="login.php">click here</a>'
;
}
else
{
// check if the user has been validated (successfully registered, logged in, or whatever other authentication you want to perform)
if ($_SESSION['isValid'] == false)
{
die('Sorry, but your account is not valid currently. Please try again later.'
;
}
else
{
// run a query to verify that the user_id is legitimate and belongs to a real user
// use conditional logic (if statement) to die() if the user is not legitimate, otherwise, do nothing
}
}
?>
<!-- By this point, you will have determined whether or not the user has successfully logged in -->
<html>
<head>
<title>Yay!</title>
</head>
<body>
<p>Congratulations! You're all logged in and ready to view the content!</p>
</body>
</html>
SELECT user_id FROM users WHERE username='username'
session_start();
$_SESSION['id'] = $result['id']; //store the resulting id as a session variable
session_start();
mysql_query("UPDATE users SET password='$new_password' WHERE id=$_SESSION['id'] LIMIT 1"); // run the update query


Copyright © 2026, NextGenUpdate.
All Rights Reserved.