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 <[email protected]>"); ?> <? $email = $row_passretrieval['emailaddress']; header ("Location: confirm.php?process=lostpass&email=".$email."") ?> any help will be greatly appreciated ma thanka u Link to comment https://forums.phpfreaks.com/topic/119045-weird-things-a-happening-in-my-script/ 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. Link to comment https://forums.phpfreaks.com/topic/119045-weird-things-a-happening-in-my-script/#findComment-613038 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 Link to comment https://forums.phpfreaks.com/topic/119045-weird-things-a-happening-in-my-script/#findComment-613047 Share on other sites More sharing options...
cooldude832 Posted August 10, 2008 Share Posted August 10, 2008 how old is this script? Link to comment https://forums.phpfreaks.com/topic/119045-weird-things-a-happening-in-my-script/#findComment-613050 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 Link to comment https://forums.phpfreaks.com/topic/119045-weird-things-a-happening-in-my-script/#findComment-613051 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 Link to comment https://forums.phpfreaks.com/topic/119045-weird-things-a-happening-in-my-script/#findComment-613052 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 Link to comment https://forums.phpfreaks.com/topic/119045-weird-things-a-happening-in-my-script/#findComment-613054 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 Link to comment https://forums.phpfreaks.com/topic/119045-weird-things-a-happening-in-my-script/#findComment-613056 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? Link to comment https://forums.phpfreaks.com/topic/119045-weird-things-a-happening-in-my-script/#findComment-613057 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 Link to comment https://forums.phpfreaks.com/topic/119045-weird-things-a-happening-in-my-script/#findComment-613058 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 Link to comment https://forums.phpfreaks.com/topic/119045-weird-things-a-happening-in-my-script/#findComment-613061 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 Link to comment https://forums.phpfreaks.com/topic/119045-weird-things-a-happening-in-my-script/#findComment-613062 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 Link to comment https://forums.phpfreaks.com/topic/119045-weird-things-a-happening-in-my-script/#findComment-613063 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 Link to comment https://forums.phpfreaks.com/topic/119045-weird-things-a-happening-in-my-script/#findComment-613064 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 Link to comment https://forums.phpfreaks.com/topic/119045-weird-things-a-happening-in-my-script/#findComment-613070 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.