Hallo Leute,
ich hab mein login-System auf verschlüsselte PW umgestellt. Das geht auch alles soweit nur bekomm ich jetzt das Reg-Formular nicht mehr zum laufen.
Im Gegenteil, ich hab sogar noch irgedwas drann kaput gemacht was vorher ging. Zur Erklärung noch etwas:
Das Script prüft zuerst ob der Name schon vergeben ist und läuft dann erst weiter. Nur soll es den PW-Wert als md5 in der DB speichert und eben das bekomm ich nicht hin. Wenn jemand den Fehler findet den ich verursacht hab sagt mir bitte wo er ist ich find ihn nicht. Soll in der Zeile $Result1 = mysql_query... sein
ich hab mein login-System auf verschlüsselte PW umgestellt. Das geht auch alles soweit nur bekomm ich jetzt das Reg-Formular nicht mehr zum laufen.
Im Gegenteil, ich hab sogar noch irgedwas drann kaput gemacht was vorher ging. Zur Erklärung noch etwas:
Das Script prüft zuerst ob der Name schon vergeben ist und läuft dann erst weiter. Nur soll es den PW-Wert als md5 in der DB speichert und eben das bekomm ich nicht hin. Wenn jemand den Fehler findet den ich verursacht hab sagt mir bitte wo er ist ich find ihn nicht. Soll in der Zeile $Result1 = mysql_query... sein
PHP:
<?php
mysql_select_db($database_db, $db);
$query = "
SELECT
`user_name`
FROM
`user`
WHERE
`user_name` = '".mysql_escape_string($_POST['user_name'])."'
";
$result = mysql_query($query, $db) or die(mysql_error());
if( mysql_num_rows($result) >= 1 ) {
echo "
<link href='css/main.css' rel='stylesheet' type='text/css'><div align='center'><fieldset style='width:25%'><legend>Der Name ist schon weg</legend>Der gewünschte Name ist schon vergeben.<br> Du must einen anderne wählen.<br> <a href='new_reg.php' target='_self'>Hier gehts zurück.</a></fieldset></div>";
exit;
}
function GetSQLValueString($theValue, $theType, $theDefinedValue='', $theNotDefinedValue='') {
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch( $theType ) {
case 'text':
$theValue = ($theValue !== '') ? chr(39) . $theValue . chr(39) : 'NULL';
break;
case 'long':
case 'int':
$theValue = ($theValue !== '') ? intval($theValue) : 'NULL';
break;
case 'double':
$theValue = ($theValue !== '') ? chr(39) . doubleval($theValue) . chr(39) : 'NULL';
break;
case 'date':
$theValue = ($theValue !== '') ? chr(39) . $theValue . chr(39) : 'NULL';
break;
case 'defined':
$theValue = ($theValue !== '') ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if( isset($_SERVER['QUERY_STRING']) ) {
$editFormAction .= '?' . htmlentities($_SERVER['QUERY_STRING']);
}
if( isset($_POST['MM_insert']) && $_POST['MM_insert'] === 'form1') {
$insertSQL = sprintf(
"INSERT INTO user (user_name, user_pw, user_mail) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['user_name'], 'text'),
GetSQLValueString .md5 ($_POST['user_pw'], 'text'),
GetSQLValueString($_POST['user_mail'], 'text')
)
$Result1 = mysql_query($insertSQL, $db) or die(mysql_error());
$insertGoTo = 'user_newok.php';
if( isset($_SERVER['QUERY_STRING']) ) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? '&' : '?';
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header('Location: ' . $insertGoTo);
}
?>