Newer
Older
if(file_exists($_SERVER['DOCUMENT_ROOT'].'error')){
error_reporting(E_ALL);
ini_set('error_log', $_SERVER['DOCUMENT_ROOT'].'/error/error-'. date("d.m.Y",time()).'.log');
if(!file_exists($_SERVER['DOCUMENT_ROOT'].'/error/error-'. date("d.m.Y",time()).'.log')){
$datei = fopen($_SERVER['DOCUMENT_ROOT'].'/error/error-'. date("d.m.Y",time()).'.log',"w");
function pw_erstellen($pw){
global $pw_zusatz;
$pw_er = hash("sha256",$pw.$pw_zusatz);
return $pw_er;
}
/**
* create_code()
*
* @author designerscripte.net
* @category system
* @version 2.5.0
* @example create_code(32);
* @param mixed $code_laenge Gewünschte stringlänge
* @return DECIMALE z.b. 6565556
*/
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;
}
$datenbank->query("DELETE FROM ". PREFIX . RELOAD ." WHERE bis < '".time() ."' ");
$user = $datenbank->get_row("SELECT umsatz,werber FROM ". PREFIX . WERBER ." WHERE uid = '". $datenbank->escape($uid) ."' ",true);
if($user->werber != 0){
$datenbank->update( PREFIX . WERBER ,array("umsatz" => $user->umsatz + $summe, "aktivzeit" => time() ), array("uid" => $datenbank->escape($uid) ), 1 );
}
}
/**
* rallysystem()
*
* @author designerscripte.net
* @category system rally
* @version 2.5.0
* @example rallysystem(10,1,10000);
* @param int $uid userid
* @param int $was rallynummer (1 für forcedbanner z.b.)
* @param mixed $anzahl wert Numerischer string
* @return keine
*/
function rallysystem ($uid,$was,$anzahl) {
global $datenbank;
$rallyorte = $datenbank->get_row("SELECT welche_rallys FROM ". PREFIX . RALLYO ." WHERE id = '". $datenbank->escape($was) ."' LIMIT 1",true);
SELECT * FROM ". PREFIX . RALLY ." WHERE `id` IN (". $rallyorte->welche_rallys .") AND `status` = 'aktive' AND ( (UNIX_TIMESTAMP(start_time)+UNIX_TIMESTAMP(start_date))-UNIX_TIMESTAMP(curdate()) <= '". time() ."' )
AND
(
(ende_art = 'zeit' AND (UNIX_TIMESTAMP(ende_time)+UNIX_TIMESTAMP(ende_date))-UNIX_TIMESTAMP(curdate()) >= '". time() ."' )
OR
(`ende_art` = 'punkt' AND `ende_punkte` > `ende_punkte_aktuell`)
) ") AS $res){
if ($res->gewinn_art == 'dynamisch') $datenbank->query("UPDATE ". PREFIX . RALLY ." SET gewinn_topf=gewinn_topf+'".$steigerung."' WHERE id = '".$res->id."' LIMIT 1");
if ($res->ende_art == 'punkt') $datenbank->query("UPDATE ". PREFIX . RALLY ." SET ende_punkte_aktuell = ende_punkte_aktuell + '".$anzahl2."' WHERE id = ".$res->id." LIMIT 1");
if($datenbank->num_rows("SELECT uid FROM ". PREFIX . RALLYU ." WHERE uid = '$uid' AND rally = '$res->id' AND ausgezahlt = '0' ") == 1){
$datenbank->query("UPDATE ". PREFIX . RALLYU ." SET punkte = punkte + '".$anzahl2."' WHERE uid = '".$uid."' AND rally = '".$res->id."' AND ausgezahlt = '0'");
}else{
$datenbank->insert(PREFIX . RALLYU, array("rally" => $res->id,"uid" => $uid, "punkte" => $anzahl2));
}
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
}
}
}
// Datum im Facebook Stil
function niceDate($timestamp)
{
$difference = time() - $timestamp;
$periods = array("Sekunde",
"Minute",
"Stunde",
"Tage",
"Woche",
"Monate",
"Jahre",
"Jahrzehnte"
);
$lengths = array("60","60","24","7","4.35","12","10");
if ($difference > 0) {
// Vergangenheit
$ending = "vor";
} else {
// Zukunft
$difference = -$difference;
$ending = "noch"; }
for($j = 0; $difference >= $lengths[$j]; $j++) {
$difference /= $lengths[$j];
$difference = round($difference); }
if($difference != 1) {
$periods[$j].= "n"; }
else {
if($periods[$j] == "Woche" || $periods[$j] == "Stunde" || $periods[$j] == "Minute" || $periods[$j] == "Sekunde") {
$periods[$j] = $periods[$j];
} else {
$periods[$j] = substr($periods[$j], 0, -1); }
}
$date= "$ending $difference $periods[$j]";
return $date;
}
//Text kürzen
function shortText($string,$lenght) {
if(strlen($string) > $lenght) {
$string = substr($string,0,$lenght)."...";
$string_ende = strrchr($string, " ");
$string = str_replace($string_ende," ", $string);
}
return $string;
}
//Alter berechnen
function ageCalculator( $day, $month, $year ) {
if ( !checkdate($month, $day, $year) )
return false;
$cur_day = date("d");
$cur_month = date("m");
$cur_year = date("Y");
$calc_year = $cur_year - $year;
if( $month > $cur_month )
return $calc_year - 1;
elseif ( $month == $cur_month && $day > $cur_day )
return $calc_year - 1;
else
return $calc_year;
}
function sonderzeichen($text){
if(preg_match('#[!"§$%&/()=?`\']#', $text)){
$err = true;
}else{
$err = false;
}
return $err;
}
if(!filter_var($email_a, FILTER_VALIDATE_EMAIL)) {
return false;
}
$email_array = explode("@", $email);
$local_array = explode(".", $email_array[0]);
for ($i = 0; $i < sizeof($local_array); $i++) {
if(!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) {
return false;
}
}
if(!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) {
$domain_array = explode(".", $email_array[1]);
if(sizeof($domain_array) < 2) {
return false;
}
for($i = 0; $i < sizeof($domain_array); $i++) {
if(!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {
return false;
}
}
}
return true;
}
function geoIP($ip){
$output = unserialize(file_get_contents("http://www.geoplugin.net/php.gp?ip=".$ip,"r"));
return $output['geoplugin_countryCode'];
}
function versch($text){
global $ver_schluessel;
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$crypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $ver_schluessel, $text, MCRYPT_MODE_ECB, $iv);
return $crypted;
}
function entsch($text){
global $ver_schluessel;
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$encrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $ver_schluessel, $text, MCRYPT_MODE_ECB, $iv);
return $encrypted;
}
function meldung($zahl,$text){
global $error,$meldung;
$error = $zahl;
$meldung = $text;
".PREFIX . USER .".*,
".PREFIX . KONTO .".*,
".PREFIX . WERBER .".*,
".PREFIX . NICKP.".*,
".PREFIX . EMAIL.".*
FROM ". PREFIX . USER ."
LEFT JOIN ". PREFIX . KONTO ." ON(". PREFIX . USER .".uid = ". PREFIX . KONTO .".uid)
LEFT JOIN ".PREFIX. WERBER ." ON(". PREFIX . KONTO .".uid = ". PREFIX . WERBER .".uid)
LEFT JOIN ".PREFIX . NICKP ." ON(". PREFIX . WERBER .".uid = ". PREFIX . NICKP .".uid)
LEFT JOIN ".PREFIX . EMAIL ." ON(". PREFIX . NICKP .".uid = ". PREFIX . EMAIL .".uid)
$adminfolder = '';
if($admin == true){ $adminfolder = '/adminforce';}
if(file_exists($_SERVER['DOCUMENT_ROOT'].$adminfolder.'/lib/class/'.$class .'.class.php')){
require_once($_SERVER['DOCUMENT_ROOT'].$adminfolder.'/lib/class/'.$class .'.class.php');
$reg = new $class;
}else{
$reg = 'error';
}
return $reg;
}
function sectodays($secs) {
$days = intval($secs / (60 * 60 * 24));
$secs = $secs % (60 * 60 * 24);
$hours = intval($secs / (60 * 60));
$secs = $secs % (60 * 60);
$mins = intval($secs / 60);
$secs = $secs % 60;
return 'noch ' . $days . ' Tage, ' . $hours . ' Std. und ' . $mins . ' Min.';
}
function getURL($url,$post = 0){
$curl = curl_init();
curl_setopt($curl,CURLOPT_URL,$url);
if($post == 1){
curl_setopt($curl,CURLOPT_POST,1);
curl_setopt($curl,CURLOPT_POSTFIELDS,$curl_post);
}
curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
$content = curl_exec($curl);
curl_close($curl);
return $content;
}
function CheckLogin(){
global $_GET,$_SESSION;
if(!isset($_GET['page'])){ $_GET['page'] = '';}
if($_GET['page'] != '/intern/startseite'){
$ex = explode("/",$_GET['page']);
if(!isset($ex[1])){ $ex[1] = '';}
if($_SESSION['login'] === false && $ex[1] != 'intern'){
$_GET['page'] = 'error/kein_zutritt';
}
function IMGtoBase64 ( $file = NULL, $ordner = NULL ) {
if($file != NULL){
$type = explode(".",$file);
if($ordner == NULL){
$content = file_get_contents ( $_SERVER['DOCUMENT_ROOT'].'/images/userava/'.$file );
}else{
$content = file_get_contents ( $_SERVER['DOCUMENT_ROOT'].'/images/'. $ordner .'/'.$file );
}
return 'data:image/'.$type[1].';base64,'.base64_encode( $content );
}else{
return '';
}
}
function LoadLanguageFile(){
global $_GET;
if(file_exists(DIR_FS .'/lib/lang/'. $_SESSION['lang'] .'/seiten'. $_GET['page'] .'.php')){
require DIR_FS .'/lib/lang/'. $_SESSION['lang'] .'/seiten'. $_GET['page'] .'.php';
}
}