Acmlm's Board - I2 Archive - Programming - Wierdest PHP error I've seen @_@
User | Post |
windwaker
Posts: 593/1797 |
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. |
Gavin
Posts: 340/799 |
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 |
windwaker
Posts: 590/1797 |
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
Posts: 338/799 |
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 |
neotransotaku
Posts: 1855/4016 |
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... |
Black Lord
Posts: 107/453 |
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... |
Gavin
Posts: 337/799 |
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 |
neotransotaku
Posts: 1854/4016 |
it's because you are missing one more close brace...i suggest in the future to indent your code appropriately... |
windwaker
Posts: 589/1797 |
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 .
SyntaxLegend
Posts: 121/222 |
first off echo top shouldnt be up there you can echo variables without the quotes eg echo $top."Hello".$bottom; |
windwaker
Posts: 581/1797 |
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?
| |
|