jonw118 Posted March 6, 2008 Share Posted March 6, 2008 I am in the process of moving my site... on my new server I've hit a problem. I have an admin side that requires a user/pass. When you login it takes you authentication.php. It as this point things get stuck. Here is the code for that page: <? //starting session error_reporting(E_ALL ^ E_NOTICE); session_start(); include_once("inc/dbConn.php"); $db=new dbConnection; $conn=$db->connection(); //authenticating login id and password $user = $_POST['txtlogid']; $passwd = $_POST['txtpwd']; $sql = "SELECT * FROM tbl_member WHERE (mem_name = '$user' AND mem_pass = '$passwd' )"; $result = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($result)>0) { $Row = @mysql_fetch_array($result); $my_adminid = $Row["mem_ID"]; session_register("my_adminid"); $_SESSION['my_adminid']=$my_adminid; header("location: index.php"); } else { header("location: login.php?fail=1"); } ?> Here is the error I get when I type in my user/pass and it stalls on the page: connection(); //authenticating login id and password $user = $_POST['txtlogid']; $passwd = $_POST['txtpwd']; $sql = "SELECT * FROM tbl_member WHERE (mem_name = '$user' AND mem_pass = '$passwd' )"; $result = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($result)>0) { $Row = @mysql_fetch_array($result); $my_adminid = $Row["mem_ID"]; session_register("my_adminid"); $_SESSION['my_adminid']=$my_adminid; header("location: index.php"); } else { header("location: login.php?fail=1"); } ?> Any help would GREATLY appreciated! Link to comment https://forums.phpfreaks.com/topic/94724-authentication-php-page-not-working/ Share on other sites More sharing options...
peranha Posted March 6, 2008 Share Posted March 6, 2008 at the top of the page use <?php not the short version <? try that and see what happens. Link to comment https://forums.phpfreaks.com/topic/94724-authentication-php-page-not-working/#findComment-484962 Share on other sites More sharing options...
jonw118 Posted March 6, 2008 Author Share Posted March 6, 2008 Awesome! That did it!!! Now I'm having an .htaccess problem, will post in another forum for that. Link to comment https://forums.phpfreaks.com/topic/94724-authentication-php-page-not-working/#findComment-484994 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.