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
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
Share on other sites

concatenations? >.> Im not seeing it lol. No offense i asked for help to find why this is stopping my script from running...the way i code i have my own reason for :) Its driving me crazy...i've been through the code for the past few hours and still can't figure it out

Link to comment
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.