PHP-Code:
<?
header("Cache-control: no-cache");
// Datenbankserver
$db_host = "localhost";
// Mysql User
$db_user = "********";
// Mysql PW
$db_pass = "********";
// Datenbank
$db_base = "********";
// Tabellenpräfix (wichtig wenn mehrere VMS in einer DB liegen)
$db_prefix = "vms";
// Domain (ohne Slash am Ende)
$domain = "http://www.icemails.de";
// Seitenname
$seitenname = "IceMails.de - Wo Lose verdienen noch Spaß macht";
// Seitenwährung
$waehrung = "Lose";
// ID vom Admin
$admin_id = 201529;
// Adminmail
$betreibermail = "buchhaltung@icemails.de";
// Passwort für Crons
$cron_pw = "********";
// beliebiger Alphanumerischer String hilft beim Schutz vor Autoklickern
$percode = '********';
// Komprimierung der Ausgabe zwischen 0 & 10 wobei 0 die Komprimierung der Ausgabe deaktiviert Empfohlener Wert: 1
$gzip_rate = 1;
/* Globale Variablen nichts ändern */
$ip = $_SERVER['REMOTE_ADDR'];
/* Funktionen Start */
// Datenbankverbindung
function db_connect() {
global $db_host,$db_user,$db_pass,$db_base,$sql_open;
$sql_open = @mysql_connect($db_host,$db_user,$db_pass) or die('Verbindung zum Mysql Server fehlgeschlagen!');
$sql_base = @mysql_select_db($db_base) or die("Keine oder falsche Datenbank gewählt!");
}
// Mysql Querys
function db_query($sql_tag){
global $count_query;
$count_query++;
$fargs = func_get_args();
if (!empty($fargs)){
$vargs = array();
foreach($fargs as $key => $arg){
$vargs[$key] = mysql_real_escape_string($arg);
}
array_shift($vargs);
$sql_tag = vsprintf($sql_tag,$vargs);
}
if($ret = mysql_query($sql_tag)){
return $ret;
}else{
return 0;
}
}
// Datenbank schließen
function db_close() {
global $sql_open;
@mysql_close($sql_open) or die('Konnte die Verbindung mit Datenbank nicht schliessen!');
}
// Zufallscode
function create_code($code_laenge) {
srand((double)microtime()*1000000);
$created_code = '';
$zeichen="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
for ($i=0;$i<$code_laenge;$i++) {
$n=rand() % strlen($zeichen);
$created_code .=substr($zeichen, $n, 1);
}
return $created_code;
}
// Einträge in Buchungsliste
function buchungsliste ($buchungs_id,$trans_menge,$verwendung,$fuer) {
global $db_prefix;
db_query("INSERT INTO ".$db_prefix."_buchungen (uid,buchungszeit,buchungs_id,buchungsmenge,verwendungszweck) VALUES (".$fuer.",".time().",'".$buchungs_id."','".$trans_menge."','".$verwendung."')");
}
// Kontotransaktionen
function kontobuchung ($art,$trans_menge,$fuer) {
global $db_prefix;
db_query("UPDATE ".$db_prefix."_kontodaten SET `kontostand` = `kontostand` ".$art." ".$trans_menge." WHERE uid=".$fuer."");
}
// Schutz von internen Seiten
function userstatus () {
global $_SESSION,$db_prefix;
if ($_SESSION['login'] == 'true') {
$us = db_query("SELECT `uid`,`passwort`,`status`,`hinweis` FROM ".$db_prefix."_kontodaten WHERE uid=".$_SESSION['uid']." and passwort='".$_SESSION['passwort']."' LIMIT 1");
$login_check = mysql_fetch_array($us);
// nicht aktiviert oder nicht angemeldet!
if (!mysql_num_rows($us) or $login_check['status'] == 0) {
setCookie('uid','',time()-86400*30);
setCookie('passwort','',time()-86400*30);
setCookie('autologin','',time()-86400*30);
$_SESSION['uid'] = "";
$_SESSION['passwort'] = "";
$_SESSION['login'] = "";
@include_once('content/error/kein_zutritt.php');
@include_once('lib/footer.php');
die();
}
// gesperrt
if ($login_check['status'] == 2) {
setCookie('uid','',time()-86400*30);
setCookie('passwort','',time()-86400*30);
setCookie('autologin','',time()-86400*30);
$_SESSION['uid'] = "";
$_SESSION['passwort'] = "";
$_SESSION['login'] = "";
@include_once('content/error/user_gesperrt.php');
@include_once('lib/footer.php');
die();
}
} else {
@include_once('content/error/kein_zutritt.php');
@include_once('lib/footer.php');
die();
}
}
// Refumsatz gutschreiben
function refumsatz ($buchungssumme,$fuer) {
global $db_prefix;
db_query ('UPDATE '.$db_prefix.'_werberdaten SET umsatz = umsatz + '.$buchungssumme.' WHERE uid = '.$fuer.' and werber != 0');
}
// Aktivrally
function aktivralley ($buchungssumme,$fuer) {
global $db_prefix;
// Wenn Aktivralley läuft
$ralleydaten_aktiv = mysql_fetch_array(db_query("SELECT `start`,`ende` FROM ".$db_prefix."_ralleydaten WHERE ralley = 'aktivralley' LIMIT 1"));
if ($ralleydaten_aktiv['start'] <= time() && $ralleydaten_aktiv['ende'] >= time()) {
db_query ('UPDATE '.$db_prefix.'_aktivralley SET punkte = punkte + '.$buchungssumme.' WHERE uid = '.$fuer);
if (mysql_affected_rows () == 0) db_query ('INSERT INTO '.$db_prefix.'_aktivralley (uid,punkte) VALUES ('.$fuer.', '.$buchungssumme.')');
}
}
// Klickrally
function klickralley () {
global $db_prefix,$_SESSION;
// wenn Klickralley läuft
$ralleydaten_klick = mysql_fetch_array(db_query("SELECT `start`,`ende`,`art`,`pro` FROM ".$db_prefix."_ralleydaten WHERE ralley = 'klickralley' LIMIT 1"));
if ($ralleydaten_klick['start'] <= time() && $ralleydaten_klick['ende'] >= time()) {
if ($ralleydaten_klick['art'] == 'dynamisch') db_query ("UPDATE ".$db_prefix."_ralleydaten SET jackpot=jackpot+'".$ralleydaten_klick['pro']."' WHERE ralley = 'klickralley'");
db_query ('UPDATE '.$db_prefix.'_klickralley SET klicks = klicks + 1 WHERE uid = '.$_SESSION['uid']);
if (mysql_affected_rows () == 0) db_query ('INSERT INTO '.$db_prefix.'_klickralley (uid,klicks) VALUES ('.$_SESSION['uid'].', 1)');
}
}
//STG_Werberralley ANFANG
//Version 1.0
//(c) 2008 by Stigma_Bln
function werberralley ($art,$summe,$fuer) {
global $db_prefix;
//Werber herausfinden
$werber = mysql_fetch_assoc(db_query('SELECT `werber` FROM `'.$db_prefix.'_werberdaten` WHERE `uid` = "'.$fuer.'" LIMIT 1'));
if($werber['werber'] != '0'){
if($art == '1'){
$tabelle = 'stg_werberralley_bettel';
$art = 'bettel';
}elseif($art == '2'){
$tabelle = 'stg_werberralley_game';
$art = 'game';
$summe = $summe / 100;
}elseif($art == '3'){
$tabelle = 'stg_werberralley_klick';
$art = 'klick';
}elseif($art == '4'){
$tabelle = 'stg_werberralley_mail';
$art = 'mail';
}else{
$error = '1';
}
//Gucken ob Werber Ralley mit dieser Art gestartet hat
$ralley_da = db_query('SELECT `start`, `ende`, `art`, `pro`, `jackpot` FROM `stg_werberralley_config` WHERE `werber` = "'.$werber['werber'].'" AND `art_ralley` = "'.$art.'" LIMIT 1');
if(!mysql_num_rows($ralley_da)){
$error = '1';
}else{
//Datenbankabfrage in Array einlesen
$ralleydaten = mysql_fetch_assoc($ralley_da);
//Falls gefundene Ralley läuft
if ($ralleydaten['start'] <= time() && $ralleydaten['ende'] >= time()) {
//Gucken ob User schon in Tabelle
$eintragen = db_query('SELECT `uid` FROM `'.$tabelle.'` WHERE `uid` = "'.$fuer.'" AND `werber` = "'.$werber['werber'].'"');
$pot = $summe * $ralleydaten['pro'];
if ($ralleydaten['art'] == 'dynamisch') db_query ('UPDATE `stg_werberralley_config` SET jackpot=jackpot+"'.$pot.'" WHERE `werber` = "'.$werber['werber'].'" AND `art_ralley` = "'.$art.'"');
if (!mysql_num_rows($eintragen)) {
db_query ('INSERT INTO `'.$tabelle.'` (`werber`, `uid`, `points`) VALUES ("'.$werber['werber'].'", "'.$fuer.'", "'.$summe.'")');
} else {
db_query ('UPDATE `'.$tabelle.'` SET `points` = `points` + "'.$summe.'" WHERE `uid` = "'.$fuer.'" AND `werber` = "'.$werber['werber'].'"');
}
}
}
}
}
//STG_Werberralley ENDE
// Bilanzen
function bilanz ($ein,$aus) {
global $db_prefix;
$ein = round($ein,2);
$aus = round($aus,2);
$date_stamp = mktime(0,0,0,date(m),date(d),date(Y));
mysql_query('UPDATE '.$db_prefix.'_bilanz SET ein=ein+"'.$ein.'", aus=aus+"'.$aus.'" WHERE date='.$date_stamp.' LIMIT 1');
if (mysql_affected_rows() == 0) db_query('INSERT INTO '.$db_prefix.'_bilanz (ein,aus,date) VALUES ("'.$ein.'","'.$aus.'",'.$date_stamp.')');
}
// GZip
if ($gzip_rate > 0)
{
ini_set('zlib.output_compression_level', $gzip_rate);
if(ereg("gzip",getenv("HTTP_ACCEPT_ENCODING"))) ob_start("ob_gzhandler");
else ob_start();
}
// Tages Klick-Rally by Hardliner Start
function tklickralley ($buchungssumme,$fuer) {
global $db_prefix;
// wenn Tages Klick-Rally läuft
$ralleydaten_tklick = mysql_fetch_array(db_query("SELECT `ende`,`art`,`pro`,`hinzu` FROM ".$db_prefix."_neu_rallydaten WHERE ralley = 'tklickrally' LIMIT 1"));
if ($ralleydaten_tklick['ende'] == '1') {
$dynamik = $buchungssumme / 100 * $ralleydaten_tklick['hinzu'];
$klickeintragen = db_query("SELECT * FROM ".$db_prefix."_tklickrally WHERE uid = '".$fuer."' LIMIT 1");
if ($ralleydaten_tklick['art'] == 'prozent') db_query ("UPDATE ".$db_prefix."_neu_rallydaten SET jackpot=jackpot+'".$dynamik."' WHERE ralley = 'tklickrally'");
if ($ralleydaten_tklick['art'] == 'dynamisch') db_query ("UPDATE ".$db_prefix."_neu_rallydaten SET jackpot=jackpot+'".$ralleydaten_tklick['pro']."' WHERE ralley = 'tklickrally'");
if (!mysql_num_rows($klickeintragen)) {
db_query ("INSERT INTO ".$db_prefix."_tklickrally (uid,punkte) VALUES ('".$fuer."','1')");
} else {
db_query ("UPDATE ".$db_prefix."_tklickrally SET punkte = punkte + '1' WHERE uid='".$fuer."'");
}
}
}
// Tages Klick-Rally by Hardliner Ende
// Wochen Klick-Rally by Hardliner Start
function wklickralley ($buchungssumme,$fuer) {
global $db_prefix;
// wenn Wochen Klick-Rally läuft
$ralleydaten_wklick = mysql_fetch_array(db_query("SELECT `ende`,`art`,`pro`,`hinzu` FROM ".$db_prefix."_neu_rallydaten WHERE ralley = 'wklickrally' LIMIT 1"));
if ($ralleydaten_wklick['ende'] == '1') {
$dynamik = $buchungssumme / 100 * $ralleydaten_wklick['hinzu'];
$klickeintragen = db_query("SELECT * FROM ".$db_prefix."_wklickrally WHERE uid = '".$fuer."' LIMIT 1");
if ($ralleydaten_wklick['art'] == 'prozent') db_query ("UPDATE ".$db_prefix."_neu_rallydaten SET jackpot=jackpot+'".$dynamik."' WHERE ralley = 'wklickrally'");
if ($ralleydaten_wklick['art'] == 'dynamisch') db_query ("UPDATE ".$db_prefix."_neu_rallydaten SET jackpot=jackpot+'".$ralleydaten_wklick['pro']."' WHERE ralley = 'wklickrally'");
if (!mysql_num_rows($klickeintragen)) {
db_query ("INSERT INTO ".$db_prefix."_wklickrally (uid,punkte) VALUES ('".$fuer."','1')");
} else {
db_query ("UPDATE ".$db_prefix."_wklickrally SET punkte = punkte + '1' WHERE uid='".$fuer."'");
}
}
}
// Wochen Klick-Rally by Hardliner Ende
// Monats Klick-Rally by Hardliner Start
function mklickralley ($buchungssumme,$fuer) {
global $db_prefix;
// wenn Monats Klick-Rally läuft
$ralleydaten_mklick = mysql_fetch_array(db_query("SELECT `ende`,`art`,`pro`,`hinzu` FROM ".$db_prefix."_neu_rallydaten WHERE ralley = 'mklickrally' LIMIT 1"));
if ($ralleydaten_mklick['ende'] == '1') {
$dynamik = $buchungssumme / 100 * $ralleydaten_mklick['hinzu'];
$klickeintragen = db_query("SELECT * FROM ".$db_prefix."_mklickrally WHERE uid = '".$fuer."' LIMIT 1");
if ($ralleydaten_mklick['art'] == 'prozent') db_query ("UPDATE ".$db_prefix."_neu_rallydaten SET jackpot=jackpot+'".$dynamik."' WHERE ralley = 'mklickrally'");
if ($ralleydaten_mklick['art'] == 'dynamisch') db_query ("UPDATE ".$db_prefix."_neu_rallydaten SET jackpot=jackpot+'".$ralleydaten_wklick['pro']."' WHERE ralley = 'mklickrally'");
if (!mysql_num_rows($klickeintragen)) {
db_query ("INSERT INTO ".$db_prefix."_mklickrally (uid,punkte) VALUES ('".$fuer."','1')");
} else {
db_query ("UPDATE ".$db_prefix."_mklickrally SET punkte = punkte + '1' WHERE uid='".$fuer."'");
}
}
}
// Monats Klick-Rally by Hardliner Ende
// TagesGameRalley (c) by Stigma_Bln
function tgameralley ($buchungssumme,$fuer) {
global $db_prefix;
// Wenn Tagesgameralley läuft
$ralleydaten_tgame = mysql_fetch_array(db_query("SELECT * FROM ".$db_prefix."_ralleydaten WHERE ralley = 'tgameralley' LIMIT 1"));
if ($ralleydaten_tgame['start'] <= time() && $ralleydaten_tgame['ende'] >= time()) {
$tgameeintragen = db_query("SELECT * FROM ".$db_prefix."_tgameralley WHERE uid = '".$fuer."'");
$buchungssumme = $buchungssumme / 100;
$pot = $buchungssumme * $ralleydaten_tgame['pro'];
if ($ralleydaten_tgame['art'] == 'dynamisch') db_query ("UPDATE ".$db_prefix."_ralleydaten SET jackpot=jackpot+'".$pot."' WHERE ralley = 'tgameralley'");
if (!mysql_num_rows($tgameeintragen)) {
db_query ("INSERT INTO ".$db_prefix."_tgameralley (uid,punkte) VALUES ('".$fuer."','".$buchungssumme."')");
} else {
db_query ("UPDATE ".$db_prefix."_tgameralley SET punkte = punkte + ".$buchungssumme." WHERE uid='".$fuer."'");
}
}
}
// TagesGameRalley
function surfralley ($buchungssumme) {
global $db_prefix,$_SESSION;
// wenn Surfralley läuft
$ralleydaten_surf = mysql_fetch_array(db_query("SELECT `start`,`ende`,`art`,`pro` FROM ".$db_prefix."_ralleydaten WHERE ralley = 'betauralley' LIMIT 1"));
if ($ralleydaten_surf['start'] <= time() && $ralleydaten_surf['ende'] >= time()) {
if ($ralleydaten_surf['art'] == 'dynamisch') {
$pot = $buchungssumme/100*$ralleydaten_surf['pro'];
db_query ("UPDATE ".$db_prefix."_ralleydaten SET jackpot=jackpot + ".$pot." WHERE ralley = 'betauralley' LIMIT 1");
}
db_query ("UPDATE ".$db_prefix."_surfralley SET klicks = klicks + 1 WHERE uid='".$_SESSION['uid']."' LIMIT 1");
if (mysql_affected_rows () == 0) db_query ("INSERT INTO ".$db_prefix."_surfralley (uid,klicks) VALUES ('".$_SESSION['uid']."','1')");
}
}
//STG_Tournament ANFANG
//Version 0.9
//(c) 2008 by Stigma_Bln
function tournament ($art,$summe,$fuer) {
$erlaubt = '0';
$tournament_config = mysql_fetch_assoc(db_query('SELECT `bettel`, `game`, `klick_banner`, `klick_text`, `mail` FROM `stg_tournament_config` LIMIT 1'));
if($art == '1'){
if($tournament_config['bettel'] == '1'){
$tabelle = 'stg_tournament_bettel';
$erlaubt = '1';
}else{
$erlaubt = '0';
}
}elseif($art == '2'){
if($tournament_config['game'] == '1'){
$tabelle = 'stg_tournament_game';
$summe = $summe / 100;
$erlaubt = '1';
}else{
$erlaubt = '0';
}
}elseif($art == '3'){
if($tournament_config['klick_banner'] == '1'){
$tabelle = 'stg_tournament_klick_banner';
$erlaubt = '1';
}else{
$erlaubt = '0';
}
}elseif($art == '4'){
if($tournament_config['klick_text'] == '1'){
$tabelle = 'stg_tournament_klick_text';
$erlaubt = '1';
}else{
$erlaubt = '0';
}
}elseif($art == '5'){
if($tournament_config['mail'] == '1'){
$tabelle = 'stg_tournament_mail';
$erlaubt = '1';
}else{
$erlaubt = '0';
}
}
if($erlaubt == '1'){
// Wenn Tournament läuft
$ralleydaten = mysql_fetch_assoc(db_query("SELECT `start`,`ende`, `status_ende` FROM `stg_ralleyconfig` WHERE `name` = 'tournament' LIMIT 1"));
if ($ralleydaten['start'] <= time() && $ralleydaten['ende'] >= time() && $ralleydaten['status_ende'] == '0') {
$eintragen = db_query('SELECT * FROM `'.$tabelle.'` WHERE `uid` = "'.$fuer.'"');
if (!mysql_num_rows($eintragen)) {
db_query ('INSERT INTO `'.$tabelle.'` (`uid`, `points`) VALUES ("'.$fuer.'","'.$summe.'")');
} else {
db_query ('UPDATE `'.$tabelle.'` SET `points` = `points` + "'.$summe.'" WHERE `uid` = "'.$fuer.'"');
}
}
}
}
//STG_Tournament ENDE
function checksmiley()
{
global $db_prefix;
$smiley_klick = mysql_fetch_array(db_query("SELECT * FROM ".$db_prefix."_klicksmileys_my"));
if ($smiley_klick['status'] == 'aktiv') {
$eintragen = db_query("SELECT * FROM ".$db_prefix."_smiley_pott WHERE uid = '".$_SESSION['uid']."'");
if (!mysql_num_rows($eintragen)) {
db_query ("INSERT INTO ".$db_prefix."_smiley_pott (id,uid,erhalten,insgesammt,status) VALUES ('','".$_SESSION['uid']."','0','0','1')");
}} else {}
}
// Klicksmilley
function smileyspott ()
{
global $db_prefix;
$smiley_klick = mysql_fetch_array(db_query("SELECT * FROM ".$db_prefix."_klicksmileys_my"));
if ($smiley_klick['status'] == 'aktiv') {
db_query ('UPDATE '.$db_prefix.'_smiley_pott SET erhalten = erhalten + 1 WHERE uid = '.$_SESSION['uid']);
}
}
?>