Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header('Access-Control-Allow-Origin: *');
- $db = new PDO('mysql:host=localhost;dbname=my_db', 'my_name');
- $secret_key = "EF";
- $enc_str = "dmFyMT0wJnZhcjI9MC4wMDEmdmFyMz1FRg==";
- $dec_str = base64_decode($enc_str);
- $split = explode("&", $dec_str);
- $decoded = json_encode($split);
- echo ($decoded);
- if($secret_key == $decoded['var3'])
- {
- $sql = "REPLACE INTO Cache VALUES (:var1, :var2, :var3)"; // Create a statement
- $stmt = $db->prepare($sql);
- $stmt->bindParam(':var1', $var1, PDO::PARAM_STR);
- $stmt->bindParam(':var2', $var2, PDO::PARAM_STR);
- $stmt->bindParam(':var3', $var3, PDO::PARAM_STR);
- $var1 = $decoded['var1'];
- $var2 = $decoded['var2'];
- $var3 = $decoded['var3'];
- $stmt->execute();
- echo ' SUCCESS';
- }
- else
- {
- echo ' FAILED: Illegal use detected';
- }
- $db = NULL;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement