function forgetPassword($userLogin, $userCPF)
{
    //get security ;)
    $userLogin = mysql_real_escape_string($userLogin);
    $userCPF = mysql_real_escape_string($userCPF);
    //select validate data sent by POST
    $query = mysql_query("SELECT `userLogin`, `userCPF`, `userMail` FROM `users` WHERE `userLogin` = '" . $userLogin . "' AND `userCPF` = '" . $userCPF . "' LIMIT 1");
    $return = mysql_num_rows($query);
    $result = mysql_fetch_assoc($query);
    if ($return == 0) {
        //oh shit!
        return false;
    } else {
        //generate and encrypt password
        $newPassword = randomPassword(6, true, true, false);
        $encryptedNewPassword = md5($newPassword);
        //update password
        $updateNewPassword = "******" . $encryptedNewPassword . "', `userChangePassword`='1' WHERE userLogin = '******' AND userCPF = '" . $userCPF . "'";
        $query = mysql_query($updateNewPassword);
        # SETTINGS TO SEND EMAIL FOR USER
        $to = $result['userMail'];
        $subject = "PGA - SEMED: Alteração de Senha";
        $message = "\n\t\t<html>\n\t\t<body>\n\t\t  <h3>Alteração de Senha</h3><br />\n\t\t  Sua nova senha é: <b>" . $newPassword . "</b>\n\t\t</body>\n\t\t</html>";
        $from = "*****@*****.**";
        $headers = "From: " . $from . "\r\n";
        $headers .= "MIME-Version: 1.0\r\n";
        $headers .= "Content-Type: text/html; charset=UTF-8\r\n";
        mail($to, $subject, $message, $headers);
        return true;
    }
}
Exemplo n.º 2
0
 public function verify_email()
 {
     //Setting up validation rules for form inputs
     $this->validation_rules = array(array('field' => 'username', 'label' => 'username', 'rules' => 'required|callback_validate_hoteluser', 'class' => 'text-danger'));
     $this->form_validation->set_error_delimiters('<div class="bg-danger">', '</div>');
     $this->form_validation->set_rules($this->validation_rules);
     $this->form_validation->set_message('validate_hoteluser', 'Hotel User with this username is not exist.');
     //$this->form_validation->set_message('valid_email','Please Enter Valid Email.');
     if ($this->form_validation->run() == FALSE) {
         $this->data['action'] = "/login/verify_user";
         $this->template->load('login_tpl', 'recovery_vw', $this->data);
     } else {
         //Get User Id From Email
         $user_info = $this->User_model->get_user_by_name($this->input->post('username'));
         $user_id = $user_info[0]['sb_hotel_user_id'];
         $hotelusername = $user_info[0]['sb_hotel_username'];
         $password = randomPassword();
         $hotel_user_data = array();
         $hotel_user_data['sb_hotel_userpasswd'] = createHashAndSalt($password);
         $result = $this->Hotel_model->edit_hotel_user($hotel_user_data, $user_id);
         $data = array();
         $data['password'] = $password;
         $data['hotelusername'] = $hotelusername;
         $message = $this->load->view('email/forgotpassword', $data, TRUE);
         sendMail('*****@*****.**', $user_info[0]['sb_hotel_useremail'], "Forgot Password", $message);
         $this->session->set_flashdata('SuccMsg', SUC_MSG_LEVEL_2);
         redirect('admin/login');
     }
 }
