Onbekend |
|
Beste mensen, ben bezig met een simpel message systeem, oftewel een shoutbox kan je ook wel zeggen misschien.
Mijn code zo ver:
<?
// we will now check if the user has logged in and if the cookie is not expired
// if so the user will have to log in again and try again to visit this page
$log_user = $_COOKIE['Reignvanadiel'];
// connecting to the database
$database = "gathering-tech-nl";
$server = "sql04.backbone.tiscomhosting.nl";
$user = "";
$wachtwoord ="";
mysql_connect("$server","$user", "$wachtwoord") or die(mysql_error());
mysql_select_db("$database") or die(mysql_error());
$query = mysql_query("SELECT * FROM members WHERE user_name = '".$log_user."' ") or die(mysql_error());
$num_row = mysql_num_rows($query);
if ($num_row > 0)
{
?>
<html>
<head>
<title>Reign of Vana'diel</title>
<META Name="description" Content="Final Fantasy XI online Linkshell community">
<META Name="keywords" Content="FFXI, Final Fantasy, Reign of vana'diel, RoVD, Linkshell">
<META NAME="robots" CONTENT="all">
<META NAME="language" CONTENT="EN">
<META NAME="revisit-after" CONTENT="30 days">
<META NAME="author" CONTENT="Burning Hardware">
<LINK REL="SHORTCUT ICON" HREF="FFXI.ico">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table id="Table_01" width="1025" height="768" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="5">
<img src="images/english_index_01.gif" width="1024" height="254" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="254" alt=""></td>
</tr>
<tr>
<td rowspan="3">
<img src="images/english_index_02.gif" width="26" height="514" alt=""></td>
<td background="images/english_index_03.gif" width="110" height="505" alt=""></td>
<td rowspan="3">
<img src="images/english_index_04.gif" width="15" height="514" alt=""></td>
<td width="835" height="506" rowspan="2" align="left" valign="top" background="images/english_index_05.gif" alt=""><div align="center">
<a href="write_message.php" style="text-decoration: none; color: black;"><font color="#336666" size="1" face="Visitor -BRK-">write
message</font></a>
<?
// displaying all posts the users made in the last specified time
$query = "SELECT * FROM posting ORDER BY id DESC";
print "<table><tr><td></td><td>subject</td><td>date</td>";
$execute = mysql_query($query) or die(mysql_query());
while ($get = mysql_fetch_object($execute))
// get the users chosen picture for his profile
{
print "<tr><td>$picture</td><td>$get->post_subject</td><td>$get->post_text</td></tr>";
}
print "</table>";
?>
</div></td>
<td rowspan="3">
<img src="images/english_index_06.gif" width="38" height="514" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="505" alt=""></td>
</tr>
<tr>
<td rowspan="2">
<img src="images/english_index_07.gif" width="110" height="9" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr>
<td>
<img src="images/english_index_08.gif" width="835" height="8" alt=""></td>
<td>
<img src="images/spacer.gif" width="1" height="8" alt=""></td>
</tr>
</table>
</body>
</html>
<?
}
else
{
print "please log in and try again, you are not authoriced to view this page without logging in";
}
?>
<? // we will now check if the user has logged in and if the cookie is not expired // if so the user will have to log in again and try again to visit this page $log_user = $_COOKIE['Reignvanadiel']; // connecting to the database $database = "gathering-tech-nl"; $server = "sql04.backbone.tiscomhosting.nl"; $user = ""; $wachtwoord =""; if ($num_row > 0) { ?> <html> <head> <title>Reign of Vana'diel</title> <META Name="description" Content="Final Fantasy XI online Linkshell community"> <META Name="keywords" Content="FFXI, Final Fantasy, Reign of vana'diel, RoVD, Linkshell"> <META NAME="robots" CONTENT="all"> <META NAME="language" CONTENT="EN"> <META NAME="revisit-after" CONTENT="30 days"> <META NAME="author" CONTENT="Burning Hardware"> <LINK REL="SHORTCUT ICON" HREF="FFXI.ico"> </head> <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <table id="Table_01" width="1025" height="768" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="5"> <img src="images/english_index_01.gif" width="1024" height="254" alt=""></td> <td> <img src="images/spacer.gif" width="1" height="254" alt=""></td> </tr> <tr> <td rowspan="3"> <img src="images/english_index_02.gif" width="26" height="514" alt=""></td> <td background="images/english_index_03.gif" width="110" height="505" alt=""></td> <td rowspan="3"> <img src="images/english_index_04.gif" width="15" height="514" alt=""></td> <td width="835" height="506" rowspan="2" align="left" valign="top" background="images/english_index_05.gif" alt=""><div align="center"> <a href="write_message.php" style="text-decoration: none; color: black;"><font color="#336666" size="1" face="Visitor -BRK-">write message</font></a> <? // displaying all posts the users made in the last specified time $query = "SELECT * FROM posting ORDER BY id DESC"; print "<table><tr><td></td><td>subject</td><td>date</td>"; // get the users chosen picture for his profile { print "<tr><td>$picture</td><td>$get->post_subject</td><td>$get->post_text</td></tr>"; } ?> </div></td> <td rowspan="3"> <img src="images/english_index_06.gif" width="38" height="514" alt=""></td> <td> <img src="images/spacer.gif" width="1" height="505" alt=""></td> </tr> <tr> <td rowspan="2"> <img src="images/english_index_07.gif" width="110" height="9" alt=""></td> <td> <img src="images/spacer.gif" width="1" height="1" alt=""></td> </tr> <tr> <td> <img src="images/english_index_08.gif" width="835" height="8" alt=""></td> <td> <img src="images/spacer.gif" width="1" height="8" alt=""></td> </tr> </table> </body> </html> <? } else { print "please log in and try again, you are not authoriced to view this page without logging in"; } ?>
Zoals je ziet word de post weergegeven hier van de gebruiker.
Ik wil nu dat ook een plaatje wordt weergegeven.
Deze zit opgeslagen in de SQL Database.
Bij het maken van een account kies je bijvoorbeeld 'Whitemage'.
Dit staat dus bij jouw account ook in de SQL opgeslagen.
Wat ik nu wil is zoiets van
de username (in de cookie dus) komt overeen met ..... character, in dit geval whitemage dus, dan weergeeft hij dat plaatje.
hoe kan ik dit nu het makkelijkst doen? heb div. dingen geprobeert maar kom er niet helemaal uit
anyone een idee?
|