예제 #1
0
파일: random.php 프로젝트: ku1918/Titan
<?php

function randStrGen($len)
{
    $result = "";
    $chars = "abcdefghijklmnopqrstuvwxyz0123456789";
    $charArray = str_split($chars);
    for ($i = 0; $i < $len; $i++) {
        $randItem = array_rand($charArray);
        $result .= "" . $charArray[$randItem];
    }
    return $result;
}
// Usage example
$randstr = randStrGen(6);
echo $randstr;
예제 #2
0
     exit;
 } else {
     if (strlen($u) < 3 || strlen($u) > 16) {
         echo "Username must be between 3 and 16 characters";
         exit;
     } else {
         if (is_numeric($u[0])) {
             echo 'Username cannot begin with a number';
             exit;
         } else {
             // END FORM DATA ERROR HANDLING
             // Begin Insertion of data into the database
             // Hash the password and apply your own mysterious unique salt
             $cryptpass = crypt($p);
             include_once "randStrGen.php";
             $p_hash = randStrGen(20) . "{$cryptpass}" . randStrGen(20);
             // Add user info into the database table for the main site table
             $sql = "INSERT INTO users (username, email, password, gender, country, ip, signup, lastlogin, notescheck)       \r\n\t\t        VALUES('{$u}','{$e}','{$p_hash}','{$g}','{$c}','{$ip}',now(),now(),now())";
             $query = mysqli_query($db_conx, $sql);
             $uid = mysqli_insert_id($db_conx);
             // Establish their row in the useroptions table
             $sql = "INSERT INTO useroptions (id, username, background) VALUES ('{$uid}','{$u}','original')";
             $query = mysqli_query($db_conx, $sql);
             // Create directory(folder) to hold each user's files(pics, MP3s, etc.)
             if (!file_exists("user/{$u}")) {
                 mkdir("user/{$u}", 0755);
             }
             // Email the user their activation link
             $to = "{$e}";
             $from = "*****@*****.**";
             $subject = 'yoursitename Account Activation';
예제 #3
0
<?php

function randStrGen($len)
{
    $result = "";
    $chars = "abcdefghijklmnopqrstuvwxyz{$_}?!-0123456789";
    $charArray = str_split($chars);
    for ($i = 0; $i < $len; $i++) {
        $randItem = array_rand($charArray);
        $result .= "" . $charArray[$randItem];
    }
    return $result;
}
// Usage example
$randstr = randStrGen(30);
echo 'password: ' . $randstr;
예제 #4
0
        $result .= "" . $charArray[$randItem];
    }
    return $result;
}
// Usage example
include_once '../include/dbconnect2.php';
#$db = new mysqli('localhost', 'root', 'mighty', 'app');
if ($_POST['email'] != "") {
    $email = mysqli_real_escape_string($db, $_POST['email']);
    $db_check = $db->query("SELECT * FROM `users` WHERE username='******'");
    $email_account = $db->query("SELECT phoneNumber FROM `users_profile` WHERE username='******'");
    $phone = mysqli_fetch_array($email_account);
    $phone2 = $phone['phoneNumber'];
    $count = mysqli_num_rows($db_check);
    if ($count == 1) {
        $newPassword = randStrGen(6);
        $md5Password = md5(mysqli_real_escape_string($db, $newPassword));
        $updatePassword = $db->query("UPDATE `users` SET `password` = '{$md5Password}' WHERE username='******'");
        // Textlocal account details
        #   $username = '******';
        $apiKey = 'FriuSQw2cXg-oL6WngD4CVqiG4EFPaTlci0cGl2osW';
        // Message details
        $numbers = array("'6'.'{$phone2}'");
        $sender = urlencode('Titan Boss');
        $message = rawurlencode("Your Temporary Password : '******'");
        $numbers = implode(',', $numbers);
        // Prepare data for POST request
        #$data = array('username' => $username, 'hash' => $hash, 'numbers' => $numbers, "sender" => $sender, "message" => $message);
        $data = array('apiKey' => $apiKey, 'numbers' => $numbers, "sender" => $sender, "message" => $message);
        // Send the POST request with cURL
        $ch = curl_init('http://api.txtlocal.com/send/');
예제 #5
0
	require_once ("../inc/functions.php");

	if(isset($_SESSION['logged_in_user_id'])) {
		header("Location: index.php");
		exit ();
	}

	$email = "";
	$email_error = "";
	$keyresponse = "";
	$checkresponse = "";
	$response = "";
	$key = "";
	$emailcheck = "";
	$link = time();
	$newpass = randStrGen(10);

	#if (isset($_GET["key"]) && isset($_GET["email"])){
		$key = cleanInput($_GET["key"]);
		$emailcheck = cleanInput($_GET["email"]);

		if ($key != "" && $emailcheck != "") {
			$keyresponse = $User->checkKey($emailcheck, $key);

			if(isset($keyresponse->success)) {
				$usedIP = $_SERVER['REMOTE_ADDR'];
				$getpw = $User->getPass($emailcheck, $key, $usedIP);
			}
		}
	#}