Exemplo n.º 3
0
function reset_password($username)
{
    //generates a random password for the user and puts it into the database
    //first generate a random password
    $randomPassword = randomPassword();
    $conn = db_connect();
    $result = $conn->query("UPDATE user SET password='******' WHERE username = '******' ");
    if (!$result) {
        throw new Exception("Could not reset password. Please try again.");
    }
    return $randomPassword;
}
Exemplo n.º 4
0
    function register($addmemberclass, $editid)
    {
        global $db;
        $postvar = $addmemberclass->getPostVar();
        $user_id = $_SESSION['USER_ID'];
        $first_name = mysql_real_escape_string(trim($postvar['first_name']));
        $last_name = mysql_real_escape_string(trim($postvar['last_name']));
        $email = mysql_real_escape_string(trim($postvar['email']));
        $usertype = mysql_real_escape_string(trim($postvar['usertype']));
        $password = randomPassword();
        $pass = sha1(mysql_real_escape_string($password));
        $hash = md5(rand(0, 1000));
        $codeverify = mysql_real_escape_string($hash);
        $sql_url = "SELECT * FROM tc_urlsetting WHERE id = '1'";
        $res_url = $db->select_data($sql_url);
        $logos = stripslashes($res_url[0]['status']);
        if ($logos == "test") {
            $liveurl = $res_url[0]['test_url'];
        } else {
            $liveurl = $res_url[0]['live_url'];
        }
        if ($editid == "") {
            $sql = "INSERT INTO `api_users`(`first_name`,`last_name`, `email`, `userid`, `password`, `usertype`, `is_active`, `created`,`online`,`modified`,`owner_id`,`hash`) VALUES ('{$first_name}','{$last_name}','{$email}','{$userid}','{$pass}','{$usertype}','0',now(),'0','','{$user_id}','{$codeverify}')";
            $result = $db->insert_data($sql);
            $in_id = mysql_insert_id();
            if ($in_id != "") {
                $to = $email;
                $subject = "Confirm Your Account.";
                $from = $memail;
                $headers = 'MIME-Version: 1.0' . "\r\n";
                $headers .= 'X-Mailer: PHP/' . phpversion() . "\n";
                $headers .= 'Reply-To:' . $to . "\r\n";
                $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
                $headers .= "From: {$from}";
                $text = '<html><body><div style=\\"width:100%;\\">
						<table>
									<tr>
										<td><a href="' . $liveurl . '" target="_blank"><img src="' . $liveurl . 'images/logo.jpg" /></a></td>
									</tr>
								</table>
						<table width="100%" cellspacing="15" cellpadding="0" border="0" bgcolor="#E8F1FA" align="center" style="font-family:Helvetica,Arial,serif">
						<tr><td><b>Hello ' . ucfirst($first_name) . ',</b></td></tr>					
						
						<tr><td colspan="2" style="font-size: 18px!important;color:#15c!important;"><p style=\\"font-family: Verdana,Arial,Helvetica,sans-serif;font-size: 18px!important;color:#15c!important;\\">Thanks for signing up!
								Your account has been created, you can confirm your account by click on below url.</p></td></tr>						
						<tr><td>&nbsp;<a href="' . $liveurl . 'verify.php?email=' . $email . '&hash=' . $hash . '" target="blank">Confirm Your Account</a></td></tr>
						<tr><td colspan="2"><b>Your Login details are:-</b></td></tr>
						<tr><td colspan="2"><b>EmailID:-</b> ' . stripslashes($email) . '</td>
						</tr>						
						<tr><td colspan="2"><b>Password:-</b> ' . $password . '</td>						
						<tr><td>&nbsp;</td></td>
						<tr><td colspan="2" style="font-size: 18px!important;color:#15c!important;"><b>After login you can change your password for security.</b></td></tr>
						<tr><td><b>Sincerely,</b></td></tr>						
						<tr><td><b>' . $liveurl . '</b></td></tr>					  
						</table></div></body></html>';
                $message = $text;
                @mail($to, $subject, $message, $headers);
            }
            $msg = "Congratulations, User Created successfully.";
            return $msg;
        } else {
            /*$up_sql = "UPDATE `eventer_events` SET `start_date`='$frmdate',`end_date`='$tdate',`start_time`='$start_time',`end_time`='$end_time',`title`='$title',`description`='$description',`venue`='$venue',`link`='$link',`image_alignment`='$image_alignment'";
            		if($_FILES['file']['name']!=""){ $up_sql .= ",`file`='$path'"; }
            		$up_sql .=  ",`status`='$status' WHERE  users_id = '$editid' ";*/
        }
        //$res_sql = $db->update_data($up_sql);
        $in_id = mysql_insert_id();
        if (count($res_sql) > 0) {
            $msg1 = "Record Updated Successfully.";
            return $msg1;
        }
    }
         $dataUsername = array("username" => $username);
         $sqlUsername = "******";
         $resultUsername = $connection2->prepare($sqlUsername);
         $resultUsername->execute($dataUsername);
     } catch (PDOException $e) {
         $gotUsername = false;
         print "<div class='error'>" . $e->getMessage() . "</div>";
     }
     if ($resultUsername->rowCount() == 0 and $gotUsername == true) {
         $continueLoop = FALSE;
     } else {
         $username = $usernameBase . $count;
     }
     $count++;
 }
 $password = randomPassword(8);
 $salt = getSalt();
 $passwordStrong = hash("sha256", $salt . $password);
 if ($continueLoop == FALSE) {
     $insertOK = true;
     try {
         $data = array("username" => $username, "passwordStrong" => $passwordStrong, "passwordStrongSalt" => $salt, "title" => $row["parent2title"], "surname" => $row["parent2surname"], "firstName" => $row["parent2firstName"], "preferredName" => $row["parent2preferredName"], "officialName" => $row["parent2officialName"], "nameInCharacters" => $row["parent2nameInCharacters"], "gender" => $row["parent2gender"], "parent2languageFirst" => $row["parent2languageFirst"], "parent2languageSecond" => $row["parent2languageSecond"], "citizenship1" => $row["parent2citizenship1"], "nationalIDCardNumber" => $row["parent2nationalIDCardNumber"], "residencyStatus" => $row["parent2residencyStatus"], "visaExpiryDate" => $row["parent2visaExpiryDate"], "email" => $row["parent2email"], "phone1Type" => $row["parent2phone1Type"], "phone1CountryCode" => $row["parent2phone1CountryCode"], "phone1" => $row["parent2phone1"], "phone2Type" => $row["parent2phone2Type"], "phone2CountryCode" => $row["parent2phone2CountryCode"], "phone2" => $row["parent2phone2"], "profession" => $row["parent2profession"], "employer" => $row["parent2employer"], "parent2fields" => $row["parent2fields"]);
         $sql = "INSERT INTO gibbonPerson SET username=:username, password='', passwordStrong=:passwordStrong, passwordStrongSalt=:passwordStrongSalt, gibbonRoleIDPrimary='004', gibbonRoleIDAll='004', status='Full', title=:title, surname=:surname, firstName=:firstName, preferredName=:preferredName, officialName=:officialName, nameInCharacters=:nameInCharacters, gender=:gender, languageFirst=:parent2languageFirst, languageSecond=:parent2languageSecond, citizenship1=:citizenship1, nationalIDCardNumber=:nationalIDCardNumber, residencyStatus=:residencyStatus, visaExpiryDate=:visaExpiryDate, email=:email, phone1Type=:phone1Type, phone1CountryCode=:phone1CountryCode, phone1=:phone1, phone2Type=:phone2Type, phone2CountryCode=:phone2CountryCode, phone2=:phone2, profession=:profession, employer=:employer, fields=:parent2fields";
         $result = $connection2->prepare($sql);
         $result->execute($data);
     } catch (PDOException $e) {
         $insertOK = false;
         print "<div class='error'>" . $e->getMessage() . "</div>";
     }
     if ($insertOK == true) {
         $failParent2 = FALSE;
Exemplo n.º 6
0
$user = $_SESSION['user'];
function randomPassword()
{
    // Courtesy of Neil from StackOverflow
    $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ";
    $pass = array();
    $alphaLength = strlen($alphabet) - 1;
    for ($i = 0; $i < 8; $i++) {
        $n = rand(0, $alphaLength);
        $pass[] = $alphabet[$n];
    }
    return implode($pass);
}
$passQry = "SELECT pass FROM `players` WHERE username = '******'";
if (!mysqli_query($link, $passQry)) {
    $pass = randomPassword();
    if (!isset($_SESSION['pass'])) {
        $_SESSION['pass'] = $pass;
    }
} else {
    $result = mysqli_query($link, $passQry);
    $r = mysqli_fetch_array($result);
    $pass = $r['pass'];
    if (!isset($_SESSION['pass'])) {
        $_SESSION['pass'] = $pass;
    }
}
$tz = $_SESSION['tz'];
$plyQry = "SELECT * FROM `players` WHERE username = '******'";
$result = mysqli_query($link, $plyQry);
$r2 = mysqli_fetch_array($result);
Exemplo n.º 7
0
function randomPassword()
{
    global $wpdb;
    $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";
    $pass = array();
    //remember to declare $pass as an array
    $alphaLength = strlen($alphabet) - 1;
    //put the length -1 in cache
    for ($i = 0; $i < 10; $i++) {
        $n = rand(0, $alphaLength);
        $pass[] = $alphabet[$n];
    }
    $pass = implode($pass);
    $query = $wpdb->query("select * from `" . $wpdb->prefix . "optins` where `unique_id` = '" . $pass . "' || `optin_unique` == '" . $pass . "'");
    if ($query) {
        randomPassword();
    } else {
        return $pass;
    }
}
Exemplo n.º 8
0
<?php

require_once "core/util.php";
$randomStr = randomPassword(16);
setcookie("xsrftoken", $randomStr, time() + 86400 * 30, "/");
// 86400 = 1 day
?>
<!DOCTYPE html>
<!-- saved from url=(0049)http://foundation.zurb.com/templates/sidebar.html -->
<html class=" js flexbox flexboxlegacy canvas canvastext webgl no-touch geolocation postmessage websqldatabase indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients cssreflections csstransforms csstransforms3d csstransitions fontface generatedcontent video audio localstorage sessionstorage webworkers applicationcache svg inlinesvg smil svgclippaths" lang="en" data-useragent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2209.0 Safari/537.36"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simple LDAP Manager</title>
<meta name="description" content="LDAP Self-Service Tool, used internally at Lucid Software">
<meta name="author" content="Naysayers">
<link rel="stylesheet" href="css/foundation.css">
<script src="js/vendor/modernizr.js"></script>
<link rel="stylesheet" href="css/app.css">
<link rel="stylesheet" href="css/jquery.dataTables.min.css">
<link rel="stylesheet" href="css/dataTables.foundation.css">
<meta class="foundation-data-attribute-namespace"><meta class="foundation-mq-xxlarge"><meta class="foundation-mq-xlarge-only"><meta class="foundation-mq-xlarge"><meta class="foundation-mq-large-only"><meta class="foundation-mq-large"><meta class="foundation-mq-medium-only"><meta class="foundation-mq-medium"><meta class="foundation-mq-small-only"><meta class="foundation-mq-small"><style></style><meta class="foundation-mq-topbar"></head>
<body>
<?php 
include "topnav.phtml";
?>
<div>
  <div id="notify" class = "row">
   
  </div>
  <div class = "large-12 small-12 columns" style="width:100%; height:100%;display:table">
  <div class="row" >
function addCacheToCacheCandidate($cacheId, $ptId)
{
    $linkCode = randomPassword(50);
    $q = "INSERT INTO `PowerTrail_cacheCandidate`(`PowerTrailId`, `cacheId`, `link`, `date`) VALUES (:1,:2,:3,NOW())";
    $db = \lib\Database\DataBaseSingleton::Instance();
    $db->multiVariableQuery($q, $ptId, $cacheId, $linkCode);
    require_once 'sendEmailCacheCandidate.php';
    emailCacheOwner($ptId, $cacheId, $linkCode);
    print 'cache added as cache candidate';
    exit;
}
Exemplo n.º 10
0
					<?php 
// add user
$checkfitbitid = mysql_query("SELECT * FROM users WHERE FitbitID = '" . $xml->user->encodedId . "'");
if (mysql_num_rows($checkfitbitid) == 1) {
    $UsernameQuery = mysql_query("SELECT `IFTTTUsername` FROM `users` WHERE `FitbitID` LIKE '" . $xml->user->encodedId . "'");
    $PasswordQuery = mysql_query("SELECT `IFTTTPassword` FROM `users` WHERE `FitbitID` LIKE '" . $xml->user->encodedId . "'");
    echo "<h1>Welcome Back " . $xml->user->displayName . "</h1>";
    echo "<p>Below are your IFTTT wordpress details:</p>";
    echo "<p>Blog URL:<code>" . $iftttBlogUrl . "</code></p>";
    echo "<p>Username:<code>" . mysql_result($UsernameQuery, 0) . "</code></p>";
    echo "<p>Password:<code>" . mysql_result($PasswordQuery, 0) . "</code></p>";
    echo '<p><a href="' . $iftttBlogUrl . '/logout.php">Logout</a></p>';
} else {
    $IFTTTPassword = randomPassword();
    while (true) {
        $IFTTTUsername = randomPassword();
        $IFTTTUsernameCheckQuery = mysql_query("SELECT `IFTTTUsername` FROM `users` WHERE `IFTTTUsername` = '" . $IFTTTUsername . "'");
        if (mysql_num_rows($IFTTTUsernameCheckQuery) < 1) {
            break;
        }
    }
    $registerquery = mysql_query("INSERT INTO users (`FitbitID`, `FitbitName`, `FitbitAvatar`, `IFTTTUsername`, `IFTTTPassword`,`FitBitToken`,`FitBitSecret`) VALUES('" . $xml->user->encodedId . "', '" . $xml->user->displayName . "','" . $xml->user->avatar . "','" . $IFTTTUsername . "','" . $IFTTTPassword . "','" . $_SESSION['token'] . "', '" . $_SESSION['secret'] . "')");
    if ($registerquery) {
        echo "<h1>Welcome " . $xml->user->displayName . "</h1>";
        echo "<p>Your account was successfully created.</p>";
        echo "<p>Below are your IFTTT wordpress details:</p>";
        echo "<p>Blog URL:<code>" . $iftttBlogUrl . "</code></p>";
        echo "<p>Username:<code>" . $IFTTTUsername . "</code></p>";
        echo "<p>Password:<code>" . $IFTTTPassword . "</code></p>";
        echo '<p><a href="' . $iftttBlogUrl . '/logout.php">Logout</a></p>';
        //create table for user activities
Exemplo n.º 11
0
 public function createUser()
 {
     $user = new User();
     $password = randomPassword();
     $email = Input::get('email');
     $user->username = Input::get('username');
     $user->email = Input::get('email');
     $user->password = $password;
     $user->password_confirmation = $password;
     $user->partner_id = Auth::user()->id;
     $user->save();
     $data = array('password' => $password, 'email' => $user->email);
     Mail::send('emails.pcreate', $data, function ($message) use($email) {
         $message->from('*****@*****.**', 'festic');
         $message->to($email);
     });
     return Redirect::to('users')->with('message', 'Account created');
 }
Exemplo n.º 12
0
            //Set the user's new password
            $req = "UPDATE `Users` SET  `password` = '{$password}' WHERE `email` = '{$email2}'";
            $result = $conn->query($req);
            //Set the key to expired
            $req = "UPDATE `LostPassword` SET `Expiry`=0 WHERE `Code` = '{$key}'";
            $result = $conn->query($req);
            echo "<div class=\"alert alert-success\" role=\"alert\">Your new password has been sent to your email, you may now login using it.</div>";
        } else {
            echo "<div class=\"alert alert-danger\" role=\"alert\">The key you have does not exist or is expired, if you think this is an error please email support@mmsquiz.com.</div>";
        }
        $conn->close();
    }
}
//Entered email for password recovery
if ($email != '') {
    $key = randomPassword(32);
    // Create connection
    $conn = new mysqli($servername, $username, $password, $dbname);
    // Check connection
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
    $req = "SELECT * FROM `Users` WHERE `email` = '{$email}'";
    $result = $conn->query($req);
    if ($result->num_rows > 0) {
        //INSERT KEY
        $expire = time() + 3600;
        $req = "INSERT INTO `LostPassword`(`Email`, `Code`, `Expiry`) VALUES ('{$email}','{$key}', {$expire})";
        $result = $conn->query($req);
        //SEND Them KEY to unlock
        $to = $email;
Exemplo n.º 13
0
								<div class="col-md-6 inputGroupContainer">
									<div class="input-group">
									<input type="text" name="id_psn" id="id_psn" class="form-control" value="<?php 
echo $NoUrut;
?>
" placeholder="ID Pasien..">
									<span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
									</div>
								</div>
						</div>
						<div class="form-group">
							<label class="col-md-3 control-label">Kata Sandi</label>
								<div class="col-md-6 inputGroupContainer">
									<div class="input-group">
									<input type="text" name="pass_psn" id="pass_psn" class="form-control" value="<?php 
echo randomPassword();
?>
" placeholder="Kata Sandi..">
									<span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>
									</div>
								</div>
						</div>
						<div class="form-group">
							<label class="col-md-3 control-label" id="captchaOperation"></label>
								<div class="col-md-3 inputGroupContainer">
									<input type="text" class="form-control" name="captcha" />
								</div>
						</div>
						<div class="form-group">
							<div class="col-md-offset-3 col-md-9">
								<button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-log-in"></span>&nbsp Daftar</button>
Exemplo n.º 14
0
    // function untuk membuat password random 6 digit karakter
    $digit = 6;
    $karakter = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789";
    srand((double) microtime() * 1000000);
    $i = 0;
    $pass = "";
    while ($i <= $digit - 1) {
        $num = rand() % 32;
        $tmp = substr($karakter, $num, 1);
        $pass = $pass . $tmp;
        $i++;
    }
    return $pass;
}
// membuat password baru secara random -> memanggil function randomPassword
$newPassword = randomPassword();
// perlu dibuat sebarang pengacak
$pengacak = "AJWKXLAJSCLWLW";
// mengenkripsi password dengan md5() dan pengacak
$newPasswordEnkrip = md5($pengacak . md5($newPassword) . $pengacak);
// membuat password baru secara random -> memanggil function randomPassword
$isi_pesan = "Username : {$username}, Pass :{$newPassword}";
$masuk = mysql_query("insert into outbox (InsertIntoDB,SendingDateTime,DestinationNumber,TextDecoded,SendingTimeOut,DeliveryReport,CreatorID)\n\t\tvalues (sysdate(),sysdate(),'{$nohp}','{$isi_pesan}',sysdate(),'yes','system')");
if ($masuk) {
    $edituser = mysql_query("UPDATE user SET\n\t\t\t\t\t\t\tpassword='******'\n                                                        \n                                                        \tWHERE iduser='******'");
    if ($edituser) {
        echo "<h4> Simpan Password baru berhasil </h4>";
    } else {
        echo "<h4> Simpan Password baru gagal </h4>";
    }
    echo "<h4> Pesan Dikirim Ke No HP anda {$nohp} </h4><br/>";
Exemplo n.º 15
0
 <?php  
} 
}
 ?>
 </form>

 
 <!--<div class="bkgd-stripes-orange">&nbsp;</div>-->
 <div class="inPageCartBlock" style="color:#5C5C5C;font-weight:bold;font-size:18px;margin-top:10px;padding-right:0px;">

 Current Order Total : $<span id="" class="total_order" style="font-size: 18px;font-weight:bold;"><?php if($_SESSION['session_order'] == ''){if($_GET['sub'] !=''){ echo $_GET['sub'];}else{ ?><?php if($_REQUEST['all_total'] != ''){echo number_format($_REQUEST['all_total'], 2, '.','');}else{ ?>0.00<?php } } }else{echo number_format($_SESSION['session_order'], 2, '.','');}?></span>
     <input type="hidden" class="total_order_txt" id="total_order_val" name="all_total" value="<?php if($_SESSION['session_order'] == ''){echo ($_GET['sub'] != '') ? $_GET['sub'] : $_REQUEST['all_total'];}else{echo number_format($_SESSION['session_order'], 2, '.','');} ?>"/>
 
 </div>
 <?php $select_customer = SupplyCustomer(); 
       $supply_usr_rand =randomPassword(); 
       $sele_usr_conti_shop = SupplyUsrContShopp($_SESSION['supply_comp_id'],$_SESSION['supply_usr_id']);
       $state_all = StateAll();
 ?>
 <input type="hidden" id="supply_usr_rand" name="supply_usr_rand" value="<?php echo $supply_usr_rand; ?>" />
 <input type="hidden" id="usr_id" name="usr_id" value="<?php echo $_GET['usr_id']; ?>" />
 <input type="hidden" id="new_user_session" name="new_user_session" value="<?php echo $_SESSION['new_user_session']; ?>" />
 <!--<div style="margin-bottom:0;" class="bkgd-stripes-orange">&nbsp;</div>-->
 <div style="clear:both;"></div>
 <div id="login_window">    	
        <div class="close"></div>
       	<span class="ecs_tooltip">Press Esc to close <span class="arrow"></span></span>
        <div id="popup_content" class="supply_login"> <!--your content start-->
                <h1>Select Customer</h1>
                <span id="alert_msg" style="color:#FF0000;font-size: 12px;"></span>
                <ul>
Exemplo n.º 16
0
function uniqueBookingnumber()
{
    do {
        $_SESSION['PWD'] = randomPassword();
        $num = querySQL('check_unique_id');
    } while ($num >= 1);
    return $_SESSION['PWD'];
}
<?php

require_once 'template/header.php';
require_once 'template/navigation.php';
if (isset($_GET['reset'])) {
    $newsecret = randomPassword();
    $sql = "UPDATE `{$db_data}`.`users` SET `ics_secret` = '{$newsecret}' WHERE `users`.`userid` = " . $_SESSION['userid'];
    if (!mysqli_query($con, $sql)) {
        die("Err");
    }
}
if (isset($_GET['disable'])) {
    $sql = "UPDATE `{$db_data}`.`users` SET `ics_secret` = '' WHERE `users`.`userid` = " . $_SESSION['userid'];
    if (!mysqli_query($con, $sql)) {
        die("Err");
    }
}
?>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
    <?php 
breadcrumbs('');
?>
    <h1 class="page-header"><?php 
echo $message['settings'];
?>
</h1>
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title"><?php 
echo $message['language'];
?>
Exemplo n.º 18
0
function dmn_create($dmnpid, $ip, $forcename = '')
{
    if ($forcename == '') {
        echo "Forcing {$forcename}: ";
        $newnum = intval(substr($dmnpid[count($dmnpid) - 1]['uname'], 5, 2)) + 1;
        $newuname = DMNPIDPREFIX . str_pad($newnum, 2, '0', STR_PAD_LEFT);
    } else {
        $newuname = $forcename;
        $newnum = intval(substr($forcename, -2));
    }
    if (DMNTESTNET === true) {
        $testinfo = ' Testnet';
    } else {
        $testinfo = '';
    }
    echo "Creating {$newuname}: ";
    exec('useradd -m -c "Dash$testinfo MasterNode #' . $newnum . '" -U -s /bin/false -p ' . randomPassword(128) . ' ' . $newuname . ' 1>/dev/null 2>/dev/null', $output, $retval);
    if ($retval != 0) {
        echo "Already exists!\n";
        if ($forcename == '') {
            die;
        }
    } else {
        echo "retval={$retval}\n";
    }
    echo "Generating dash.conf";
    mkdir("/home/{$newuname}/.dashcore");
    touch("/home/{$newuname}/.dashcore/dash.conf");
    chmod("/home/{$newuname}/.dashcore", 0700);
    chmod("/home/{$newuname}/.dashcore/dash.conf", 0600);
    $conflist = array('server=1', 'rpcuser='******'rpc', 'rpcpassword='******'alertnotify=echo %s | mail -s "Dash MasterNode #' . str_pad($newnum, 2, '0', STR_PAD_LEFT) . ' Alert" somebody@mowhere.blackhole', 'rpcallowip=127.0.0.1', "bind={$ip}", 'rpcport=' . (intval($newnum) + DMNCTLRPCPORTVAL) . '998', 'masternode=0', "externalip={$ip}", '#mnctlcfg#enable=1');
    if (DMNTESTNET === true) {
        $conflist[] = 'testnet=1';
    }
    $dashconf = implode("\n", $conflist);
    file_put_contents("/home/{$newuname}/.dashcore/dash.conf", $dashconf);
    echo "OK\n";
    echo "Setting ACL";
    if (file_exists("/home/{$newuname}/.bash_history")) {
        chmod("/home/{$newuname}/.bash_history", 0600);
    }
    chmod("/home/{$newuname}/.bashrc", 0600);
    chmod("/home/{$newuname}/.profile", 0600);
    chmod("/home/{$newuname}/.bash_logout", 0600);
    chmod("/home/{$newuname}/", 0700);
    chown("/home/{$newuname}/.dashcore/", $newuname);
    chgrp("/home/{$newuname}/.dashcore/", $newuname);
    chown("/home/{$newuname}/.dashcore/dash.conf", $newuname);
    chgrp("/home/{$newuname}/.dashcore/dash.conf", $newuname);
    echo "OK\n";
    echo "Add to /etc/network/interfaces\n";
    echo "        post-up /sbin/ifconfig eth0:{$newnum} {$ip} netmask 255.255.255.255 broadcast {$ip}\n";
    echo "        post-down /sbin/ifconfig eth0:{$newnum} down\n";
}
Exemplo n.º 19
0
     // takie estq
     exit('<p>логин или емайл или имя уже заняты</p>');
 }
 # esli vse harasho, shifranem parolq
 $pass3 = $pass;
 $pass = md5($pass);
 // registriruem
 $time = time();
 // kod aktivacii:
 function randomPassword($length)
 {
     $pass = md5(microtime());
     $pass = substr($pass, 0, $length);
     return $pass;
 }
 $actcode = randomPassword(6);
 // shlem ego na email
 $header = 'Content-Type: text/html; charset=utf-8\\n';
 $header .= ' Content-Transfer-Encoding: quoted-printable\\n';
 $msg = "Здравствуйте! Вы толькочто успешно зарегистрировались в онлайн игре Забытая История!\n Для окончания регистрации зайдите в игру и введите там код: " . $actcode . " . Приятной игры!";
 $msg .= "<br/><br/>Zdravstvujte! Vy tolqkochto uspeshno zaregistrirovalisq v onlajn igre Zabytaja Istorija! Dlja okonchanija registracii zajdite v igru i vvedite tam kod: " . $actcode . " . Prijatnoj igry!";
 $a = mysql_query("INSERT INTO players VALUES (0, '" . $login . "', '" . $pass . "', '" . $email . "', '" . $gender . "', '" . $age . "', '0', '100', '1|0|1600|1|0|178|1|1', '2|2|1|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0', '0', '0', '100|100', '100|100', '15', 'location|location', '" . $time . "|" . $time . "|" . $time . "|" . $time . "|" . $time . "|" . $time . "|" . $time . "|" . $time . "|" . $time . "', '', '01000', '0', '0', '0', '11111100111111111111', '<p>для того, чтоб говорить, нажмите на ник игрока/нпц</p>', '', '', '000000000000000000000000000000000000000000000000000000000', '', '', '', '', '', '" . $time . "', '0', '0', '0', '0', '" . $actcode . "', '" . $name . "', '|||||||||', '0', '0', '000000000000000000000000000000000000000000000000000000000000000000000', NOW(), '0', '0', '0', '0', '0');", $dbcnx);
 if ($a) {
     $q = mysql_query("SELECT id_player FROM players WHERE login = '******';", $dbcnx);
     $id = mysql_result($q, 0);
     mysql_query("INSERT INTO anketa VALUES (0, '" . $id . "', '', '', '', '', '');", $dbcnx);
     // otpravljaem:
     //mail ($email, 'zi-online registration', $msg, $header);
     // vse horosho. poprivetstvuem i otpravim dalqshe
     $f = gen_sheader('регистрация 2');
     $f .= '<div class="y" id="ioty">Ваши данные приняты!</div><div class="n" id="wt743t">';
Exemplo n.º 20
0
        }
        function randomPassword()
        {
            $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";
            $pass = array();
            //remember to declare $pass as an array
            $alphaLength = strlen($alphabet) - 1;
            //put the length -1 in cache
            for ($i = 0; $i < 8; $i++) {
                $n = rand(0, $alphaLength);
                $pass[] = $alphabet[$n];
            }
            return implode($pass);
            //turn the array into a string
        }
        $res = randomPassword();
        $to = $identify;
        $subject = "Account Notification";
        $msg = "Good Day {$f} {$m} {$s}!!!, Your password In Online Grading System For Integrated School of Online Grading Assistant with Mobile Inquiry System - ARASOF Nasugbu has been reset, This is Your Username : {$u} and New Password : {$res} . Thank You!!!";
        $from = "Online Grading Assistant with Mobile Inquiry Systemlab Information System";
        mail($to, $subject, $msg, $from);
        $res2 = md5($res);
        mysql_query("update tbl_faculty set password='******',sans='M',sque='M',con_pass='******',status='1' where e_add='{$identify}'") or die(mysql_error());
        $_SESSION['x'] = 1;
        exit(header("location:forgot_faculty.php"));
    }
} else {
    $username = mysql_query("select *from tbl_faculty where username='******' and daccnt=0") or die(mysql_error());
    $eid = mysql_query("select *from tbl_faculty where e_id='{$identify}' and daccnt=0") or die(mysql_error());
    $eadd = mysql_query("select *from tbl_faculty where e_add='{$identify}' and daccnt=0") or die(mysql_error());
    if (mysql_num_rows($username) == 1) {
Exemplo n.º 21
0
function writeForm($table = '')
{
    // rather than recursively calling query, insert all rows with one query
    global $general, $global_basedir, $settings;
    $_SESSION['errors'] = array();
    // prepare POST data for storage in database:
    // $keys
    // $values
    if ($table) {
        $keys = array();
        $values = array();
        $i = 1;
        // prepare day offs
        if ($table == 'outlets') {
            $dayoffs = '';
            for ($i = 1; $i <= 7; $i++) {
                $field = "outlet_closeday_" . $i;
                if (isset($_POST[$field])) {
                    $dayoffs .= $_POST[$field] . ",";
                }
            }
            if ($dayoffs != '') {
                $dayoffs = substr($dayoffs, 0, -1);
            }
            $keys[$i] = 'outlet_closeday';
            $values[$i] = "'" . $dayoffs . "'";
            $i++;
        }
        // prepare arrays for database query
        foreach ($_POST as $key => $value) {
            if ($key == 'saison_start_month' || $key == 'saison_start_day' || $key == 'saison_end_month' || $key == 'saison_end_day') {
                $saison_start = $_POST['saison_start_month'] . $_POST['saison_start_day'];
                $saison_end = $_POST['saison_end_month'] . $_POST['saison_end_day'];
            } else {
                if ($key == 'password') {
                    if ($value != "EdituseR") {
                        $keys[$i] = $key;
                        $dbAccess = array('dbHost' => $settings['dbHost'], 'dbName' => $settings['dbName'], 'dbUser' => $settings['dbUser'], 'dbPass' => $settings['dbPass'], 'dbPort' => $settings['dbPort']);
                        $insert = new flexibleAccess('', $dbAccess);
                        $password = $insert->hash_password($value);
                        $values[$i] = "'" . $password . "'";
                    }
                } else {
                    if ($key == 'outlet_child_capacity') {
                        // make value always positive
                        $keys[$i] = $key;
                        $values[$i] = "'" . abs($value) . "'";
                    } else {
                        if ($key == 'outlet_child_capacity') {
                            // make value always positive
                            $keys[$i] = $key;
                            $values[$i] = "'" . $value . "'";
                        } else {
                            if ($key == 'role') {
                                if ($value < 1 || $value > 6) {
                                    $value = 6;
                                }
                                // add role field
                                $keys[$i] = $key;
                                $values[$i] = "'" . $value . "'";
                            } else {
                                if ($key == 'contactform_color_scheme' || $key == 'contactform_background') {
                                    // settings table correct HEX color code
                                    $keys[$i] = $key;
                                    $values[$i] = "'" . substr($value, 1, 8) . "'";
                                } else {
                                    if ($key != "action" && $key != "email_type" && $key != "password2" && $key != "eventID" && $key != "e_datepicker" && $key != "ev_datepicker" && $key != "s_datepicker" && $key != "MAX_FILE_SIZE" && $key != "propertyID" && $key != "token" && $key != "verify" && $key != "PHPSESSID" && $key != "new" && substr($key, 0, 15) != "outlet_closeday") {
                                        // all other 'normal fields'
                                        $keys[$i] = $key;
                                        $values[$i] = "'" . $value . "'";
                                    }
                                }
                            }
                        }
                    }
                }
            }
            $i++;
        }
        // END foreach $_POST
        // build webform field on outlets
        if ($table == 'outlets') {
            $index = array_search('webform', $keys);
            if (!$index) {
                $keys[] = 'webform';
                $values[] = 0;
            }
        }
        // build outofill field on users
        if ($table == 'plc_users') {
            $index = array_search('autofill', $keys);
            if (!$index) {
                $keys[] = 'autofill';
                $values[] = 0;
            }
        }
        // img & logo upload
        // =-=-=-=-=-=
        // img upload
        if ($_FILES['img']['error'][0] > 0) {
            $_SESSION['errors'][] = _sorry;
        } else {
            if (($_FILES['img']["type"][0] == "image/gif" || $_FILES['img']["type"][0] == "image/jpeg" || $_FILES['img']["type"][0] == "image/png") && $_FILES['img']["size"][0] < 2000000) {
                //$imgName 	  = $_FILES['img_logo']['name'];
                $img_type = substr($_FILES['img']["type"][0], 6);
                $imgName = randomPassword(24, true, true, false) . "." . $img_type;
                $uploadpath = substr(dirname(__FILE__), 0, -7);
                $result = move_uploaded_file($_FILES['img']["tmp_name"][0], "../uploads/img/" . $imgName);
                $keys[] = 'img_filename';
                $values[] = "'" . $imgName . "'";
            }
        }
        // logo upload
        if ($_FILES['img']['error'][1] > 0) {
            $_SESSION['errors'][] = _sorry;
        } else {
            if (($_FILES['img']["type"][1] == "image/gif" || $_FILES['img']["type"][1] == "image/jpeg" || $_FILES['img']["type"][1] == "image/png") && $_FILES['img']["size"][1] < 2000000) {
                //$imgName 	  = $_FILES['img_logo']['name'];
                $img_type = substr($_FILES['img']["type"][1], 6);
                $imgName = randomPassword(24, true, true, false) . "." . $img_type;
                $uploadpath = substr(dirname(__FILE__), 0, -7);
                $result = move_uploaded_file($_FILES['img']["tmp_name"][1], "../uploads/logo/" . $imgName);
                $keys[] = 'logo_filename';
                $values[] = "'" . $imgName . "'";
            }
        }
        $_SESSION['reservation_date'] = date('Y-m-d', $reservation_date);
        $_SESSION['recurring_date'] = date('Y-m-d', $recurring_date);
        // outlets build start and enddate
        if ($saison_start != '' && $saison_end != '') {
            $keys[] = 'saison_start';
            $values[] = "'" . $saison_start . "'";
            $keys[] = 'saison_end';
            $values[] = "'" . $saison_end . "'";
        }
        // =-=-=-=Store in database =-=-=-=-=-=-=-=-=-=-=-=-=-=-=
        // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
        // No reservation, everything else to store
        // enter into database
        // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
        // number of database fields
        $max_keys = count($keys);
        $query = "INSERT INTO `{$table}` (" . implode(',', $keys) . ") VALUES (" . implode(',', $values) . ") ON DUPLICATE KEY UPDATE ";
        // Build 'on duplicate' query
        for ($i = 1; $i <= $max_keys; $i++) {
            if ($keys[$i] != '') {
                $query .= $keys[$i] . "=" . $values[$i] . ",";
            } else {
                $max_keys++;
            }
        }
        // run sql query
        $query = substr($query, 0, -1);
        //DEbugging
        //echo $query;
        $result = query($query);
        $new_id = mysql_insert_id();
        // Set STANDARD settings for new property
        if ($table == 'properties' && $_POST['new'] == 1) {
            include 'register/standard_settings.inc.php';
        }
        // -----
        return $new_id;
    }
}
Exemplo n.º 22
0
 // On lance la création d'un mot de passe
 function randomPassword()
 {
     $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";
     $pass = array();
     //remember to declare $pass as an array
     $alphaLength = strlen($alphabet) - 1;
     //put the length -1 in cache
     for ($i = 0; $i < 8; $i++) {
         $n = rand(0, $alphaLength);
         $pass[] = $alphabet[$n];
     }
     return implode($pass);
     //turn the array into a string
 }
 $form['pass'] = randomPassword();
 // On hash le mot de passe
 $form['pass_sec'] = password_hash($form['pass'], PASSWORD_BCRYPT);
 // On enregistre les informations
 $link = Configuration::read('db.core');
 $client = Configuration::read('ini')['LEQG']['compte'];
 $query = $link->prepare('INSERT INTO `user` (`client`, `email`, `password`, `firstname`, `lastname`, `auth_level`) VALUES (:client, :email, :pass, :first, :last, :auth)');
 $query->bindParam(':client', $client);
 $query->bindParam(':email', $form['email']);
 $query->bindParam(':pass', $form['pass_sec']);
 $query->bindParam(':first', $form['prenom']);
 $query->bindParam(':last', $form['nom']);
 $query->bindParam(':auth', $form['selectAuth']);
 $query->execute();
 // On lance l'envoi du mail avec les informations de connexion
 $email = file_get_contents('tpl/mail/user-creation.tpl.html');
Exemplo n.º 23
0
<?php

require_once 'template/header.php';
require_once 'template/navigation.php';
if (isset($_POST['adduser']) && UserCan('create_user')) {
    $username = $_POST['firstname'] . $_POST['lastname'];
    $username = strtolower($username);
    $passwd = randomPassword();
    $addr = str_replace('users.php', '', $_SERVER['SCRIPT_NAME']);
    $body = "Hallo " . $_POST['firstname'] . " " . $_POST['lastname'] . ",\n";
    $body .= "Sie wurden als Nutzer hinzugefügt. \n";
    $body .= "Ihr Nutzername lautet: {$username}\n";
    $body .= "Ihr Passwort lautet: {$passwd}\n";
    $body .= "Bitte ändern Sie es bei nächster Möglichkeit.\n";
    $body .= "Die URL zum Tool lautet: " . $_SERVER['SERVER_ADDR'] . $addr;
    $passwd = hash('sha512', $passwd);
    $sql = "INSERT INTO `{$db_data}`.`users` (`userid` , `username`, `groupid` , `email` , `lastname` , `firstname` , `description`, `passwd`)\n    VALUES (NULL , '" . $username . "' , '" . $_POST['groupid'] . "' ,'" . $_POST['email'] . "', '" . $_POST['lastname'] . "', '" . $_POST['firstname'] . "' , '" . $_POST['description'] . "' , '" . $passwd . "')";
    if (mysqli_query($con, $sql)) {
        smtpmailer($_POST['email'], 'Du wurdest als Nutzer angelegt', $body);
    }
}
$result = mysqli_query($con, "SELECT * FROM users");
if (!UserCan('show_users')) {
    $error = "<div class=\"col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main\">";
    $error .= "<div class=\"alert alert-danger\" role=\"alert\">";
    $error .= "Fehler, Du hast nicht die benötigten Recht um Nutzer anzuzeigen.";
    $error .= "</div>";
    $error .= "</div>";
    die($error);
}
?>
Exemplo n.º 24
0
function start_batch($batch)
{
    $users = get_users();
    $date = create_date();
    $batch = (int) $batch;
    foreach ($users as $user) {
        $password = randomPassword();
        $hashed_password = password_hash($password, PASSWORD_DEFAULT);
        $id = (int) $user['ID'];
        mysql_query("UPDATE user SET Password = '******' WHERE ID = {$id}");
        $reviewer = (int) $user['ID'];
        $reviewee = (int) $user['ID'];
        mysql_query("INSERT INTO poll (Reviewer, Reviewee, Status, Time_Created, Last_Update, Batch) VALUES ({$reviewer}, {$reviewee} , (SELECT ID FROM poll_status WHERE Name = 'Niet Ingevuld'), '{$date}', '{$date}', {$batch})");
        echo mysql_error();
        $to = $user['Email'];
        $toName = $user['Firstname'] . " " . $user['Lastname'];
        $subject = get_text('Title') . ': ' . get_text('Start_phase_1');
        $message = get_text('Dear') . ' ' . $user['Firstname'] . "," . get_text('Mail_phase_1') . get_text('Username') . ": " . $user['Username'] . "\n\t\t\t<br />\n\t\t\t" . get_text('Password') . ": " . $password . get_text('Mail_footer');
        mailFromProject($to, $toName, $subject, $message);
    }
    mysql_query("UPDATE batch SET Status = (SELECT ID FROM batch_status WHERE Name = 'Running1'), Running1_date = '{$date}' WHERE ID = {$batch}");
    echo mysql_error();
    header('Location: admin.php');
}
     $AI = str_pad($rowAI['Auto_increment'], 14, "0", STR_PAD_LEFT);
 }
 if ($AI == "") {
     if ($thisInvoiceFailed == FALSE) {
         $invoiceFailCount++;
         $thisInvoiceFailed = TRUE;
     }
 } else {
     //Add invoice
     //Make and store unique code for confirmation. add it to email text.
     $key = "";
     //Let's go! Create key, send the invite
     $continue = FALSE;
     $count = 0;
     while ($continue == FALSE and $count < 100) {
         $key = randomPassword(40);
         try {
             $dataUnique = array("key" => $key);
             $sqlUnique = "SELECT * FROM gibbonFinanceInvoice WHERE gibbonFinanceInvoice.`key`=key";
             $resultUnique = $connection2->prepare($sqlUnique);
             $resultUnique->execute($dataUnique);
         } catch (PDOException $e) {
         }
         if ($resultUnique->rowCount() == 0) {
             $continue = TRUE;
         }
         $count++;
     }
     if ($continue == FALSE) {
         //Fail 2
         $URL .= "&addReturn=fail2";
Exemplo n.º 26
0
$Status= $_POST['Status']               or    $Status="Status";
$Picture= $_POST['Picture']             or    $Picture="http://triplecrit.com/wp-content/themes/creativemag/images/default.png";
if (substr( $Picture, 0, 4 )==='http'){} else $Picture= "http://".$Picture;
$LastUpdated="now()";

	function randomPassword() {
	    $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";
	    $pass = array(); //remember to declare $pass as an array
	    $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
	    for ($i = 0; $i < 8; $i++) {
	        $n = rand(0, $alphaLength);
	        $pass[] = $alphabet[$n];
	    }
	    return implode($pass); //turn the array into a string
	}
$YourPass = randomPassword();

$sql = "INSERT into project (Title, Description, Professors, Link, Prereq, Contact, Status, Picture, LastUpdated, Password) 
values ('".$Title."','".$Description."','".$Professors."','".$Link."','".$Prereq."','".$Contact."','".$Status."','".$Picture."',".$LastUpdated.",'".$YourPass."')";
$stmt = $dbh->prepare( $sql );

/* execute the query */
$stmt->execute();
If($stmt)
{
Echo "<br><h3>Record successfully inserted <br><br>
Your Password: $YourPass <br><b>
Please make sure to record your password!</b></h3>
";
}
Else
Exemplo n.º 27
0
 $userid1 = getQueryData('userid1');
 $userid2 = getQueryData('userid2');
 $len = strlen($userid1);
 $base_userid = intval($userid1);
 $allcount = 0;
 for ($i = $base_userid;;) {
     if ($userid2 != null) {
         $userid = str_repeat("0", $len) . $i;
         $userid = substr($userid, -$len);
     } else {
         $userid = $userid1;
     }
     $sql = "select count(*) from tbl_user where userid=" . correctSQL($userid);
     $cnt = executeScalar($db, $sql);
     if ($cnt == 0) {
         $sql = "insert into tbl_user (userid, password, type, tel, fullname, email, identitycard, address, agentstoreid, agentempid, status, memo, flag, create_id, create_date, update_id, update_date) values (" . correctSQL($userid) . "," . correctSQL(getQueryData('password') == null ? randomPassword(8) : getQueryData('password')) . "," . correctSQL(getQueryData('type')) . "," . correctSQL(getQueryData('tel')) . "," . correctSQL(getQueryData('fullname')) . "," . correctSQL(getQueryData('email')) . "," . correctSQL(getQueryData('identitycard')) . "," . correctSQL(getQueryData('address')) . "," . correctSQL(getQueryData('agentstoreid')) . "," . correctSQL(getQueryData('agentempid')) . "," . correctSQL(getQueryData('status')) . "," . correctSQL(getQueryData('memo')) . "," . "'" . (getQueryData('vodflag') == 1 ? "1" : "0") . "'" . "," . correctSQL($login_id) . "," . "now() ," . correctSQL($login_id) . "," . "now());";
         executeSQL($db, $sql);
         $allcount++;
     }
     $i++;
     if ($userid2 == null) {
         break;
     }
     if ($i > intval($userid2)) {
         break;
     }
 }
 if ($allcount > 0) {
     responseData(true, "" . $allcount);
 } else {
     responseData(false, "User id is duplicated!");
Exemplo n.º 28
0
function forgotPassword($email)
{
    $db = new MysqliDb();
    $options = ['cost' => 12];
    $new_password = randomPassword();
    $password = password_hash($new_password, PASSWORD_BCRYPT, $options);
    $data = array('password' => $password);
    $db->where('mail', $email);
    if ($db->update('clientes', $data)) {
        $mail = new PHPMailer();
        $mail->isSMTP();
        // Set mailer to use SMTP
        $mail->Host = 'gator4184.hostgator.com';
        // Specify main and backup SMTP servers
        $mail->SMTPAuth = true;
        // Enable SMTP authentication
        $mail->Username = '******';
        // SMTP username
        $mail->Password = '******';
        // SMTP password
        $mail->SMTPSecure = 'ssl';
        // Enable TLS encryption, `ssl` also accepted
        $mail->Port = 465;
        $mail->CharSet = 'UTF-8';
        $mail->From = '*****@*****.**';
        $mail->FromName = 'UIGLP';
        $mail->addAddress($email);
        // Add a recipient
        $mail->addAddress('*****@*****.**');
        // Add a recipient
        $mail->isHTML(true);
        // Name is optional
        $mail->Subject = 'Recuperar Contraseña Hydrox';
        $mail->Body = "<table>\n    <tr><td>Te enviamos a continuación la siguiente contraseña.</td></tr>\n    <tr><td>Nueva Contraseña:</td></tr>\n    <tr><td>" . $new_password . "</td></tr>\n    <tr><td>Hydrox</td></tr>\n    <tr><td></td></tr>\n    <tr><td></td></tr>\n</table>";
        $mail->AltBody = "Nuevo Mail:" . $new_password;
        if (!$mail->send()) {
            echo 'Message could not be sent.';
            echo 'Mailer Error: ' . $mail->ErrorInfo;
        } else {
            echo 'Message has been sent';
        }
    }
}
Exemplo n.º 29
0
     header("Location: {$URL}");
 } else {
     $fail = FALSE;
     //DEAL WITH CUSTOM SOUND SETTING
     $time = time();
     //Move attached file, if there is one
     if ($_FILES['file']["tmp_name"] != "") {
         //Check for folder in uploads based on today's date
         $path = $_SESSION[$guid]["absolutePath"];
         if (is_dir($path . "/uploads/" . date("Y", $time) . "/" . date("m", $time)) == FALSE) {
             mkdir($path . "/uploads/" . date("Y", $time) . "/" . date("m", $time), 0777, TRUE);
         }
         $unique = FALSE;
         $count = 0;
         while ($unique == FALSE and $count < 100) {
             $suffix = randomPassword(16);
             $attachment = "uploads/" . date("Y", $time) . "/" . date("m", $time) . "/alarmSound_{$suffix}" . strrchr($_FILES["file"]["name"], ".");
             if (!file_exists($path . "/" . $attachment)) {
                 $unique = TRUE;
             }
             $count++;
         }
         if (!move_uploaded_file($_FILES["file"]["tmp_name"], $path . "/" . $attachment)) {
             $fail = TRUE;
         }
     } else {
         $attachment = $attachmentCurrent;
     }
     //Write setting to database
     try {
         $data = array("value" => $attachment);
Exemplo n.º 30
0
        }
        $post_meta_infos = $wpdb->get_results("SELECT meta_key, meta_value FROM {$wpdb->postmeta} WHERE post_id={$post_id}");
        if (count($post_meta_infos) != 0) {
            $sql_query = "INSERT INTO {$wpdb->postmeta} (post_id, meta_key, meta_value) ";
            foreach ($post_meta_infos as $meta_info) {
                $meta_key = $meta_info->meta_key;
                $meta_value = addslashes($meta_info->meta_value);
                $sql_query_sel[] = "SELECT {$new_post_id}, '{$meta_key}', '{$meta_value}'";
            }
            $sql_query .= implode(" UNION ALL ", $sql_query_sel);
            $wpdb->query($sql_query);
        }
        $camp_tab = $wpdb->prefix . 'campaigns';
        $campaigns = $wpdb->get_results(" SELECT * FROM {$camp_tab} WHERE {$camp_tab}.id = {$campaign_id}");
        $campaign = $campaigns[0];
        $unique = randomPassword();
        $slug = get_post($new_post_id);
        $slug = $slug->post_name;
        $camp_table = $wpdb->prefix . "campaigns";
        $insert = array("unique_id" => $unique, "post_id" => $new_post_id, "campaign_name" => $_POST['name'], "campaign_slug" => $slug, "autoresponder" => $campaign->autoresponder, "autoresponder_code" => $campaign->autoresponder_code, "include_field" => $campaign->include_field, "fb_retarget_pixel" => $campaign->fb_retarget_pixel, "source_url" => urldecode($_GET['url']), "popup_style" => $campaign->popup_style, "delay" => $campaign->delay, "closable" => $campaign->closable, "popup_details" => $campaign->popup_details, "content_headline" => $campaign->content_headline, "enable_video" => $campaign->enable_video, "video_embed_code" => $campaign->video_embed_code, "content_subheadline" => $campaign->content_subheadline, "support_email" => $campaign->support_email, "gift_url" => $campaign->gift_url, "unlock_after" => $campaign->unlock_after, "button_text" => $campaign->button_text, "page_title" => $campaign->page_title, "feature_title" => $campaign->feature_title, "feature_text" => $campaign->feature_text, "feature_image" => $campaign->feature_image, "feature_image_align" => $campaign->feature_imagealign);
        $query_insert = $wpdb->insert($camp_table, $insert);
        $camp_id = $wpdb->insert_id;
        $social_clicks = $wpdb->prefix . "clicks";
        $wpdb->query(" INSERT INTO {$social_clicks} (camp_id,slug) VALUES ({$camp_id}, '{$slug}') ");
        ?>
        <script>
       	 open('<?php 
        echo site_url();
        ?>
/wp-admin/admin.php?page=social-funnel&sf=add-compaign&edit-id=<?php 
        echo $camp_id;