Jump to content

Recommended Posts

Thanks thorpe for your reply...

Yes, my browser does allow cookies.
The thing is that my code works fine on other servers like Godaddy,aplus.net and etc.
But it doesn't work on my computer, I'am using [b]PHP Version 4.3.11[/b] and apache [b]Apache/1.3.33 (Win32)[/b].
So I can't figure out the reason....

Thanks,
George
Have you checked your server log and/or put the following line in after your first opening <?php tag -
[code]error_reporting(E_ALL);[/code]
What are all the session related settings from your php.ini file?

When you say that they don't work, what are they doing and post some code that you have that does not work.

I suspect that output buffering is ON on the servers that your code works on and it is off on your development system and that your code is improperly outputting content to the browser prior to your session_start()...
Here is the login script for example wich works fine on other servers:

[code]<?php
session_start();
require ("config.php"); //conect to db
$myuser = $_POST['user']; // vars from form
$mypass = $_POST['pass'];
$log = $_POST['list'];

switch($log){
default:
$sql="SELECT * FROM aid_users WHERE user='$myuser' and pass='$mypass'";
$result = mysql_query($sql);
$count = mysql_num_rows($result);
if($count==1){
session_register("user");
header("location:index.php");
}
else {
header("location:admin.php?login=false");
}
break;
case "admin":
$sql="SELECT * FROM aid_users WHERE user='$myuser' and pass='$mypass'";
$result = mysql_query($sql);
$count = mysql_num_rows($result);
if($count==1){
session_register("user");
header("location:index.php");
}
else {
header("location:admin.php?login=false");
}
break;
case "director":
$sql="SELECT * FROM aid_director WHERE user='$myuser' and pass='$mypass'";
$result = mysql_query($sql);
$count = mysql_num_rows($result);
if($count==1){
session_register("user");
header("location:functions/eng/eng_dir.php");
}
else {
header("location:admin.php?login=false");
}
break;
}
?>[/code]

My problem is that it doesn't display a registered session...

Thanks,
George
[b][color=red]Do not change register_globals to on[/color][/b]  Read [url=http://www.php.net/register_globals]this section[/url] in the PHP manual on register_globals. When it's enabled, your code can be compromised very easily if you're not very careful (even if you are very careful).

Ken
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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