Witam. Mam problem z rejestracją użytkownika. Pojawia się formularz, jednak nic się nie dzieję, gdy klikam na "rejestruj". Oto kod pliku "rejestracja.php" :
<?php
$link_id = mysql_connect("localhost", "root", "pass");
mysql_select_db("adam");
mysql_close($link_id);
function html_header()
{
global $new_win_width, $new_win_height;
?>
<HTML>
<HEAD>
<TITLE>Przegladarka rekordow</TITLE>
</HEAD>
<BODY>
<?php
}
function html_footer()
{
?>
</BODY>
</HTML>
<?php
}
function in_use($userid)
{
global $tabela_uzytkownikow;
$query = "SELECT userid FROM $tabela_uzytkownikow WHERE userid = 'userid'";
$result = mysql_query($query);
if(!mysql_num_rows($result)) return 0;
else return 1;
}
function register_form()
{
global $userid, $username;
global $PHP_SELF;
?>
<CENTER><H3>Utworz swoje konto</H3></CENTER>
<FORM METHOD="post" ACTION="<?php echo $PHP_SELF ?>">
<INPUT TYPE="hidden" NAME="action" VALUE="register">
<DIV ALIGN="center"><CENTER><TABLE BORDER="1" WIDTH="90%">
<TR>
<TH WIDTH="30%" NOWRAP>Wybrany identyfikator</TH>
<TD WIDTH="70%"><INPUT TYPE="text" NAME="userid" VALUE="<?php echo $userid ?>" SIZE="8"
MAXLENGHT="8"></TD>
</TR>
<TR>
<TH WIDTH="30%" NOWRAP>Wybrane hasło</TH>
<TD WIDTH="70%"><INPUT TYPE="password" NAME="userpassword" SIZE="15"></TD>
</TR>
<TR>
<TH WIDTH="30%" NOWRAP>Powtórz hasło</TH>
<TD WIDTH="70%"><INPUT TYPE="password" NAME="userpassword2" SIZE="15"></TD>
</TR>
<TR>
<TH WIDTH="30%" NOWRAP>Imie i Nazwisko</TH>
<TD WIDTH="70%"><INPUT TYPE="text" NAME="username" VALUE="<?php echo $username ?>"
SIZE="20"></TD>
</TR>
<TR>
<TH WIDTH="30%" COLSPAN="2" NOWRAP>
<INPUT TYPE="submit" VALUE="Rejestruj">
<INPUT TYPE="reset" VALUE="Wyczyść">
</TH>
</TR>
</TABLE>
</CENTER></DIV>
</FORM>
<?php
}
function create_account()
{
global $userid, $username, $userpassword, $userpassword2;
$link_id = mysql_connect("localhost", "root", "pass");
$query = "INSERT INTO adam VALUES(NULL, '$userid', password('$userpassword'), '$username')";
$result = mysql_query($query);
$usernumber = mysql_insert_id($link_id);
html_header();
?>
<CENTER><H3>
<?php echo $username ?>, dziękujemy za zarejestrowanie się
</H3></CENTER>
<DIV ALIGN="center"><CENTER><TABLE BORDER="1" WIDTH="90%">
<TR>
<TH WIDTH="30%" NOWRAP>Numer użytkonika</TH>
<TD WIDTH="70%"><?php echo $usernumber ?></TD>
</TR>
<TR>
<TH WIDTH="30%" NOWRAP>Wybrany identyfikator</TH>
<TD WIDTH="70%"><?php echo $userid ?></TD>
</TR>
<TR>
<TH WIDTH="30%" NOWRAP>Wybrane hasło</TH>
<TD WIDTH="70%"><?php echo $userpassword ?></TD>
</TR>
<TR>
<TH WIDTH="30%" NOWRAP>Imię i Nazwisko</TH>
<TD WIDTH="70%"><?php echo $username ?></TD>
</TR>
</TABLE></CENTER></DIV>
<?php
html_footer();
}
switch($action)
{
case "register":
create_account();
break;
default:
html_header();
register_form();
html_footer();
break;
}
?>
Co jest nie tak?
Pozdrawiam