Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Web Development
You last visited: Today at 02:47

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



PHP Register page

Discussion on PHP Register page within the Web Development forum part of the Coders Den category.

Reply
 
Old   #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($text03);
    }
     
    
$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');
    
?>
xSincex is offline  
Old 11/01/2013, 13:52   #2



 
Shawak's Avatar
 
elite*gold: 0
The Black Market: 259/0/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'); 
    
?>
Shawak is offline  
Thanks
1 User
Old 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.
xSincex is offline  
Old 11/01/2013, 14:50   #4
 
tolio's Avatar
 
elite*gold: 2932
The Black Market: 169/1/0
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
tolio is offline  
Old 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.
xSincex is offline  
Old 11/01/2013, 15:39   #6



 
Shawak's Avatar
 
elite*gold: 0
The Black Market: 259/0/0
Join Date: Apr 2010
Posts: 10,291
Received Thanks: 3,611
Wie können gehashte Passwörter nicht angenommen werden?
Shawak is offline  
Old 11/02/2013, 00:54   #7
 
EngelEatos's Avatar
 
elite*gold: 22
Join Date: May 2011
Posts: 516
Received Thanks: 178
Quote:
Originally Posted by Shawak View Post
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
EngelEatos is offline  
Thanks
1 User
Old 11/02/2013, 02:00   #8



 
Shawak's Avatar
 
elite*gold: 0
The Black Market: 259/0/0
Join Date: Apr 2010
Posts: 10,291
Received Thanks: 3,611
@EngelEatos: Du hast vergessen das Password zu escapen, böse.
Shawak is offline  
Thanks
1 User
Old 11/02/2013, 11:16   #9
 
elite*gold: 3
Join Date: Feb 2012
Posts: 687
Received Thanks: 158
@EngelEatos


Danke jetzt geht alles
xSincex is offline  
Old 11/02/2013, 13:04   #10
 
elite*gold: 0
Join Date: Mar 2011
Posts: 306
Received Thanks: 156
mysql_close();

What? : >
jibi1996 is offline  
Old 11/04/2013, 22:18   #11

 
xxfabbelxx's Avatar
 
elite*gold: 900
Join Date: Apr 2009
Posts: 14,976
Received Thanks: 11,388
Arrow General Coding -> Web Development

moved
xxfabbelxx is offline  
Reply


Similar Threads 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.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.