Page 1 of 1
problem...urgent~
Posted: Sun May 30, 2004 9:07 am
by kevin7
i doin my college project...
it was a system for sales...
before it uploaded into my web hosting... everything work perfectly~
i can login, add customer everything w/o any problems..
after that, i upload it into my web hosting... but, the problem was occured!!! it was a nightmare... databasse login all is correct...
then i login... i can login at the first time.. everything work fine.. but suddenly an acccess denied message comes out~ and i can't login anymore... but sometimes can login... aisk...
my computer using mysql 3.0++ and my web hosting using mysql 4.0.18... is that a problem? i'm using session id...
gosh~~~ how~~
Posted: Sun May 30, 2004 9:12 am
by John Cartwright
umm.. show us some code
Posted: Sun May 30, 2004 10:09 am
by dull1554
different versoins of php?
there could be some config problems with sessions
Posted: Sun May 30, 2004 10:19 am
by kevin7
http://www.the-kevin.org/mobilecore/login.php
staff id : 1000
password : kevin7
.... try login and hanging around...
Posted: Sun May 30, 2004 10:24 am
by kevin7
how can i config session in the server?
Posted: Sun May 30, 2004 10:27 am
by kevin7
i think it was a session id problem...
Posted: Sun May 30, 2004 10:28 am
by dull1554
i did, i was able to go between all the pages multiple times without anyproblem
if you use sessions, that could be your problem, secure sessions use cookies so if you dont have cookies enabled your gonna be introuble
Posted: Sun May 30, 2004 11:31 am
by kevin7
Code: Select all
<?
session_start();
header("cache-control: private");
$id = (isset($_REQUESTї'id']) ? $_REQUESTї'id']: null);
if ($id==null) {
header('location:error_id.php?type=access_denied');
} else {
require("sqlauth.php");
$result = mysql_query("SELECT * FROM employee WHERE emp_id=$id",$db);
if (!isset($_SESSIONї'name'])) {
header('location:error_id.php?type=session_expired');
}
$flag=0;
while ($myrow = mysql_fetch_row($result)) {
if (($_SESSIONї'name']==$myrowї0]) && ($_SESSIONї'pass']==$myrowї12])) {
$flag=1;
<!-- START OF CONTENT -->
<!-- END OF CONTENT -->
}
}
if ($flag==0) {
header('location:error_id.php?type=access_denied');
}
}
?>
all my pages have this coding... i know it was a mess...
Code: Select all
$flag=0;
while ($myrow = mysql_fetch_row($result)) {
if (($_SESSIONї'name']==$myrowї0]) && ($_SESSIONї'pass']==$myrowї12])) {
$flag=1;
<!-- START OF CONTENT -->
<!-- END OF CONTENT -->
}
}
in the line above... i use while loop to match the session id' name and pass with the database... if correct then display content... there hv a flag if the matches is meet... all the while... all the pages work for me, only one page hv faulty... it seem like the SESSION not match with the database... and the variable $flag=0... as a result... it jump to the following if statement...
Code: Select all
if ($flag==0) {
header('location:error_id.php?type=access_denied');
}
i realized, the problem was the session ID... but why it seem like erased... and after that, i cannot login anymore unless i close the browser and start it all again...
Posted: Sun May 30, 2004 11:44 am
by kevin7
ooo... i found the bug...
the session id for staff id change by itself... from 1000 to 1f00 ???
what is goin on??