sith717 Posted September 22, 2008 Author Share Posted September 22, 2008 So should I add my own version of the session thing? <? session_start(); if(!session_is_registered(myusername)){ header("location:login.php"); } ?> Link to comment https://forums.phpfreaks.com/topic/125341-solved-change-password/page/5/#findComment-648085 Share on other sites More sharing options...
peranha Posted September 22, 2008 Share Posted September 22, 2008 on the change_password.php page put the following after session_start(); echo $_SESSION['is_valid']; exit(); That will tell you if the session is being passed on. Link to comment https://forums.phpfreaks.com/topic/125341-solved-change-password/page/5/#findComment-648087 Share on other sites More sharing options...
sith717 Posted September 22, 2008 Author Share Posted September 22, 2008 I dont understand this shit at all... Link to comment https://forums.phpfreaks.com/topic/125341-solved-change-password/page/5/#findComment-648089 Share on other sites More sharing options...
sith717 Posted September 22, 2008 Author Share Posted September 22, 2008 http://delta.bluespacetechnologies.com/~bucketho/admin/change_password.php?pass_change_form=true Its blank now. It stays on the page, but now blank. Link to comment https://forums.phpfreaks.com/topic/125341-solved-change-password/page/5/#findComment-648091 Share on other sites More sharing options...
genericnumber1 Posted September 22, 2008 Share Posted September 22, 2008 I dont understand this shit at all... http://www.hudzilla.org/phpbook/read.php/10_0_0 http://us2.php.net/manual/en/intro.session.php PHP is one of the best documented languages out there, utilize the information. Link to comment https://forums.phpfreaks.com/topic/125341-solved-change-password/page/5/#findComment-648092 Share on other sites More sharing options...
sith717 Posted September 22, 2008 Author Share Posted September 22, 2008 I dont understand at all... Link to comment https://forums.phpfreaks.com/topic/125341-solved-change-password/page/5/#findComment-648094 Share on other sites More sharing options...
peranha Posted September 22, 2008 Share Posted September 22, 2008 On the checklogin.php page change $_SESSION['is_valid'] = true; to $_SESSION['is_valid'] = "true"; and try that. Link to comment https://forums.phpfreaks.com/topic/125341-solved-change-password/page/5/#findComment-648102 Share on other sites More sharing options...
sith717 Posted September 22, 2008 Author Share Posted September 22, 2008 Man, it was going great. I was really hoping to have this work. I have no idea how to code php thats why I am needing TONS of help. like 100% of it. Link to comment https://forums.phpfreaks.com/topic/125341-solved-change-password/page/5/#findComment-648103 Share on other sites More sharing options...
sith717 Posted September 22, 2008 Author Share Posted September 22, 2008 On the checklogin.php page change $_SESSION['is_valid'] = true; to $_SESSION['is_valid'] = "true"; and try that. Ok so: session_start(); echo $_SESSION['is_valid']; exit(); to session_start(); echo $_SESSION['is_valid'] = "true"; exit(); Link to comment https://forums.phpfreaks.com/topic/125341-solved-change-password/page/5/#findComment-648105 Share on other sites More sharing options...
genericnumber1 Posted September 22, 2008 Share Posted September 22, 2008 I have no idea how to code php thats why I am needing TONS of help. then start at the beginning.. http://hudzilla.org/phpwiki/index.php?title=Introducing_PHP http://gr2.php.net/tut.php If you want us to program for you please "Don't ask someone to write or re-write a script for you, unless you are posting a message to the Freelancing Forum. The forums are not the place to request XYZ script. This is a community of people learning PHP, and not a script location service. Try searching SourceForge, PHP Classes, HotScripts, or Google." I'll stop posting in this thread now it's just really annoying to see Link to comment https://forums.phpfreaks.com/topic/125341-solved-change-password/page/5/#findComment-648107 Share on other sites More sharing options...
sith717 Posted September 22, 2008 Author Share Posted September 22, 2008 I did that. Now: http://delta.bluespacetechnologies.com/~bucketho/admin/change_password.php?pass_change_form=true It says "True" ?? Link to comment https://forums.phpfreaks.com/topic/125341-solved-change-password/page/5/#findComment-648108 Share on other sites More sharing options...
peranha Posted September 22, 2008 Share Posted September 22, 2008 no, on your check login page, you set $_SESSION['is_valid'] = true; if the user is logged in. right here // Register $myusername, $mypassword and redirect to file "index.php" $_SESSION['username'] = $myusername; $_SESSION['is_valid'] = true; session_register("myusername"); session_register("mypassword"); change it there Link to comment https://forums.phpfreaks.com/topic/125341-solved-change-password/page/5/#findComment-648110 Share on other sites More sharing options...
sith717 Posted September 22, 2008 Author Share Posted September 22, 2008 This is what I have for now. If you can be nice enough to add in the codes in the correct spots would be great. <?php session_start(); $_SESSION['is_valid'] = "true"; exit(); $host = "localhost"; // Host name $username = "bucketho_****"; // <-- Mysql username MAKE SURE THIS IS SET! $password = "*****"; // <-- Mysql password MAKE SURE THIS IS SET! $db_name = "bucketho_*****"; // <-- Database name CHANGE THIS TOO! $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"); if ($_GET['change_pass'] == true && $_SESSION['is_valid'] == true){ $new_pass1 = mysql_real_escape_string($_POST['pass1']); $new_pass2 = mysql_real_escape_string($_POST['pass2']); $old_pass = mysql_real_escape_string($_POST['old_pass']); $username = $_SESSION['username']; $sql = "SELECT COUNT(*) AS `total_found` FROM `members` WHERE `username`='$username' AND `password`='$old_pass' LIMIT 1;"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); $total_found = $row['total_found']; if (($total_found == 1) && ($new_pass1 == $new_pass2)){ $sql = "UPDATE `members` SET `password`='$new_pass1' WHERE `username`='$username';"; mysql_query($sql); header("location:./"); exit(); } else{ print "Error processing Password change. Please try again"; } } if ($_GET['pass_change_form'] == true && $_SESSION['is_valid'] == true){ ?> <form method="POST" action="?change_pass=true"> <table border="0"> <tr> <td>Old Password:</td> <td><input type="password" name="old_pass"></td> </tr> <tr> <td>New Password:</td> <td><input type="password" name="pass1"></td> </tr> <tr> <td>New Password(Again):</td> <td><input type="password" name="pass2"></td> </tr> <tr> <td> </td> <td><input type="submit" value="Submit"></td> </tr> </table> </form> <?php } else{ header("location:./"); exit(); } Link to comment https://forums.phpfreaks.com/topic/125341-solved-change-password/page/5/#findComment-648115 Share on other sites More sharing options...
corbin Posted September 22, 2008 Share Posted September 22, 2008 I would actually say that PHP probably is the best documented language out there. (In the sense of accessibility, maybe not quality.) Then again, there are some other strong communities. PHP is definitely top 5. Link to comment https://forums.phpfreaks.com/topic/125341-solved-change-password/page/5/#findComment-648116 Share on other sites More sharing options...
sith717 Posted September 22, 2008 Author Share Posted September 22, 2008 Personally php is very hard for me... So you mean this community is top 5 or php is top 5? Link to comment https://forums.phpfreaks.com/topic/125341-solved-change-password/page/5/#findComment-648117 Share on other sites More sharing options...
sith717 Posted September 22, 2008 Author Share Posted September 22, 2008 I have added it in pern. The page is now blank: http://delta.bluespacetechnologies.com/~bucketho/admin/change_password.php?pass_change_form=false Link to comment https://forums.phpfreaks.com/topic/125341-solved-change-password/page/5/#findComment-648120 Share on other sites More sharing options...
peranha Posted September 22, 2008 Share Posted September 22, 2008 <?php $host="localhost"; // Host name $username="bucketho_****"; // Mysql username $password="*****"; // Mysql password $db_name="bucketho_****"; // 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"); // username and password sent from form $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; // To protect MySQL injection (more detail about MySQL injection) $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "index.php" $_SESSION['username'] = $myusername; $_SESSION['is_valid'] = "true"; session_register("myusername"); session_register("mypassword"); header("location:index.php"); } else { header("location:login_failed.php"); } ?> <?php session_start(); echo $_SESSION['is_valid']; exit(); $host = "localhost"; // Host name $username = "bucketho_****"; // <-- Mysql username MAKE SURE THIS IS SET! $password = "*****"; // <-- Mysql password MAKE SURE THIS IS SET! $db_name = "bucketho_*****"; // <-- Database name CHANGE THIS TOO! $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"); if ($_GET['change_pass'] == true && $_SESSION['is_valid'] == true){ $new_pass1 = mysql_real_escape_string($_POST['pass1']); $new_pass2 = mysql_real_escape_string($_POST['pass2']); $old_pass = mysql_real_escape_string($_POST['old_pass']); $username = $_SESSION['username']; $sql = "SELECT COUNT(*) AS `total_found` FROM `members` WHERE `username`='$username' AND `password`='$old_pass' LIMIT 1;"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); $total_found = $row['total_found']; if (($total_found == 1) && ($new_pass1 == $new_pass2)){ $sql = "UPDATE `members` SET `password`='$new_pass1' WHERE `username`='$username';"; mysql_query($sql); header("location:./"); exit(); } else{ print "Error processing Password change. Please try again"; } } if ($_GET['pass_change_form'] == true && $_SESSION['is_valid'] == true){ ?> <form method="POST" action="?change_pass=true"> <table border="0"> <tr> <td>Old Password:</td> <td><input type="password" name="old_pass"></td> </tr> <tr> <td>New Password:</td> <td><input type="password" name="pass1"></td> </tr> <tr> <td>New Password(Again):</td> <td><input type="password" name="pass2"></td> </tr> <tr> <td> </td> <td><input type="submit" value="Submit"></td> </tr> </table> </form> <?php } else{ header("location:./"); exit(); } Link to comment https://forums.phpfreaks.com/topic/125341-solved-change-password/page/5/#findComment-648121 Share on other sites More sharing options...
sith717 Posted September 22, 2008 Author Share Posted September 22, 2008 It is now showing a 1. http://delta.bluespacetechnologies.com/~bucketho/admin/change_password.php?pass_change_form=true Link to comment https://forums.phpfreaks.com/topic/125341-solved-change-password/page/5/#findComment-648124 Share on other sites More sharing options...
Zane Posted September 22, 2008 Share Posted September 22, 2008 what's the password for the username bucket Link to comment https://forums.phpfreaks.com/topic/125341-solved-change-password/page/5/#findComment-648125 Share on other sites More sharing options...
sith717 Posted September 22, 2008 Author Share Posted September 22, 2008 I will pm you it. Link to comment https://forums.phpfreaks.com/topic/125341-solved-change-password/page/5/#findComment-648128 Share on other sites More sharing options...
sith717 Posted September 22, 2008 Author Share Posted September 22, 2008 I pmed it. Hopefully someone can figure it out. Link to comment https://forums.phpfreaks.com/topic/125341-solved-change-password/page/5/#findComment-648130 Share on other sites More sharing options...
sith717 Posted September 22, 2008 Author Share Posted September 22, 2008 No? Then! I must!!! Link to comment https://forums.phpfreaks.com/topic/125341-solved-change-password/page/5/#findComment-648133 Share on other sites More sharing options...
sith717 Posted September 22, 2008 Author Share Posted September 22, 2008 Someone help? Thanks. Link to comment https://forums.phpfreaks.com/topic/125341-solved-change-password/page/5/#findComment-648139 Share on other sites More sharing options...
peranha Posted September 22, 2008 Share Posted September 22, 2008 I am getting db errors after I login in. In db.php and functions.php Link to comment https://forums.phpfreaks.com/topic/125341-solved-change-password/page/5/#findComment-648140 Share on other sites More sharing options...
sith717 Posted September 22, 2008 Author Share Posted September 22, 2008 I know, your trying to access some pages that are not there. I deleted those pages since I am customizing it to my own. Dont worry, Link to comment https://forums.phpfreaks.com/topic/125341-solved-change-password/page/5/#findComment-648142 Share on other sites More sharing options...
Recommended Posts