Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // $_GET['do']
- // 1: add 1 to impression counter
- // 2: add 1 to click counter
- // 3: get num of impressions
- // 4: get num of clicks
- // table: customads
- // id
- // adname
- // impressions
- // clicks
- $sv_name = "localhost";
- $username = "root";
- $password = "slash112bot";
- $db_name = "customads";
- $table = "customads";
- $con = mysql_connect($sv_name, $username, $password) or die(mysql_error());
- mysql_select_db($db_name, $con) or die(mysql_error());
- $do = mysql_real_escape_string($_GET['do']);
- if ($do == 1) {
- $query = "UPDATE " . $table . " SET impressions=impressions+1 WHERE adname='dreamstar'";
- mysql_query($query, $con) or die(mysql_error());
- }
- else if ($do == 2) {
- $query = "UPDATE " . $table . " SET clicks=clicks+1 WHERE adname='dreamstar'";
- mysql_query($query, $con) or die(mysql_error());
- }
- else if ($do == 3) {
- $query = "SELECT * FROM " . $table;
- $result = mysql_query($query, $con) or die(mysql_error());
- while($row = mysql_fetch_array($result))
- {
- if ($row['adname'] == "dreamstar") {
- echo $row['impressions'];
- }
- }
- }
- else if ($do == 4) {
- $query = "SELECT * FROM " . $table;
- $result = mysql_query($query, $con) or die(mysql_error());
- while($row = mysql_fetch_array($result))
- {
- if ($row['adname'] == "dreamstar") {
- echo $row['clicks'];
- }
- }
- }
- else {
- echo "fuck off, hacker";
- }
- ?>
Add Comment
Please, Sign In to add comment