<head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> </head> <?php require_once("../zapytania.php"); mysql_connect ("mysql3.superhost.pl","sh178151_admin","xxx"); //łącze z bazą ("serwer bazy","użytkownik","hasło") function emotki($string) { $emotikony = array(":D" => "http://firegifts.pl/images/emoticons/smilie5.gif",":)" => "http://firegifts.pl/images/emoticons/wink.gif", "lol2" => "http://emotikona.pl/emotikony/pic/01icon_lol2.gif", ":(" => "http://emotikona.pl/emotikony/pic/0sad.gif", ":P" => "http://emotikona.pl/emotikony/pic/0tongue.gif", "kurwa" => "http://firegifts.pl/images/emoticons/censored.gif", "huj" => "http://firegifts.pl/images/emoticons/censored.gif", "google" => "http://emotikona.pl/emotikony/pic/14icon_google.gif"); foreach($emotikony as $tekst => $grafika) $string = str_replace($tekst,'<img src="'.$grafika.'" />',$string); return $string; } { //Definicja zmiennych $ip = $_SERVER['REMOTE_ADDR']; //Wykonujemy zapytanie importujące zdefiniowane dane mysql_query ("INSERT INTO `posty` (`login`, `tresc`, `data`, `ip`) VALUES('$login', '$tresc', '$data', '$ip')"); //No i przenosimy użytkownika z powrotem do shoutboxa } else { ?><span id="licznik"><? //Pobieramy dane z bazy //Początek struktury tabeli //Pętla do wyświetlenia wszystkich wpisów .'<b> '); .$shout['tresc'] //wyświetlamy treść .'<br/><span class="data">' .$shout['data'] //wyświetlamy datę .'</span> '); ?></span><? if (($data['admin']) == 1){ { switch ($_GET['akcja']) { case 'usun': break; } } ?><a href="/chat/index.php?akcja=usun&id=<? echo''.$shout['id'].''; ?> "> <span style="color:red;"><b>X</b></a></span><? } if (($data['admin']) == 1){ { switch ($_GET['akcja']) { case 'spamer': mysql_query("UPDATE `users` SET spamer='1' WHERE `login` = '".$_GET['login']."'") or die(mysql_error()); break; } } ?><a href="/chat/index.php?akcja=spamer&login=<? echo''.$shout['login'].''; ?> "> <span style="color:green;"><b>S</b></a></span><? } } // //Koniec struktury tabeli } //print_r($_SERVER); if($data['spamer'] == 1){ } else {?> <form action="" method="POST" id="shoutbox"> <?php require_once("../zapytania.php"); echo'<input type="hidden" name="login" value="'.$data['login'].'" />'; ?><br/> Treść: <input type="text" name="tresc" maxlength="125" /> <button type="submit" name="wyslij">Napisz</button> </form> <? } ?>
Oto Kod Index.php:
<!DOCTYPE HTML> <html> <head> <title>ShoutBox</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" type="text/css" href="styles.css" /> <style type="text/css"> html,body{margin:0;padding:0} body{ background: #3399FF; font: 76% arial,sans-serif;text-align:left} p{margin:0 10px 10px} a{padding:5px; text-decoration:none; color:#000000;} #shoutbox { width:100%; font-size: 11px; text-align:left background: green; } #shoutbox .wpis { background: #BFBD93; text-align:left} #shoutbox .data { color: #444; font-size: 10px; } #shoutbox input { background: #BFBD93; text-align:left border: 1px solid #444; height: 13px; font-size: 11px; } #shoutbox button { background: #BFBD93; text-align:left border: 1px solid #444; height: 18px; font-size: 11px; } form { padding-left: 3px; } </style> <!--[if lte IE 6]><style type="text/css">#freecssfooter{position:absolute;}</style><![endif]--> </head> <body> <div id="extra"> <p><?php include('shoutbox.php'); ?></p> </div>
Chcę aby:
- Jeśli w bazie w users użytkownik o id $data['id'] dokładniej jeśli w tablce users kolumnie admin ma 1 to jego nick ma być czerwony
Próbowałem tak:
if (($data['admin']) == 1){ <span style="color:red;">....</span> }
ale wtedy ja jako admin widziałem wszystkie nicki na czerwono, a inni nic nie widzieli na czerwono.
POMOCY!