Skip to content
Snippets Groups Projects
Commit bf2c99b8 authored by Christoph Zysik's avatar Christoph Zysik
Browse files

fixed ptc functions to basically work again

parent 5d4505d1
Branches
No related merge requests found
......@@ -4,7 +4,6 @@ if(!isset($_GET['data'])) exit;
require ('lib/datenbank.inc.php');
require ('lib/functions.lib.php');
require ('lib/session.lib.php');
require ('ext/ap/ads.inc.php');
list($art, $tan) = explode('-', $_GET['data']); // yeah sorry ;)
$art = base64_decode($art);
......@@ -41,5 +40,5 @@ if( $tan == $_SESSION['current_ad']['tan'] &&
</body>
</html><?php
invalidateAlreadyRunningAd();
$ptc->invalidateAlreadyRunningAd( $_SESSION['uid'], $ip );
?>
<?php
ini_set('display_errors', 1);
if(!isset($_GET['data'])) exit;
require ('lib/datenbank.inc.php');
require ('lib/functions.lib.php');
require ('lib/session.lib.php');
require ('ext/ap/ads.inc.php');
list($art, $tan) = explode('-', $_GET['data']); // yeah sorry ;)
$art = base64_decode($art);
......@@ -12,8 +12,8 @@ $tan = base64_decode($tan);
$kampdaten = $campaigns->getByTanAndType( $tan, $art );
// TODO prevent malicious ziel urls
invalidateAlreadyRunningAd();
setCurrentRunningAd( $art, $tan );
$ptc->invalidateAlreadyRunningAd( $_SESSION['uid'], $ip );
$ptc->setCurrentRunningAd( $art, $kampdaten->id, $tan );
?><!DOCTYPE html>
<html>
<head>
......
......@@ -39,7 +39,7 @@ class Campaigns
)
WHERE
`t1`.`id` = :t1cid AND
`t2`.`id` IS NULL AND
`t2`.`cid` IS NULL AND
`t1`.`menge` >= 1 AND
`t1`.`status` = 1 AND
`t1`.`sponsor` != :t1uid
......
......@@ -37,7 +37,7 @@ class Ptc
public function invalidateAlreadyRunningAd( $uid, $ip )
{
$result = false;
$zeit = time();
if( isset($_SESSION['current_ad']) )
{
$tan = ( isset($_SESSION['current_ad']['tan']) ) ? $_SESSION['current_ad']['tan'] : false;
......@@ -46,10 +46,10 @@ class Ptc
if( 0 !== $id )
{
$kamp = $this->campaigns->getById( $id );
if( 0 < $kamp['count'] )
$kamp = $this->campaigns->getIsClickableById( $id, $ip, $uid, $zeit );
if( false !== $kamp )
{
$until = time() + $kamp['data']->reload;
$until = $zeit + $kamp->reload;
$this->addCampaignToReload( $id, $uid, $ip, $until );
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment