Witam, mój problem jest następujący, z pomocą kolegi napisałem skrypt mający za zadanie rejestrację użytkowników, który skłda się z plików functions.php i register.php. Niestety nie wiem co teraz zrobić, niby wszystko co potrzebne mam, ale gdy odpalam plik register.php i functions.php pojawia się pusta strona... Co teraz?
plik functions.php
<?php
function connection ( )
{
if ( $conn )
{
return $conn ;
}
else
{
{
return 0 ;
}
else
{
return $conn ;
}
}
}
function sql ( $query )
{
if ( ! ( $conn = connection ( ) ) )
{
return 0 ;
}
else
{
if ( ! $result )
{
echo ( iso
( "<font face=verdana size=1>Wystąpił błąd!<br>". mysql_error ( ) ."</font>" ) ) ; }
else
{
return $result ;
}
}
}
?>
Zaś plik register.php
<html>
<body>
<script TYPE="text/javascript" LANGUAGE="JavaScript">
<!--
function sprawdz(formularz)
{
for (i = 0; i < formularz.length; i++)
{
var pole = formularz.elements[i];
if ((pole.type == "text" || pole.type == "pass" || pole.type == "mail") && pole.value == "")
{
alert("Proszę wypełnić wszystkie pola!");
return false;
}
}
return true;
}
//-->
</SCRIPT>
<?php
function register_form ( )
{
<form style="margin:0" action="rejestracja.php?step=2" method="post" onsubmit="if (sprawdz(this)) return true; return false">
<table cellspacing="2" cellpadding="0" border="0">
<tr>
<td>Login:</td>
<td><input type="text" style="background-image:url('login.jpg');border-width:0;width:78px" name="login"></td>
</tr>
<tr>
<td>E-mail:</td>
<td><input type="text" style="background-image:url('login.jpg');border-width:0;width:78px" name="email"></td>
</tr>
<tr>
<td>Hasło:</td>
<td><input type="password" style="background-image:url('login.jpg');border-width:0;width:78px" name="pass"></td>
</tr>
<tr>
<td>Powtórz hasło:</td>
<td><input type="password" name="pass2" style="background-image:url('login.jpg');border-width:0;width:78px"></td>
</tr>
<tr>
<td align="center" colspan="2"><input type="submit" value="Zarejestruj"></td>
</tr>
</table>
</form>
" ) ;
}
function register ( )
{
if ( $_POST [ 'pass' ] != $_POST [ 'pass2' ] )
{
echo ( "Podane hasła nie są identyczne!" ) ; }
else
{
$result = sql ( "SELECT login FROM users WHERE login = ". $_POST [ 'login' ] ) ;
{
echo ( "Podany login jest już zajęty!" ) ; }
else
{
if ( sql ( "INSERT INTO users VALUES ( "", "". $_POST [ 'login' ] ."", "". md5 ( $_POST [ 'pass' ] ) ."", "". $_POST [ 'email' ] ."" )" ) )
{
echo ( "Rejestracja zakończona pomyślnie. Możesz się zalogować za pomocą podanego w
cześniej loginu i hasła." ) ; }
else
{
echo ( "Wystąpił nieoczekiwany błąd, rejestracja nie powiodła się!" ) ; }
}
}
}
if ( ! $_GET [ 'step' ] )
{
register_form ( ) ;
}
elseif ( $_GET [ 'step' ] == 2 )
{
rejestracja ( ) ;
}
?>