Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
0 user currently in Programming. | 3 guests
Acmlm's Board - I2 Archive - Programming - Wierdest PHP error I've seen @_@ | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
windwaker

Ball and Chain Trooper
WHY ALL THE MAYONNAISE HATE
Level: 61

Posts: 581/1797
EXP: 1860597
For next: 15999

Since: 03-15-04

Since last post: 4 days
Last activity: 6 days
Posted on 12-11-04 07:55 AM Link | Quote
require "layout.php";
echo "$top";

if (!$action) $login = "You are not logged in.
Username:
<form name=\"username\" method=\"post\" action=\"login.php\">
<input type=\"text\" name=\"username\">
<input type=\"hidden\" name=\"action\" value=\"login\">
Password:<br>
<input type=\"password\" name=\"password\">

<input type=\"submit\" value=\"Log in\">

</form>";
if ($action == "login") {
$password = md5($password);
mysql_connect("localhost", "root", "");
mysql_select_db("news_posts");
$sql = mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `password` = '$password' AND `username` = '$username'"),0);
if ($sql != 1) echo "Sorry, your username and password couldn't be found in our database";
if ($sql == 1) {
setcookie("username", $username, time()+259200);
setcookie("password", $password, time()+259200);
$login = "Cookie set successfully!";
}
echo "$login";
echo "$end";

This has the oddest error I've seen.

Parse error : syntax error, unexpected $end in C:\apachefriends\xampp\htdocs\login.php on line 26
, is there anything wrong with my code?


(edited by windwaker on 12-10-04 10:55 PM)
(edited by windwaker on 12-10-04 10:57 PM)
SyntaxLegend

Double metal axe
Level: 25

Posts: 121/222
EXP: 78264
For next: 11356

Since: 04-21-04
From: Australia

Since last post: 20 days
Last activity: 10 hours
Posted on 12-11-04 09:18 AM Link | Quote
first off echo top shouldnt be up there
you can echo variables without the quotes eg echo $top."Hello".$bottom;
windwaker

Ball and Chain Trooper
WHY ALL THE MAYONNAISE HATE
Level: 61

Posts: 589/1797
EXP: 1860597
For next: 15999

Since: 03-15-04

Since last post: 4 days
Last activity: 6 days
Posted on 12-11-04 09:57 AM Link | Quote
Well, here's what I have now:
-- all of the previous code --
echo $top ."<font color=#CCCCCC>". $login ."</font> ". $end;

It still echoes the same error .


(edited by windwaker on 12-11-04 12:57 AM)
neotransotaku

Baby Mario
戻れたら、
誰も気が付く
Level: 87

Posts: 1854/4016
EXP: 6220548
For next: 172226

Since: 03-15-04
From: Outside of Time/Space

Since last post: 11 hours
Last activity: 1 hour
Posted on 12-11-04 10:27 AM Link | Quote
it's because you are missing one more close brace...i suggest in the future to indent your code appropriately...
Gavin

Fuzzy
Rhinoceruses don't play games. They fucking charge your ass.
Level: 43

Posts: 337/799
EXP: 551711
For next: 13335

Since: 03-15-04
From: IL, USA

Since last post: 13 hours
Last activity: 13 hours
Posted on 12-11-04 11:38 AM Link | Quote
Originally posted by windwaker
Well, here's what I have now:
-- all of the previous code --
echo $top ."<font color=#CCCCCC>". $login ."</font> ". $end;

It still echoes the same error .


syntax errors i can understand... but using a < font > tag is just disgustingly reprehensible :_;. take, for instance, all of the disgusting Acmlmboard code. chalk full of terrible non-standardized code that makes you want to vomit.

don't go down that alleyway WW. alleyways lead to rape. rape isn't good
Black Lord

Level: 34

Posts: 107/453
EXP: 235639
For next: 18012

Since: 03-15-04
From: Nebraska, what's a Nebraska

Since last post: 8 days
Last activity: 1 day
Posted on 12-11-04 06:31 PM Link | Quote
Originally posted by Gavin
Originally posted by windwaker
Well, here's what I have now:
-- all of the previous code --
echo $top ."<font color=#CCCCCC>". $login ."</font> ". $end;

It still echoes the same error .


syntax errors i can understand... but using a < font > tag is just disgustingly reprehensible :_;. take, for instance, all of the disgusting Acmlmboard code. chalk full of terrible non-standardized code that makes you want to vomit.

don't go down that alleyway WW. alleyways lead to rape. rape isn't good


But you can't rape the willing Gavin...

As neotransotaku said you have two open braces to your one close brace...
neotransotaku

Baby Mario
戻れたら、
誰も気が付く
Level: 87

Posts: 1855/4016
EXP: 6220548
For next: 172226

Since: 03-15-04
From: Outside of Time/Space

Since last post: 11 hours
Last activity: 1 hour
Posted on 12-11-04 08:57 PM Link | Quote
Originally posted by Gavin
syntax errors i can understand... but using a < font > tag is just disgustingly reprehensible :_;. take, for instance, all of the disgusting Acmlmboard code. chalk full of terrible non-standardized code that makes you want to vomit


How is using <font> non-standardized? Just because it is depreciated doesn't make it non-standard... not unless you are pushing for CSS to be used... then I can see how using such formatting tags can lead to inconsistencies...
Gavin

Fuzzy
Rhinoceruses don't play games. They fucking charge your ass.
Level: 43

Posts: 338/799
EXP: 551711
For next: 13335

Since: 03-15-04
From: IL, USA

Since last post: 13 hours
Last activity: 13 hours
Posted on 12-12-04 01:10 AM Link | Quote
Originally posted by neotransotaku
Originally posted by Gavin
syntax errors i can understand... but using a < font > tag is just disgustingly reprehensible :_;. take, for instance, all of the disgusting Acmlmboard code. chalk full of terrible non-standardized code that makes you want to vomit


How is using non-standardized? Just because it is depreciated doesn't make it non-standard... not unless you are pushing for CSS to be used... then I can see how using such formatting tags can lead to inconsistencies...


what? you didnt jump on the new wave of internet savyness and declare war against all deprecated and non-standard web code?

you rebel you
windwaker

Ball and Chain Trooper
WHY ALL THE MAYONNAISE HATE
Level: 61

Posts: 590/1797
EXP: 1860597
For next: 15999

Since: 03-15-04

Since last post: 4 days
Last activity: 6 days
Posted on 12-12-04 05:05 AM Link | Quote
Lol.

Okay, then how do I add a CSS font color?

And while I'm asking questions, whenever I do anything in PHP related to cookies, "?" appears on the page .
Gavin

Fuzzy
Rhinoceruses don't play games. They fucking charge your ass.
Level: 43

Posts: 340/799
EXP: 551711
For next: 13335

Since: 03-15-04
From: IL, USA

Since last post: 13 hours
Last activity: 13 hours
Posted on 12-12-04 05:48 AM Link | Quote
well, what does your code look like? keep in mind that cookies are part of the header information of a page so they have to be set before any html.

CSS font


(edited by Gavin on 12-11-04 08:53 PM)
windwaker

Ball and Chain Trooper
WHY ALL THE MAYONNAISE HATE
Level: 61

Posts: 593/1797
EXP: 1860597
For next: 15999

Since: 03-15-04

Since last post: 4 days
Last activity: 6 days
Posted on 12-12-04 06:16 AM Link | Quote
D'oh , I forgot about that.

Now, my code is. . .

require "layout.php";

Then I go down to say "if !action, login form appears in $login, if action = login, set some cookies, $login equals 'cookie set', then at the bottom: echo $top.$login".

In layout.php, I have:

require "function.php";
*if $user = asdf $loggedin = "you are logged in * else *$loggedin = you aren't logged in*
$top = "
$loggedin";

Aaaand in function.php, I have:

$user = $_COOKIE['username'];
$pass = $_COOKIE['password'];

Pardon my crappy immitation code, I'm just lazy.

Edit: nevermind, like Gav said, I was evidently requesting cookie info after the the html started.


(edited by windwaker on 12-11-04 09:44 PM)
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
Acmlm's Board - I2 Archive - Programming - Wierdest PHP error I've seen @_@ | |


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.009 seconds.