Advertisement
Guest User

Untitled

a guest
May 11th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.12 KB | None | 0 0
  1.         /* Written to Database, so it works */
  2.        
  3.        
  4.                           $hostDb='mysql:host=127.0.0.1;port=3306;dbname=wp';
  5.                           $user='root';
  6.                           $password='startrekonline';
  7.            
  8.                           $DBH = new PDO($hostDb, $user, $password);
  9.            
  10. $ATH = $DBH -> prepare( "SELECT content FROM wp_formcraft_b_submissions ORDER BY id DESC LIMIT 1" );
  11. $ATH -> execute();
  12. $wea = $ATH -> fetch();
  13. $zqw = $wea ["content"];
  14.                  
  15.     $zqw = stripslashes($zqw);      
  16.     //it's no longer json, its just some random non-conforming string
  17.  
  18.     $stuff = json_decode( $zqw, true );
  19.     $my_unique_id = "DEFAULT";    
  20.     $asin = $stuff[0][value];
  21.     $notes = $stuff[3][value];
  22.     $email = $stuff[4][value];
  23.     //$timeStamp = $stuff[1][value];
  24.     //$myDateTime = DateTime::createFromFormat('d-m-Y', $timeStamp);
  25.     //$newDateString = $myDateTime->format('Y-m-d');
  26.     //$timeStamp = exec("date +%s");
  27.    
  28.     $slashes = $stuff[1][value];
  29.     $ex = explode("/", $slashes);
  30.     $datetime = $ex[2].'-'.$ex[1].'-'.$ex[0];
  31.     $emaildate = $ex[1].'-'.$ex[0].'-'.$ex[2];
  32.     $active = "0";
  33.     $days = $stuff[2][value];
  34.     $lastsyntax = ' + ' . $days . ' days';
  35.     $lastday = date('Y-m-d', strtotime($datetime . $lastsyntax));
  36.     $emaillastday = date('m-d-Y', strtotime($datetime . $lastsyntax));
  37.     $hash = md5( rand(0,1000) );
  38.        
  39.          $ZTH = $DBH -> prepare("INSERT INTO asin (id, asin, notes, timeStamp, email, active, days, sekret) VALUES (:id, :asin, :notes, :timeStamp, :email, :active, :days, :sekret)");
  40.          $ZTH->bindParam(':id', $my_unique_id, PDO::PARAM_STR);
  41.          $ZTH->bindParam(':asin', $asin, PDO::PARAM_STR);
  42.          $ZTH->bindParam(':notes', $notes, PDO::PARAM_STR);
  43.          $ZTH->bindParam(':timeStamp', $datetime, PDO::PARAM_STR);
  44.          $ZTH->bindParam(':email', $email, PDO::PARAM_STR);
  45.          $ZTH->bindParam(':active', $active, PDO::PARAM_STR);
  46.          $ZTH->bindParam(':days', $lastday, PDO::PARAM_STR);
  47.          $ZTH->bindParam(':sekret', $hash, PDO::PARAM_STR);
  48.          $ZTH -> execute();
  49.          $result = $ZTH -> fetch();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement