Click to See Complete Forum and Search --> : One site runs fine on JSAS but not in WAMP
Siddan
09-18-2008, 06:08 AM
Hello
DidnŽt know wich category this topic really belongs in but.... IŽll try it here
I have a simple invoice program written in PHP using MySQL.
It runs fine when browsing through JSAS but not through WAMP.
So I wonder what could be the difference between these two local servers that it will not work in WAMP.
All other sites work fine just not this invoice program/site.
This is the error text shown on the login screen using WAMP local server
Password supplied for user: $login is Invalid.
"); exit(); } } else { $query="SELECT password,access FROM USERS WHERE name='$login'"; $result=mysql_query($query,$db_link); $row=mysql_fetch_row($result) or die("Query Error"); if(compare_password($pass, $row[0])) { $accesslvl=$row[1]; $id=$login; header("Location: $serverurl/list.php"); exit(); } else{print("
Password supplied for user: $login is Invalid.
") ;exit();} } } else { ?>
WAMP:
MySQL clientversion: 5.0.45
PHP = 5.2.5
Apache = 2.2.8
JSAS
MySQL clientversion: 3.23.49
Apache Version Apache/2.0.54 (Win32) PHP/4.4.4
IŽll be happy to provide more information if you tell me what is missing
scragar
09-18-2008, 06:14 AM
atfirst I thought it was a problem with PHP4 code, but that's not so, that isn't an error message, it's your PHP code, is the PHP module turned on, and have your tried stopping and starting apache again(so it checks for new modules)?
Siddan
09-18-2008, 06:36 AM
Hi and thanks for the Swift reply
I have been using WAMP for about 6 months now and that site did not work from the start, only from JSAS... so the apache have been restarted a number of times :)
I am not sure about the "modules", though, as I am not the one who have made the coding.
Although the program is free to download so if you have WAMP on your computer perhaps you could try and see if it returns the same result?
chazzy
09-18-2008, 09:45 AM
the biggest problem i see is that you have 2 different mysql versions. you'll have to show us some of your code to understand what's happening.
Siddan
09-18-2008, 11:15 AM
Hi
Ok, here is the index file.. Please let me know if there is something else. Or you can also download the whole program and see if the same is happening to you in WAMP server
<?
$logclick = $_REQUEST['logclick'];
$login = $_REQUEST['login'];
$pass = $_REQUEST['pass'];
require("common.php");
if($logclick=="login")
{
session_register("accesslvl");
session_register("id");
require("dbinfo.php");
if(intval($login)!=0)
{
$query="SELECT password FROM CLIENT WHERE clientid='$login'";
$result=mysql_query($query,$db_link);
$row=mysql_fetch_row($result);
if( $row == FALSE ){
die("Query Error");
}
if(compare_password($pass, $row[0]))
{
$accesslvl=1;
$id=$login;
logevent("Client Logged into the $company_name Billing System",$id,system);
header("Location: $serverurl/realinv.php");
exit();
}
else{
print("<h1>Password supplied for user: $login is Invalid.</h1><br>");
exit();
}
}
else
{
$query="SELECT password,access FROM USERS WHERE name='$login'";
$result=mysql_query($query,$db_link);
$row=mysql_fetch_row($result) or die("Query Error");
if(compare_password($pass, $row[0]))
{
$accesslvl=$row[1];
$id=$login;
header("Location: $serverurl/list.php");
exit();
}
else{print("<h1>Password supplied for user: $login is Invalid.</h1><br>") ;exit();}
}
}
else
{
?>
<html><title>User Login</title>
<?include("cbmshead.html");?>
<h1>Enter User Information Below</h1></center><BR>
<form method="POST"><table><tr><td>User ID:</td><td><input name=login size=4></td></tr>
<tr><td>Password:</td><td><input type=password name=pass size=12></td></tr></table>
<input type=submit name=logclick value=login></form>
<?
}
?>
Scroll down to the near end where you see the download link. Install the database tables accordingly as it is written in Install.txt
http://www.madgenius.com/madBMS/
chazzy
09-18-2008, 03:16 PM
Take a note on the function intval from the PHP manual:
Empty arrays and objects return 0
Based on what you showed, intval is returning 0 for the $login variable.
You might want to start by debugging the code, adding some statements like the following in that big else block:
else
{
print_r($_REQUEST);
$query="SELECT password,access FROM USERS WHERE name='$login'";
print($query);
$result=mysql_query($query,$db_link) or die ("Failed to issue query: ".mysql_error());
Siddan
09-18-2008, 06:03 PM
Hi
I replaced those else statements with yours, and allthough it did take away the messages it will not however let me login. Nothing happens....
chazzy
09-18-2008, 08:25 PM
the code i gave you wasn't intended to fix any problems, just give you more information about why it's failing.
Siddan
09-19-2008, 07:10 AM
Hi
Yes ok. But if it doesnŽt show any information at all... what can be told from this then?
Here is the index file again with the other 'else' statement. Perhaps I left something out.. ż
<?
$logclick = $_REQUEST['logclick'];
$login = $_REQUEST['login'];
$pass = $_REQUEST['pass'];
require("common.php");
if($logclick=="login")
{
session_register("accesslvl");
session_register("id");
require("dbinfo.php");
if(intval($login)!=0)
{
$query="SELECT password FROM CLIENT WHERE clientid='$login'";
$result=mysql_query($query,$db_link);
$row=mysql_fetch_row($result);
if( $row == FALSE ){
die("Query Error");
}
if(compare_password($pass, $row[0]))
{
$accesslvl=1;
$id=$login;
logevent("Client Logged into the $company_name Billing System",$id,system);
header("Location: $serverurl/realinv.php");
exit();
}
else
{
print_r($_REQUEST);
$query="SELECT password,access FROM USERS WHERE name='$login'";
print($query);
$result=mysql_query($query,$db_link) or die ("Failed to issue query: ".mysql_error());
}
}
else
{
$query="SELECT password,access FROM USERS WHERE name='$login'";
$result=mysql_query($query,$db_link);
$row=mysql_fetch_row($result) or die("Query Error");
if(compare_password($pass, $row[0]))
{
$accesslvl=$row[1];
$id=$login;
header("Location: $serverurl/list.php");
exit();
}
else
{
print_r($_REQUEST);
$query="SELECT password,access FROM USERS WHERE name='$login'";
print($query);
$result=mysql_query($query,$db_link) or die ("Failed to issue query: ".mysql_error());
}
}
else
{
?>
<html><title>User Login</title>
<?include("cbmshead.html");?>
<h1>Enter User Information Below</h1></center><BR>
<form method="POST"><table><tr><td>User ID:</td><td><input name=login size=4></td></tr>
<tr><td>Password:</td><td><input type=password name=pass size=12></td></tr></table>
<input type=submit name=logclick value=login></form>
<?
}
?>