Regi Page

    • Werbung zur Unterstützung des Forums ( Bitte AddBlocker deaktivieren )

    • [FONT="Trebuchet MS"][COLOR="LemonChiffon"][SIZE="2"]CreateAccount Function

      Quellcode

      1. SET ANSI_NULLS ON
      2. GO
      3. SET QUOTED_IDENTIFIER ON
      4. GO
      5. CREATE PROCEDURE [dbo].[createaccount]
      6. @account VARCHAR(15),
      7. @password VARCHAR(32)
      8. AS
      9. SET NOCOUNT ON
      10. DECLARE @DateActivated AS CHAR(8)
      11. IF NOT EXISTS (SELECT account FROM ACCOUNT_TBL WHERE account = @account) BEGIN
      12. INSERT INTO ACCOUNT_TBL (account, [password], id_no2, isuse, member, realname)
      13. VALUES (@account, @password, @password, 'T', 'A', 'F')
      14. SET @DateActivated = CONVERT(CHAR(8), GETDATE()-1, 112 ) --Is the date today - 1
      15. --UPDATE ACCOUNT_TBL_DETAIL SET BlockTime = @DateYesterday WHERE account = @userid
      16. --INSERT INTO ACCOUNT_TBL_DETAIL (account, gamecode, tester, m_chLoginAuthority, regdate, BlockTime, EndTime, WebTime, isuse)
      17. -- VALUES (@account, 'A000', '2', 'F', GETDATE(), '20990101', '20990101', '20050101', 'O')
      18. INSERT INTO ACCOUNT_TBL_DETAIL (account, gamecode, tester, m_chLoginAuthority, regdate, BlockTime, EndTime, WebTime, isuse)
      19. VALUES (@account, 'A000', '2', 'F', GETDATE(), @DateActivated, '20990101', '20050101', 'O')
      20. END
      Alles anzeigen


      PHP-Quellcode

      1. <!-- Start Register -->
      2. <?php
      3. #############################
      4. ##Copyright (c) TheJacob#####
      5. ##All Rights Reserved########
      6. ##thejacobpollack@gmail.com##
      7. #############################
      8. #############################
      9. #############################
      10. ##Configuration##
      11. $mssql_server = ""; //MSSQL server name or IP
      12. $mssql_username = ""; //MSSQL username
      13. $mssql_password = ""; //MSSQL password
      14. $mssql_account_db = "ACCOUNT_DBF"; //MSSQL account database name
      15. $mssql_character_01_db = "CHARACTER_01_DBF"; //MSSQL character database name
      16. $mssql_account_table = "account_tbl"; //MSSQL account table name
      17. $mssql_username_column = "account"; //MSSQL username column in account table
      18. $mssql_password_column = "password"; //MSSQL password column in account table
      19. $hash = ""; //Hash code
      20. $random_text_text = "e=mc2"; //Random text they must enter to register
      21. #############################
      22. #############################
      23. ##MSSQL Connect Function##
      24. function mssql_connect_ini($mssql_server,$mssql_username,$mssql_password) {
      25. $mssql_connect = mssql_connect($mssql_server, $mssql_username, $mssql_password) or die ("<strong>Cannot connect to the MSSQL server.</strong>");
      26. if ((strlen($mssql_server) == 0) || (strlen($mssql_username) == 0) || (strlen($mssql_password) == 0)) {
      27. echo "<strong>The connection configuration settings are invalid. Please make sure you've entered them in correctly.</strong>";
      28. }
      29. }
      30. ##MSSQL Account Database Select Function##
      31. function mssql_account_ini($mssql_account_db) {
      32. $mssql_select_db = mssql_select_db($mssql_account_db) or die ("<strong>Cannot select the Account database.</strong>");
      33. if (strlen($mssql_account_db) == 0) {
      34. echo "<strong>The account database configuration setting is invalid. Please make sure you've entered it correctly.</strong>";
      35. }
      36. }
      37. #############################
      38. #############################
      39. ##MSSQL Core Functionality##
      40. mssql_connect_ini($mssql_server,$mssql_username,$mssql_password);
      41. mssql_account_ini($mssql_account_db);
      42. #############################
      43. #############################
      44. $pusername = @$_POST['username']; //Post wsername
      45. $ppassword = @$_POST['password']; //Post password
      46. $prpassword = @$_POST['rpassword']; //Post re-enter password
      47. $random_text = @$_POST['random_text']; //Random text
      48. if (isset($_POST['submit']) == true) {
      49. $username = preg_replace("/[^a-zA-Z0-9\-\_\!\$\#\@\^\&\*\(\)\^\+\ \.\?]/", "", $pusername);
      50. $password = preg_replace("/[^a-zA-Z0-9\-\_\!\$\#\@\^\&\*\(\)\^\+\ \.\?]/", "", $ppassword);
      51. if ((isset($_POST['submit']) == true) and (strlen($pusername) < 3) || (strlen($pusername) > 15)) {
      52. echo "Your username must be between 3 and 15 characters in length.";
      53. }
      54. else if ((isset($_POST['submit']) == true) and ((strlen($ppassword) < 3) || (strlen($ppassword) > 15) || (strlen($prpassword) < 3) || (strlen($prpassword) > 15))) {
      55. echo "The password must be between 3 and 15 characters in length.";
      56. }
      57. else if ((isset($_POST['submit']) == true) and ($ppassword != $prpassword)) {
      58. echo "The passwords must be the same.";
      59. }
      60. else if ((isset($_POST['submit']) == true) and (($pusername == $ppassword) || ($pusername == $prpassword))) {
      61. echo "The username and password cannot be the same.";
      62. }
      63. else if ((isset($_POST['submit']) == true) and ($random_text != $random_text_text)) {
      64. echo "The random text must be filled in correctly. Please take another look at the random text.";
      65. }
      66. else if (mssql_num_rows(mssql_query("SELECT * FROM $mssql_account_table WHERE $mssql_username_column = '$username'")) == '0') {
      67. $stmt = mssql_init('createaccount');
      68. mssql_bind($stmt, '@account', $username, SQLVARCHAR, false, false, 15);
      69. mssql_bind($stmt, '@password', md5($hash . $password), SQLVARCHAR, false, false, 36);
      70. mssql_execute($stmt) or die ("<strong>Error occurred while executing the statement.</strong>");
      71. mssql_free_statement($stmt);
      72. echo "You've been successfully registered as <strong>" . $username . "</strong>!";
      73. } else {
      74. echo "The username already exists.";
      75. }
      76. }
      77. ?>
      78. <br>
      79. <center>
      80. <form method ="post" action="#">
      81. <table>
      82. <tr>
      83. <td><strong>Username</strong></td>
      84. </tr>
      85. <tr>
      86. <td><input name="username" type="username"></td>
      87. </tr>
      88. <tr>
      89. <td><strong>Password</strong></td>
      90. </tr>
      91. <tr>
      92. <td><input name="password" type="password"></td>
      93. </tr>
      94. <tr>
      95. <td><strong>Re-enter Password</strong></td>
      96. </tr>
      97. <tr>
      98. <td><input name="rpassword" type="password"></td>
      99. </tr>
      100. <tr>
      101. <td><strong>Please enter "<?php echo $random_text_text ?>" without the brackets below</strong></td>
      102. </tr>
      103. <tr>
      104. <td><input name="random_text" type="text"></td>
      105. </tr>
      106. <tr>
      107. <td><input name="submit" type="submit" value="Register"></td>
      108. </tr>
      109. </table>
      110. </form>
      111. </center>
      112. <!-- End Regiser -->
      Alles anzeigen


      (C) TheJacob[/SIZE][/COLOR][/FONT]