| Linux in-mum-web1499.main-hosting.eu 5.14.0-503.40.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Mon May 5 06:06:04 EDT 2025 x86_64 Path : /home/u901718425/public_html/php/ |
| Current File : /home/u901718425/public_html/php/signup.php |
<?php
include('../panel/globale.php');
$out = [];
if($_POST && isset($_POST['email']) && $_POST['email']!="" && isset($_POST['password']) && $_POST['password']!=""){
$email = $_POST['email'];
$pass = hash('sha512', hash('sha512',$email) +$_POST['password']);
$data['id'] = ($db->max('user') == NULL? 1 : (int)$db->max('user') + 1);
$data['email'] = $email;
$data['password'] = $pass;
$res = $db->insert('user', $data);
if($res[0] == 'success'){
$res2 = $db->read('user', ' id='.$data['id']);
if($res[0] == 'success'){
foreach ($res2[1] as $key => $value) {
if($key !="password"){
$_SESSION[ $key ] = $value;
}
setcookie('id', $res[1]['id'], time() + (86400 * 30), "/");
$out[0] = 'success';
$out[1] = 'Successfuly login';
}
}
}else{
$out[0] = 'error';
$out[1] = 'Technical Error';
$out[2] = $res;
}
}else{
$out[0] = 'error';
$out[1] = 'Please fill the fileds';
}
echo json_encode($out);
?>