Jump to content

[SOLVED] MySql Error? Or is it?


FlyingIsFun1217

Recommended Posts

Hey!

 

I've got a login script as such:

 

login.php:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "XHTML1-s.dtd">
<html>
<head>
<title>Ploronex TMS Login</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>

<div id="header">

<h1>TMS</h1>
<h2>Ploronex Development Team</h2>

</div>


<div id="container">

<div id="primarycontainer">
	<div id="primarycontent">

		<!-- Primary content start -->

		<br></br>

		<?php
			if($_GET['rslt'] == '1')
			{
				echo '<div id="loginerrorbox">';
				echo '<b>Invalid Login Credentials!</b>';
				echo '</div>';
				echo '<br>';
			}
		?>

		<div id="loginbox">
		<center>
		<table>
		<form action="loginAction.php" method="post">
			<tr>
				<td valign="middle">Login ID</td>
				<td valign="middle"><input type="text" name="UserName"></input></td>
			</tr>

			<tr>
				<td valign="middle">Password</td>
				<td valign="middle"><input type="password" name="PasswordMD5"></input></td>
			</tr>
			<tr><td><p></p></td><td><p></p></td></tr>
			<tr>
				<td></td>
				<td align="right"><input type="submit" value="Log In"></input></td>
			</tr>
		</form>
		</table>
		</center>
		</div>

		<!-- Primary content end -->

	</div>
</div>
</div>

<div id="footer">
© 2008 Ploronex. Design by <a href="http://www.nodethirtythree.com/">NodeThirtyThree</a>.
</div>


</body>
</html>

 

and loginAction.php:

<?php
include('dbsInfo.php');
include('dbsConnect.php');

$loginID 	= $_POST['UserName'];
$loginPass 	= md5($_POST['PasswordMD5']);

$SQLID = 'SELECT UserName, PasswordMD5 FROM users WHERE UserName="'.$loginID.'"';
$userData = mysql_fetch_array(mysql_query($SQLID), MYSQL_ASSOC);

if($userData['UserName'] == $loginID)
{
	if($userData['PasswordMD5'] == $loginPass)
	{
		setcookie('UserName',		$userData['UserName'],	time()+3600);
		setcookie('PasswordMD5',	$loginPass,				time()+3600);

		echo '<script type="text/javascript">';
		echo 'window.location = "index.php"';
		echo '</script>';
	}

	else
	{
		echo '<script type="text/javascript">';
		echo 'window.location = "login.php?rslt=1"';
		echo '</script>';
	}
}

else
{
	echo '<script type="text/javascript">';
	echo 'window.location = "login.php?rslt=1"';
	echo '</script>';
}
?>

 

I've been looking over it for hours now, and I just can't figure this one out... It works perfectly fine on my local computer (which is windows, I'm developing with Xampp), but when I go to use it on a remote server (which is running Debian), I put in my login credentials, and it flashes (VERY fast) an error, I believe. It then immediately redirects me back to login.php, no error or anything, just cleared fields.

 

Surely this cannot be because it is reading information that is not kosher from the database... I am using a backup of my local database (which again, works fine) on the remote server.

 

I'm REALLY hoping somebody is going to spot a stupid error on my part. It's been driving me nuts!

 

Thanks!

FlyingIsFun1217

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.