PDA

View Full Version : [PHP] Unexpected $end



Luke
07-09-2008, 06:25 PM
Hi

I've ot this, and i;m trying to use it, but it says unexpected $end on line 251
And since i suck at php i can't seem to fix it.

I understand how unsecure it is, it's just for temporery measures to seehow the site works with it ;)


<?php
ob_start();
// Include the config file
include ("config.php");
switch ($_GET[mode]) {

// Display the Search form
default:
echo "
Search for a member:
<form action=\"find.php?mode=search\" method=\"post\">
<input name=\"name\" type=\"text\" width=\"200\">
<input name=\"find\" type=\"submit\" value=\"Find\" width=\"100\">
</form><b>---------------------------------------</b>
";
break;

// Once the form is finished it will post information here
case 'search';

// Find out what the submited name was
$name = $_POST['name'];

// Check to see if there we found anything
$getuser = mysql_query("SELECT * FROM `users` WHERE username = '$name'");
$usernum = mysql_num_rows($getuser);

// If we didn't...
if ($usernum == 0) {
echo ("User Not Found");

// If we did...
} else {
echo "<strong>Found:</strong><br><br>";

// Find out all the users information
$query = mysql_query("SELECT * FROM `users` WHERE username = '$name'");
$profile = mysql_fetch_array($query);

// Show a little information about them
echo ("
<center><b><span class=\"$profile[level]\">$profile[username]</span>'s Profile:</b> - (<a href='friends.php?action=ask&mate=$profile[username]'>Ask to be friend</a>)<br /><br /></center>
<img src=\"$profile[picture]\" align=\"left\"><b>MSN Messenger:</b> $profile[msn]<br />
<b>AIM Messebger:</b> $profile[aim]<br />
<b>Age:</b> $profile[location]<br />
<b>School/College:</b> <a href=\"$profile[homepage]\" target=\"_blank\">$profile[homepage]</a><br>
<b>Favourite Aircraft:</b> $profile[habboname]<br />
<b>Favourite Camp:</b> $profile[hotels]<br /><br />
<p><b><u>Rank:</u></b></p> ");
}
break;
}

switch($_GET[go])
{
default:
if (!$_GET[user]){
if(!isset($_GET['page'])){
$page = 1;
} else {
$page = $_GET['page'];
}
$max_results = "15"; // Change to how many member you would like to display per page
$from = (($page * $max_results) - $max_results);
$getuser = mysql_query("SELECT * FROM users ORDER BY id ASC LIMIT $from, $max_results");
while ($user = mysql_fetch_array($getuser)){
// gets all the users information.
echo ("<table border=\"0\" width=\"318\" height=\"25\">
<tr width=\"100%\">
<td width=\"318\" height=\"100%\" background=\"images/bgmems.gif\">&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"members.php?user=$user[username]\"><span class=\"$user[level]\"><b>$user[username]</b></span></a></td>
</tr>
");
// links to a page to view the user's profile.
}
echo "</table>Go to page: ";
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM users"),0);
$total_pages = ceil($total_results / $max_results);
for($i = 1; $i <= $total_pages; $i++){
if(($page) == $i){
echo "$i ";
} else {
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\" title=\"Go to page $i\">$i</a> ";
}
}
} else {
$getuser = mysql_query("SELECT * FROM users WHERE username = '$_GET[user]'");
$usernum = mysql_num_rows($getuser);
if ($usernum == 0){
echo ("User Not Found");
} else {
$profile = mysql_fetch_array($getuser);
echo ("<br><table width='20%' border='0' class='contentTable' align='center'><tr class='contentTableHeader'>
<td align='center'>Users Rank</td></tr><tr class='contentTableAltRow'><td align='center'>");
if($profile[display_badge]){
echo("<img src='$profile[display_badge]'>");
}else{
echo("None Set");
}
echo("</td>
</tr></table><br>
<table class='contentTable' width='60%' align='center'>
<tr class='contentTableHeader'>
<td width='100%' colspan='2'><center><b><span class=\"$profile[level]\">$profile[username]</span>'s Profile:</b> - (<a href='friends.php?action=ask&mate=$profile[username]'><span style='color:ffcc00'>Ask to be friend</span></a>)</center></td>
</tr>");
if($profile[level] > 1){
echo(" <tr class=''>
<td width=\"25%\"><b>Full Name</b></td>
<td width=\"75%\">$profile[mission]</td>
</tr>");
}
echo("
<tr class='contentTableAltRow'>
<td width=\"25%\"><b>Age</b></td>
<td width=\"75%\">$profile[location]</td>
</tr>
<tr>
<td width=\"25%\"><b>School/College</b></td>
<td width=\"75%\"><a href=\"$profile[homepage]\" target=\"_blank\">$profile[homepage]</a></td>
</tr>
<tr class='contentTableAltRow'>
<td width=\"25%\"><b>Favourite Aircraft</b></td>
<td width=\"75%\">$profile[habboname]</td>
</tr>
<tr>
<td width=\"25%\"><b>Favourite Camp</b></td>
<td width=\"75%\">$profile[hotels]</td>
</tr>
<tr>
<td width=\"25%\"><b>Date Joined</b></td>
<td width=\"75%\">$profile[fav_food]</td>
</tr>
<tr class='contentTableAltRow'>
<td width=\"25%\"><b>GICS Completed</b></td>
<td width=\"75%\">$profile[best_habbo]</td>
</tr>
<tr>
<td width=\"25%\"><b>AEFS Completed</b></td>
<td width=\"75%\">$profile[occupation]</td>
</tr>
<tr class='contentTableAltRow'>
<td width=\"25%\"><b>Gender</b></td>
<td width=\"75%\">$profile[gender]</td>
</tr>
<tr>
<td width=\"25%\"><b>Guns qualified to shoot</b></td>
<td width=\"75%\">$profile[fav_color]</td>
</tr>

<tr class='footerText'>
<td width=\"100%\" colspan='2'>");
if($logged[level] == 12){
echo("<span class='$logged[level]'><b>Admin:</span></b> <a href='admin/users.php?user=$profile[username]' target='middle'>Edit this User</a><br><span class='$logged[level]'><b>Admin:</span></b> <a href='admin/alertuser.php?user=$profile[username]' target='middle'>Alert User</a>");
}
echo("</td>
</tr>
</table>
<br><br>
}
}
}
}
?>
</p>

Blob
07-09-2008, 06:29 PM
<?php
ob_start();
// Include the config file
include ("config.php");
switch ($_GET[mode]) {

// Display the Search form
default:
echo "
Search for a member:
<form action=\"find.php?mode=search\" method=\"post\">
<input name=\"name\" type=\"text\" width=\"200\">
<input name=\"find\" type=\"submit\" value=\"Find\" width=\"100\">
</form><b>---------------------------------------</b>
";
break;

// Once the form is finished it will post information here
case 'search';

// Find out what the submited name was
$name = $_POST['name'];

// Check to see if there we found anything
$getuser = mysql_query("SELECT * FROM `users` WHERE username = '$name'");
$usernum = mysql_num_rows($getuser);

// If we didn't...
if ($usernum == 0) {
echo ("User Not Found");

// If we did...
} else {
echo "<strong>Found:</strong><br><br>";

// Find out all the users information
$query = mysql_query("SELECT * FROM `users` WHERE username = '$name'");
$profile = mysql_fetch_array($query);

// Show a little information about them
echo ("
<center><b><span class=\"$profile[level]\">$profile[username]</span>'s Profile:</b> - (<a href='friends.php?action=ask&mate=$profile[username]'>Ask to be friend</a>)<br /><br /></center>
<img src=\"$profile[picture]\" align=\"left\"><b>MSN Messenger:</b> $profile[msn]<br />
<b>AIM Messebger:</b> $profile[aim]<br />
<b>Age:</b> $profile[location]<br />
<b>School/College:</b> <a href=\"$profile[homepage]\" target=\"_blank\">$profile[homepage]</a><br>
<b>Favourite Aircraft:</b> $profile[habboname]<br />
<b>Favourite Camp:</b> $profile[hotels]<br /><br />
<p><b><u>Rank:</u></b></p> ");
}
break;
}

switch($_GET[go])
{
default:
if (!$_GET[user]){
if(!isset($_GET['page'])){
$page = 1;
} else {
$page = $_GET['page'];
}
$max_results = "15"; // Change to how many member you would like to display per page
$from = (($page * $max_results) - $max_results);
$getuser = mysql_query("SELECT * FROM users ORDER BY id ASC LIMIT $from, $max_results");
while ($user = mysql_fetch_array($getuser)){
// gets all the users information.
echo ("<table border=\"0\" width=\"318\" height=\"25\">
<tr width=\"100%\">
<td width=\"318\" height=\"100%\" background=\"images/bgmems.gif\">&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"members.php?user=$user[username]\"><span class=\"$user[level]\"><b>$user[username]</b></span></a></td>
</tr>
");
// links to a page to view the user's profile.
}
echo "</table>Go to page: ";
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM users"),0);
$total_pages = ceil($total_results / $max_results);
for($i = 1; $i <= $total_pages; $i++){
if(($page) == $i){
echo "$i ";
} else {
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\" title=\"Go to page $i\">$i</a> ";
}
}
} else {
$getuser = mysql_query("SELECT * FROM users WHERE username = '$_GET[user]'");
$usernum = mysql_num_rows($getuser);
if ($usernum == 0){
echo ("User Not Found");
} else {
$profile = mysql_fetch_array($getuser);
echo ("<br><table width='20%' border='0' class='contentTable' align='center'><tr class='contentTableHeader'>
<td align='center'>Users Rank</td></tr><tr class='contentTableAltRow'><td align='center'>");
if($profile[display_badge]){
echo("<img src='$profile[display_badge]'>");
}else{
echo("None Set");
}
echo("</td>
</tr></table><br>
<table class='contentTable' width='60%' align='center'>
<tr class='contentTableHeader'>
<td width='100%' colspan='2'><center><b><span class=\"$profile[level]\">$profile[username]</span>'s Profile:</b> - (<a href='friends.php?action=ask&mate=$profile[username]'><span style='color:ffcc00'>Ask to be friend</span></a>)</center></td>
</tr>");
if($profile[level] > 1){
echo(" <tr class=''>
<td width=\"25%\"><b>Full Name</b></td>
<td width=\"75%\">$profile[mission]</td>
</tr>");
}
echo("
<tr class='contentTableAltRow'>
<td width=\"25%\"><b>Age</b></td>
<td width=\"75%\">$profile[location]</td>
</tr>
<tr>
<td width=\"25%\"><b>School/College</b></td>
<td width=\"75%\"><a href=\"$profile[homepage]\" target=\"_blank\">$profile[homepage]</a></td>
</tr>
<tr class='contentTableAltRow'>
<td width=\"25%\"><b>Favourite Aircraft</b></td>
<td width=\"75%\">$profile[habboname]</td>
</tr>
<tr>
<td width=\"25%\"><b>Favourite Camp</b></td>
<td width=\"75%\">$profile[hotels]</td>
</tr>
<tr>
<td width=\"25%\"><b>Date Joined</b></td>
<td width=\"75%\">$profile[fav_food]</td>
</tr>
<tr class='contentTableAltRow'>
<td width=\"25%\"><b>GICS Completed</b></td>
<td width=\"75%\">$profile[best_habbo]</td>
</tr>
<tr>
<td width=\"25%\"><b>AEFS Completed</b></td>
<td width=\"75%\">$profile[occupation]</td>
</tr>
<tr class='contentTableAltRow'>
<td width=\"25%\"><b>Gender</b></td>
<td width=\"75%\">$profile[gender]</td>
</tr>
<tr>
<td width=\"25%\"><b>Guns qualified to shoot</b></td>
<td width=\"75%\">$profile[fav_color]</td>
</tr>

<tr class='footerText'>
<td width=\"100%\" colspan='2'>");
if($logged[level] == 12){
echo("<span class='$logged[level]'><b>Admin:</span></b> <a href='admin/users.php?user=$profile[username]' target='middle'>Edit this User</a><br><span class='$logged[level]'><b>Admin:</span></b> <a href='admin/alertuser.php?user=$profile[username]' target='middle'>Alert User</a>");
}
echo("</td>
</tr>
</table>
<br><br>");
}
}
}
}
?>
</p>

Luke
07-09-2008, 06:33 PM
thank you!

i've just noticed the echo :P

thanks
+rep

PS: there was an extra } as well xD

Want to hide these adverts? Register an account for free!