ponizej zawartosc register.php:
<? include(\"common.php\"); $id_polaczenia = db_connect(); if(!isset($_POST[\"user_nick\"]) && !isset($_POST[\"user_password\"]) && !$_SESSION[\"usernick\"] && !$_SESSION[\"userpassword\"]){ html_header(); ?> </TR> <TR> <TD WIDTH=\"100%\" HEIGHT=\"16\" background=\"layout/belka2.gif\" style=\"border-bottom: solid; border-bottom-width: 1px; border-bottom-color: black;\"><center><font style=\"font-family: Times New Roman; font-size: 8pt;\"><b>Logowanie</b></center></TD> </TR> </table> <TABLE cellpadding=\"1\" cellspacing=\"0\" WIDTH=\"100%\" HEIGHT=\"1000\" BGCOLOR=\"#000000\" style=\"border-left: solid; border-left-width: 1px; border-left-color: black; border-bottom: solid; border-bottom-width: 1px; border-bottom-color: black; border-right: solid; border-right-width: 1px; border-right-color: black;\"> <TR> <TD valign=\"top\" align=\"center\" bgcolor=\"#414141\" colspan=\"3\"> <br> <table border=\"0\" cellpadding=\"1\" cellspacing=\"0\" width=\"95%\" height=\"10%\" align=\"center\" valign=\"top\"> <tr> <th width=\"30%\" NOWRAP><font style=\"font-family: Verdana; font-size: 10px; color: gray;\">Nick:</th> <td width=\"70%\"><input type=\"text\" name=\"user_nick\" size=\"20\" maxlength=\"20\" class=\"pollItem\"></td> </tr> <tr> <th width=\"30%\" NOWRAP><font style=\"font-family: Verdana; font-size: 10px; color: gray;\">Hasło:</th> <td width=\"70%\"><input type=\"text\" name=\"user_password\" size=\"20\" maxlength=\"20\" class=\"pollItem\"></td> </tr> <tr> <th width=\"30%\" colspan=\"2\" NOWRAP> <input type=\"submit\" class=\"pollButton\" value=\"Zaloguj\" onmouseover=\"this.className='pollButton-over'\" onmouseout=\"this.className='pollButton'\"> </tr> </table> </table> </form> <?php html_footer(); } else $_SESSION[\"usernick\"] = strtolower(trim($_COOKIE['user_id'])); $_SESSION[\"userpassword\"] = trim($_COOKIE['user_pass']); $zapytanie = mysql_query(\"SELECT user_nick, user_pass, admin FROM users WHERE user_nick ='$_SESSION[usernick]'\"); if($_SESSION[\"usernick\"] == strtolower($user[\"user_nick\"]) && $_SESSION[\"userpassword\"] == $user[\"user_pass\"] && $user[\"admin\"] == \"TAK\"){ $id_polaczenia = db_connect(); function in_use($user_nick) { $query = \"SELECT user_nick FROM $user_tablename WHERE user_nick = '$user_nick'\"; else return 1; } function reg_form() { html_header(); ?> </TR> <TR> <TD WIDTH=\"100%\" HEIGHT=\"16\" background=\"layout/belka2.gif\" style=\"border-bottom: solid; border-bottom-width: 1px; border-bottom-color: black;\"><center><font style=\"font-family: Times New Roman; font-size: 8pt;\"><b>Dodaj nowego użytkownika</b></center></TD> </TR> </table> <TABLE cellpadding=\"1\" cellspacing=\"0\" WIDTH=\"100%\" HEIGHT=\"1000\" BGCOLOR=\"#000000\" style=\"border-left: solid; border-left-width: 1px; border-left-color: black; border-bottom: solid; border-bottom-width: 1px; border-bottom-color: black; border-right: solid; border-right-width: 1px; border-right-color: black;\"> <TR> <TD valign=\"top\" align=\"center\" bgcolor=\"#414141\" colspan=\"3\"> <br> <input type=\"hidden\" name=\"action\" value=\"register_user\"> <table border=\"0\" cellpadding=\"1\" cellspacing=\"0\" width=\"95%\" height=\"70%\" align=\"center\" valign=\"top\"> <tr> <th width=\"30%\" NOWRAP><font style=\"font-family: Verdana; font-size: 10px; color: gray;\">Nick:</th> <td width=\"70%\"> <input type=\"text\" size=\"20\" maxlength=\"20\" name=\"nick\" class=\"pollItem\"></td> </tr> <tr> <th width=\"30%\" NOWRAP><font style=\"font-family: Verdana; font-size: 10px; color: gray;\">Wybrane hasło:</th> <td width=\"70%\"> <input type=\"password\" size=\"20\" maxlength=\"20\" name=\"userpassword\" class=\"pollItem\"></td> </tr> <tr> <th width=\"30%\" NOWRAP><font style=\"font-family: Verdana; font-size: 10px; color: gray;\">Powtórz hasło:</th> <td width=\"70%\"> <input type=\"password\" name=\"userpassword2\" size=\"20\" maxlength=\"20\" class=\"pollItem\"></td> </tr> <tr> <th width=\"30%\" NOWRAP><font style=\"font-family: Verdana; font-size: 10px; color: gray;\">Email:</th> <td width=\"70%\"> <input type=\"text\" name=\"usermail\" size=\"20\" maxlength=\"20\" class=\"pollItem\"></td> </tr> <tr> <th width=\"30%\" NOWRAP><font style=\"font-family: Verdana; font-size: 10px; color: gray;\">O sobie:</th> <td width=\"70%\"> <textarea rows=\"5\" cols=\"40\" name=\"userprofile\" class=\"pollItem\"></textarea></td> </tr> <tr> <th width=\"30%\" NOWRAP><font style=\"font-family: Verdana; font-size: 10px; color: gray;\">Sprzęt:</th> <td width=\"70%\"> <input type=\"text\" name=\"userhardware\" size=\"20\" maxlength=\"20\" class=\"pollItem\"></td> </tr> <tr> <th width=\"30%\" NOWRAP><font style=\"font-family: Verdana; font-size: 10px; color: gray;\">Admin:</th> <td width=\"70%\"> <select name=\"admin\" size=1 class=\"pollItem\"> <option selected value=\"NIE\">NIE</option> <option value=\"TAK\">TAK</option> </select> </td> </tr> <tr> <th width=\"30%\" colspan=\"2\" NOWRAP> <input type=\"submit\" class=\"pollButton\" value=\"Rejestruj\" onmouseover=\"this.className='pollButton-over'\" onmouseout=\"this.className='pollButton'\"> <input type=\"reset\" class=\"pollButton\" value=\"Wyczysc\" onmouseover=\"this.className='pollButton-over'\" onmouseout=\"this.className='pollButton'\"></th> </tr> </table> </table> </form> <?php echo \" <a href=\"$PHP_SELF?action=logout\"><font style=\"font-family: Verdana; font-size: 9px;\"><b>Wyloguj</b></a><br>n\"; html_footer(); } function register_user() { $awatar = \"obrazki/users/none.jpg\"; mailcheck($usermail); if($userpassword!=$userpassword2) error_message(\"Podane hasła nie są identyczne\"); if(in_use($nick)) error_message(\"Wybrany nick jest już zajęty, proszę wybrać inny\"); $query = \"INSERT INTO users VALUES(NULL, '$nick', '$userpassword', '$usermail', '$userprofile', curdate(), NULL, '$userhardware', '$awatar', '$admin')\"; if(!$wynik) error_message(sql_error()); html_header(); ?> <TR> <TD WIDTH=\"100%\" HEIGHT=\"16\" background=\"layout/belka2.gif\" style=\"border-bottom: solid; border-bottom-width: 1px; border-bottom-color: black;\"><center><font style=\"font-family: Times New Roman; font-size: 8pt;\"><b>Dodaj nowego użytkownika</b></center></TD> </TR> </table> <TABLE cellpadding=\"1\" cellspacing=\"0\" WIDTH=\"100%\" HEIGHT=\"1000\" BGCOLOR=\"#000000\" style=\"border-left: solid; border-left-width: 1px; border-left-color: black; border-bottom: solid; border-bottom-width: 1px; border-bottom-color: black; border-right: solid; border-right-width: 1px; border-right-color: black;\"> <TR> <TD valign=\"top\" align=\"center\" bgcolor=\"#414141\" colspan=\"3\"> <br> <font style=\"font-family: Verdana; font-size: 9pt; color: gray;\"><b>Użytkownik <?php echo $nick ?> został zarejestrowany</b><br> </tr> </table> <?php html_footer(); } switch($action) { case \"register_user\": register_user(); break; case \"logout\": logout(); break; default: reg_form(); break; } } else { } ?>
funcja logout(), znajdujaca sie pliku common.php:
<? function logout() { if($_COOKIE['user_id'] && $_COOKIE['user_pass']) { error_message(\"Zostałeś wylogowany\"); } } ?>
PS. http://forum.php.pl/index.php?showtopic=22285
pzdr