Commit f400c174 authored by Eric Laufer's avatar Eric Laufer

Update Bettellink

Ausführliche Bettellinkauswertung dazu gekommen
parent 0f668012
<?php
class betteln{
private $db;
private $gconfig;
private $post = array();
private $error = 0;
private $meldung;
public function __construct(){
global $datenbank,$grundconfig;
$this->db = $datenbank;
$this->gconfig = $grundconfig;
}
private function make_array($post){
foreach($post AS $key => $value){
if($key != '' && $key != 'run' && $value != ''){
$this->post[$key] = $this->db->escape($value);
}
}
}
public function Uebersicht(){
return '
<div class="row">
<div class="col-6">
<div class="card">
<div class="card-header">Bettellink aufrufe</div>
<div class="card-body">
'. $this->Aufrufe() .'
</div>
</div>
</div>
<div class="col-6">
<div class="card">
<div class="card-header">Gesperrte URL\'s</div>
<div class="card-body">
'. $this->Sperre() .'
</div>
</div>
</div>
<div class="w-100"></div>
<div class="col-6">
<div class="card">
<div class="card-header">Bettellog <small>die letzten 100 Eintr&auml;ge</small></div>
<div class="card-body">
'. $this->liste() .'
</div>
</div>
</div>
</div>
';
}
private function Sperre(){
$aus = '<ul class="list-group">';
foreach($this->db->get_results("SELECT * FROM ". PREFIX . BETTELURLS ." ") AS $res){
$aus .= '
<li class="list-group-item">
<form method="post" action="">
<input type="hidden" name="id" value="'. $res->id .'">
<div class="row">
<div class="col-4">'. $res->url .'</div>
<div class="col-4">'. date("d.m.Y", $res->datum) .'</div>
<div class="col-4"><input type="submit" name="run[BettelURLSperreDelete]" class="btn btn-success" value="Entsperren"></div>
</div>
</form>
</li>
';
}
$aus .= '</ul>';
return $aus;
}
private function Aufrufe(){
$array = array();
foreach($this->db->get_results("SELECT * FROM ". PREFIX . BETTELB ." ") AS $res){
if(array_key_exists($res->refferer,$array)){
$array[$res->refferer] += 1;
}else{
$array[$res->refferer] = 1;
}
}
$aus = '<ul class="list-group">';
foreach($array AS $key => $value){
$aus .= '
<li class="list-group-item">
<form method="post" action="">
<input type="hidden" name="url" value="'. $key .'">
<div class="row">
<div class="col-4">'.$key.'</div>
<div class="col-4">'.$value.'</div>
<div class="col-4">';
if($this->db->num_rows("SELECT id FROM ". PREFIX . BETTELURLS ." WHERE url = '$key' ") == 0){
$aus .= '<input type="submit" name="run[BettelURLSperre]" value="Sperren" class="btn btn-danger">';
}
$aus .= '</div>
</div>
</form>
</li>
';
}
$aus .= '</ul>';
return $aus;
}
private function Liste(){
$aus = '<ul class="list-group">';
foreach($this->db->get_results("SELECT * FROM ". PREFIX . BETTELB ." ORDER BY id DESC LIMIT 100") AS $res){
if($res->status == 0){ $css = 'danger';}else{ $css = 'success';}
$aus .= '
<li class="list-group-item list-group-item-'. $css .'">
<div class="row">
<div class="col-3">'. date("d.m.Y H:i",$res->zeit) .'</div>
<div class="col-3">'. $res->uid .'</div>
<div class="col-3">'. $res->refferer .'</div>
<div class="col-3">'. number_format($res->betrag,2,',','.') .' '. $this->gconfig->waehrung .'</div>
</div>
</li>
';
}
$aus .= '</ul>';
return $aus;
}
public function URLSperren($post){
$this->make_array($post);
$this->post['datum'] = time();
if($this->db->insert(PREFIX . BETTELURLS, $this->post) == true){
$this->meldung = BETTELT['sperren']['true'];
}else{
$this->error = 1;
$this->meldung = BETTELT['sperren']['false'];
}
meldung($this->error,$this->meldung);
}
public function URLEntsperren($post){
$this->make_array($post);
if($this->db->delete(PREFIX . BETTELURLS, $this->post, 1) == true){
$this->meldung = BETTELT['entsperren']['true'];
}else{
$this->error = 1;
$this->meldung = BETTELT['entsperren']['false'];
}
meldung($this->error,$this->meldung);
}
}
\ No newline at end of file
<?php
$Class = Classloader('betteln',true);
$Class->URLEntsperren($_POST);
?>
\ No newline at end of file
<?php
$Class = Classloader('betteln',true);
$Class->URLSperren($_POST);
?>
\ No newline at end of file
......@@ -119,4 +119,17 @@
//MySQL Upload
define("MYSQL_DATEITYPE_FALSE","Es sind nur .txt oder .mysql Datein erlaubt<br>");
define("MYSQL_UPLOAD_TRUE","Die Datei wurde erfolgreich eingelesen.<br>Bitte beachte, das es dennoch zu fehlern kommen konnte.<br>");
//Bettellinkverwaltung
define("BETTELT", array(
"sperren" => array(
"true" => 'Die URL wurde erfolgreich eingetragen',
"false" => 'Die URL konnte nicht eingetragen werden'
),
"entsperren" => array(
"true" => 'Die URL wurde erfolgreich wieder freigegeben',
"false" => 'Die URL konnte nicht wieder freigegeben werden'
)
)
);
?>
<?php
$Class = Classloader('betteln',true);
echo $Class->Uebersicht();
?>
\ No newline at end of file
<table class="table table-striped">
<tr>
<td><b>min. Verdienst (Bettelaufruf)</b></td>
<td><input class="form-control" type="Text" name="min_betteln" value="<?php echo $interface->min_betteln;?>"></td>
</tr>
<tr>
<td><b>max. Verdienst (Bettelaufruf)</b></td>
<td><input class="form-control" type="Text" name="max_betteln" value="<?php echo $interface->max_betteln;?>"></td>
</tr>
<tr>
<td><b>Direktaufruf von Bettellink</b></td>
<td>
<select name="bettel_direkt" class="form-control">
<option value="0" <?php if($grundconfig->bettel_direkt == 0) echo 'selected="selected"';?>>nicht erlauben</option>
<option value="1" <?php if($grundconfig->bettel_direkt == 1) echo 'selected="selected"';?>>erlauben</option>
</select>
</td>
</tr>
<tr>
<td><b>Infotext f&uuml;r User</b></td>
<td><textarea name="bettel_infotext" class="form-control"><?php echo $interface->bettel_infotext;?></textarea></td>
</tr>
<tr>
<td><b>Reloadzeit (Bettelaufruf)</b><br><i>Angaben in Sekunden (3600 = 1 Stunde) (0 = Bettellink deaktiviert)</i></td>
<td><input class="form-control" type="Text" name="reload_betteln" value="<?php echo $interface->reload_betteln;?>"></td>
</tr>
</table>
\ No newline at end of file
......@@ -11,18 +11,6 @@
<td><b>Refebene 3</b><br><i>Angaben in Prozent!</i></td>
<td><input class="form-control" type="Text" name="re3" value="<?php echo $interface->re3;?>"></td>
</tr>
<tr>
<td><b>min. Verdienst (Bettelaufruf)</b></td>
<td><input class="form-control" type="Text" name="min_betteln" value="<?php echo $interface->min_betteln;?>"></td>
</tr>
<tr>
<td><b>max. Verdienst (Bettelaufruf)</b></td>
<td><input class="form-control" type="Text" name="max_betteln" value="<?php echo $interface->max_betteln;?>"></td>
</tr>
<tr>
<td><b>Reloadzeit (Bettelaufruf)</b><br><i>Angaben in Sekunden (3600 = 1 Stunde) (0 = Bettellink deaktiviert)</i></td>
<td><input class="form-control" type="Text" name="reload_betteln" value="<?php echo $interface->reload_betteln;?>"></td>
</tr>
<tr>
<td><b>Auszahlungssperre bei Neuanmeldung</b><br>
<i>Jede Neuanmeldung muss erst manuell freigeschaltet werden</i></td>
......
......@@ -9,6 +9,7 @@ head("Webseiteneinstellungen"); ?>
<ul class="nav nav-pills mb-3" role="tablist">
<li role="presentation" class="nav-item"><a href="#start" class="nav-link active" role="tab" data-toggle="tab">Seiteneinstellung</a></li>
<li role="presentation" class="nav-item"><a href="#waehrung" class="nav-link" role="tab" data-toggle="tab">W&auml;hrung</a></li>
<li role="presentation" class="nav-item"><a href="#bettel" class="nav-link" role="tab" data-toggle="tab">Bettellink</a></li>
<li role="presentation" class="nav-item"><a href="#nutzer" class="nav-link" role="tab" data-toggle="tab">Nutzer</a></li>
<li role="presentation" class="nav-item"><a href="#smtp" class="nav-link" role="tab" data-toggle="tab">SMTP</a></li>
<li role="presentation" class="nav-item"><a href="#ref" class="nav-link" role="tab" data-toggle="tab">Refeinstellung</a></li>
......@@ -28,6 +29,12 @@ head("Webseiteneinstellungen"); ?>
<input type="submit" name="run[GrunConfigUpdate]" value="W&auml;hrung Speichern" class="btn btn-default">
</form>
</div>
<div role="tabpanel" class="tab-pane" id="bettel">
<form action="" method="post">
<?php require('page/interfacedaten/config_include/betteln.php');?>
<input type="submit" name="run[GrunConfigUpdate]" value="Bettellink Einstellung Speichern" class="btn btn-default">
</form>
</div>
<div role="tabpanel" class="tab-pane" id="nutzer">
<form action="" method="post">
<?php require('page/interfacedaten/config_include/nutzer.php');?>
......
This diff is collapsed.
......@@ -3,6 +3,7 @@
class bettel{
private $db;
private $session = array();
private $gconfig;
private $config;
private $uid = 0;
private $error = 0;
......@@ -10,12 +11,15 @@ class bettel{
private $cookie = 0;
private $ip;
private $refferer;
private $server;
private $url;
function __construct(){
global $_SESSION,$datenbank,$grundconfig,$_SERVER;
$this->url = new stdClass;
$this->db = $datenbank;
$this->session = $this->db->escape($_SESSION);
$this->config = $grundconfig;
$this->gconfig = $grundconfig;
$this->ip = $_SERVER['REMOTE_ADDR'];
if(isset($_SERVER['HTTP_REFERER'])){
$this->refferer = $this->db->escape($_SERVER['HTTP_REFERER']);
......@@ -62,34 +66,51 @@ class bettel{
}
}
private function CheckReferer(){
if(!isset($this->server['HTTP_REFERER'])){
$this->server['HTTP_REFERER'] = 'kein Referer';
$this->url->host = 'direktaufruf';
}else{
$url = parse_url($this->server);
$this->url->host = $url['host'];
}
}
private function BettelAuszahlung(){
global $_SERVER;
$bettelsumme = rand($this->config->min_betteln * 100, $this->config->max_betteln * 100) / 100;
$new_reload = time() + $this->config->reload_betteln;
$this->CheckReferer();
$bettelsumme = rand($this->gconfig->min_betteln * 100, $this->gconfig->max_betteln * 100) / 100;
$new_reload = time() + $this->gconfig->reload_betteln;
$bettelb = array(
"uid" => $this->uid,
"refferer" => $_SERVER['HTTP_REFERER'],
"refferer" => $this->server['HTTP_REFERER'],
"url" => 'https://'.$this->url->host,
"betrag" => $bettelsumme,
"zeit" => time()
"zeit" => time(),
"status" => 1
);
$this->db->insert(PREFIX . BETTELB, $bettelb,1);
$this->db->insert(PREFIX . RELOAD, array("ip" => $this->ip,"uid" => $this->uid ,"tan" => 'bettelaufruf',"bis" => $new_reload) );
$this->db->query("UPDATE ". PREFIX . KONTO ." SET angebettelt = angebettelt + 1, bv = bv + $bettelsumme, kontostand_a = kontostand_a + $bettelsumme WHERE uid = '$this->uid' ");
$this->db->insert(PREFIX . BETTELB, array("uid" => $this->uid, "refferer" => $this->refferer, "zeit" => time(), "betrag" => $bettelsumme));
$bilanz = Classloader('bilanz');
//$this->db->insert(PREFIX . RELOAD, array("ip" => $this->ip,"uid" => $this->uid ,"tan" => 'bettelaufruf',"bis" => $new_reload) );
if($this->gconfig->bettel_direkt == 1 && $this->db->num_rows("SELECT id FROM ". PREFIX . BETTELURLS ." WHERE url = '". $bettelb['refferer'] ."' ") == 0){
$this->db->query("UPDATE ". PREFIX . KONTO ." SET angebettelt = angebettelt + 1, bv = bv + $bettelsumme, kontostand_a = kontostand_a + $bettelsumme WHERE uid = '$this->uid' ");
$bilanz = Classloader('bilanz');
refumsatz ($bettelsumme, $this->uid);
rallysystem ($this->uid, '6', $bettelsumme);
$bilanz->bilanz(0,$bettelsumme,'werbekosten','Bettellink');
$this->meldung = '<b>Du hast für den User ' . $this->uid . ' gerade ' . $bettelsumme . ' ' . $this->gconfig->waehrung . ' erbettelt!</b>';
}else{
$bettelb['status'] = 0;
$this->meldung = 'Leider konnte dein Aufruf nicht gewertet werden, da du keinen Referer &uuml;bergeben hast.';
}
refumsatz ($bettelsumme, $this->uid);
rallysystem ($this->uid, '6', $bettelsumme);
$bilanz->bilanz(0,$bettelsumme,'werbekosten','Bettellink');
$this->meldung = '<b>Du hast für den User ' . $this->uid . ' gerade ' . $bettelsumme . ' ' . $this->config->waehrung . ' erbettelt!</b>';
$this->db->insert(PREFIX . BETTELB, $bettelb,1);
}
public function BettelAufruf($get,$cookie){
public function BettelAufruf($get,$cookie,$server){
$this->server = $server;
if(isset($cookie['uid'])){
if(is_numeric($cookie['uid'])){$this->cookie = $cookie['uid'];}
}
if(is_numeric($get['ref'])){ $this->uid = $get['ref'];}
if($this->config->reload_betteln > 0){
if($this->gconfig->reload_betteln > 0){
$this->AngebetteltPruef();
if($this->error == 0){ $this->ReloadCheck();}
if($this->error == 0){ $this->BettelSperre();}
......
......@@ -14,25 +14,48 @@ class werbemittel{
$aus = '';
$aus .= $this->Werbelink();
$aus .= '<hr>';
$aus .= $this->Bettelregeln();
$aus .= '<hr>';
$aus .= $this->Banner();
return $aus;
}
private function Bettelregeln(){
return '
<div class="card">
<div class="card-header">Bettelinformationen</div>
<div class="card-body">
'. htmlspecialchars_decode($this->gconfig->bettel_infotext) .'
</div>
</div>
';
}
private function is_dir_empty($dir) {
if (!is_readable($dir)) return false;
return (count(scandir($dir)) == 2);
}
private function Banner(){
$url = $this->gconfig->domain.'/?content=/betteln&amp;ref='.$this->session['uid'].'';
$aus = '<div class="card"><div class="card-header text-center">Werbebanner</div><div class="card-body text-center">';
$open = opendir('./images/werbemittel/');
while ($banner = readdir($open)){
if ($banner != '..' && $banner != '.' && $banner != 'Thumbs.db'){
$size = getimagesize('images/werbemittel/'.$banner);
$groesse = filesize('images/werbemittel/'.$banner.'')/1024;
$aus .= '
<b>'.$size[0].'x'.$size[1].' (~ '.round($groesse).' KB)</b><br>
<img src="images/werbemittel/'.$banner.'" alt="'.$this->gconfig->seitenname.'"><br>
<code>&lt;a href="'.$url.'" target="_blank"&gt;&lt;img src="'.$this->gconfig->domain.'/images/werbemittel/'.$banner.'" alt="'.$this->gconfig->seitenname.'" border="0"&gt;&lt;/a&gt;</code><br><br>';
$dir = './images/werbemittel/';
if($this->is_dir_empty($dir) != false){
$open = opendir($dir);
while ($banner = readdir($open)){
if ($banner != '..' && $banner != '.' && $banner != 'Thumbs.db'){
$size = getimagesize('images/werbemittel/'.$banner);
$groesse = filesize('images/werbemittel/'.$banner.'')/1024;
$aus .= '
<b>'.$size[0].'x'.$size[1].' (~ '.round($groesse).' KB)</b><br>
<img src="images/werbemittel/'.$banner.'" alt="'.$this->gconfig->seitenname.'"><br>
<code>&lt;a href="'.$url.'" target="_blank"&gt;&lt;img src="'.$this->gconfig->domain.'/images/werbemittel/'.$banner.'" alt="'.$this->gconfig->seitenname.'" border="0"&gt;&lt;/a&gt;</code><br><br>';
}
}
closedir($open);
}else{
$aus .= '<div class="alert alert-info text-center">Momentan keine Banner vorhanden</div>';
}
closedir($open);
$aus .= '</div></div>';
return $aus;
......@@ -44,7 +67,7 @@ class werbemittel{
<div class="card-header text-center">Deine Werbelinks</div>
<div class="card-body">
Dein Reflink: <a href="'.$this->gconfig->domain.'/?ref='.$this->session['uid'].'" target="_blank">'.$this->gconfig->domain.'/?ref='.$this->session['uid'].'</a><br>
Dein Bettellink: <a href="'.$this->gconfig->domain.'/?content=/betteln&amp;ref='.$this->session['uid'].'" target="_blank">'.$this->gconfig->domain.'/?content=/betteln&amp;ref='.$this->session['uid'].'</a>
Dein Bettellink: <a href="'.$this->gconfig->domain.'/?page=/intern/betteln&amp;ref='.$this->session['uid'].'" target="_blank">'.$this->gconfig->domain.'/?page=/intern/betteln&amp;ref='.$this->session['uid'].'</a>
</div>
</div>
';
......
<?php
$bettel = Classloader('bettel');
$return = $bettel->BettelAufruf($_GET,$_COOKIE,$_SERVER);
if($return['error'] == 1){
$class = 'danger';
}else{
$class = 'success';
}
head("Betteln auf " . $grundconfig->seitenname);
echo 'Verdiene auch Du mit!<br>
Melde Dich bei ' . $grundconfig->seitenname . ' an und bewirbe Deinen persönlichen Bettellink, so
verdienst Du deine ' . $grundconfig->waehrung . ' fast wie im Schlaf!<br>
<br>
<div class="alert alert-'.$class.' text-center">' . $return['meldung'] . '</div>';
foot();
head("Werbung dieser Seite");
$texte = Classloader('texte');
$aus = $texte->AWerbung('bettelwerbung');
echo nl2br($aus);
foot();
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