Jump to content

dapidmini

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

dapidmini's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. but don't session expires every time I close the browser?
  2. I have a login.php that has a usual login form with a username and password textbox and a login button that redirects to index.php. when I login and go to the index.php, the welcome sign is on but after I click on a link that points to index.php itself, the "welcome, <myname>" sign is replaced with "sign in" again (the cookie disappears) even though I put a checking on top of the index.php page.. here's my code in index.php: <?php if ($_COOKIE['activeuser'] != '#') { } else { setcookie('activeuser','#',time()+60*100); } include('connect.php'); //this code connects to my database if (isset($_POST['bLogin'])) { $sql = 'SELECT * FROM user WHERE username = "'.$_POST['tfUsername'].'"'; $sql .= ' AND password = "'.$_POST['tfPassword'].'"'; $result = mysql_query($sql,$con); if($result) { $row = mysql_fetch_array($result); $_COOKIE['activeuser'] = $row['name']; } else { echo 'query error'; } } if ($_COOKIE['useraktif'] != '#') { echo '<div id="welcome">Welcome, ' . $_COOKIE['activeuser']; echo '<br/><a href="logout.php">Logout</a></div>'; } else { echo '<div class="signIn"><a href="login.php">sign in</a></div>'; echo '<div class="signIn"><a href="#">Register</a></div>'; }
×
×
  • 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.