Hey everyone,
I'm sorry for re-opening this again but I have a log in script that someone gave me on here and it works on my local server..but when I upload it to godaddy..it doesn't work right..it keeps saying my user info isn't correct when It clearly is..and It's connected to the database correctly as well as the table..I don't know what to do..
Here is the log in script with the login form because it is all on the same page..
<?php
// script login for login.php
session_start();
$err='';
$file=strip_tags($_SERVER['PHP_SELF']);
if(isset($_POST['Submit']))
{
//connect to login database
mysql_connect('******','********','*******') or die(mysql_error());
mysql_select_db('*********') or die(mysql_error());
$user = mysql_real_escape_string(stripslashes($_POST['username']));
$pass = mysql_real_escape_string(stripslashes($_POST['password']));
$select = "SELECT * FROM `users` where `username`='".$_POST['username']."' AND `password`='".md5($_POST['password'])."'";
$msq = mysql_query($select) or die(mysql_error());
$total=mysql_num_rows($msq);
if(1==$total)
{
$row = mysql_fetch_assoc($msq);
foreach($row as $k=>$v)
{
$_SESSION[$k] = $v;
}
if(isset($_SESSION['returnTo']) && !empty($_SESSION['returnTo']))
{
$temp=$_SESSION['returnTo'];
$_SESSION['returnTo']=NULL;
header('Location: '.$temp);
}
elseif(1==(int)$_SESSION['user_level'])
{
header('Location: Blog-admin-area.php');
}
else
{
header('Location: index.php');
}
exit;
}
elseif(0==$total)
{
$err='<p>Incorrect username/password</p>';
}
else
{
$err='<p>We are currently experiencing technical difficulties. Please try again later.</p>';
$msg='Error encountered at '.$file.'. Expected the query to yield zero or one row, but instead the query generated '.$total.' rows.'.PHP_EOL;
$msg.='The submitted data is as follows:'.PHP_EOL.print_r($_POST,true);
$webmaster='***********.com';
$to=$webmaster;
$subject="Error at Login Page For Ready Or Not Tahirih's website";
$headers='To: '.$to.PHP_EOL;
$headers.='From: '.$webmaster.PHP_EOL;
$headers.='Return-Path: '.$webmaster.PHP_EOL;
mail($to,$subject,$msg,$headers);
}
}
?>
and here is the html form
<?php
if(!empty($err))
{
echo $err;
}
?>
<form action="<?php echo $file;?>" method="post">
<table width="50%" border="0" align="center" cellpadding="7" cellspacing="0">
<tr>
<td width="22%">Username</td>
<td width="78%"><input name="username" type="text" id="username"></td>
</tr>
<tr>
<td>Password</td>
<td><input name="password" type="password" id="password"></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
<div class="login-links">
<a href="lost_pw.html">Lost Password</a> <a href="changepassword-form.php"> Change Password</a>
</div>
</form>
Thanks for bearing with me!! I appreciate everyone's help!