Loathorhealer
-
Posts
4 -
Joined
-
Last visited
Never
Posts posted by Loathorhealer
-
-
[code] if ($logged_in == 1) {
echo 'welcome back '.$_SESSION['username'].'';
$query = sprintf("SELECT firstname, lastname FROM users WHERE ("$logged_in == 1")");
$result = mysql_query($query);
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}
while ($row = mysql_fetch_field($result)) {
echo $row['firstname'];
echo $row['lastname'];
}
mysql_free_result($result);[/code]
okay. I get this error
[code]Parse error: syntax error, unexpected T_VARIABLE in /home/.navy/loathor/squaresyndicate.com/welcome.php on line 13[/code]
and I know its becuase of the $logged_in <-- deal. but I need it to display the firstname and the lastname of the person Just logged in. can you help?
-
[!--quoteo(post=357181:date=Mar 21 2006, 09:24 PM:name=hitman6003)--][div class=\'quotetop\']QUOTE(hitman6003 @ Mar 21 2006, 09:24 PM) [snapback]357181[/snapback][/div][div class=\'quotemain\'][!--quotec--]
The easiest thing to do is to make session_start() the first command intrepreted by php. If anything has been sent to the browser before session_start() has been called, it will fail.
Move session_start() to the top...make it the first include and at the top of that include, then it should work.
[/quote]
LOL you can call me retarted. I had a space in my welcome.php <-- first line and thats what screwed it up. Thanks a bunch. But before I go. I was wondering if you could help me really quick. I want a profile page. somewhat close to Myspace. I was wondering if you could maybe point me in the right direction?
I can write how the person can view it. BUT I need scripts to how it updates the database. Im not entirely sure how I can do that. -
Okay. so I have these files.
Header.php and Welcome.php <--
the header .php file contains.
[code]
<?php
require_once 'databaseinfofile.php';
?>
<html>
<head>
<title> Torque - Your Sports Cars Headquarters</title>
</head>
<link rel="stylesheet" href="tor.css">
<table cellpadding="0" cellspacing="0" width="1000" align="center">
<?php
print("<tr><td align=\"center\">");
print("<img src=\"images\banner.jpg\" align=\"center\" style=\"border:1px solid #868686\">");
print ("</td></tr>");
print("<tr><td class=\"thead\" width=\"1000\" height=\"29\" style=\"border-bottom:1px solid #868686\" style=\"border-right:1px solid #868686\" style=\"border-left: 1px solid #868686\">");
print("<table align=\"right\" width=\"1000\" height=\"29\" cellpadding=\"0\" cellspacing=\"1\"><tr>");
print("<td width=\"700\">");
if ($logged_in == 1) {
print("<a href=\"welcome.php?page=user_profile\"><img src=\"images\usercp.jpg\" border=\"0\"></a> <img src=\"images\memberlist.jpg\">");
} else {
echo 'Register';
}
print("</td><td class=\"contenthead\" width=\"300\" align=\"right\">");
if ($logged_in == 1) {
echo 'Logged in as '.$_SESSION['username'].', <a href="logout.php">logout</a>';
} else {
echo 'Not logged in. <a href="login.php">Login</a>';
}
print ("</td></tr></table>");
?>
</table>
[/code]
and then. The Welcome has
[code]
<?php
require_once 'header.php';
print ("</td></tr></table>");
if ($logged_in == 1) {
echo 'welcome back '.$_SESSION['username'].'';
} else {
print ("
<h1>Login</h1>
<form action=\"login_functions.php\" method=\"post\">
<table align=\"center\" border=\"1\" cellspacing=\"0\" cellpadding=\"3\">
<tr><td>Username:</td><td>
<input type=\"text\" name=\"uname\" maxlength=\"40\">
</td></tr>
<tr><td>Password:</td><td>
<input type=\"password\" name=\"passwd\" maxlength=\"50\">
</td></tr>
<tr><td colspan=\"2\" align=\"right\">
<input type=\"submit\" name=\"submit\" value=\"Login\">
</td></tr>
</table>
</form>
</body>
</html>");
}
?>
[/code]
okay. and then at the top of my page..I get these errors:
[code]
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/.navy/loathor/squaresyndicate.com/welcome.php:2) in /home/.navy/loathor/squaresyndicate.com/check_login.php on line 5[/code]
and what It does, is it registers the session on another page called Login_functions <-- and I dont understand why Im getting that error. :-/
Forum
in PHP Coding Help
Posted
Im looking for a Forum Tutorial. Im pretty good at PHP but I just need a start.
does anyone know where I can get one. you dont have to post it.. you can just PM me about it. But I would really apprecite it.
Also I searched the forums for a Thread already about this.. But I didnt find one. If I did miss it. if you could direct me toward it.