Page 1 of 1

Fatal Error in Session_Start in OES environment

Posted: Mon Aug 22, 2005 3:22 am
by reana
Help...

Could someone please advise me why am I getting this error -

FATAL ERROR -Call to Undefined Function (Session_Start in /srv/www.htdocs/xxx/xx/indexyy.php)

I got this error when I installed and integrate my system at my client's OES server. It seem to work fine when I tested it from Windows platform.

Could it be due to different version of PHP (mine at office is version 5, whereas client's OES PHP is version 4) ?

Otherwise why can't the OES recognise the session_start function ?

Help me I'm stuck...I'm a fresh grad and this is my first system, just my lucky star that I got involved with OES and I can't help feeling like a little lost lamb....

Anyways, I put the session_start function right at the top of my coding as below:-

Code: Select all

<?
session_start(); 

<?


if(!isset($username) | !isset($password)) {
// escape from php mode.
?>

<form action="<?=$PHP_SELF?><?if($QUERY_STRING){ echo"?". $QUERY_STRING;}?>" method="POST">



session_register("username");
session_register("password");


$db="xx";
$con=mysql_connect("localhost","root","");
mysql_select_db($db,$con);


$sql = mysql_query("SELECT password, MD5(UNIX_TIMESTAMP() + id + RAND(UNIX_TIMESTAMP())) GUID FROM login WHERE username = '$username'",$con);
$fetch_em = mysql_fetch_array($sql);
$numrows = mysql_num_rows($sql);

if($numrows != "0" & $password == $fetch_em["password"]) {
$valid_user = 1;
//$psRefer='index.php';
include('index.php');
}
else {
$valid_user = 0;
}
Thanks to advise...


Cheers
ReAnA



feyd | Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Mon Aug 22, 2005 5:02 am
by raghavan20

Code: Select all

<? <-------------------
session_start(); 

<? <-----------------------


if(!isset($username) | !isset($password)) { 
// escape from php mode. 
?> 

<form action="<?=$PHP_SELF?><?if($QUERY_STRING){ echo"?". $QUERY_STRING;}?>" method="POST">
why have you got two opening tags one after the other without a closing one? 8O
should have posted under PHP-Code :)

Posted: Mon Aug 22, 2005 5:06 am
by raghavan20
this does not really look like an OR statement
:wink:

Code: Select all

if(!isset($username) | !isset($password)) { //look at the OR operator here
just a small thought, you could have used
$_SERVER["REQUEST_URI"]
instead of

Code: Select all

="<?=$PHP_SELF?><?if($QUERY_STRING){ echo"?". $QUERY_STRING;}?>"

Posted: Mon Aug 22, 2005 6:07 am
by AnarKy
raghavan20 wrote:this does not really look like an OR statement
:wink:

Code: Select all

if(!isset($username) | !isset($password)) { //look at the OR operator here
Bitwise or and and operators are all well,
but dont you need logical operators instead?

Sorry sorrier sorriest!!!

Posted: Mon Aug 22, 2005 6:09 am
by reana
Whoops...

Sorry, that's what happen when you merely cut n paste the coding...I was seeing double vision...silly me...sorry folks.. :oops:

Anyway, this seem to work in Windows platform and there's no error whatsoever. It's only when I install this latest coding into the OES/SuSE Linux server that I'm seeing the fatal error.

Fyi, I'm at final stage of my system development, but I need to add this security/login page as the data involved are considered sensitive. But it turns out that everything gone haywire when I include the login/session codes in OES...

What really baffles me is that it works fine in Windows - so only authorised users are allowed to access the system, but when I put it on the OES server this error comes out. I had t ried to disable the session_start function, but my system just stuck there on the login page... :roll:

Anybody familiar with OES/SuSE Linux environment..please please please...I need your precious advise...

Cheers
ReAnA

difference

Posted: Mon Aug 22, 2005 6:24 am
by AnarKy
Perhaps its a difference in php.ini between the 2 servers.

Please do correct the errors in the script.
It's always a bad idea to ignore small errors.

Posted: Mon Aug 22, 2005 7:55 am
by feyd
I'm not seeing what this thread has to do with Security, so moved to PHP - Code.

Could the different versions of PHP be the Culprit ??

Posted: Tue Aug 23, 2005 10:18 pm
by reana
OK, I had tested my system on Linux PC and the login page seems to work just fine, so any bypass attempts will be challenged by login page so only authorised users are allowed to access my system.

Logically, this proves that the coding are allright (well, there's no error whatsoever in both Windows/Linux platform back at my office, and the system runs as I wanted it to be).

I had re-checked everything and realised that my office is using LAMPP with PHP ver 5, while my client's server is WITHOUT LAMPP and it is using PHP ver 4.

Could someone please advise if the difference between 2 versions of PHP caused my system to go haywire when I include the session_start in my coding ???

Cheers
ReAnA