Session
Posted on
16th Feb 2014 07:03 pm by
admin
I am having a little trouble with a session. Not sure if it is my browser or what. I know I do not have any trouble logging into forums such at these, so not sure why this is not working.
first the code. Just basic code from php documentation plus some added checks.
Code: <?php
// page1.php
if (session_start()) {
echo "OK";
} else {
echo "FAIL";
}
// echo phpinfo();
// echo getcwd();
echo 'Welcome to page #1';
$_SESSION['favcolor'] = 'green';
$_SESSION['animal'] = 'cat';
$_SESSION['time'] = time();
print_r($_SESSION);
// Works if session cookie was accepted
echo '<br /><a href="page2.php">page 2</a>';
// Or maybe pass along the session id, if needed
echo '<br /><a href="page2.php?' . SID . '">page 2</a>';
?>
And
Code: <?php
// page2.php
session_start();
echo 'Welcome to page #2<br />';
echo $_SESSION['favcolor']; // green
echo $_SESSION['animal']; // cat
echo date('Y m d H:i:s', $_SESSION['time']);
print_r($_SESSION);
// You may want to use SID here, like we did in page1.php
echo '<br /><a href="page1.php">page 1</a>';
?>
There is no reason why this should not work. Can someone go to:
http://www.e-sullivan.com/DIITop25/page1.php
and tell me if it works for you? It shows me that the sessions are being started but the variables are not passing between page1.php and page2.php for me.
No comments posted yet
Your Answer:
Login to answer
331
8
Other forums
str_replace help
Hey there,
I'm a PHP newb, I'm having troubles with the str_replace function. I want to clean
Remote Database Access
Hey guys!!
OK, i'm used to only working with databases from the CPANEL, accessing phpMyAdmin
whats wrong with my code please help!!!
this is the error
Warning: mysql_close(): supplied argument is not a valid MySQL-Link res
PHP Programming error. Please help!
Hi there,
Am making a website for a friend and have encountered a problem that i need fixing
Saas with SAP R/3
hi experts,
Is SaaS offer available in SAP? for SAP R/3? from where i can get the info a
Not showing whole name with mail () script
I sent up a simple mail form with the PHP mail() script. One problem is when it sends an email with
Sessions work for me and not others?
I'm having a bit of bad luck with sessions. In the past they have worked fine for me, but this time
Dump with added_funcion cl_salv_table
Hi there, I'm having some troubles adding a self defined function to an ALV in fullscreen. The thing
convert pps to wsf with php'how?
hi
i want to convert with php
PowerPoint file to swf file(flash)
how please?
thank!!!
Preventing SQL Injection
I have a question about SQL Injection, In some of our code we use this:
view plaincopy to clipboa