<?php
ini_set('display_errors', 0);
$connection = mssql_connect('****-PC\SQLEXPRESS', 'sa', '****'); //Change YOURHOST and YOURPASSWORD
if(!connection || !mssql_select_db('ACCOUNT_DBF', $connection))
{
die('Unable to connect or select database!');
}
$checkusername = $_POST['username'];
$query = mssql_query("SELECT account FROM ACCOUNT_TBL WHERE account = '$checkusername'");
$result = mssql_fetch_row($query);
if(isset($_POST['submit'])){
if($_POST['username'] == ""){
$error = '<font color="red">Bitte gebe ein Username an.</font>';
}
else if($result[0] == $checkusername){
$error = '<font color="red"><p>Dieser Username ist schon in gebrauch. Bitte benutzte einen anderen.</font>';
}
else if($_POST['Password'] == ""){
$error = '<font color="red"><p>Bitte gebe ein Passwort an.</font>';
}
else if($_POST['Password2'] == ""){
$error = '<font color="red"><p>Du hast vergessen dein Passwort zu wiederhollen.</font>';
}
else if($_POST['Password'] != $_POST['Password2']){
$error = '<font color="red"><p>Passwörter stimmen nicht überein.</font>';
}
else if($_POST['birthday'] == ""){
$error = '<font color="red"><p>Bitte gebe dein Geburtsdatum an.</font>';
}
else if($_POST['mail'] == ""){
$error = '<font color="red"><p>Bitte gebe deine Email an.</font>';
}
else{
$password = md5('nForceIsGay' . $_POST['Password']);
$stmt = mssql_init('webCreateAcc', $connection);
mssql_bind($stmt, '@account', $checkusername, SQLVARCHAR, false, false, 15);
mssql_bind($stmt, '@password', $password, SQLVARCHAR, false, false, 36);
mssql_bind($stmt, '@birthday', $_POST['birthday'], SQLVARCHAR, false, false, 120);
mssql_bind($stmt, '@email', $_POST['mail'], SQLVARCHAR, false, false, 120);
mssql_execute($stmt) or die ("<p>Die Registrierung war nicht erfolgreich, bitte versuche es noch einmal.");
mssql_free_statement($stmt);
$error = '<font color="green"><p>Die Registrierung war erfolgreich.</font>';
}
}
echo '<form action="reg.php" method="post">';
echo 'Account ID <input type="text" name="username" /><br /><br />';
echo 'Passwort: <input type="password" name="Password" /><br /><br />';
echo 'Passwort wdh.: <input type="password" name="Password2" /><br /><br />';
echo 'Geburtsdatum: <input type="text" name="birthday" /><br /><br />';
echo 'E-mail Adresse: <input type="text" name="mail" /><p />';
echo '<input type="submit" name="submit" value="Registrieren!" />';
echo '</form>';
echo $error;
?>
</center>
Ich hab eine Frage zu dem Script.. und zwar wenn ich meine Account ID groß schreibe, dann wird die in die MSSQL DB auch groß reinimpotiert.. Darf sie aber nicht :>.. Also es soll so sein das die Id klein reingeschrieben wird.. Weis da jemand vllt eine Lösung wie man das machen kann?(Wenn man die Account ID groß schreibt das sie klein geschrieben in die DB eingefügt wird?