473,372 Members | 1,042 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,372 software developers and data experts.

php session problem in IE 6.0

i have this log in script from a book that uses session variable to
track the user.. everything works fine in firefox but in IE 6.0 the
page only refreshes and the user can be authenticated... i have tried
most of the solutions posted on the web.. but to no avail.. if anyone
can look at the code.. and help me..

thanks.. kelli

here are the scripts..
// stories.php
<?php
// Listing 26.5
// stories.php Is the Interface for Writers to Manage Their Stories

include('include_fns.php');
session_start();

if (!check_auth_user()) {
?>
<form action="login.php" method="post">
<table border="0">
<tr>
<td>Username</td>
<td><input size="16" name="username"></td>
</tr>
<tr>
<td>Password</td>
<td><input size="16" type="password" name="password"></td>
</tr>
</table>
<input type="submit" value="Log in">
</form>
<?php
}
else {
$conn = db_connect();

$w = get_writer_record($HTTP_SESSION_VARS['auth_user']);

print 'Welcome, '.$w['full_name'];
print ' (<a href="logout.php">Logout</a>)';
print '<p>';

$sql = 'select * from stories where writer = \''.
$HTTP_SESSION_VARS['auth_user'].'\' order by created desc';
$result = mysql_query($sql, $conn);

print 'Your stories: ';
print mysql_num_rows($result);
print ' (<a href="story.php">Add new</a>)';
print '</p><br /><br />';

if (mysql_num_rows($result)) {
print '<table>';
print '<tr><th>Headline</th><th>Page</th>';
print '<th>Created</th><th>Last modified</th></tr>';
while ($qry = mysql_fetch_array($result)) {
print '<tr>';
print '<td>';
print $qry['headline'];
print '</td>';
print '<td>';
print $qry['page'];
print '</td>';
print '<td>';
print date('M d, H:i', $qry['created']);
print '</td>';
print '<td>';
print date('M d, H:i', $qry['modified']);
print '</td>';
print '<td>';
if ($qry['published'])
print '[Published '.date('M d, H:i', $qry['published']).']';
else {
print '[<a href="story.php?story='.$qry['id'].'">edit</a>] ';
print '[<a
href="delete_story.php?story='.$qry['id'].'">delete</a>] ';
print '[<a
href="keywords.php?story='.$qry['id'].'">keywords</a>]';
}
print '</td>';
print '</tr>';
}
print '</table>';
}

}
?>
///////login.php
<?php
session_start();

include('include_fns.php');
session_register("auth_user");

if ( (!isset($HTTP_POST_VARS['username'])) ||
(!isset($HTTP_POST_VARS['password'])) ) {
print 'You must enter your username and password to proceed';
exit;
}

$username = $HTTP_POST_VARS['username'];
$password = $HTTP_POST_VARS['password'];

if (login($username, $password)) {
$HTTP_SESSION_VARS['auth_user'] = $username;

header('Location: '.$HTTP_SERVER_VARS['HTTP_REFERER']);
}
else {
print 'The password you entered is incorrect';
exit;
}
?>

// user_auther_fns.php
<?php
session_start();
function login($username, $password)
// check username and password with db
// if yes, return true
// else return false
{
// connect to db
$conn = db_connect();
if (!$conn)
return 0;

$result = mysql_query("select * from writers
where username='$username'
and password ='$password'");
if (!$result)
return 0;

if (mysql_num_rows($result)>0)
return 1;
else
return 0;
}

function check_auth_user($auth_user)
// see if somebody is logged in and notify them if not
{
global $HTTP_SESSION_VARS;
if (isset($HTTP_SESSION_VARS['auth_user']))
return true;
else
return false;
}

?>

Jul 17 '05 #1
0 1108

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Damien | last post by:
Hi to all, I'm currently re-designing our intranet : nice and lean CSS2, cleaned-up PHP 4.3.7, better-normalized MySQL ;o). So I've started using the $_SESSION variable instead of register_globals...
1
by: mudge | last post by:
I'm running PHP Version 4.3.10. I'm trying to make it so that when a person logs in using a user name and password that their session is valid and continues for a few months so they don't have to...
6
by: Al Jones | last post by:
This is a repost form the vbscript newgroup - if this isn't the appropriate group would you point me toward one that is. Basically, I seem to be losing session data part way though preparing an...
5
by: Abhilash.k.m | last post by:
This is regarding the session management using Out of proc session management(SQL SERVER). Among the samples below which one is better to set the session? 1. There are 20 session...
0
by: joseph conrad | last post by:
Hi, I tried to implement my own session handler in order to keep control on the process the drawback I foun it is not creating and storing in my cookie the PHPSESSID variable anymore. reading te...
14
by: aroraamit81 | last post by:
Hi, I am facing a trouble. I have some Session variables in my code and somehow my session variables are getting mixed up with other users. For example User A has access to 10 companies and...
7
by: aroraamit81 | last post by:
Well Guys, Here is a very strange trouble. When more than one users request tto same page at the same time then our session gets conflicted. Moreover I printed my SessionID, strangely but true I...
0
by: TRB_NV | last post by:
I'd been using an Access database based shopping cart, but wanted to change it so that it would use session variables. I have a form that's submitted to a page called addtocart.asp that contains...
1
by: Santosh | last post by:
Dear All i am writting a code sending mail with attachement. i am writting code for sending mail in one page and code for attaching a file in the next page. aftet attaching a file i am taking...
5
by: lyealain | last post by:
<% If Session("username") = "" Then Response.Redirect("/CLS/Login.asp") End If Dim conn Dim connectstr Dim db_name, db_username, db_userpassword Dim db_server Dim res
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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...

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.