#1 del record
This commit is contained in:
parent
ec58273211
commit
6ef79d7673
9
post.php
9
post.php
|
@ -7,6 +7,15 @@ try {
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Erreur : '.$e->getMessage());
|
die('Erreur : '.$e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//DELETE FROM `projetphp` WHERE `projetphp`.`login` = \'caprout\'
|
||||||
|
if(isset($_POST["userToDel"]))
|
||||||
|
{
|
||||||
|
$req = $bdd->prepare('DELETE FROM `projetphp` WHERE `projetphp`.`login`=:login');
|
||||||
|
$req->execute(array( 'login' => htmlspecialchars($_POST["userToDel"])));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//UPDATE `projetphp` SET `security_level` = '6' WHERE `projetphp`.`login` = 'aaazzze';
|
//UPDATE `projetphp` SET `security_level` = '6' WHERE `projetphp`.`login` = 'aaazzze';
|
||||||
if(isset($_POST["updatePW"], $_POST["datene"], $_POST["email"], $_POST["pw"], $_POST["sl"], $_POST["login"]))
|
if(isset($_POST["updatePW"], $_POST["datene"], $_POST["email"], $_POST["pw"], $_POST["sl"], $_POST["login"]))
|
||||||
if(preg_match('/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/', $_POST["email"]))
|
if(preg_match('/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/', $_POST["email"]))
|
||||||
|
|
49
script.js
49
script.js
|
@ -26,8 +26,57 @@ $("#allRecord").on("keyup", ".email input", function(){
|
||||||
$('div', $(this).parent()).css("display", "block");
|
$('div', $(this).parent()).css("display", "block");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||||
|
/*~~~~~~~~~~~~~~~~TR TO DEL~~~~~~~~~~~~~~~~*/
|
||||||
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||||
|
$("#allRecord").on("click", ".delUser", function() {
|
||||||
|
tr = $(this).parent().parent();
|
||||||
|
var login = "";
|
||||||
|
var sl = "";
|
||||||
|
if(tr.find("i.editUser").length !== 0)
|
||||||
|
{
|
||||||
|
sl = ltrim($('.sl', tr).html())
|
||||||
|
login = $('.login', tr).html();
|
||||||
|
}
|
||||||
|
else if(tr.find("i.confirmEditUser").length !== 0)
|
||||||
|
{
|
||||||
|
sl = $('.sl select', tr).val();
|
||||||
|
login = $('.login', tr).html();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
swal("error");
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
console.log(sl);
|
||||||
|
if(sl == "10")
|
||||||
|
{
|
||||||
|
swal( "Oops" , "You can't del user with sl 10" , "error" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
login = ltrim(login);
|
||||||
|
swal({
|
||||||
|
title: "Are you sure to del "+login+" ?",
|
||||||
|
text: "Once deleted, you will not be able to recover this!",
|
||||||
|
icon: "warning",
|
||||||
|
buttons: true,
|
||||||
|
dangerMode: true,
|
||||||
|
})
|
||||||
|
.then((willDelete) => {
|
||||||
|
if (willDelete) {
|
||||||
|
$.post("post.php", {userToDel: login}, function(){
|
||||||
|
tr.remove();
|
||||||
|
swal("Poof! "+login+" has been deleted!", {
|
||||||
|
icon: "success",
|
||||||
|
});
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||||
/*~~~~~~~~~~~~~~~~TR TO EDIT~~~~~~~~~~~~~~~~*/
|
/*~~~~~~~~~~~~~~~~TR TO EDIT~~~~~~~~~~~~~~~~*/
|
||||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||||
|
|
Loading…
Reference in New Issue