Commit ebb3bb47 authored by Christoph Zysik's avatar Christoph Zysik

no popup at pay4start if on reload and popup enabled

parent 2568ea37
......@@ -47,7 +47,7 @@ class Campaigns
$sql_params = array(
':t2uid' => $uid,
':t2ip' => $ip,
':t2ip' => inet_pton($ip),
':t2until'=> $time,
':t1cid' => $cid,
':t1uid' => $uid,
......@@ -81,7 +81,7 @@ class Campaigns
$sql_params = array(
':t2uid' => $uid,
':t2ip' => $ip,
':t2ip' => inet_pton($ip),
':t2until' => $zeit,
':t1tan' => $tan,
':t1type' => $type,
......@@ -133,7 +133,7 @@ class Campaigns
$sql_params = array(
':ruid' => $uid,
':ip' => $ip,
':ip' => inet_pton($ip),
':until' => $zeit,
':ubuid' => $uid,
':wart' => $art,
......
......@@ -25,7 +25,7 @@ class Ptc
(:aip, :auid, :acid, :auntil) ON DUPLICATE KEY UPDATE
`until` = :buntil ';
$sql_params = array(
':aip' => $ip,
':aip' => inet_pton($ip),
':auid' => $uid,
':acid' => $cid,
':auntil'=> $until,
......@@ -41,7 +41,7 @@ class Ptc
(:aip, :auid, :acid, :auntil) ON DUPLICATE KEY UPDATE
`until` = :buntil ';
$sql_params = array(
':aip' => $ip,
':aip' => inet_pton($ip),
':auid' => $uid,
':acid' => $cid,
':auntil'=> $until,
......@@ -51,14 +51,34 @@ class Ptc
}
public function isCampaignInReload( $cid, $uid, $ip )
public function isCampaignInReload( $cid, $uid, $ip, $time )
{
$sql = ' COUNT(`until`) AS `c`, `until` FROM `'.DB_PREFIX.'_campaign_reloads` WHERE `until` >= :until AND ( (`uid` = :uid OR `ip` = :ip) AND `cid` = :cid ) LIMIT 1';
$sql_params = array(
':until' => $time,
':uid' => $uid,
':ip' => inet_pton($ip),
':cid' => $cid,
);
$db_result = $this->database->select( $sql, $sql_params );
$in_reload = ( isset($db_result[0]) && 0 == $db_result[0]->c ) ? false : true;
$until = ( $in_reload ) ? $db_result[0]->until : 0;
return array('in_reload' => $in_reload, 'until' => $until);
}
public function isContentInReload( $cid, $uid, $ip )
public function isContentInReload( $cid, $uid, $ip, $time)
{
$sql = ' COUNT(`until`) AS `c`, `until` FROM `'.DB_PREFIX.'_content_reloads` WHERE `until` >= :until AND ( (`uid` = :uid OR `ip` = :ip) AND `cid` = :cid ) LIMIT 1';
$sql_params = array(
':until' => $time,
':uid' => $uid,
':ip' => inet_pton($ip),
':cid' => $cid,
);
$db_result = $this->database->select( $sql, $sql_params );
$in_reload = ( isset($db_result[0]) && 0 == $db_result[0]->c ) ? false : true;
$until = ( $in_reload ) ? $db_result[0]->until : 0;
return array('in_reload' => $in_reload, 'until' => $until);
}
public function invalidateAlreadyRunningAd( $uid, $ip )
......
<?php
userstatus();
if ($pageconfig['popup_start'] == 0) {
$reloadcheck = db_query("SELECT * FROM ".$db_prefix."_content_reloads WHERE uid = '".$_SESSION['uid']."' and cid = 1 and `until` >= '".time()."'");
if (!mysqli_num_rows($reloadcheck)) {
if ($pageconfig['popup_start'] == 0)
{
if (false == $start_reload['in_reload'])
{
// Reload setzen und Umstze schreiben
$new_reload = time()+$pageconfig['reload_start'];
$ptc->addContentToReload( 1, $_SESSION['uid'], $ip, $new_reload );
db_query("UPDATE ".$db_prefix."_kontodaten SET s_aufrufe = s_aufrufe + 1, s_verdienst = s_verdienst + ".$pageconfig['verdienst_start']." WHERE uid = '".$_SESSION['uid']."'");
kontobuchung ('+', $pageconfig['verdienst_start'], create_code(14), $_SESSION['uid'], 1, 'System Startseitenverg&uuml;tung');
refumsatz ($pageconfig['verdienst_start'],$_SESSION['uid']);
aktivralley ($pageconfig['verdienst_start'],$_SESSION['uid']);
$starttext = '<b>Du hast gerade '.number_format($pageconfig['verdienst_start'],2,',','.').' '.$waehrung.' f&uuml;r diesen Aufruf erhalten!</b>';
} else {
$reloadcheck = mysqli_fetch_array($reloadcheck);
$starttext = '<b><font color="#FF0000">Du bist noch f&uuml;r '. round((($reloadcheck['until'] - time())/60),0) .' Minuten f&uuml;r den Startseitenaufruf gesperrt</font></b>';
}
head("");
echo '
<div align="center">'.$starttext.'</div>
<br>
';
foot();
// Reload setzen und Umstze schreiben
$new_reload = time()+$pageconfig['reload_start'];
$ptc->addContentToReload( 1, $_SESSION['uid'], $ip, $new_reload );
db_query("UPDATE ".$db_prefix."_kontodaten SET s_aufrufe = s_aufrufe + 1, s_verdienst = s_verdienst + ".$pageconfig['verdienst_start']." WHERE uid = '".$_SESSION['uid']."'");
kontobuchung ('+', $pageconfig['verdienst_start'], create_code(14), $_SESSION['uid'], 1, 'System Startseitenverg&uuml;tung');
refumsatz ($pageconfig['verdienst_start'],$_SESSION['uid']);
aktivralley ($pageconfig['verdienst_start'],$_SESSION['uid']);
$starttext = '<b>Du hast gerade '.number_format($pageconfig['verdienst_start'],2,',','.').' '.$waehrung.' f&uuml;r diesen Aufruf erhalten!</b>';
} else {
$starttext = '<b><font color="#FF0000">Du bist noch f&uuml;r '. round((($start_reload['until'] - time())/60),0) .' Minuten f&uuml;r den Startseitenaufruf gesperrt</font></b>';
}
head("");
echo '<div align="center">'.$starttext.'</div><br>';
foot();
} else {
echo '
<script language="javascript">
window.open(\'content/start_popup.php?key='.md5($_SESSION['uid']."-".date("H:i")).'\', \'sv\', \'width=244, height=100 scrollbar=no, status=no, resizable=no\')
</script>
';
if (false == $start_reload['in_reload'])
{
echo '<script>
window.open(\'content/start_popup.php?key='.md5($_SESSION['uid']."-".date("H:i")).'\', \'sv\', \'width=244, height=100 scrollbar=no, status=no, resizable=no\')
</script>';
}
}
$text = mysqli_fetch_array(db_query("SELECT text FROM ".$db_prefix."_texte WHERE name = 'startseite'"));
head("Willkomen auf der Pay4Start von ".$pageconfig['seitenname']);
echo nl2br($text['text']);
......
......@@ -8,23 +8,23 @@ require_once ('../lib/session.lib.php');
require_once ('../lib/layout.lib.php');
userstatus();
if ( md5($_SESSION['uid']."-".date("H:i")) == $_GET['key']) {
$reloadcheck = db_query("SELECT * FROM ".DB_PREFIX."_content_reloads WHERE uid = '".$_SESSION['uid']."' and cid = 1 and `until` >= '".time()."'");
if (!mysqli_num_rows($reloadcheck)) {
$start_reload = $ptc->isContentInReload( 1, $_SESSION['uid'], $ip, time());
if (false == $start_reload['in_reload'] )
{
// Reload setzen und Umstze schreiben
$new_reload = time()+$pageconfig['reload_start'];
$ptc->addContentToReload( 1, $_SESSION['uid'], $ip, $new_reload );
db_query("UPDATE ".DB_PREFIX."_kontodaten SET s_aufrufe = s_aufrufe + 1, s_verdienst = s_verdienst + ".$pageconfig['verdienst_start']." WHERE uid = '".$_SESSION['uid']."'");
kontobuchung ('+', $pageconfig['verdienst_start'], create_code(14), $_SESSION['uid'], 1, 'System Startseitenverg&uuml;tung');
refumsatz ($pageconfig['verdienst_start'],$_SESSION['uid']);
// Reload setzen und Umstze schreiben
$new_reload = time()+$pageconfig['reload_start'];
$ptc->addContentToReload( 1, $_SESSION['uid'], $ip, $new_reload );
db_query("UPDATE ".DB_PREFIX."_kontodaten SET s_aufrufe = s_aufrufe + 1, s_verdienst = s_verdienst + ".$pageconfig['verdienst_start']." WHERE uid = '".$_SESSION['uid']."'");
kontobuchung ('+', $pageconfig['verdienst_start'], create_code(14), $_SESSION['uid'], 1, 'System Startseitenverg&uuml;tung');
refumsatz ($pageconfig['verdienst_start'],$_SESSION['uid']);
$starttext = '<b>Du hast gerade '.number_format($pageconfig['verdienst_start'],2,',','.').' '.$pageconfig['waehrung'].' f&uuml;r diesen Aufruf erhalten!</b>';
} else {
$starttext = '<b>Du hast gerade '.number_format($pageconfig['verdienst_start'],2,',','.').' '.$pageconfig['waehrung'].' f&uuml;r diesen Aufruf erhalten!</b>';
} else {
$reloadcheck = mysqli_fetch_array($reloadcheck);
$bis = (($reloadcheck['until'] - time())/60);
$starttext = '<b><font color="#FF0000">Du bist noch f&uuml;r '. round($bis,0) .' Minuten f&uuml;r den Startseitenaufruf gesperrt</font></b>';
}
$bis = (($start_reload['until'] - time())/60);
$starttext = '<b><font color="#FF0000">Du bist noch f&uuml;r '. round($bis,0) .' Minuten f&uuml;r den Startseitenaufruf gesperrt</font></b>';
}
head("");
echo '
<link rel="stylesheet" href="/css/main.css" type="text/css">
......
......@@ -27,12 +27,12 @@ if (!file_exists('content' . $_GET['content'] . '.php')) $_GET['content'] = '/er
if ($_GET['content'] == '/intern/startseite') @require_once ('lib/texte/alt_startseitenpopup.txt');
if ($_GET['content'] == '/betteln') @require_once ('lib/texte/alt_bettelseitenpopup.txt');
$start_reload = db_query("SELECT * FROM ".$db_prefix."_content_reloads WHERE uid = '".$_SESSION['uid']."' and cid = 1 and `until` >= '".time()."'");
if (mysqli_num_rows($start_reload) != 0) {
$start = mysqli_fetch_array($start_reload);
$datetime = date("Y-m-d H:i:s", $start['until']);
$start_reload = $ptc->isContentInReload( 1, $_SESSION['uid'], $ip, time());
if (true == $start_reload['in_reload'])
{
$datetime = date("Y-m-d H:i:s", $start_reload['until']);
}else{
$datetime = "2014-09-21 20:33:28";
$datetime = "2014-09-21 20:33:28";
}
$ts = strtotime($datetime);
?><!DOCTYPE html>
......
Markdown is supported
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