]>
Softwares of Agnibho - simpleipd.git/blob - adduser
3 $db=new SQLite3("data/data.db");
4 if(!empty($_SERVER["argv"][1]) && !empty($_SERVER["argv"][2]) && !empty($_SERVER["argv"][3])){
5 $stmt=$db->prepare("SELECT * FROM users WHERE user=:user");
6 $stmt->bindValue(":user",$_SERVER["argv"][1]);
7 if($stmt->execute()->fetchArray()){
8 $stmt=$db->prepare("UPDATE users SET usergroup=:usergroup,hash=:hash WHERE user=:user");
9 $stmt->bindValue(":user", $_SERVER["argv"][1]);
10 $stmt->bindValue(":hash", password_hash($_SERVER["argv"][3], PASSWORD_DEFAULT
));
14 $stmt=$db->prepare("INSERT INTO users (user,usergroup,hash) VALUES (:user,:usergroup,:hash)");
15 $stmt->bindValue(":user", $_SERVER["argv"][1]);
16 $stmt->bindValue(":usergroup", $_SERVER["argv"][2]);
17 $stmt->bindValue(":hash", password_hash($_SERVER["argv"][3], PASSWORD_DEFAULT
));
22 echo "Plese enter an username and password for entry into the DB\n";