Commit ea519a27 authored by Christoph Zysik's avatar Christoph Zysik

_reloads removed except deletion of account, will be handled by different class

parent ebb3bb47
Pipeline #8 canceled with stages
......@@ -58,6 +58,7 @@ foot();
if ($_POST['anzeigen'] == 'anzeigen !')
{
$ptc->delAllReloads();
$result=mysqli_query("SELECT t1.emailadresse AS email,t1.uid,t2.kontostand,t3.nickname FROM ".$db_prefix."_emaildaten AS t1, vms_kontodaten AS t2,vms_userdaten AS t3 WHERE t1.uid = t2.uid AND t2.uid = t3.uid AND last_active < ".$timestamp."");
$konto='0';
while($row=mysqli_fetch_array($result))
......@@ -80,8 +81,6 @@ foot();
db_query ('DELETE FROM '.$db_prefix.'_admin_abuse WHERE uid = '.$row['uid']);
db_query ('DELETE FROM '.$db_prefix.'_adscan_userblacklist WHERE uid = '.$row['uid']);
db_query ('DELETE FROM vms_buchungen WHERE uid = '.$row['uid']);
db_query ('DELETE FROM `'.DB_PREFIX.'_campaign_reloads` WHERE uid = '.$row['uid']);
db_query ('DELETE FROM `'.DB_PREFIX.'_content_reloads` WHERE uid = '.$row['uid']);
db_query ('DELETE FROM vms_schnittstelle_anfragen WHERE uid = '.$row['uid']);
echo '<font color="#00d000">User Gel&ouml;scht</font><br />';
......
......@@ -280,6 +280,19 @@ class Database extends DaveDatabase
return $this->lastInsertId();
}
public function rawDelete( $sql, $data )
{
$stmt = $this->prepare( $sql );
foreach ($data as $key => $value) {
$stmt->bindValue("$key", $value);
}
$stmt->execute();
return $stmt->rowCount();
}
/*
* $db->select("`username` FROM `members` WHERE `memberID` = :id and `email` = :email", array(':id' => 1, ':email' => 'someone@domain.com'));
......
......@@ -18,6 +18,31 @@ class Ptc
$this->campaigns = $campaigns;
}
public function delCampaignReloads( )
{
$zeit = time();
$sql = ' DELETE FROM `'.DB_PREIX.'_campaign_reloads` WHERE `until` <= :until ';
$sql_params = array( 'until' => $zeit );
return $database->rawDelete( $sql, $sql_params );
}
public function delContentReloads( )
{
$zeit = time();
$sql = ' DELETE FROM `'.DB_PREIX.'_content_reloads` WHERE `until` <= :until ';
$sql_params = array( 'until' => $zeit );
return $database->rawDelete( $sql, $sql_params );
}
public function delAllReloads( )
{
$this->delCampaignReloads( );
$this->delContentReloads( );
return true;
}
public function addCampaignToReload( $cid, $uid, $ip, $until )
{
$sql = 'INSERT INTO `'.DB_PREFIX.'_campaign_reloads`
......
......@@ -8,27 +8,33 @@ if ($pageconfig['reload_betteln'] == 0) {
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` >= " . $_zeit . " LIMIT 1");
if (!mysqli_num_rows($reloadcheck)) {
$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 = $_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, $_ref_id);
rallysystem ($_ref_id, '6', $bettelsumme);
bilanz(0, $bettelsumme);
$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>';
}
$reloadcheck = $ptc->isContentInReload( 3, $_SESSION['uid'], $ip, $_zeit);
if (false == $reloadcheck['in_reload'])
{
$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 = $_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, $_ref_id);
rallysystem ($_ref_id, '6', $bettelsumme);
bilanz(0, $bettelsumme);
$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);
......
......@@ -20,8 +20,7 @@ if($setting['buchungen_loeschen'] == 1){
}
## Alte Reloads löschen
db_query('DELETE FROM '.$db_prefix.'_content_reloads WHERE `until` <= '.time().'');
db_query('DELETE FROM '.$db_prefix.'_campaign_reloads WHERE `until` <= '.time().'');
$ptc->delAllReloads( );
## Abgelaufene Paidmails löschen
db_query('DELETE FROM '.$db_prefix.'_paidmails_empfaenger WHERE
status = 1 || status = 2 || gueltig < '.time().'');
......
......@@ -3,22 +3,24 @@ require_once('../../lib/datenbank.inc.php');
require_once('../../lib/functions.lib.php');
require_once('../../lib/session.lib.php');
$error = 0;
$zeit = time();
$_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.';}
if(empty($_POST['inhalt'])){ $error = 1; $meldung = 'Bitte Text eingeben.';}
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 "));
if($error == 0)
{
$reload_info = $ptc->isContentInReload( 2, $_SESSION['uid'], $ip, $_zeit);
$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("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( $zeit >= $reload['until']){
$daten = mysqli_fetch_array(db_query("SELECT sb_reload,sb_verguetung FROM ".$db_prefix."_chat_einstellungen "));
if( false === $reload_info['in_reload'] )
{
$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;
kontobuchung ('+', $verguetung/2, create_code(14), $_SESSION['uid'],'Chatverg&uuml;tung');
......@@ -30,7 +32,7 @@ if($error == 0){
}
db_query("UPDATE ".$db_prefix."_kontodaten SET sb_verdienst = sb_verdienst + '".$daten['sb_verguetung']."' WHERE uid = '".$_SESSION['uid']."' ");
$sperre = $zeit + $daten['sb_reload'];
$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