Jump to content


Photo

nothing


  • Please log in to reply
7 replies to this topic

#1 BillyBoB

BillyBoB
  • Members
  • PipPipPip
  • Advanced Member
  • 630 posts

Posted 13 July 2006 - 07:39 PM

nothing

#2 akitchin

akitchin
  • Staff Alumni
  • Advanced Member
  • 2,516 posts
  • LocationCalgary, AB, Canada

Posted 13 July 2006 - 07:44 PM

is it so hard for people on these forums to at least glance at the pinned topics first?

http://www.phpfreaks...ic,37442.0.html

see that topic for your answer.

#3 BillyBoB

BillyBoB
  • Members
  • PipPipPip
  • Advanced Member
  • 630 posts

Posted 13 July 2006 - 07:52 PM

then why does it still happen after i followed that

#4 akitchin

akitchin
  • Staff Alumni
  • Advanced Member
  • 2,516 posts
  • LocationCalgary, AB, Canada

Posted 13 July 2006 - 07:54 PM

well it's hard to say, since you've edited your post to remove everything, but i'd guess that you've still got output happening before you run setcookie().  what does the page look like up to and including those lines?

#5 BillyBoB

BillyBoB
  • Members
  • PipPipPip
  • Advanced Member
  • 630 posts

Posted 13 July 2006 - 07:56 PM

in the post that u sent me to said it i had to send output to put ob_start(); at the top and i did

#6 BillyBoB

BillyBoB
  • Members
  • PipPipPip
  • Advanced Member
  • 630 posts

Posted 13 July 2006 - 07:57 PM


<?php
ob_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
ob_start();
include("config.php");

if (!$logged[username])
{
if(!$_POST[login])
{
echo("
<center>
<form method=\"POST\">
Username:<br />
<input type=\"text\" size=\"15\" maxlength=\"50\" name=\"username\"><br />
Password:<br />
<input type=\"password\" size\"15\" maxlength=\"50\" name=\"password\"><br />
<input type=\"submit\" name=\"login\" value=\"Login\"><br />
<br />
Not a member yet?<br />
<a href=\"register.php\">Register</a><br />
<a href=\"lostpass.php\">Lost Pass?</a>
</form>
</center>
");
}
if($_POST[login])
{
$username=$_POST['username'];
$password = md5($_POST[password]);

$info = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error());
$data = mysql_fetch_array($info);
if($data[password] != $password) {
echo("Wrong password or username!");
}else{
$query = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error());
$user = mysql_fetch_array($query);
ob_flush();
setcookie("id", $user[id],time()+(60*60*24*5), "/", "");
setcookie("pass", $user[password],time()+(60*60*24*5), "/", "");
ob_flush();
echo ("<meta http-equiv=\"Refresh\" content=\"0; URL=http://dreamshowstudios.net\"/>Thank You! You will be redirected");
}
}
}else{
echo("
<center>Welcome <b>$logged[username]</b>!<br />
- <a href=\"editprofile.php\">Edit Profile</a><br />
- <a href=\"members.php\">Member List</a><br />
- <a href=\"logout.php\">Logout</a>
</center>
");
if($user[rank]>=4) {

if($user[rank]==5) {
echo("
<center>
Hello, Admin<br />
- <a href=\"postnews.php\">Post News</a>
</center>
");
}else{
echo("
<center>
Hello, Moderator<br />
- <a href=\"postnews.php\">Post News</a>
</center>
");
}
}
}
?>


#7 akitchin

akitchin
  • Staff Alumni
  • Advanced Member
  • 2,516 posts
  • LocationCalgary, AB, Canada

Posted 13 July 2006 - 08:02 PM

my post was suggesting using output buffering, of which one of the functions is ob_start().  have a look in the manual if you want to go that route.  very few issues are solvable simply by adding one function, a little reading is always involved.

to fix it, REMOVE OUTPUT BEFORE setcookie().  that was the simpler solution, and the solution first mentioned.  move your <DOCTYPE> output to below where you process the login, and specifically, where you use setcookie().  this may require a restructure of your code (so that you manage to get the DOCTYPE out before you echo anything) such as putting any errors into a variable first and echoing it later, but you've gotta give a little to get anything.

#8 BillyBoB

BillyBoB
  • Members
  • PipPipPip
  • Advanced Member
  • 630 posts

Posted 13 July 2006 - 08:04 PM

i gots it it was in the index had to be fixed




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users