pjheliking Posted August 10, 2008 Share Posted August 10, 2008 I have a password reset form pretty basic but heres the weird thing it will sometimes work then not it goes back and forth. could you please have a wee look and see if there is anything i am missing or needing to shed (me = novice ) <?php session_start(); session_register("sessUsername"); $sessUsername = $HTTP_POST_VARS['username']; ?> <? require_once('../../Connections/gimmiegimmie.php'); if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $maxRows_passretrieval = 10; $pageNum_passretrieval = 0; if (isset($_GET['pageNum_passretrieval'])) { $pageNum_passretrieval = $_GET['pageNum_passretrieval']; } $startRow_passretrieval = $pageNum_passretrieval * $maxRows_passretrieval; $colname_passretrieval = "-1"; if (isset($_SESSION['sessUsername'])) { $colname_passretrieval = $_SESSION['sessUsername']; } mysql_select_db($database_thebar, $thebar); $query_passretrieval = sprintf("SELECT * FROM bar33userdetails WHERE emailaddress = %s", GetSQLValueString($colname_passretrieval, "text")); $query_limit_passretrieval = sprintf("%s LIMIT %d, %d", $query_passretrieval, $startRow_passretrieval, $maxRows_passretrieval); $passretrieval = mysql_query($query_limit_passretrieval, $thebar) or die(mysql_error()); $row_passretrieval = mysql_fetch_assoc($passretrieval); if (isset($_GET['totalRows_passretrieval'])) { $totalRows_passretrieval = $_GET['totalRows_passretrieval']; } else { $all_passretrieval = mysql_query($query_passretrieval); $totalRows_passretrieval = mysql_num_rows($all_passretrieval); } $totalPages_passretrieval = ceil($totalRows_passretrieval/$maxRows_passretrieval)-1; ?> <?php // My Details $email = $row_passretrieval['emailaddress']; $pass = $row_passretrieval['password']; // The subject $subject = " Pasword Reminder"; // Grab Details //no dets to grab continue // The message $message = "*****DONOT REPLY TO THIS MESSAGE AS THE EMAIL ADDRESS IS UNMANNED*****\n\n Password retrieval details for email address ".$email." \n\n Password = ".$pass." \n\n We recommend that you change your password to something more memorable you can do this in your settings when you log in."; mail($email, $subject, $message, "From:Password Reseter <pass@reset.com>"); ?> <? $email = $row_passretrieval['emailaddress']; header ("Location: confirm.php?process=lostpass&email=".$email."") ?> any help will be greatly appreciated ma thanka u Quote Link to comment Share on other sites More sharing options...
Acs Posted August 10, 2008 Share Posted August 10, 2008 That code seems really old. Use $_POST and not $HTTP_POST_VARS (it's deprecated - http://pt.php.net/manual/en/reserved.variables.post.php) From the manual: Use of $_SESSION is preferred, as of PHP 4.1.0 So you should use $_SESSION['sessUsername'] instead of the session_register function. Why would you open a php tag and then close to just open another php tag? And why use both <? and <?php ? As for your errors, either use a debugger or put some echoes in the code. Quote Link to comment Share on other sites More sharing options...
pjheliking Posted August 10, 2008 Author Share Posted August 10, 2008 I changed what you said and still no joy im gonna get a debugger now ... regarding closing to open thats just pure lazyness on my part as i copy an paste most things i do make an attempt once and a while to sort through the code to make it better... and the <? and <?php copied and pasted and it really depends on how i feel when i wake up lol. thnx for tips Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted August 10, 2008 Share Posted August 10, 2008 how old is this script? Quote Link to comment Share on other sites More sharing options...
Acs Posted August 10, 2008 Share Posted August 10, 2008 Yeah the problem were probably not in those functions but since you were going to change the code you might as well alter those. Also, try to set the error level to E_ALL it might catch something we are not seeing. And try and organize the code using tab, having: return $theValue; } } Does not look good Quote Link to comment Share on other sites More sharing options...
pjheliking Posted August 10, 2008 Author Share Posted August 10, 2008 couple of days i never downloaded it from anywhere its just using things i know nd dreamweaver it works sometimes but has too many cigarette breaks Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted August 10, 2008 Share Posted August 10, 2008 well its written for php 3.X which is depreciated Quote Link to comment Share on other sites More sharing options...
pjheliking Posted August 10, 2008 Author Share Posted August 10, 2008 kk but most of the code is thrown up by dream cs3 thot it wuda been up to date Quote Link to comment Share on other sites More sharing options...
Acs Posted August 10, 2008 Share Posted August 10, 2008 So.. you are asking help on generated code? Quote Link to comment Share on other sites More sharing options...
pjheliking Posted August 10, 2008 Author Share Posted August 10, 2008 well the only generated code is the database part everything else i have done Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted August 10, 2008 Share Posted August 10, 2008 this is for people who write their own scripts not people who "generate" codes so either figure out how to write it yourself or move elsewhere Quote Link to comment Share on other sites More sharing options...
pjheliking Posted August 10, 2008 Author Share Posted August 10, 2008 no need to be nasty just cause u all prob know what your doing but i only started into php 2 weeks ago and all i was asking is there something im missing and as i said it has worked just dont know why it isnt now Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted August 10, 2008 Share Posted August 10, 2008 no need to be nasty just cause u all prob know what your doing but i only started into php 2 weeks ago and all i was asking is there something im missing and as i said it has worked just dont know why it isnt now You aren't doing php your playing around in dreamweaver big difference Quote Link to comment Share on other sites More sharing options...
pjheliking Posted August 10, 2008 Author Share Posted August 10, 2008 ffs i know i aint doing ma own and I am so sorry if i have offended you in implying that i done it myself and if you dont wanna help get lost simple Quote Link to comment Share on other sites More sharing options...
pjheliking Posted August 10, 2008 Author Share Posted August 10, 2008 got help from another forum made sense instead of pulling the info from a server variable user a form variable instead worked a treat Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.