|
You last visited: Today at 02:47
Advertisement
PHP Register page
Discussion on PHP Register page within the Web Development forum part of the Coders Den category.
11/01/2013, 10:24
|
#1
|
elite*gold: 3
Join Date: Feb 2012
Posts: 687
Received Thanks: 158
|
PHP Register page
Hey Leute, undzwar hab ich mich dazu entschlossen bisschen php unter die Lupe zu nehmen.
Ich hab da ein Problem, undzwar möchte ich ne simple register aufbauen.
Nur ich scheitere grade an dem, das er kein salt benutzen soll und ich nicht weis wie ich es umschreibe.
Ich hoffe ihr könnt mir helfen ich wäre echt dankbar.
PHP Code:
<?php //retrieve our data from POST $username = $_POST['username']; $password1 = $_POST['password1']; $password2 = $_POST['password2']; $email = $_POST['email']; if($password1 != $password2) header('Location: registration.html'); if(strlen($username) > 30) header('Location: registration.html'); //Das hier soll weg und durch normale Buchstaben/Zahlen erstezt werden also kein Salt password. $hash = hash('sha256', $password1); function createSalt() { $text = md5(uniqid(rand(), true)); return substr($text, 0, 3); } $salt = createSalt(); $password = hash('sha256', $salt . $hash); $conn = mysql_connect('localhost', 'root', ''); mysql_select_db('login', $conn); //sanitize username $username = mysql_real_escape_string($username); $query = "INSERT INTO member ( username, password, email, salt ) VALUES ( '$username', '$password', '$email', '$salt' );"; mysql_query($query); mysql_close(); header('Location: login.php'); ?>
|
|
|
11/01/2013, 13:52
|
#2
|
elite*gold: 0
Join Date: Apr 2010
Posts: 10,291
Received Thanks: 3,611
|
So?
PHP Code:
<?php //retrieve our data from POST $username = $_POST['username']; $password1 = $_POST['password1']; $password2 = $_POST['password2']; $email = $_POST['email']; if($password1 != $password2) header('Location: registration.html'); if(strlen($username) > 30) header('Location: registration.html'); $conn = mysql_connect('localhost', 'root', ''); mysql_select_db('login', $conn); $password = hash('sha256', $password1); $username = mysql_real_escape_string($username); $email = mysql_real_escape_string($email); $query = "INSERT INTO member ( username, password, email, salt ) VALUES ( '$username', '$password', '$email', '');"; mysql_query($query); mysql_close(); header('Location: login.php'); ?>
|
|
|
11/01/2013, 14:07
|
#3
|
elite*gold: 3
Join Date: Feb 2012
Posts: 687
Received Thanks: 158
|
nicht ganz jetzt kommt da so ein gekritzel raus
9f86d081884c7d659a2feaa0c55ad015
Ich meinte z.b. wenn ich ein Account erstelle mit
ID: Test
Password: Test
Das er es exakt so in der Db anzeigen soll.
Aber danke für deine hilfe.
|
|
|
11/01/2013, 14:50
|
#4
|
elite*gold: 2932
Join Date: Oct 2009
Posts: 6,966
Received Thanks: 1,097
|
es macht aber keinen sinn passwörter plain in der db zu speichern, deswegen wird nur der hash gespeichert
|
|
|
11/01/2013, 14:55
|
#5
|
elite*gold: 3
Join Date: Feb 2012
Posts: 687
Received Thanks: 158
|
Das es kein sinn macht ist mir bewusst, dennoch kann ich mit gehashten passwörten nix anfangen da diese nicht angenommen werden.
|
|
|
11/01/2013, 15:39
|
#6
|
elite*gold: 0
Join Date: Apr 2010
Posts: 10,291
Received Thanks: 3,611
|
Wie können gehashte Passwörter nicht angenommen werden?
|
|
|
11/02/2013, 00:54
|
#7
|
elite*gold: 22
Join Date: May 2011
Posts: 516
Received Thanks: 178
|
Quote:
Originally Posted by Shawak
Wie können gehashte Passwörter nicht angenommen werden?
|
Vielleicht Datenbank falsch konfiguriert.
PHP Code:
//an Shawak's Code (post1) orientiert <?php //retrieve our data from POST $username = $_POST['username']; $password1 = $_POST['password1']; $password2 = $_POST['password2']; $email = $_POST['email']; if($password1 != $password2) header('Location: registration.html'); if(strlen($username) > 30) header('Location: registration.html'); $conn = mysql_connect('localhost', 'root', ''); mysql_select_db('login', $conn); $username = mysql_real_escape_string($username); $email = mysql_real_escape_string($email); $query = "INSERT INTO member ( username, password, email ) VALUES ( '$username', '$password1', '$email');"; mysql_query($query); mysql_close(); header('Location: login.php'); ?>
du musst die datenbank dementsprechend ändern, d.h. 'Salt'-Spalte raus
#nicht getestet
|
|
|
11/02/2013, 02:00
|
#8
|
elite*gold: 0
Join Date: Apr 2010
Posts: 10,291
Received Thanks: 3,611
|
@EngelEatos: Du hast vergessen das Password zu escapen, böse.
|
|
|
11/02/2013, 11:16
|
#9
|
elite*gold: 3
Join Date: Feb 2012
Posts: 687
Received Thanks: 158
|
@EngelEatos
Danke jetzt geht alles
|
|
|
11/02/2013, 13:04
|
#10
|
elite*gold: 0
Join Date: Mar 2011
Posts: 306
Received Thanks: 156
|
mysql_close();
What? : >
|
|
|
11/04/2013, 22:18
|
#11
|
elite*gold: 900
Join Date: Apr 2009
Posts: 14,976
Received Thanks: 11,388
|
General Coding -> Web Development
moved
|
|
|
|
Similar Threads
|
[Some Help please ] Register page
10/03/2012 - EO PServer Hosting - 2 Replies
Ok even when i use xamp wam lamp etc. my acc server ALWAYS shuts down when someone logs on , but they stay online , ill have to keep restarting my acc server inorder for a player to login , can someone explain to me how to fix this? Oh , im also Using Chaos/MortalQueen DB :)
|
How To ISS 7 Register Page and Help Page And Guild
12/16/2011 - Rappelz Private Server - 3 Replies
Hello ,
IIS 7 to the registration page . Good Luck..
ISS 7 Register Page and Help Page And Guild Page - YouTube
Result
589896 - YouTube
|
Ep1 Register page?
10/26/2011 - Last Chaos - 9 Replies
hey.
Ich brauche dringend hilfe bei meiner Reg page bei xampp.
Ich bekomm erstens Apache nicht zum laufen und 2. Scripts usw ist fertig und die HP geht trd nicht.
Was tun?
Kann mir wer helfen?
Mfg
Der jenige der mir hilft , bekommt Cash im wert von 5€ auf unserem Server.
|
[HELP] Register Page
03/25/2009 - EO PServer Hosting - 1 Replies
hi guyz i have a problem in my register page , IDK what to do , i replaced it , and i replaced every thing , even removed APPserver ,a dn install it back , but still not workin plz help me , here is the link to reg page
http://eo-satan.sytes.net:8090/register/register. php
and another thing , after i put added the gold wings to server , casulas ( flame clothes , black light ) make player invisible , and still can be bought from mall and every thing good in db plz help
|
All times are GMT +2. The time now is 02:47.
|
|