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
https://forums.phpfreaks.com/topic/141250-solved-mysql-error-or-is-it/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.