Wykorzystalem twoj pomysl, ale pewnie cos zle zrobielm, bo nie dziala.
kod funkcji log_form() (wyswietla formularz logowania)
<?
function log_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>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['user_nick\", \"user_password'];
}
?>
A tu pliku register.php
<?
include(\"common.php\");
$id_polaczenia = db_connect();
log_form();
$zapytanie=mysql_query(\"SELECT user_nick, user_pass FROM users WHERE user_nick ='$_SESSION[user_nick]' AND user_pass ='$_SESSION[user_password]'\"); if($_SESSION[\"user_nick\"] == strtolower($user[\"user_nick\"]) && $_SESSION[\"user_password\"] == $user[\"user_pass\"]){
$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{
header(\"Location: $PHP_SELF?msg=Zły login lub hasło\"); exit; }
?>
PZdr