sonomatek Posted February 26, 2010 Share Posted February 26, 2010 Hi, I was using the login script below which worked flawlessly on a FreeBSD server, in a shared environment, offered by Pair Networks. I have since moved the site to a Linux server, in a shared environment offered by Go Daddy, and now the function isn't working. There are no error messages being returned; the page seems to simply refresh itself with the form fields cleared. I hope someone can help and thank you in advance! include "connection.inc.php"; session_start(); session_register("session"); error_reporting(0); if($REQUEST_METHOD=="POST") { if($_SESSION['logged'] = "true") { $_SESSION['logged'] = ""; } //check for the existence of the username and the password $exist = GiveValue("intAdminID","tbladmin"," where vchUserName = '".$vchUserName."' and vchPassword = '".$vchPassword."'",0); //print $exist; if($exist>0) { $_SESSION['logged'] = "true"; header("location:sendmail.php"); } else { $message = "Either invalid username or password,please try again."; } } function GiveValue($fields,$table,$wherecondition,$debug) { $retval=""; $strSQL=" select $fields from $table $wherecondition"; print (($debug == "1")||($debug == "2")) ? $strSQL: ""; if ($debug == "2") exit; $record=mysql_fetch_array(mysql_query($strSQL)); if(is_array($record)) $retval=$record[0]; else $retval=0; return $retval; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Learning Tree School</title> <script language="javascript"> function checkform() { if(document.frm.vchUserName.value=="") { alert("Please enter your user name"); document.frm.vchUserName.focus(); return false; } if(document.frm.vchPassword.value=="") { alert("Please enter your password"); document.frm.vchPassword.focus(); return false; } return true; } </script> <link href="main.css" rel="stylesheet" type="text/css" /> </head> <body> <table width="900" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="460" valign="bottom"><img src="images/hdr.jpg" width="900" height="214" /></td> </tr> </table> <table width="900" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#fcf5e2"> <tr> <td width="900" height="400" valign="top"><br /><br /><br /> <div style="width:90%; margin:0 auto;"> <p class="page-title"><?=$message;?></p> <form name="frm" method="post" action="index.php" onsubmit="return checkform();"> <table width="650" border="0" align="center" cellpadding="0" cellspacing="0" > <tr> <td width="635" class="bottom" style="background:url(../images/hd-right1.gif) right no-repeat;"><strong>Login</strong><strong><br /> </strong></td> </tr> </table> <br /> <table width="628" border="0" align="center" cellpadding="4" cellspacing="0" > <tr> <td width="276" align="right"><strong>Username</strong></td> <td width="336"><input name="vchUserName" type="text" class="input" style="width:200px;"/></td> </tr> <tr> <td align="right"><strong>Password</strong></td> <td><input name="vchPassword" type="password" class="input" style="width:200px;"/></td> </tr> <tr> <td> </td> <td><input type="submit" name="submit" value="Login" /></td> </tr> </table> <br /> </form> <div class="border-bottom1" style="width:650px;margin:0 auto;"> </div> </div> <br /><br /></td> </tr> </table> <table width="900" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="26" align="center" style="background:url(images/table-hd-bg.gif)"><strong>Copyright © 2009 Learning Tree School. All rights reserved.</strong></td> </tr> </table> </body> </html> Link to comment https://forums.phpfreaks.com/topic/193522-simple-login/ Share on other sites More sharing options...
trq Posted February 27, 2010 Share Posted February 27, 2010 The first thing you need to do is put.... error_reporting(E_ALL) ; ini_set('display_errors', 1); at the top of the script. I can see from here you appear to be using allot of variables that (from this post) appear undefined. This indicates that the script likely relies on register globals being on. register globals have been off by default in php for over 7 years. Your also using depricated functions such as session_register. Basically, the script looks old & out of times with where php currently is. Link to comment https://forums.phpfreaks.com/topic/193522-simple-login/#findComment-1018764 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.