Newer
Older
error_reporting(E_ALL);
ini_set('display_errors', 'On');
ini_set('error_log', '/home/isaack/vms_suee/error/error-'. date("d.m.Y",time()).'.log');
ini_set('log_errors', 'On');
if(!file_exists('/home/isaack/vms_suee/error/error-'. date("d.m.Y",time()).'.log')){
$datei = fopen('/home/isaack/vms_suee/error/error-'. date("d.m.Y",time()).'.log',"w");
fwrite($datei, " ",100);
fclose($datei);
}
$ip = $_SERVER['REMOTE_ADDR'];
function pw_erstellen($pw){
global $pw_zusatz;
$pw_er = hash("sha256",$pw.$pw_zusatz);
return $pw_er;
}
// Komprimierung der Ausgabe zwischen 0 & 10 wobei 0 die Komprimierung der Ausgabe deaktiviert Empfohlener Wert: 1
$gzip_rate = 0;
/**
* 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;
}
function ReloadDelete(){
global $datenbank;
$datenbank->delete(PREFIX . RELOAD, array("bis" => "<".time() ) );
}
function __construct(){
global $datenbank;
$this->db = $datenbank;
}
$kontos = $this->db->get_row("SELECT kontostand_a,kontostand_b FROM ". PREFIX . KONTO . " WHERE uid = '". $this->db->escape($this->uid) ."' ");
if($konto == 'kontostand'){
return $kontos->kontostand_a;
}else{
return $kontos->kontostand_b;
}
}
function kontobuchung_a ($art, $trans_menge, $buchungs_id, $fuer, $verwendung) {
$konto = $this->kontostand('kontostand');
array("uid" => $fuer),
1
);
if($buchung == true){
$buchung_ok = 1;
}else{
$buchung_ok = 2;
}
PREFIX . BUCH ,
array( "uid" => $fuer,
"buchungszeit" => time(),
"buchungs_id" => $buchungs_id,
"buchungsmenge" => $art.$trans_menge,
"verwendungszweck" => $verwendung,
"buchung_ok" => $buchung_ok
)
);
}
function kontobuchung_b(){
$konto = $this->kontostand('kontostand_b');
);
if($buchung == true){
$buchung_ok = 1;
}else{
$buchung_ok = 2;
}
PREFIX . BUCH_B ,
array( "uid" => $fuer,
"buchungszeit" => time(),
"buchungs_id" => $buchungs_id,
"buchungsmenge" => $art.$trans_menge,
"verwendungszweck" => $verwendung,
"buchung_ok" => $buchung_ok
)
);
function refumsatz ($summe, $uid) {
global $datenbank;
$user = $datenbank->get_row("SELECT umsatz FROM ". PREFIX . WERBER ." WHERE uid = '". $datenbank->escape($uid) ."' ");
$datenbank->update(
array( "umsatz" => $user->umsatz + $summe,
"aktivzeit" => time()
),
array(
"uid" => $datenbank->escape($uid),
"werber" => " != 0"
),
1
);
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
}
/**
* 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 $time;
db_query("UPDATE vms_kontodaten SET eintap = eintap + ".$anzahl."/100 WHERE uid= ".$uid." LIMIT 1");
$rallyorte=mysqli_fetch_array(db_query("SELECT welche_rallys FROM vms_rallyorte WHERE id = '".$was."' LIMIT 1"));
$rally = db_query("SELECT * FROM `vms_rallydaten` WHERE `id` IN (".$rallyorte['welche_rallys'].") AND `status` = 'aktive' AND `start` <= UNIX_TIMESTAMP() AND ((`ende_art` = 'zeit' AND `ende_zeit` > UNIX_TIMESTAMP()) OR (`ende_art` = 'punkt' AND `ende_punkte` > `ende_punkte_aktuell`)) ");
while($rallys = mysqli_fetch_array($rally)){
$gesperrt = explode(',',$rallys['sperruser']);
if (!in_array($uid, $gesperrt)) {
$anzahl2 = $anzahl.$rallys['ende_punkte_anzahl'];
eval("\$anzahl2 = $anzahl2;");
$steigerung = $anzahl.$rallys['gewinn_dyn_steigerung'];
eval("\$steigerung = $steigerung;");
if ($rallys['gewinn_art'] == 'dynamisch') db_query ("UPDATE vms_rallydaten SET gewinn_topf=gewinn_topf+'".$steigerung."' WHERE id = '".$rallys['id']."' LIMIT 1");
if ($rallys['ende_art'] == 'punkt') db_query ("UPDATE vms_rallydaten SET ende_punkte_aktuell = ende_punkte_aktuell + '".$anzahl2."' WHERE id = ".$rallys['id']." LIMIT 1");
db_query ("UPDATE vms_rallyuser SET punkte = punkte + '".$anzahl2."' WHERE uid = '".$_SESSION['uid']."' AND rally = '".$rallys['name']."' AND ausgezahlt < '1'");
if (mysqli_affected_rows () == 0) db_query ("INSERT INTO vms_rallyuser (rally,uid,punkte) VALUES ('".$rallys['name']."','".$uid."','".$anzahl2."')");
}
}
}
// 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();
}
// 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.".*
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)
WHERE ".PREFIX . USER .".uid= ".$uid.";",true);