コード例 #1
0
ファイル: getPubLink.php プロジェクト: kostya1017/our
<?php

error_reporting(E_ALL);
ini_set('display_errors', '1');
set_time_limit(0);
//include "../includes/functions.php";
include "includes/db.php";
require_once "Objects/FunctionClass.php";
$username = isset($_GET['username']) ? $_GET['username'] : "";
$password = isset($_GET['password']) ? $_GET['password'] : "";
$ads_id = isset($_GET['ads_id']) ? $_GET['ads_id'] : "";
try {
    $functionObject = new FunctionClass('./');
    $member_id = $functionObject->getIdMembre($username, $password);
    $url = $functionObject->getPubUrl($ads_id);
    $date = date('Y-m-d', time());
    $STH = $DBH->prepare("\n\tSELECT id, clicked \n\tFROM ads_clicked \n\tWHERE ads_id = :ads_id \n\tAND date = :date \n\tLIMIT 1");
    $STH->bindParam(":ads_id", $ads_id);
    $STH->bindParam(":date", $date);
    $STH->execute();
    $STH->setFetchMode(PDO::FETCH_ASSOC);
    $row = $STH->fetch();
    if (empty($row)) {
        $STH = $DBH->prepare("\n\t\tINSERT INTO `ads_clicked` (`ads_id`, `date`) \n\t\tVALUES (:ads_id, :date) \n\t\t");
        $STH->bindParam(":ads_id", $ads_id);
        $STH->bindParam(":date", $date);
        $STH->execute();
        $tacking_id = $DBH->lastInsertId();
        $clicked = 0;
    } else {
        $tacking_id = $row['id'];