Zmienilem skrypt uzywajac kodu twojego skryptu.
Teraz skrypt wyglada tak:
<?
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>
<form method=\"post\" action=\"
<?php echo $PHP_SELF ?>\">
<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\" maxlenght=\"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\" maxlenght=\"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();
$_SESSION[\"usernick\"] = strtolower(trim($_POST['user_nick']));
$_SESSION[\"userpassword\"] = md5(trim($_POST['user_password']));
}
else
$zapytanie=mysql_query(\"SELECT user_nick, user_pass 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>
<form method=\"post\" enctype=\"multipart/form-data\" action=\"
<?php echo $PHP_SELF ?>\">
<input type=\"hidden\" name=\"action\" value=\"register\">
<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\" name=\"userpassword\" size=\"20\" maxlenght=\"20\" 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\" maxlenght=\"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\" maxlenght=\"40\" 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\" maxlenght=\"40\" 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
html_footer();
}
function register_user() {
global $nick, $userpassword, $userpassword2, $usermail, $userprofile, $userhardware, $admin; global $default_db, $user_tablename; $awatar = \"obrazki/users/none.jpg\";
mailcheck($usermail);
if(empty($userprofile)) error_message
(\"Brak komentarza!\"); if(empty($usermail)) error_message
(\"Brak adresu email!\"); if(empty($nick)) error_message
(\"Brak nicku!\"); if(empty($userpassword)) error_message
(\"Brak hasla!\"); if(empty($userpassword2)) error_message
(\"Musisz powtórzyć hasło!\"); 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\":
register_user();
break;
default:
reg_form();
break;
}
}
else
echo \"zly login lub haslo\"; echo \"<a href=\"$PHP_SELF\">Logowanie</a><br>\";
?>
Mimo tego iz podaje dobre dane (
www.majcok.republika.pl/d_screenn.JPG) i w rekordzie ktory pobiera (narazie jest tylko jeden wpis) pole 'admin' ma wartosc 'TAK' na ekranie pojawia mi sie komunikat o blednym loginie lub hasle.
Chociaz juz jakis postep (IMG:
http://forum.php.pl/style_emoticons/default/smile.gif)
Ten post edytował Majcok12 20.10.2004, 18:12:10