473,396 Members | 2,109 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problem with Session_start()

1
I'm having a problem with my session variables. I have a basic login script that contains:

[PHP]
session_start();
...

$_SESSION['uname'] = $username;
$_SESSION['utype'] = $uType;
[/PHP]

The user is then redirected to a menu page that I modified to verify that the session variables were still accessible there. Here is the page:

[PHP]
<?
session_start();
if(!session_is_registered(myusername)){
header("location:main_login.php");
}

?>

<html>
<body>
Login Successful
<?
$name = $_SESSION["uname"];
echo "Hello ". $name;
?>
<br>
<a href="browse.html">Browse</a>
<br>
<a href="Logout.php">Logout</a>
</body>
</html>
[/PHP]

Then the user is diected to a search page, the page uses AJAX and accessing a couple of scripts, none of which use the session vaiables before it access this script:

[PHP]
<?php
session_start();
$login = $_SESSION["uname"];
$utype = $_SESSION["utype"];
....
[/PHP]

I use the username later and they come up as empty strings.

What baffles me is that, on the middle, 'menu' page the session variables are initiated the same way but in that instance they come out right, but in the next page, they come up blank. I'm using vista and firefox, I don't get any errors but both the session variables come up blank. Any ideas? Thanks!
Apr 16 '07 #1
0 988

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: sky2070 | last post by:
session_start(); $_SESSION++; print 'You have visited here '.$_SESSION.' times.'; returned: Warning: session_start() : open(/tmp\sess_c8bf2007256f6e15a938c0254adb21e4, O_RDWR) failed: No...
3
by: Sticks | last post by:
i have been having difficulty with session variables - i seem to be able to set them, but when i wish to have another page update them, they remain as they were. this makes them utterly useless to...
2
by: Paul | last post by:
Dear experts, I have a problem with session_start() and JavaScript. In IE6 (but not Mozilla) the first time the page below loads the JavaScript doesn't work (clicking on the graphic should write...
1
by: Ray Torres | last post by:
I get a warning and cannot start a session. I understand from reading through the documentation and other posts that session_start must occur in the php script before any HTML tags or output to...
5
by: cowofchaos | last post by:
when I use the session_start() function at the top of my scripts I get 5 errors on the page If anyone can help please do this has been a problem for a while and I cannot do much more work on my...
9
by: Bartosz Wegrzyn | last post by:
I need help with sessions. I createt set of web site for nav with authorization. first I go into main.php which looks like this: <?php //common functions include_once '../login/common.php';...
19
by: lawrence k | last post by:
How can I find out where my script is outputting to the screen for the first time? My error logs are full of stuff like this: PHP Warning: session_start(): Cannot send session cache...
3
by: anis2007 | last post by:
Hi, following code run our server but this is not run client server:- index code is: PUT YOUR CODE BETWEEN code OR php TAGS!! It is absolutely unreadeable! <?php ob_start(); session_start();...
5
by: Garry Jones | last post by:
This is a excerpt from the code where I collect data with a form. <FORM action="index15dq.php" method="post" name="stegscf_pwd_edit" id="stegscf_pwd_edit"> I am setting three session variables...
2
by: jwhite68 | last post by:
The essence of my problem is this. 1. I login to my website with user/password. 2. I select any option, which effectively re-calls index2.php with some additional parameters, to control whats...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.