Advertisement
Guest User

Untitled

a guest
Apr 8th, 2018
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  1. <?php
  2. ini_set('display_errors', '1');
  3.  
  4. $user = 'cs108';
  5. $pass = '108';
  6.  
  7. $db = new PDO('mysql:host=localhost;dbname=cs108', $user, $pass);
  8. $db->query("SET NAMES utf8");
  9.  
  10.  
  11. $option = $_POST['option'];
  12. if ($option == 'add') {
  13.     $descr  = $_POST['descr'];
  14.     $user   = $_POST['user'];
  15.     $pass   = $_POST['pass'];
  16.     $note   = $_POST['note'];
  17.     $addkey = $_POST['addkey'];
  18.  
  19.     $sql_text = "INSERT INTO passwords (descr, user, pass, note, addkey) VALUES (?, ?, ?, ?, ?)";
  20.     $st = $db->prepare($sql_text);
  21.     $st->execute(array($descr, $user, $pass, $note, $addkey)); 
  22. } else if ($option == 'del') {
  23.     #TODO: удаление записи
  24. }
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement