Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Written to Database, so it works */
- $hostDb='mysql:host=127.0.0.1;port=3306;dbname=wp';
- $user='root';
- $password='startrekonline';
- $DBH = new PDO($hostDb, $user, $password);
- $ATH = $DBH -> prepare( "SELECT content FROM wp_formcraft_b_submissions ORDER BY id DESC LIMIT 1" );
- $ATH -> execute();
- $wea = $ATH -> fetch();
- $zqw = $wea ["content"];
- $zqw = stripslashes($zqw);
- //it's no longer json, its just some random non-conforming string
- $stuff = json_decode( $zqw, true );
- $my_unique_id = "DEFAULT";
- $asin = $stuff[0][value];
- $notes = $stuff[3][value];
- $email = $stuff[4][value];
- //$timeStamp = $stuff[1][value];
- //$myDateTime = DateTime::createFromFormat('d-m-Y', $timeStamp);
- //$newDateString = $myDateTime->format('Y-m-d');
- //$timeStamp = exec("date +%s");
- $slashes = $stuff[1][value];
- $ex = explode("/", $slashes);
- $datetime = $ex[2].'-'.$ex[1].'-'.$ex[0];
- $emaildate = $ex[1].'-'.$ex[0].'-'.$ex[2];
- $active = "0";
- $days = $stuff[2][value];
- $lastsyntax = ' + ' . $days . ' days';
- $lastday = date('Y-m-d', strtotime($datetime . $lastsyntax));
- $emaillastday = date('m-d-Y', strtotime($datetime . $lastsyntax));
- $hash = md5( rand(0,1000) );
- $ZTH = $DBH -> prepare("INSERT INTO asin (id, asin, notes, timeStamp, email, active, days, sekret) VALUES (:id, :asin, :notes, :timeStamp, :email, :active, :days, :sekret)");
- $ZTH->bindParam(':id', $my_unique_id, PDO::PARAM_STR);
- $ZTH->bindParam(':asin', $asin, PDO::PARAM_STR);
- $ZTH->bindParam(':notes', $notes, PDO::PARAM_STR);
- $ZTH->bindParam(':timeStamp', $datetime, PDO::PARAM_STR);
- $ZTH->bindParam(':email', $email, PDO::PARAM_STR);
- $ZTH->bindParam(':active', $active, PDO::PARAM_STR);
- $ZTH->bindParam(':days', $lastday, PDO::PARAM_STR);
- $ZTH->bindParam(':sekret', $hash, PDO::PARAM_STR);
- $ZTH -> execute();
- $result = $ZTH -> fetch();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement