marcus Posted November 30, 2006 Share Posted November 30, 2006 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();<?phpsession_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] Quote Link to comment Share on other sites More sharing options...
piznac Posted December 1, 2006 Share Posted December 1, 2006 Why do you have the <?php tags twice?[code]<?php ob_start();<?phpsession_start();[/code]try just this:[code]<?php ob_start();session_start();[/code]or close the other one out like this:[code]<?php ob_start(); ?><?phpsession_start();[/code] Quote Link to comment Share on other sites More sharing options...
marcus Posted December 1, 2006 Author Share Posted December 1, 2006 That didn't change anything :) Quote Link to comment Share on other sites More sharing options...
piznac Posted December 1, 2006 Share Posted December 1, 2006 Ok well that was my shot in the dark :) Quote Link to comment Share on other sites More sharing options...
marcus Posted December 1, 2006 Author Share Posted December 1, 2006 I fixed that error, haha. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.