Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include("rmb.php");
- $cxn = mysqli_connect($host,$user,$passmilah,$dbase)
- or die("Query died: connect");
- $func = $_GET['func'];
- $func($cxn);
- function salt($length)
- {
- // Assign strings to variables
- $lc = 'abcdefghijklmnopqrstuvwxyz'; // lowercase
- $uc = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; // uppercase
- $nr = '1234567890'; // numbers
- $sp = '^@*+-+%()!?'; //special characters
- $chars = $lc.$up.$nr.$sp;
- // Length of character list
- $chars_length = (strlen($chars) – 1);
- // Start our string
- $string = $chars{rand(0, $chars_length)};
- // Generate random string
- for ($i = 1; $i < $length; $i = strlen($string))
- {
- // Take random character from our list
- $random = $chars{rand(0, $chars_length)};
- // Make sure the same two characters don’t appear next to each other
- if ($random != $string{$i – 1}) $string .= $random;
- }
- return $string;
- }
- function login($cxn)
- {
- }
- function register($cxn)
- {
- $username = mysqli_real_escape_string($_GET['fusername']);
- $sql = "SELECT username FROM user WHERE username = '$username' ";
- $result = mysqli_query($cxn,$sql)
- or die(mysqli_error($cxn));
- $num = mysqli_num_rows($result);
- if($num > 0) //if the username exists already
- {
- exit();
- }
- else //adding the new user to the database
- {
- $password = md5($_GET['fpassword']);
- $salt = salt(5);
- $const = "hy7";
- $password .= $salt;
- $password .= $const;
- echo $password
- }
- }
Add Comment
Please, Sign In to add comment