Jump to content

Session help


marcus

Recommended Posts

I'm just making a login for my friend using sessions, but I can't seem to get the sessions to register

[code]
<?php ob_start();
<?php
session_start();


  $sql = "SELECT * FROM account
          WHERE name='$_POST[name]'
          AND pass='$_POST[pass]'";

  $result = mysql_query($sql);
  $num = mysql_num_rows($result);
  if ($num > 0) {
    $id = mysql_fetch_assoc($result);    // ### USER AND PASSWORD ARE CORRECT



    $_SESSION[auth] = "yes";
    $_SESSION[name] = "$_POST[name]";
    $_SESSION[id] = "$id[id]";

    header("Location: ?content=news");

  }else{                                          // ### USER OR PASSWORD IS INCORRECT
    header("Location: ?content=failed");
  }

?>
<?php ob_end_flush(); ?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/29043-session-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.