Commit 2568ea37 authored by Christoph Zysik's avatar Christoph Zysik

minor adjustments to betteln and addContentToReload

parent bf2c99b8
......@@ -34,6 +34,33 @@ class Ptc
return $this->database->rawInsert( $sql, $sql_params );
}
public function addContentToReload( $cid, $uid, $ip, $until )
{
$sql = 'INSERT INTO `'.DB_PREFIX.'_content_reloads`
(`ip`, `uid`, `cid`, `until`) VALUES
(:aip, :auid, :acid, :auntil) ON DUPLICATE KEY UPDATE
`until` = :buntil ';
$sql_params = array(
':aip' => $ip,
':auid' => $uid,
':acid' => $cid,
':auntil'=> $until,
':buntil'=> $until,
);
return $this->database->rawInsert( $sql, $sql_params );
}
public function isCampaignInReload( $cid, $uid, $ip )
{
}
public function isContentInReload( $cid, $uid, $ip )
{
}
public function invalidateAlreadyRunningAd( $uid, $ip )
{
$result = false;
......
<?php
$_GET['ref'] = (int)$_GET['ref'];
$_ref_id = (isset($_GET['ref'])) ? (int)$_GET['ref'] : 0;
$_zeit = time();
if ($pageconfig['reload_betteln'] == 0) {
$betteltext = '<b>Die Bettelfunktion ist auf dieser Seite deaktiviert';
} else {
if ($_SESSION['uid'] == $_GET['ref'] || $_GET['ref'] == $_COOKIE['uid']) {
if ($_SESSION['uid'] == $_ref_id || $_ref_id == $_COOKIE['uid']) {
$betteltext = '<b><font color="#FF0000">Du kannst dich nicht selbst anbetteln!</font></b>';
} else {
$reloadcheck = db_query("SELECT `until` FROM " . $db_prefix . "_content_reloads WHERE ip = '" . $ip . "' and cid = 3 and `until` >= " . time() . " LIMIT 1");
$reloadcheck = db_query("SELECT `until` FROM `" . DB_PREFIX . "_content_reloads` WHERE `ip` = '" . $ip . "' and `cid` = 3 and `until` >= " . $_zeit . " LIMIT 1");
if (!mysqli_num_rows($reloadcheck)) {
$sperre = mysqli_fetch_array(db_query("SELECT bettel_sperre FROM ".$db_prefix."_kontodaten WHERE uid = '".$_GET['ref']."' "));
$sperre = mysqli_fetch_array(db_query("SELECT bettel_sperre FROM ".DB_PREFIX."_kontodaten WHERE uid = '".$_ref_id."' "));
if($sperre['bettel_sperre'] == 0){
$minimum = $pageconfig['min_betteln'];
$maximum = $pageconfig['max_betteln'];
srand((double)microtime() * 1000000);
$bettelsumme = rand($minimum * 100, $maximum * 100) / 100;
$new_reload = time() + $pageconfig['reload_betteln'];
db_query("INSERT INTO " . $db_prefix . "_content_reloads (ip,uid,cid,`until`) VALUES ('" . $ip . "','" . $_GET['ref'] . "',3,'" . $new_reload . "')");
db_query("UPDATE " . $db_prefix . "_kontodaten SET angebettelt =angebettelt + 1, bv = bv + " . $bettelsumme . ", kontostand = kontostand + '" . $bettelsumme . "' WHERE uid = '" . $_GET['ref'] . "'");
db_query("INSERT INTO ".$db_prefix."_bettel_buchung (zeit,betrag,refferer,uid) VALUES ('". time() ."', '".$bettelsumme."', '".$_SERVER['HTTP_REFERER']."', '".$_GET['ref']."' )");
$new_reload = $_zeit + $pageconfig['reload_betteln'];
$ptc->addContentToReload( 3, $ref_id, $ip, $sperre );
db_query("UPDATE " . DB_PREFIX . "_kontodaten SET angebettelt =angebettelt + 1, bv = bv + " . $bettelsumme . ", kontostand = kontostand + '" . $bettelsumme . "' WHERE uid = '" . $_ref_id . "'");
db_query("INSERT INTO ".DB_PREFIX."_bettel_buchung (zeit,betrag,refferer,uid) VALUES ('". $_zeit ."', '".$bettelsumme."', '".$_SERVER['HTTP_REFERER']."', '".$_ref_id."' )");
refumsatz ($bettelsumme, $_GET['ref']);
rallysystem ($_GET['ref'], '6', $bettelsumme);
refumsatz ($bettelsumme, $_ref_id);
rallysystem ($_ref_id, '6', $bettelsumme);
bilanz(0, $bettelsumme);
$betteltext = '<b>Du hast für den User ' . $_GET['ref'] . ' gerade ' . $bettelsumme . ' ' . $pageconfig['waehrung'] . ' erbettelt!</b>';
$betteltext = '<b>Du hast für den User ' . $_ref_id . ' gerade ' . $bettelsumme . ' ' . $pageconfig['waehrung'] . ' erbettelt!</b>';
}else{
$betteltext = '<b><font color="#FF0000">User ist f&uuml;r das Betteln gesperrt.</font></b>';
}
} else {
$reloadcheck = mysqli_fetch_array($reloadcheck);
$betteltext = '<b><font color="#FF0000">Du bist noch f&uuml;r ' . round((($reloadcheck['until'] - time()) / 60), 0) . ' Minuten fürs Betteln gesperrt</font></b>';
$betteltext = '<b><font color="#FF0000">Du bist noch f&uuml;r ' . round((($reloadcheck['until'] - $_zeit) / 60), 0) . ' Minuten fürs Betteln gesperrt</font></b>';
}
}
}
head("Betteln auf " . $seitenname);
head("Betteln auf " . $pageconfig['seitenname']);
echo 'Verdiene auch Du mit!<br>
Melde Dich bei ' . $seitenname . ' an und bewirbe Deinen persönlichen Bettellink, so
Melde Dich bei ' . $pageconfig['seitenname'] . ' an und bewirbe Deinen persönlichen Bettellink, so
verdienst Du deine ' . $pageconfig['waehrung'] . ' fast wie im Schlaf!<br>
<br>
<div align="center">' . $betteltext . '</div>';
......
......@@ -7,7 +7,7 @@ if (!mysqli_num_rows($reloadcheck)) {
// Reload setzen und Umstze schreiben
$new_reload = time()+$pageconfig['reload_start'];
db_query("INSERT INTO ".$db_prefix."_content_reloads (ip,uid,tan,`until`) VALUES ('".$ip."','".$_SESSION['uid']."',1,'".$new_reload."')");
$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']);
......@@ -31,7 +31,7 @@ window.open(\'content/start_popup.php?key='.md5($_SESSION['uid']."-".date("H:i")
';
}
$text = mysqli_fetch_array(db_query("SELECT text FROM ".$db_prefix."_texte WHERE name = 'startseite'"));
head("Willkomen auf der Pay4Start von ".$seitenname);
head("Willkomen auf der Pay4Start von ".$pageconfig['seitenname']);
echo nl2br($text['text']);
foot();
?>
......@@ -8,17 +8,17 @@ 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()."'");
$reloadcheck = db_query("SELECT * FROM ".DB_PREFIX."_content_reloads WHERE uid = '".$_SESSION['uid']."' and cid = 1 and `until` >= '".time()."'");
if (!mysqli_num_rows($reloadcheck)) {
// Reload setzen und Umstze schreiben
$new_reload = time()+$pageconfig['reload_start'];
db_query("INSERT INTO ".$db_prefix."_content_reloads (ip,uid,tan,`until`) VALUES ('".$ip."','".$_SESSION['uid']."',1,'".$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']."'");
$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,',','.').' '.$waehrung.' f&uuml;r diesen Aufruf erhalten!</b>';
$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);
......
......@@ -3,6 +3,7 @@ require_once('../../lib/datenbank.inc.php');
require_once('../../lib/functions.lib.php');
require_once('../../lib/session.lib.php');
$error = 0;
$zeit = time();
$sperre = mysqli_fetch_array(db_query("SELECT chat_sperre FROM ".$db_prefix."_userdaten WHERE uid = '". mysqli_real_escape_string($sql_open,$_SESSION['uid']) ."' "));
if($sperre['chat_sperre'] == '1'){ $error = 1; $meldung = 'Du bist für den Chat gesperrt.';}
......@@ -11,13 +12,12 @@ if($_SESSION['uid'] <= 0){ $error = 1; $meldung = 'Ung&uuml;ltige User-ID.';}
if($error == 0){
$reload = mysqli_fetch_array(db_query("SELECT `until` FROM ".$db_prefix."_content_reloads WHERE uid = '".$_SESSION['uid']."' AND cid = 2 "));
$zeit = time();
$text = $_POST['inhalt'];
$user = mysqli_fetch_array(db_query("SELECT nickname FROM ".$db_prefix."_userdaten WHERE uid = '".$_SESSION['uid']."' "));
db_query("INSERT INTO ".$db_prefix."_chat (absender, nachricht, time) VALUES ('".$user['nickname']."', '". mysqli_real_escape_string($sql_open,$text) ."', '".$zeit."')");
db_query("UPDATE ".$db_prefix."_kontodaten SET sb_texte = sb_texte + '1' WHERE uid = '".$_SESSION['uid']."' ");
if( time() >= $reload['until']){
if( $zeit >= $reload['until']){
$daten = mysqli_fetch_array(db_query("SELECT sb_reload,sb_verguetung FROM ".$db_prefix."_chat_einstellungen "));
if($_COOKIE['adblocker'] == 1){
$verguetung = $daten['sb_verguetung']/2;
......@@ -30,8 +30,8 @@ if($error == 0){
}
db_query("UPDATE ".$db_prefix."_kontodaten SET sb_verdienst = sb_verdienst + '".$daten['sb_verguetung']."' WHERE uid = '".$_SESSION['uid']."' ");
$sperre = time() + $daten['sb_reload'];
db_query("INSERT INTO ".$db_prefix."_content_reloads (uid,`until`,`cid`) VALUES ('".$_SESSION['uid']."','".$sperre."',2) ");
$sperre = $zeit + $daten['sb_reload'];
$ptc->addContentToReload( 2, $_SESSION['uid'], $ip, $sperre );
}
}
......
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