Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(-1);
- ini_set("display_errors", 1);
- $user = "root";
- $pass = "Musik4live!";
- $table = "linkcounter";
- $pdo = new PDO('mysql:host=localhost;dbname=sphinx-music' , $user, $pass);
- $stmt = $pdo->prepare("UPDATE $table SET hits = hits + 1 WHERE url = :url");
- $stmt->execute(['url' => $_GET['url']]);
- if($stmt->rowCount() == 0)
- {
- $stmt = $pdo->prepare("INSERT INTO $table (link, hits) VALUES (:url, 1)");
- $stmt->execute(['url' => $_GET['url']]);
- }
- HEADER("Location: " . $_GET['url']);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement