##Spørgsmålet igen
<?If ($action == \"login\") {
require(\"config.php\");
include(\"users.inc\");
print \"<font face=\\\"arial\\\" size=\\\"2\\\">\\n\";
$status = 1;
If ($row[status] == \"\") {
print \"registere venligst dem selv\";
}
Else {
if ($row[status] == \"1\") { $status_navn = \"Gæst\"; }
elseif ($row[status] == \"2\") { $status_navn = \"Normal\"; }
elseif ($row[status] == \"3\") { $status_navn = \"Superbruger\"; }
elseif ($row[status] == \"4\") { $status_navn = \"CoAdmin\"; }
elseif ($row[status] == \"5\") { $status_navn = \"Admin\"; }
If ($row[status] == 1) { print \"Velkommen!<br>\"; } ?>
Du er nu logget ind med <? print \"$nick og din status er $status_navn\"; ?><br>
Du har følgende muligheder<br>
<form method=\"post\" action=\"<? print\"$PHP_SELF\"; ?>\" target=\"_self\">
<input type=\"hidden\" name=\"action\" value=\"mail\">
<input type=\"hidden\" name=\"nick\" value=\"<? print \"$nick\"; ?>\">
<input type=\"hidden\" name=\"pass\" value=\"<? print \"$pass\"; ?>\">
<input type=\"submit\" value=\"Skriv besked\"></form><br>
<form method=\"highscore\" action=\"<? print\"$PHP_SELF\"; ?>\">
<input type=\"hidden\" name=\"action\" value=\"highscore\">
<input type=\"hidden\" name=\"nick\" value=\"<? print \"$nick\"; ?>\">
<input type=\"hidden\" name=\"pass\" value=\"<? print \"$pass\"; ?>\">
<input type=\"submit\" value=\"Se Highscore\">
<form method=\"post\" action=\"<? print\"$PHP_SELF\"; ?>\">
<input type=\"hidden\" name=\"action\" value=\"checkmail\">
<input type=\"hidden\" name=\"nick\" value=\"<? print \"$nick\"; ?>\">
<input type=\"hidden\" name=\"pass\" value=\"<? print \"$pass\"; ?>\">
<input type=\"submit\" value=\"Læs besked\">
Du har
<?php
require(\"config.php\");
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($database);
$res = mysql_query(\"SELECT * FROM postsystem where modtager = \'$HTTP_POST_VARS[nick]\' and new = \'ja\'\");
$tal = mysql_num_rows($res);
if ($tal == \"1\") {
print \"<img
src=brev.jpg width=16
height=11 alt=brev.jpg (771 bytes)> 1 ny besked\";
}
elseif ($tal == \"0\") {
print \"<img
src=ikke_brev.jpg width=16
height=11 alt=brev.jpg (771 bytes)> ingen nye beskeder\";
}
else {
print \"<img
src=brev.jpg width=16
height=11 alt=brev.jpg (771 bytes)> $tal nye beskeder\";
}
mysql_close();
?>
<form method=\"post\" action=\"<? print\"$PHP_SELF\"; ?>\" target=\"_self\">
<input type=\"hidden\" name=\"action\" value=\"checksendtmail\">
<input type=\"hidden\" name=\"nick\" value=\"<? print \"$nick\"; ?>\">
<input type=\"hidden\" name=\"pass\" value=\"<? print \"$pass\"; ?>\">
<input type=\"submit\" value=\"Læs sendte beskeder\"></form>
<? If ($row[status] == \"5\") { ?>
<form method=\"post\" action=\"<? print\"$PHP_SELF\"; ?>\" target=\"_self\">
<input type=\"hidden\" name=\"action\" value=\"admin\">
<input type=\"hidden\" name=\"nick\" value=\"<? print \"$nick\"; ?>\">
<input type=\"hidden\" name=\"pass\" value=\"<? print \"$pass\"; ?>\">
<input type=\"submit\" value=\"Promote & Demote\"></form>
<? } ?>
<form method=\"post\" action=\"<? print\"$PHP_SELF\"; ?>\" target=\"_self\">
<input type=\"hidden\" name=\"action\" value=\"\">
<input type=\"submit\" value=\"Log ud\"></form><br>
<?
}
}
Elseif ($action == \"mail\"){
?> Hvem vil du skrive en besked til?
<form method=\"post\" action=\"<?$PHP_SELF?>\" target=\"_self\">
Modtager : <input type=\"text\" name=\"modtager\">
<?
require(\"config.php\");
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($database);
$modtager = mysql_query(\"select * from userlogin where nick != \'$nick\' order by nick\");
while($row = mysql_fetch_array($modtager))
?>
</select> <br>
Emnet : <input type=\"text\" name=\"emnet\"><br><textarea rows=\"6\" name=\"besked\" cols=\"20\"></textarea>
<input type=\"hidden\" name=\"action\" value=\"sendmail\">
<input type=\"hidden\" name=\"afsender\" value=\"<? print \"$nick\"; ?>\">
<input type=\"submit\" value=\"Send\"></td>
<?
}
Elseif ($action == \"sendmail\"){
if($HTTP_POST_VARS[modtager] && $HTTP_POST_VARS[emnet] && $HTTP_POST_VARS[besked])
$afsender = $HTTP_POST_VARS[afsender];
$modtager = $HTTP_POST_VARS[modtager];
$besked = $HTTP_POST_VARS[besked];
$emnet = $HTTP_POST_VARS[emnet];
$ip = $REMOTE_ADDR;
{
require(\"config.php\");
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($database);
mysql_query(\"INSERT INTO postsystem (afsender, modtager, emne, besked, ip) VALUES(\'$afsender\', \'$modtager\', \'$emnet\', \'$besked\', \'$ip\')\");
$msg = \"Din besked er sendt!\";
mysql_close();
}
if($msg) echo $msg;
?>
<script>
history.go(-2);
</script>
<?
}
Elseif ($action == \"checkmail\"){
require(\"config.php\");
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($database);
$res = mysql_query(\"SELECT * FROM userlogin WHERE nick=\'$nick\' and pass = \'$pass\' \");
if (mysql_num_rows($res)) { ?>
<table width=\'100%\' border=\'1\' bordercolor=\'#000000\' cellpadding=\'3\' cellspacing=\'0\'>
<tr valign=\"left\">
<td bgcolor=\'#007171\' width=\"200\" height=\"2\">Afsender:</td>
<td bgcolor=\'#007171\' width=\"82\" height=\"2\">Emne:</td>
<td bgcolor=\'#007171\' width=\"82\" height=\"2\">Ny:</td>
<td bgcolor=\'#007171\' width=\"82\" height=\"2\">Tidspunkt:</td>
</tr>
<?
require(\"config.php\");
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($database);
$res = mysql_query(\"SELECT * FROM postsystem WHERE modtager = \'$HTTP_POST_VARS[nick]\' \") or die(\"Brugernavnet findes ikke!\");
$tal = mysql_num_rows($res);
if ($tal <1) {
print\"Der er i øjeblikket ikke nogen beskeder til dig\";
} else {
while($row = mysql_fetch_array($res)) {
$res1 = mysql_query(\"SELECT * FROM postsystem WHERE modtager = \'$HTTP_POST_VARS[nick]\' \");
?>
<tr align=\'left\' bgcolor=\'#FFFFFF\' valign=\"top\">
<td width=\"200\" height=\"27\">
<form method=\"post\" action=\"<? print\"$PHP_SELF\"; ?>\" target=\"_self\">
<input type=\"hidden\" name=\"action\" value=\"readmail\">
<input type=\"hidden\" name=\"nick\" value=\"<? print \"$nick\"; ?>\">
<input type=\"hidden\" name=\"pass\" value=\"<? print \"$pass\"; ?>\">
<input type=\"hidden\" name=\"id\" value=\"<? print \"$row[id]\"; ?>\">
<input type=\"hidden\" name=\"modtager\" value=\"<? print \"$nick\"; ?>\">
<input type=\"submit\" value=\"<? print \"$row[afsender]\"; ?>\"></form>
</td>
<td width=\"82\" height=\"27\"><? print \"$row[emne]\"; ?></td>
<td width=\"82\" height=\"27\"><? print \"$row[new]\"; ?></td>
<?
$year = substr (\"$row[tid]\", 0, 4);
$month = substr (\"$row[tid]\", 4, 2);
$day = substr (\"$row[tid]\", 6, 2);
$hour = substr (\"$row[tid]\", 8, 2);
$min = substr (\"$row[tid]\", 10, 2);
$sec = substr (\"$row[tid]\", 12, 2); ?>
<td width=\"82\" height=\"27\"><? print \"$hour:$min:$sec $day, $month - $year\"; ?></td>
</tr>
<? } } ?>
</table>
<?
} }
Elseif ($action == \"readmail\"){
require(\"config.php\");
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($database);
$res = mysql_query(\"SELECT * FROM userlogin WHERE nick=\'$modtager\' and pass = \'$pass\' \");
if (mysql_num_rows($res)) {
mysql_query(\"update postsystem set new = \'nej\' WHERE id = \'$HTTP_POST_VARS[id]\'\");
$res1 = mysql_query(\"SELECT * FROM postsystem where modtager = \'$HTTP_POST_VARS[modtager]\' and id = \'$HTTP_POST_VARS[id]\'\");
$row = mysql_fetch_array($res1)
?>
<table width=\'100%\' border=\'1\' bordercolor=\'#000000\' cellpadding=\'3\' cellspacing=\'0\'>
<tr valign=\"left\">
<td bgcolor=\'#007171\' width=\"150\" height=\"2\">Afsender:</td>
<td bgcolor=\'#007171\' width=\"82\" height=\"2\">Emne:</td>
<td bgcolor=\'#007171\' width=\"82\" height=\"2\">Besked:</td>
<td bgcolor=\'#007171\' width=\"82\" height=\"2\">Tidspunkt:</td>
<tr align=\'left\' bgcolor=\'#FFFFFF\' valign=\"top\">
<td width=\"200\" height=\"27\"><? print \"$row[afsender]\"; ?></td>
<td width=\"82\" height=\"27\"><? print \"$row[emne]\"; ?></td>
<td width=\"82\" height=\"27\"><? print \"$row[besked]\"; ?></td>
<?
$year = substr (\"$row[tid]\", 0, 4);
$month = substr (\"$row[tid]\", 4, 2);
$day = substr (\"$row[tid]\", 6, 2);
$hour = substr (\"$row[tid]\", 8, 2);
$min = substr (\"$row[tid]\", 10, 2);
$sec = substr (\"$row[tid]\", 12, 2); ?>
<td width=\"82\" height=\"27\"><? print \"$hour:$min:$sec $day, $month - $year\"; ?></td>
</tr>
</table>
<?
}
}
Elseif ($action == \"checksendtmail\"){
require(\"config.php\");
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($database);
$res = mysql_query(\"SELECT * FROM userlogin WHERE nick=\'$nick\' and pass = \'$pass\' \");
if (mysql_num_rows($res)) { ?>
<table width=\'100%\' border=\'1\' bordercolor=\'#000000\' cellpadding=\'3\' cellspacing=\'0\'>
<tr valign=\"left\">
<td bgcolor=\'#007171\' width=\"200\" height=\"2\">Modtager:</td>
<td bgcolor=\'#007171\' width=\"82\" height=\"2\">Emne:</td>
<td bgcolor=\'#007171\' width=\"82\" height=\"2\">Stadig ny:</td>
<td bgcolor=\'#007171\' width=\"82\" height=\"2\">Tidspunkt:</td>
</tr>
<?
require(\"config.php\");
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($database);
$res = mysql_query(\"SELECT * FROM postsystem WHERE afsender = \'$HTTP_POST_VARS[nick]\' \") or die(\"Brugernavnet findes ikke!\");
$tal = mysql_num_rows($res);
if ($tal <1) {
print\"Sendte beskeder:\";
} else {
while($row = mysql_fetch_array($res)) {
$res1 = mysql_query(\"SELECT * FROM postsystem WHERE afsender = \'$HTTP_POST_VARS[nick]\' \");
?>
<tr align=\'left\' bgcolor=\'#FFFFFF\' valign=\"top\">
<td width=\"200\" height=\"27\">
<form method=\"post\" action=\"<? print\"$PHP_SELF\"; ?>\" target=\"_self\">
<input type=\"hidden\" name=\"action\" value=\"readsendtmail\">
<input type=\"hidden\" name=\"nick\" value=\"<? print \"$nick\"; ?>\">
<input type=\"hidden\" name=\"pass\" value=\"<? print \"$pass\"; ?>\">
<input type=\"hidden\" name=\"id\" value=\"<? print \"$row[id]\"; ?>\">
<input type=\"hidden\" name=\"afsender\" value=\"<? print \"$nick\"; ?>\">
<input type=\"submit\" value=\"<? print \"$row[modtager]\"; ?>\"></form>
</td>
<td width=\"82\" height=\"27\"><? print \"$row[emne]\"; ?></td>
<td width=\"82\" height=\"27\"><? print \"$row[new]\"; ?></td>
<?
$year = substr (\"$row[tid]\", 0, 4);
$month = substr (\"$row[tid]\", 4, 2);
$day = substr (\"$row[tid]\", 6, 2);
$hour = substr (\"$row[tid]\", 8, 2);
$min = substr (\"$row[tid]\", 10, 2);
$sec = substr (\"$row[tid]\", 12, 2); ?>
<td width=\"82\" height=\"27\"><? print \"$hour:$min:$sec $day, $month - $year\"; ?></td>
</tr>
<? } }?>
</table>
<?
} }
Elseif ($action == \"readsendtmail\"){
require(\"config.php\");
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($database);
$res = mysql_query(\"SELECT * FROM userlogin WHERE nick=\'$afsender\' and pass = \'$pass\' \");
if (mysql_num_rows($res)) {
$res1 = mysql_query(\"SELECT * FROM postsystem where afsender = \'$HTTP_POST_VARS[afsender]\' and id = \'$HTTP_POST_VARS[id]\'\");
$row = mysql_fetch_array($res1) ?>
<table width=\'100%\' border=\'1\' bordercolor=\'#000000\' cellpadding=\'3\' cellspacing=\'0\'>
<tr valign=\"left\">
<td bgcolor=\'#007171\' width=\"150\" height=\"2\">Afsender:</td>
<td bgcolor=\'#007171\' width=\"82\" height=\"2\">Emne:</td>
<td bgcolor=\'#007171\' width=\"82\" height=\"2\">Besked:</td>
<td bgcolor=\'#007171\' width=\"82\" height=\"2\">Tidspunkt:</td>
<tr align=\'left\' bgcolor=\'#FFFFFF\' valign=\"top\">
<td width=\"200\" height=\"27\"><? print \"$row[modtager]\"; ?></td>
<td width=\"82\" height=\"27\"><? print \"$row[emne]\"; ?></td>
<td width=\"82\" height=\"27\"><? print \"$row[besked]\"; ?></td>
<?
$year = substr (\"$row[tid]\", 0, 4);
$month = substr (\"$row[tid]\", 4, 2);
$day = substr (\"$row[tid]\", 6, 2);
$hour = substr (\"$row[tid]\", 8, 2);
$min = substr (\"$row[tid]\", 10, 2);
$sec = substr (\"$row[tid]\", 12, 2); ?>
<td width=\"82\" height=\"27\"><? print \"$hour:$min:$sec $day, $month - $year\"; ?></td>
</tr>
</table>
<?
}
else {
?>
Der er sket en fejl. Log venligst på igen.
<? }
mysql_close();
}
Elseif ($action == \"admin\"){
require(\"config.php\");
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($database);
$res = mysql_query(\"SELECT * FROM userlogin WHERE nick=\'$nick\' and pass = \'$pass\' \");
if (mysql_num_rows($res)) { ?>
<form method=\"post\" action=\"<? print\"$PHP_SELF\"; ?>\">
<SELECT name=\"promote\">
<option value=\"vælg\">Vælg</option\">
<?
require(\"config.php\");
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($database);
$modtager = mysql_query(\"select * from userlogin where nick != \'$nick\' order by nick\");
while($row = mysql_fetch_array($modtager))
{ print \"
<option value=\\\"$row[nick]\\\">$row[nick]</option>\"; }
?>
</select>
<input type=\"hidden\" name=\"action\" value=\"promote\">
<input type=\"hidden\" name=\"nick\" value=\"<? print \"$nick\"; ?>\">
<input type=\"hidden\" name=\"pass\" value=\"<? print \"$pass\"; ?>\">
<input type=\"submit\" value=\"Promote\"></form>
<br>
<form method=\"post\" action=\"<? print\"$PHP_SELF\"; ?>\">
<SELECT name=\"demote\">
<option value=\"vælg\">Vælg</option\">
<?
require(\"config.php\");
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($database);
$modtager = mysql_query(\"select * from userlogin where nick != \'$nick\' order by nick\");
while($row = mysql_fetch_array($modtager))
{ print \"<option value=\\\"$row[nick]\\\">$row[nick]</option>\"; }
?>
</select>
<input type=\"hidden\" name=\"action\" value=\"demote\">
<input type=\"hidden\" name=\"nick\" value=\"<? print \"$nick\"; ?>\">
<input type=\"hidden\" name=\"pass\" value=\"<? print \"$pass\"; ?>\">
<input type=\"submit\" value=\"Demote\"></form>
<? }
else {
?>
Der er sket en fejl. Log venligst på igen.
<? }
}
Elseif ($action == \"promote\"){
require(\"config.php\");
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($database);
$res = mysql_query(\"SELECT * FROM userlogin WHERE nick=\'$nick\' and pass = \'$pass\' \");
$row = mysql_fetch_array($res);
if (mysql_num_rows($res)) {
$res_user = mysql_query(\"SELECT * FROM userlogin WHERE nick=\'$HTTP_POST_VARS[promote]\'\");
$row_user = mysql_fetch_array($res_user);
$promote_user_to = $row_user[status] + 1;
if ($row[status] + 1== $promote_user_to) {
print \"Brugeren har samme status som dig! Og kan derfor ikke få en højere status!\"; }
elseif ($row[status] -1 >= $promote_user_to) {
mysql_query(\"update userlogin set status = \'$promote_user_to\' WHERE nick = \'$HTTP_POST_VARS[promote]\'\");
print \"Bruger har nu fået sin status 1 trin højere\";
}
else {
print \"Du kan ikke give en bruger samme status som dig selv!\"; }
}
}
Elseif ($action == \"demote\"){
require(\"config.php\");
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($database);
$res = mysql_query(\"SELECT * FROM userlogin WHERE nick=\'$nick\' and pass = \'$pass\' \");
$row = mysql_fetch_array($res);
if (mysql_num_rows($res)) {
$res_user = mysql_query(\"SELECT * FROM userlogin WHERE nick=\'$HTTP_POST_VARS[demote]\'\");
$row_user = mysql_fetch_array($res_user);
$demote_user_to = $row_user[status] - 1;
if ($row[status] - 1== $demote_user_to) {
print \"Brugeren har samme status som dig! Og kan derfor ikke få en lavere status!\"; }
elseif ($row_user[status] == \"2\") {
print \"Brugeren har den laveste status og kan derfor ikke forfremmes!\"; }
elseif ($row[status] - 1 >= $demote_user_to) {
mysql_query(\"update userlogin set status = \'$demote_user_to\' WHERE nick = \'$HTTP_POST_VARS[demote]\'\");
print \"Bruger har nu fået sin status 1 trin lavere\";
}
else {
print \"Du kan ikke give en bruger samme status som dig selv!\"; }
}
}
Elseif ($action == \"\"){
require(\"config.php\");
print \"<form method=\\\"post\\\" action=\\\"$PHP_SELF\\\" target=\\\"_self\\\">\\n\";
print \"<input type=\\\"hidden\\\" name=\\\"action\\\" value=\\\"login\\\">\\n\";
print \"<table>\";
print \"<tr>\";
print \"<td><font face=\\\"arial\\\" size=\\\"2\\\" color=#000000>Brugernavn:</font></td>\";
print \"<td><input type=\\\"text\\\" name=\\\"nick\\\"></td>\\n\";
print \"</tr>\";
print \"<tr>\";
print \"<td><font face=\\\"arial\\\" size=\\\"2\\\" color=#000000>Password:</font></td>\";
print \"<td><input type=\\\"password\\\" name=\\\"pass\\\">\\n\";
print \" <input type=\\\"submit\\\" value=\\\"Login\\\"></td>\\n\";
print \"</form>\\n\";
print \"</table>\";
print \"<a href=\\\"opret.php\\\" target=_self>Opret en ny bruger - Tryk her!</a> :)\";}
?>
så er problemet:
<?
}
Elseif ($action == \"highscore\"){
?>
<table>
<tr>
<td>Plads:</td>
<td>Brugernavn:</td>
<td>Point:</td>
<td>Onlinetid:</td>
<td>Status:</td>
</tr>
<?
require(\"config.php\");
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($database);
//Status
$status[1] = \"Gæst\";
$status[2] = \"SuperBruger\";
$status[3] = \"CoAdmin\";
$status[4] = \"Admin\";
//kald først op til DBen
$res = mysql_query(\"SELECT * FROM userlogin ORDER BY points DESC\");
$i = 1;
While ($row = mysql_fetch_array($res)) {
print (\"
<tr>
<td>\".$i.\"</td>
<td>\".$row[nick].\"</td>
<td>\".$row[points].\"</td>
<td>\".$row[tid].\" min</td>
<td>\".$status[$row[status]].\"</td>
</tr></table>
</form> \");
$i++;
}
?>
hvor må jeg putte den ind?? Altså i teksten så der ikke bliver problemer...? Jeg har prøvet at putte den ind men hvor må jeg??