|
You last visited: Today at 19:31
Advertisement
[EP2]Register Script [PHP]
Discussion on [EP2]Register Script [PHP] within the Last Chaos Private Server forum part of the Last Chaos category.
11/07/2012, 02:52
|
#1
|
elite*gold: 1
Join Date: Oct 2011
Posts: 1,609
Received Thanks: 2,189
|
[EP2]Register Script [PHP]
Da ich zu faul war jedesmal manuell alles in die DB einzutragen hab ich mir schnell ein script gebastelt^^
#gelöscht
Credits :
- FapMax (clean_str funktion)
So viel Spaß damit^^
|
|
|
11/07/2012, 12:02
|
#2
|
elite*gold: 16
Join Date: Sep 2012
Posts: 1,005
Received Thanks: 982
|
Hey sel ähm ich glaube das script wird gut buggen da mysql real escape string eine mysql verbindung braucht wenn ich mich recht erinnere aber egal warum prüfst du ein passwort auf sqli was sowieso erst verschlüsselt wird bevor es an die datenbank kommt ? o.O und "htmlspecialchars" brauchst du nach clean_str eh nichtmehr weil nach cleanstr nurnoch a-z, A-Z, 0-9 und "@ und ." übrig bleibt ?
Aber sonst gute arbeit ich wette das hätte nicht viele aus der sektion hinbekommen. Gut ich gebs zu ich glaube fast keiner
Mfg Samker
|
|
|
11/07/2012, 14:38
|
#3
|
elite*gold: 241
Join Date: Dec 2011
Posts: 1,803
Received Thanks: 1,301
|
Quote:
Originally Posted by Samker
Hey sel ähm ich glaube das script wird gut buggen da mysql real escape string eine mysql verbindung braucht wenn ich mich recht erinnere aber egal warum prüfst du ein passwort auf sqli was sowieso erst verschlüsselt wird bevor es an die datenbank kommt ? o.O und "htmlspecialchars" brauchst du nach clean_str eh nichtmehr weil nach cleanstr nurnoch a-z, A-Z, 0-9 und "@ und ." übrig bleibt ?
Aber sonst gute arbeit ich wette das hätte nicht viele aus der sektion hinbekommen. Gut ich gebs zu ich glaube fast keiner
Mfg Samker
|
Sicher keiner.
|
|
|
11/07/2012, 14:40
|
#4
|
elite*gold: 0
Join Date: May 2012
Posts: 2,369
Received Thanks: 646
|
Quote:
Originally Posted by PapiSchlumpf
Sicher keiner.
|
Ein paar bestimmt schon
|
|
|
11/07/2012, 14:42
|
#5
|
elite*gold: 16
Join Date: Sep 2012
Posts: 1,005
Received Thanks: 982
|
Quote:
Originally Posted by SânSalvador
Ein paar bestimmt schon 
|
also sel tefarian basti180 hateme fapmax ich das ist keine frage aber sonst eigentlich keiner gut wizatek MaX (bin ich mir nicht sicher  ) und ein paar wenige mehr
|
|
|
11/07/2012, 15:03
|
#6
|
elite*gold: 1
Join Date: Oct 2011
Posts: 1,609
Received Thanks: 2,189
|
Quote:
Originally Posted by Samker
Hey sel ähm ich glaube das script wird gut buggen da mysql real escape string eine mysql verbindung braucht wenn ich mich recht erinnere aber egal warum prüfst du ein passwort auf sqli was sowieso erst verschlüsselt wird bevor es an die datenbank kommt ? o.O und "htmlspecialchars" brauchst du nach clean_str eh nichtmehr weil nach cleanstr nurnoch a-z, A-Z, 0-9 und "@ und ." übrig bleibt ?
Aber sonst gute arbeit ich wette das hätte nicht viele aus der sektion hinbekommen. Gut ich gebs zu ich glaube fast keiner
Mfg Samker
|
Weil ich das Script im Halbschlaf geschrieben habe, also habe ich einfach alles an Sicherheitsprüfung reingehauen was es gibt D:
|
|
|
11/07/2012, 16:27
|
#7
|
elite*gold: 0
Join Date: Sep 2011
Posts: 751
Received Thanks: 229
|
Quote:
Originally Posted by Samker
also sel tefarian basti180 hateme fapmax ich das ist keine frage aber sonst eigentlich keiner gut wizatek MaX (bin ich mir nicht sicher  ) und ein paar wenige mehr
|
du lügst, vergiss nicht whazzert!
|
|
|
11/07/2012, 16:49
|
#8
|
elite*gold: 16
Join Date: Sep 2012
Posts: 1,005
Received Thanks: 982
|
Quote:
Originally Posted by illyminati
du lügst, vergiss nicht whazzert!
|
ich habe keine ahnung bist du einfach nur strunz dumm oder soll das ironie sein wirklich ich habe keine ahnung es gibt zu viele in der sektion denen ich so viel dummheit zutraue
|
|
|
11/07/2012, 17:30
|
#9
|
elite*gold: 265
Join Date: Jul 2009
Posts: 735
Received Thanks: 2,147
|
I can understand that u want to clean the username, but why are u cleaning the password? A good password consists out of atleast a few special chars also :@&$*(; etc, etc.
the mysql_real_escape_string will do nothing in this context btw.
It is to be used with the mysql_ library and not the mysqli because it uses its own sanitizing functions.
Do some more research on mysqli prepared statements, then u are 100% sure u are safe.
|
|
|
11/07/2012, 17:32
|
#10
|
elite*gold: 2470
Join Date: Jul 2010
Posts: 7,524
Received Thanks: 5,444
|
Kommen da auch so beleidigende Meldungen wie bei deinen restlichen Tools, so nach dem Motto "Dein Account wurde angelegt du reallifesloses kleinen Stück *censored*"?
PS: Das war nicht ganz ernst gemeint 
Aber dein Zeug funktioniert wenigstens immer, also gute Arbeit, auch wenn dich Barunson nun in die Hölle schickt!
|
|
|
11/07/2012, 17:36
|
#11
|
elite*gold: 265
Join Date: Jul 2009
Posts: 735
Received Thanks: 2,147
|
PHP Code:
<?php
if( isset( $_POST['username'] ) && !empty( $_POST['username'] ) && isset( $_POST['password'] ) && !empty( $_POST['password'] )) {
$conf['db']['server'] = '123.456.789.123'; $conf['db']['user'] = 'mysql_username_here'; $conf['db']['pass'] = 'mysql_assword_here'; $conf['dbname']['auth'] = 'newproject_auth'; $salt = 'salt_here'; // Create the DSN $conf['db']['dsn'] = sprintf("mysql:host=%s;dbname=%s", $conf['db']['server'], $conf['dbname']['auth'] ); // Try to connect to the database try { $db = new PDO($conf['db']['dsn'], $conf['db']['user'], $conf['db']['pass']); } catch(PDOException $e) { die('Error connecting to the database<br />'); } $dbh = $db->prepare("SELECT count(*) FROM bg_user WHERE user_id = :user"); $dbh->execute( array( ':user' => $_POST['username'] )); $result = $dbh->fetch(); if( $result[0] != 0 ) echo 'User '. htmlspecialchars( $_POST['username'] ) .' already exist'; else { $hash = hash('sha256', $_POST['username'] . $salt . $_POST['password']); $dbh = $db->prepare("INSERT INTO bg_user (user_id, passwd) VALUES(:user,:pass)"); $dbh->execute( array( ':user' => $_POST['username'], ':pass' => $hash )); echo '['. htmlspecialchars( $_POST['username'] ) .'] Account created!<hr />'; }
} else {
echo ' <form method="post"> <table> <tr> <td>Username</td> <td><input type="text" name="username" size="30" maxlength="16" /></td> </tr> <tr> <td>Password</td> <td><input type="text" name="password" size="30" /></td> </tr> <tr> <td></td> <td><input type="submit" value="Create account" /></td> </tr> </table> </form>'; }
?>
|
|
|
11/07/2012, 17:46
|
#12
|
elite*gold: 16
Join Date: Sep 2012
Posts: 1,005
Received Thanks: 982
|
Quote:
Originally Posted by wizatek
PHP Code:
<?php
if( isset( $_POST['username'] ) && !empty( $_POST['username'] ) && isset( $_POST['password'] ) && !empty( $_POST['password'] ))
{
$conf['db']['server'] = '123.456.789.123';
$conf['db']['user'] = 'mysql_username_here';
$conf['db']['pass'] = 'mysql_assword_here';
$conf['dbname']['auth'] = 'newproject_auth';
$salt = 'salt_here';
// Create the DSN
$conf['db']['dsn'] = sprintf("mysql:host=%s;dbname=%s", $conf['db']['server'], $conf['dbname']['auth'] );
// Try to connect to the database
try
{
$db = new PDO($conf['db']['dsn'], $conf['db']['user'], $conf['db']['pass']);
}
catch(PDOException $e)
{
die('Error connecting to the database<br />');
}
$dbh = $db->prepare("SELECT count(*) FROM bg_user WHERE user_id = :user");
$dbh->execute( array( ':user' => $_POST['username'] ));
$result = $dbh->fetch();
if( $result[0] != 0 )
echo 'User '. htmlspecialchars( $_POST['username'] ) .' already exist';
else
{
$hash = hash('sha256', $_POST['username'] . $salt . $_POST['password']);
$dbh = $db->prepare("INSERT INTO bg_user (user_id, passwd) VALUES(:user,:pass)");
$dbh->execute( array( ':user' => $_POST['username'],
':pass' => $hash ));
echo '['. htmlspecialchars( $_POST['username'] ) .'] Account created!<hr />';
}
}
else
{
echo '
<form method="post">
<table>
<tr>
<td>Username</td>
<td><input type="text" name="username" size="30" maxlength="16" /></td>
</tr>
<tr>
<td>Password</td>
<td><input type="text" name="password" size="30" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Create account" /></td>
</tr>
</table>
</form>';
}
?>
|
Wizatek a little tipp set the pdo charset to UTF-8 then you can input all sysmbols but the clean_str function from fapmax delete all these
|
|
|
11/07/2012, 17:46
|
#13
|
elite*gold: 1
Join Date: Oct 2011
Posts: 1,609
Received Thanks: 2,189
|
Quote:
Originally Posted by wizatek
I can understand that u want to clean the username, but why are u cleaning the password? A good password consists out of atleast a few special chars also :@&$*(; etc, etc.
the mysql_real_escape_string will do nothing in this context btw.
It is to be used with the mysql_ library and not the mysqli because it uses its own sanitizing functions.
Do some more research on mysqli prepared statements, then u are 100% sure u are safe.
|
I was really tired at the time I was scripting this, but it works.
|
|
|
11/07/2012, 17:50
|
#14
|
elite*gold: 16
Join Date: Sep 2012
Posts: 1,005
Received Thanks: 982
|
Quote:
Originally Posted by Sentence'
I was really tired at the time I was scripting this, but it works. 
|
yeah i just say the same thing but i have my answer via skype
|
|
|
11/08/2012, 14:14
|
#15
|
elite*gold: 25
Join Date: Sep 2011
Posts: 5,536
Received Thanks: 1,266
|
Das Script ist Grotten schlecht Coded.
|
|
|
 |
|
Similar Threads
|
Help with Register Script?
04/24/2015 - Rappelz Private Server - 5 Replies
NULL
|
[PHP] Register 4 Key Script
07/20/2013 - Web Development - 4 Replies
Hey,
Ich mache grad ein Register Script für eine Metin2 Homepage.
Man soll einen Key eingeben , der in einer Table gespeichert ist,
aber er soll nur funktionieren wenn der status auf 'ok' ist.
Sollte er auf BLOCK sein , so soll die registrierung fehl schlagen.
Ich habe bisher folgendes gemacht:
$key = $_POST;
|
V14 Register Script für Gms [Homepage Script]
05/21/2011 - Flyff Private Server - 10 Replies
Naja, Meine frage wär wie man nen V14 Register Page macht wo man wenn man registriert sofort Gm ist =D.
PS: für ein ein Test Server ;3
Trafalgar†Law ~
|
Register Script [HELP]
09/13/2010 - Flyff Private Server - 5 Replies
Register.php
PHP-Code:
<?php
require('./configs/reg_conf.php');
function doesUsernameExist($name){
$exit = FALSE;
$result = @mssql_query("SELECT * FROM ACCOUNT_TBL WHERE account='$name'");
if (mssql_num_rows($result) != 0){
$exit = TRUE;
}
|
[HELP]Register Script
12/30/2009 - EO PServer Hosting - 17 Replies
Hello Community ...
I have an problem with register script
I don't know where is www folder lol
I must download something ??
Please anyone can help me !
Thanks
|
All times are GMT +1. The time now is 19:31.
|
|