}
//If ID is not set, then exit with message
if (!isset($id)) {
    echo "E-Mail {$email} does not exist";
}
//Create a random password
$password = generateRandomString('5');
echo $password;
//Hash the password provided
$hash = encryptPassword($password);
//Save new password for user
//If already exists, then update password and if not insert record
$params = array();
$response = null;
$params = add_where('idPerson', $id, $params);
$response = select_from_table('password', 'idPerson', $params);
//echo $response;
if (empty(json_decode($response, true))) {
    //Insert
    $record = array();
    $records = array();
    $record = add_field('idPerson', $id, $record);
    $record = add_field('password', $hash, $record);
    $record = add_field('misses', "0", $record);
    $record = add_field('locked', "0", $record);
    array_push($records, $record);
    insert_into_table('password', $records);
} else {
    //Modify
    $update = array();
    $where = array();
예제 #2
0
		
			<div id="rightdiv">
			<h2 class='titleA' >Retour d'une Location</h2>
			<?php 
include './depotformulaire.php';
?>
				
			</div>
			
			<div id="bttdiv"  style='background: color;' >
			<h2 class='titleA'>test</h2>
			<?php 
if (isset($_GET['search'])) {
    if (!empty($_GET['code'])) {
        $code = $_GET['code'];
        select_from_table($code);
    }
}
?>
				
			</div>
			<div id='bottomDiv'></div>
			
			
			
		</div>
	
	</div>

</body>
</html>
<?php

require_once '..\\utilities\\functions.php';
header('Access-Control-Allow-Origin: *');
$where = array();
$table = null;
$fields = "all";
while ($value = current($_GET)) {
    $key = key($_GET);
    switch ($key) {
        case 'table':
            $table = $value;
            break;
        case 'fields':
            $fields = $value;
            break;
        default:
            $where = add_where($key, $value, $where);
            break;
    }
    next($_GET);
}
$response = select_from_table($table, $fields, $where);
echo $response;
예제 #4
0
<?php

require_once '..\\utilities\\functions.php';
header('Access-Control-Allow-Origin: *');
$where = $_get();
// List fields or define field as NULL
$fields = array("namelast", "namefirst", "email");
//$fields = null;
$response = select_from_table('person', $fields, $where);
echo $response;