Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-14-2003, 11:58 PM   PM User | #1
stoodder
Regular Coder

 
Join Date: Oct 2002
Location: Milwaukee, Wisconsin
Posts: 123
Thanks: 1
Thanked 0 Times in 0 Posts
stoodder is an unknown quantity at this point
Unhappy Arg whats Wrong With Meh Code???

okay guys ive made a use register for my saite it seemed to work perfectly i mean i got it to set the database and what not but now when they loggin i getthe stupid parse error!!!
heres the page if you need it: http://www.shadowgelert.com/myweb6
here is the login pages html
Code:
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<?php $title = "Members Login"; ?>
</head>
<body>
<form method="post" action="?page=login2">
Enter your User Name <input type="text" name="Name" size="20"><br>
Enter you Password <input type="password" name="Password" size="20"><br>
<input type="submit" name="submit">
</form>
</body>
</html>
heres the code for the page after you would hit the loggin button
Code:
<?php 
$title = "Logged In";
include("common.php"); 

if(!($link_id = mysql_connect($Host, $User, $Pass))) die(mysql_erorr()); 
mysql_select_db($DB); 

$sql = "SELECT ID FROM " . $Table . " WHERE Name='" . addslashes($_POST['Name']) . "' AND Password='" . md5($_POST['Password']) . "' LIMIT 1"; 
if(!($result = mysql_query($sql))) die(mysql_error()); 

if(mysql_num_rows($result) == 1) {
    setcookie("LoggedIn, TRUE, time()+(3600 * 24)); 
    echo"You Are Now Logged In"; 
} else { 
    echo"Login failure"; 
} 
?>
I need help please
stoodder is offline   Reply With Quote
Old 03-15-2003, 01:40 AM   PM User | #2
Spookster
Supreme Overlord


 
Spookster's Avatar
 
Join Date: May 2002
Location: Marion, IA USA
Posts: 6,220
Thanks: 4
Thanked 80 Times in 79 Posts
Spookster will become famous soon enough
Uhhhh so what's the parse error when logging in?
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster
Who gave you that Ugging infraction? Yeah that's right it was me!
Spookster is offline   Reply With Quote
Old 03-15-2003, 02:02 AM   PM User | #3
stoodder
Regular Coder

 
Join Date: Oct 2002
Location: Milwaukee, Wisconsin
Posts: 123
Thanks: 1
Thanked 0 Times in 0 Posts
stoodder is an unknown quantity at this point
well i figuered out part of it
setcookie("LoggedIn, TRUE, time()+(3600 * 24)); was suppoesed to be
setcookie('LoggedIn', 'TRUE', time()+(3600 * 24));

but i still get this new error:
Warning: Cannot add header information - headers already sent by (output started at /home/stoodder/public_html/myweb6/index.php:8) in /home/stoodder/public_html/myweb6/login2.php on line 13
stoodder is offline   Reply With Quote
Old 03-15-2003, 02:22 AM   PM User | #4
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
You need to set the cookies before anything is sent to the browser, and as you didn't inlcude the source for common.php, I assume you send some html to the browser with that.
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 03-15-2003, 02:26 AM   PM User | #5
stoodder
Regular Coder

 
Join Date: Oct 2002
Location: Milwaukee, Wisconsin
Posts: 123
Thanks: 1
Thanked 0 Times in 0 Posts
stoodder is an unknown quantity at this point
hmm uh i dont really get what your saying sory./.. buit common .php has my database info in it thats all. otherwise i use index,php as my template file then i have ?page=whatever page to include into index.php im not sure if that is what you meant though please word that better.. sorry im slow lol
stoodder is offline   Reply With Quote
Old 03-15-2003, 02:32 AM   PM User | #6
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
From what I understand, that error means that whatever you're trying to send to the client already exists, or that you're trying to set cookies/sessions after html has been sent, ie:

<html>
<head>
<title>page</title>
</head>
<body>
<?
setcookie("LoggedIn, TRUE, time()+(3600 * 24));
echo 'blah blah';
?>
</body>
</html>
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 03-15-2003, 03:18 AM   PM User | #7
stoodder
Regular Coder

 
Join Date: Oct 2002
Location: Milwaukee, Wisconsin
Posts: 123
Thanks: 1
Thanked 0 Times in 0 Posts
stoodder is an unknown quantity at this point
hey thanx man i got it now
stoodder is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 01:03 PM.


Advertisement
Log in to turn off these ads.