Witam
Mam skrypt na rejestracje i działa idealnie! Tylko jeśli rejestruje jakaś osobe to po wysłaniu rekordu, nie moge się i tak zalogować ponieważ nie ma wpisanego w kolumne acces >root<. Chciałbym żebyśćie mi pomogli w naprawieniu tego, o to skrypt:
><?
if (isset($_POST['submit'])){ require_once('config.php');
$l = usun($_POST['login']);
}else{
$l = FALSE;
$message .= '<font color="red">Proszę podać imie</font><br />';
}
$e = usun($_POST['email']);
}else{
$e = FALSE;
$message .= '<font color="red">Proszę podać email</font><br />';
}
if($_POST['pass'] == $_POST['pass2']){
$p = usun($_POST['pass']);
}else{
$message .= '<font color="red">Podane hasła różnią się od siebie</font><br />';
}
}else{
$message .= '<font color="red">Prosze podać hasło</font><br />';
}
if ( $l && $e && $p ){
$query = "SELECT user_id FROM user WHERE username='$l'";
// sprawdzanie czy takie konto istnienie
//dodajemy uzytkownika do bazy
$query2 = "INSERT INTO user (username, email, haslo, data_rejstacji) VALUES ('$l', '$e', PASSWORD('$p'), NOW())";
if ($result2){ //jezeli nie wystapily zadne bledy
echo 'Zostałes zarejstrowany na stronie'; }else{
echo 'Ze względu na wystąpienie błędu systemowego rejestracja nie była możliwa. Przepr
aszamy za wszelkie niedogodnościi.<br />'; }
}else{
$message .= '<font color="red">Konto o podanym nicku juz istnieje</font><br />';
}
}else{
$message .= '<font color="red">Spróbuj ponownie</font><br />';
}
}
?>
<html>
<head>
<title>Rejstracja</title>
<script type="text/javascript">
<!-- //
function regulamin()
{
if(document.getElementById('reg').checked == true )
{
document.getElementById('dalej').disabled=false;
}
else
{
document.getElementById('dalej').disabled=true;
}
}
// ]]> -->
</script>
</head>
<body>
<form method="post" action="
<? echo $_SERVER['PHP_SELF']; ?>">
<table align="left" border="0">
<tr>
<td align="right" class="uni_01">login:</td>
<td><input type="text" name="login" size="35" value="
<? if (isset($_POST['login'])){ echo $_POST['login']; }?>"><small>*minimalna długość loginu to 4 znaki</small>
</td>
</tr>
<tr>
<td align="right" class="uni_01">email:</td>
<td><input type="text" name="email" size="35" value="
<? if (isset($_POST['email'])){ echo $_POST['email']; } ?>">
</td>
</tr>
<tr>
<td align="right" class="uni_01">hasło:</td>
<td><input name="pass" type="password" size="25"><small>*minimalna długosc hasła do 4 znaki</small>
</td>
</tr>
<tr>
<td align="right" class="uni_01">powtórz hasło::</td>
<td><input name="pass2" type="password" size="25">
</td>
</tr>
<tr>
<td align="right" class="uni_01"> </td>
<td>
<b>Oświadczam, że zapoznałem się z regulaminem i zgadzam się na warunki tam zami
eszczone</b>
<input type="checkbox" id="reg" onClick="regulamin()" />
</td>
</tr>
<tr>
<td align="right" class="uni_01"> </td>
<td>
<input style="font-weight: bold;" type="submit" name="submit" value="loguj" id="dalej" disabled="disabled">
</td>
</tr>
</table>
</form>
Podsumowanie:
Proszę żeby ktoś pokazał gdzie wstawić coś by do zarejestrowanego nowego użytkownika dopisywało root w kolumnie acces.!
Zgóry dzięki!