Jump to content

[SOLVED] Help please


Archadian

Recommended Posts

can anyone see why its making the index.php show up white in IE?

 


if (isset($_COOKIE['user']) {

include('include/dbcon.inc');	

$uname = $_COOKIE['user'];

$sql = mysql_query("SELECT uname FROM users WHERE uname = '$uname'") or die("Could not get the username from the DB.");
$name = mysql_fetch_array($sql);

echo "<table class=\"login\" align=\"center\" valign=\"middle\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\" height=\"35\">";
echo "<tr>";
echo "<td align=\"left\" width=\"50%\" height=\"35\">Welcome " . ucfirst($name) . "! </td>";
echo "<td align=\"left\" width=\"50%\" height=\"35\"><a href=\"" $_SERVER['PHP_SELF'] . "?action=logout\">Logout</a></td>";
echo "</tr>";
echo "</table>";

}
else {

echo "<table class=\"login\" align=\"center\" valign=\"middle\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\" height=\"35\">";
echo "<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"POST\">";
echo "<tr>";
echo "<td align=\"left\" width=\"25%\" height=\"35\">Username:  </td>";
echo "<td align=\"left\" width=\"25%\" height=\"35\"><input type=\"text\" name=\"uname\" size=\"10\"></td>";
echo "<td align=\"left\" width=\"25%\" height=\"35\">Password:  </td>";
echo "<td align=\"left\" width=\"25%\" height=\"35\"><input type=\"password\" name=\"pass\" size=\"10\"></td>";
echo "</tr>";
echo "</form>";
echo "</table>";

}

 

I've stared at this for 20 minutes and can't find it...Thanks

Link to comment
https://forums.phpfreaks.com/topic/40960-solved-help-please/
Share on other sites

From the script, you've missed the end brace on the first line.

  You've also got missing concatenations in line 10. I'd advice you look at the error logs. Also you'd save yourself a lot of work if you work more within the html rather than have the php generate the html.

 

Don't echo the whole line, just insert <td> <?php ucfirst($name); ?> </td>

Link to comment
https://forums.phpfreaks.com/topic/40960-solved-help-please/#findComment-198376
Share on other sites

yes i was missing the ., can't believe i missed that i looked at that over and over lol

 

here is the code now:

 


if (isset($_COOKIE['user'])) {

include('include/dbcon.inc');

if (isset($_COOKIE['user'])) {	

$uname = $_COOKIE['user'];

$sql = mysql_query("SELECT uname FROM users WHERE uname = '$uname'") or die("Could not get the username from the DB.");
$name = mysql_fetch_array($sql);

echo "<table class=\"logform\" align=\"center\" valign=\"middle\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\" height=\"35\">";
echo "<tr>";
echo "<td align=\"left\" width=\"50%\" height=\"35\">Welcome " . ucfirst($name) . "! </td>";
echo "<td align=\"left\" width=\"50%\" height=\"35\"><a href=\"" . $_SERVER['PHP_SELF'] . "?action=logout\">Logout</a></td>";
echo "</tr>";
echo "</table>";

}

else {

echo "<table class=\"logform\" align=\"center\" valign=\"middle\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\" height=\"35\">";
echo "<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"POST\">";
echo "<tr>";
echo "<td align=\"left\" width=\"25%\" height=\"35\">Username:  </td>";
echo "<td align=\"left\" width=\"25%\" height=\"35\"><input type=\"text\" name=\"uname\" size=\"10\"></td>";
echo "<td align=\"left\" width=\"25%\" height=\"35\">Password:  </td>";
echo "<td align=\"left\" width=\"25%\" height=\"35\"><input type=\"password\" name=\"pass\" size=\"10\"></td>";
echo "</tr>";
echo "</form>";
echo "</table>";

}

 

its still stopping the script :(

Link to comment
https://forums.phpfreaks.com/topic/40960-solved-help-please/#findComment-198389
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.