-
Posts
131 -
Joined
-
Last visited
Never
Posts posted by paddyhaig
-
-
So I turned on register_globals = On Just to see what would happena and got all this stuff in my php_log
[08-May-2010 17:12:15] PHP Notice: Undefined variable: login in C:\wamp\www\concierge\scripts\authenticate\auth.php on line 19
[08-May-2010 17:12:15] PHP Notice: Undefined variable: password in C:\wamp\www\concierge\scripts\authenticate\auth.php on line 20
[08-May-2010 17:12:15] PHP Notice: Undefined variable: privilage in C:\wamp\www\concierge\scripts\authenticate\auth.php on line 41
[08-May-2010 17:12:15] PHP Notice: Undefined variable: privilage in C:\wamp\www\concierge\scripts\authenticate\auth.php on line 47
[08-May-2010 17:12:15] PHP Notice: Undefined variable: privilage in C:\wamp\www\concierge\scripts\authenticate\auth.php on line 53
-
register_globals is turned off in the php.ini
How would I use session's instead?
-
Ok, I tried 'if( isset($_POST['submit']) ) ' and I am no longer getting the error! I am still not logging in as yet, but that could be something else. Yikes!!!
[08-May-2010 16:53:12] PHP Notice: Undefined variable: login in C:\wamp\www\concierge\scripts\authenticate\auth.php on line 19
[08-May-2010 16:53:12] PHP Notice: Undefined variable: password in C:\wamp\www\concierge\scripts\authenticate\auth.php on line 20
[08-May-2010 16:53:12] PHP Notice: Undefined variable: privilage in C:\wamp\www\concierge\scripts\authenticate\auth.php on line 41
[08-May-2010 16:53:12] PHP Notice: Undefined variable: privilage in C:\wamp\www\concierge\scripts\authenticate\auth.php on line 47
[08-May-2010 16:53:12] PHP Notice: Undefined variable: privilage in C:\wamp\www\concierge\scripts\authenticate\auth.php on line 53
Why did it work before and now it does not??? I am not kidding ya, it worked just fine.
God need's to do more than just listen!
-
Thank you 'Ignace', I am not to hot at php programming. Some of the stuff, like changing the php.ini file I can do, The other suggestions you made will take me a while to figure out.
-
I originally wrote this script 7 years ago and haven't been near php since, it worked then on both my Windows box running a WAMP kit and also on my Linux server. I am wondering if it has something to do with php being updated?
-
That's handy to know! But it doesn't fix my authentication script situation any. I am running the script on my Windows laptop via WAMPserver. The shouldn't be a problem, as I am running a number of other authentication based web apps on the same setup with out issue. If any one can look over the script and tell me if they see any issues, I would be grateful. If it's not the script, I will look else where.
-
I am receiving an error see below (This script used to work on the system I had before this one) I am grateful of any help that I might get.
Here is the error that I am receiving, this used to work fine on another system!
"Notice: Undefined variable: submit in C:\wamp\www\concierge\scripts\authenticate\auth.php on line 7"
The are 2 scripts being used, one is an authentication input interface. index.php
And the other is the authentication processing script. auth.php
See scripts below:
------------------------------------------------------------------------------------------
index.php:
------------------------------------------------------------------------------------------
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Concierge</title>
<!--
@import url(layout/style.css);
-->
<style type="text/css">
<!--
body,td,th {
color: #283A86;
}
-->
</style></head>
<body>
<form method="POST" action="scripts/authenticate/auth.php">
<p> </p>
<p> </p>
<div align="center"> <center>
<table border="0" cellpadding="0" cellspacing="0" bgcolor="#283A86">
<tr>
<td align="center"><img border="0" src="graphics/framing/ltc.gif" width="91" height="91"></td>
<td align="center"><img border="0" src="graphics/framing/top_whole.gif" width="200" height="91"></td>
<td align="center"><img border="0" src="graphics/framing/rtc.gif" width="91" height="91"></td>
</tr>
<tr>
<td align="center"><img border="0" src="graphics/framing/left_whole.gif" width="91" height="171"></td>
<td align="center"> <table border="0" cellpadding="0" cellspacing="0" height="62" bgcolor="#283A86">
<tr>
<td align="center" height="25"> <p align="center"><font color="#FFFFFF"><b>User</b></font></p></td>
<td align="center" height="25"><input type="text" name="login" size="14"></td>
</tr>
<tr>
<td align="center" height="12">_________</td>
<td align="center" height="12"> </td>
</tr>
<tr>
<td align="left" height="13"><font color="#FFFFFF"><b> Password
</b></font> </td>
<td align="center" height="13"><input type="password" name="password" size="14"></td>
</tr>
<tr>
<td align="center" height="6" colspan="2"> </td>
</tr>
<tr>
<td align="center" height="6"> </td>
<td align="center" height="6"> <p align="left">
<input type="submit" value="Login" name="submit">
</td>
</tr>
</table></td>
<center>
<td align="center"><img border="0" src="graphics/framing/right_whole.gif" width="91" height="171"></td>
</center>
</tr>
<tr>
<td align="center"><img border="0" src="graphics/framing/blc.gif" width="91" height="91"></td>
<td align="center"><img border="0" src="graphics/framing/bottom_whole.gif" width="200" height="91"></td>
<td align="center"><img border="0" src="graphics/framing/brc.gif" width="91" height="91"></td>
</tr>
</table>
</center> </div>
</form>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><font color="#808080" size="2">Concierge System </font></td>
</tr>
<tr>
<td align="center"><font color="#808080" size="2">Powered by</font></td>
</tr>
<tr>
<td align="center"><a href="http://www.onina.net" target="_blank"><font size="2" color="#0000FF">Onina</font></a></td>
</tr>
</table>
</center>
</div>
<p align="center"> </p>
</body>
</html>
------------------------------------------------------------------------------------------
auth.php
------------------------------------------------------------------------------------------
<?php
/* Seems to be a problem right here, it looks like I am trying to submit an undefined variable that does not exist but it does, as it should be being passed from the index,php form.
*/
////////////////
if ($submit)
///////////////
{$db = mysql_connect("localhost", "example", "example");
mysql_select_db("concierge", $db);
$sql = "
SELECT privilage
FROM auth
WHERE login = '$login'
AND password = '$password'
";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
$privilage = $row["privilage"];
}
if (!mysql_num_rows($result)) {
header("Location: ../../index.php");
// if the information doesn't match, i.e. returns
// no records, then they shouldn't be there.
} else {
setcookie('username', $_POST['username'], (time()-2592000), '/', '', 0);
setcookie('privilage', $_POST['privilage'], (time()-2592000), '/', '', 0);
}
// Receptionist level
if ($privilage == "receptionist") {
header("Location: ../../employees/receptionist/index2.htm");
// Managers level
} elseif ($privilage == "manager") {
header("Location: ../../employees/managers/index1.htm");
// Administrator level
} elseif ($privilage == "administrator") {
header("Location: ../../admin/index.php");
}
// for each access level, the level is displayed
// as well as the link to the next.php script.
// For expansion, the access level displayed could
// also be stored in a database for dynamic retrieval.
} else {
// if they haven't submitted their username and
// password, then the original form is displayed
?>
<?php
}
?>
Authentication error
in PHP Coding Help
Posted
ignace, apart from putting a <?php at the begging and a ?> at the end of the script. I have to say that you got yourself a believer. Thank you, thank you, thank you, I guess I don't have to say it now works!