| 34 |
header("Content-Type:application/json; charset=utf-8"); |
header("Content-Type:application/json; charset=utf-8"); |
| 35 |
|
|
| 36 |
// Validate input data |
// Validate input data |
| 37 |
if (!preg_match("/^[A-Za-z][A-Za-z0-9]{4,11}$/", $username)) |
if (!preg_match("/^[A-Za-z][A-Za-z0-9_]{4,11}$/", $username)) |
| 38 |
{ |
{ |
| 39 |
$result_set["return"]["code"] = -1; |
$result_set["return"]["code"] = -1; |
| 40 |
array_push($result_set["return"]["errorFields"], array( |
array_push($result_set["return"]["errorFields"], array( |
| 246 |
// Create new user |
// Create new user |
| 247 |
$temp_password = gen_passwd(10); |
$temp_password = gen_passwd(10); |
| 248 |
|
|
| 249 |
$sql = "INSERT INTO user_list(username, temp_password) values('$username', '$temp_password')"; |
$sql = "INSERT INTO user_list(username, temp_password) values('$username', SHA2('$temp_password', 256))"; |
| 250 |
|
|
| 251 |
$rs = mysqli_query($db_conn, $sql); |
$rs = mysqli_query($db_conn, $sql); |
| 252 |
if ($rs == false) |
if ($rs == false) |