Skip to content

[Question] Script Reg and reset Paswword

Featured Replies

hello i have reg script and change password and i dont know how i can add to "regscript" option "meil and accept rules" this is reg script:

 

//////////////////////////// PHP ////////////////////////////////////////

 

<?php

//set host, username and password for MySQL

$dbhost = "localhost";

$dbuser = "root";

$dbpass = "";

 

//connect to MySQL or return an error

$conn = mysql_connect("$dbhost", "$dbuser", "$dbpass")

or die('Could not connect: ' . mysql_error());

 

//set database name

$dbname = "l2jdb";

 

//select database or return an error

$dbselect = mysql_select_db("$dbname") 

or die ('Could not select database');

 

//get username and password info from the form, protecting against SQL injection

$pass = mysql_real_escape_string($_POST["pass"]);

$confirm = mysql_real_escape_string($_POST["confirm"]);

$user = mysql_real_escape_string($_POST["name"]);

 

//validate user input

if(!preg_match('/^[a-zA-Z0-9]{5,20}$/',$user)) {

die ('Error: Usernames can only contain alphanumeric characters and must be between 5 and 20 characters in length.');

}

 

if(!preg_match('/^[a-zA-Z0-9]{5,20}$/',$pass)) {

die ('Error: Passwords can only contain alphanumeric characters and must be between 5 and 20 characters in length.');

}

 

if($pass != $confirm) {

die ('Error: Passwords do not match.');

}

 

//make sure user doesn't already exist and if it doesn't, add new record to the database

$result = mysql_query("SELECT login FROM accounts WHERE login='$user'");

 

if(mysql_num_rows($result)>0) {

die ('Error: Username already exists.');

}else{

mysql_query("INSERT INTO accounts (login, password, access_level) VALUES ('".$_POST['name']."', '".base64_encode(pack('H*', sha1($_POST['pass'])))."', 0)")

or die ('Error: ' . mysql_error());

}

 

//report successful registration

echo "Account created successfully.";

 

//close MySQL connection

mysql_close();

 

?>

 

/////////////////////////////////  HTML ///////////////////////////////////////

 

<center>

<p> </p>

<p> </p>

<p> </p>

 

<b>Register New Account</b>

<p> </p>

<form action="regphp.php" method="post">

UserID: <br>

<input type="text" name="name" style=""/><br />

Password: <br>

<input type="password" name="pass" style=""/><br />

Confirm Password: <br>

<input type="password" name="confirm" style=""/><br />

 

<input type="submit" name="submit" value="Create"><br><br>

 

</form>

</center>

 

 

And how how i can create "reset password script" i write login and email, and base send me email whith my new password. Wait for answer :)

hello i have reg script and change password and i dont know how i can add to "regscript" option "meil and accept rules" this is reg script:

 

 

 

 

//////////////////////////// PHP ////////////////////////////////////////

 

<?php

//set host, username and password for MySQL

$dbhost = "localhost";

$dbuser = "root";

$dbpass = "";

 

//connect to MySQL or return an error

$conn = mysql_connect("$dbhost", "$dbuser", "$dbpass")

or die('Could not connect: ' . mysql_error());

 

//set database name

$dbname = "l2jdb";

 

//select database or return an error

$dbselect = mysql_select_db("$dbname") 

or die ('Could not select database');

 

//get username and password info from the form, protecting against SQL injection

$pass = mysql_real_escape_string($_POST["pass"]);

$confirm = mysql_real_escape_string($_POST["confirm"]);

$user = mysql_real_escape_string($_POST["name"]);

 

//validate user input

if(!preg_match('/^[a-zA-Z0-9]{5,20}$/',$user)) {

die ('Error: Usernames can only contain alphanumeric characters and must be between 5 and 20 characters in length.');

}

 

if(!preg_match('/^[a-zA-Z0-9]{5,20}$/',$pass)) {

die ('Error: Passwords can only contain alphanumeric characters and must be between 5 and 20 characters in length.');

}

 

if($pass != $confirm) {

die ('Error: Passwords do not match.');

}

 

//make sure user doesn't already exist and if it doesn't, add new record to the database

$result = mysql_query("SELECT login FROM accounts WHERE login='$user'");

 

if(mysql_num_rows($result)>0) {

die ('Error: Username already exists.');

}else{

mysql_query("INSERT INTO accounts (login, password, access_level) VALUES ('".$_POST['name']."', '".base64_encode(pack('H*', sha1($_POST['pass'])))."', 0)")

or die ('Error: ' . mysql_error());

}

 

//report successful registration

echo "Account created successfully.";

 

//close MySQL connection

mysql_close();

 

?>

 

/////////////////////////////////  HTML ///////////////////////////////////////

 

<center>

<p> </p>

<p> </p>

<p> </p>

 

<b>Register New Account</b>

<p> </p>

<form action="regphp.php" method="post">

UserID: <br>

<input type="text" name="name" style=""/><br />

Password: <br>

<input type="password" name="pass" style=""/><br />

Confirm Password: <br>

<input type="password" name="confirm" style=""/><br />

 

<input type="submit" name="submit" value="Create"><br><br>

 

</form>

</center>

 

 

And how how i can create "reset password script" i write login and email, and base send me email whith my new password. Wait for answer :)

 

 

do  javy  reg  ?  po co w jave rejestracja ?

  • Author

Pl: Do rejestracji to chyba logiczne? Nie każdy daje autokreacje kont. I na przyszlosc to angielskie forum :)

En: For registration unless it logical? Not everyone gives a self-creation of accounts. And the future this is international forum.

Pl: Do rejestracji to chyba logiczne? Nie każdy daje autokreacje kont. I na przyszlosc to angielskie forum :)

En: For registration unless it logical? Not everyone gives a self-creation of accounts. And the future this is international forum.

 

 

"uhm"

  • Author

Nobody can help me??

Just add a new option with radio button, and right behind it is the rule link.

Then create a procedure that control the radio button, like if the button is blank then print a message etc...

And about the mail check, you must have the mail service to do so.

Everything can be done using your Javascript/PHP knowledge.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.