Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 01-15-2005, 01:37 AM Slight Problem
log2's Avatar
Skilled Talker

Posts: 80
Trades: 0
Ok, I have a login script, simple login script, the login page and the main page(after you login) is in the same file. . . like so:
main.php
PHP Code:
<?
include("include/session.php"); // includes important MySQL Info
?>

<html>
<title>4D Realms</title>
<body background="bg2.png">

<table>
<tr><td>


<?
if($session->logged_in){ // if the session is started, do the following:
   
echo "<h1>Logged In</h1>";
   echo 
"Welcome <b>$session->username</b>, you are logged in. <br><br>" // General Info
       
."[<a href=\"userinfo.php?user=$session->username\">My Account</a>] &nbsp;&nbsp;" // View The Info on your Account
       
."[<a href=\"useredit.php\">Edit Account</a>] &nbsp;&nbsp;"/// Edit your own Account
   
if($session->isAdmin()){
      echo 
"[<a href=\"admin/admin.php\">Admin Center</a>] &nbsp;&nbsp;"/// ADMIN ONLY: Admin Center
   
}
    echo 
"[<a href=\"../index.php\">Forum</a>] &nbsp;&nbsp;"// To the Forum
    
echo "[<a href=\"process.php\">Logout</a>]"/// Loging Out
    
echo "<br><br>";
    echo 
"Unique Visitors: ";
    include (
"huc.php"); /// Unique Counter File
    
echo "<br>";
    include (
"counter.php"); // Site Hits Counter File
    
echo "<br><br><br><A href=\"Admin.php\">Click here for a table of the users!</a>"// Table Of Users

}
else{
?>

<h1>Login</h1>
<?
/**
 * User not logged in, display the login form.
 * If user has already tried to login, but errors were
 * found, display the total number of errors.
 * If errors occurred, they will be displayed.
 */
if($form->num_errors 0){
   echo 
"<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>";
}
?>
<form action="process.php" method="POST">
<table align="left" border="0" cellspacing="0" cellpadding="3">
<tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr>
<tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr>
<tr><td colspan="2" align="left"><input type="checkbox" name="remember" <? if($form->value("remember") != ""){ echo "checked"; } ?>>
<font size="2">Remember me next time &nbsp;&nbsp;&nbsp;&nbsp;</font>
<input type="hidden" name="sublogin" value="1">
<input type="submit" value="Login"></td></tr>
<tr><td colspan="2" align="left"><br><font size="2">[<a href="forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr>
<tr><td colspan="2" align="left"><br>Not registered? <a href="register.php">Sign-Up!</a></td></tr>
</table>
</form>

<?
}

/**
 * Just a little page footer, tells how many registered members
 * there are, how many users currently logged in and viewing site,
 * and how many guests viewing site. Active users are displayed,
 * with link to their user information.
 */
echo "</td></tr><tr><td align=\"center\"><br><br>";
echo 
"<b>Member Total:</b> ".$database->getNumMembers()."<br>";
echo 
"There are $database->num_active_users registered members and ";
echo 
"$database->num_active_guests guests viewing the site.<br><br>";

include(
"include/view_active.php");

?>


</td></tr>
</table>


</body>
</html>
Ok so now when I log in with FF(firefox) it redirects me perfectly to what it should but when I do it with IE it doesn't, It says I log on down at the bottom (where it shows the users online) and then it keeps me at the login part of the script, If i try to go to Admin.php which has an
Quote:
If($session->logged_in){
statement at the top it shows a message
Quote:
Not Logged In, Click Here
Can anyone figure out why that is, And it's not only on my computer I got a friend to try it too (actually he pointed it out to me ) Hope someone can help
log2 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-15-2005, 10:07 AM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
Do both browsers allow cookies from your site?
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 01-15-2005, 06:00 PM
log2's Avatar
Skilled Talker

Posts: 80
Trades: 0
yes i'm pretty sure they do
log2 is offline
Reply With Quote
View Public Profile
 
Old 01-17-2005, 11:24 AM
mikeroq's Avatar
Skilled Talker

Posts: 92
Name: Mike Roq
Location: Lakewood, CO
Trades: 1
why do u need a session file. My main page says something like
[php]
<?php
session_start()
$user=$_SESSION['username']
if (!$user)
{
WElcome Login or register
}
else {
Logged in a $user. CP | Upload Files |
__________________
CodingHub.com
mikeroquemore.com
mikeroq is offline
Reply With Quote
View Public Profile Visit mikeroq's homepage!
 
Old 01-17-2005, 09:07 PM
vivekar's Avatar
Webmaster Talker

Posts: 612
Trades: 0
IE 6 and FF have some tough cookie security settings.
Are you testing it in an intranet or external hosting?
if on intranet, try your website like http://yoursite and not like http://yoursite/someapp

Sessions are dropped by IE and FF and recreated for each request.

Add some P3P Cookie settings like
header("P3P: CP=NOI CURa OUR NOR UNI");

Let us know the progress.
__________________

Please login or register to view this content. Registration is FREE
(Active since 2003) |
Please login or register to view this content. Registration is FREE
vivekar is offline
Reply With Quote
View Public Profile Visit vivekar's homepage!
 
Old 01-18-2005, 04:04 PM
log2's Avatar
Skilled Talker

Posts: 80
Trades: 0
where would I add that header("P3P: CP=NOI CURa OUR NOR UNI");??? and I have a session file so i never have to type all that start $_session out, I hate typing that!!!!
log2 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Slight Problem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23132 seconds with 12 queries