From 502e9f0812b5ef55c23218ec2dbf5308a8509f0e Mon Sep 17 00:00:00 2001 From: isaack <isaack0815@gmail.com> Date: Sun, 3 Dec 2017 11:42:06 +0100 Subject: [PATCH] kleine bugs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Chat wurde funktionstüchtig gemacht, userprofil und nickpage design und funktion erweitert. --- content/konto/nickpage.php | 63 +++++++++---------------------- content/konto/refuebersicht.php | 24 ++++++------ content/konto/userprofil.php | 10 ++--- install/mysql.txt | 23 ++++++++++- lib/class/chat.class.php | 3 +- lib/functions.lib.php | 11 +++++- lib/funktionen/konto/anmelden.php | 3 ++ lib/funktionen/konto/nickpage.php | 60 +++++++++++++++++++++++++++++ lib/run.inc.php | 16 +++++--- lib/session.lib.php | 2 +- 10 files changed, 140 insertions(+), 75 deletions(-) create mode 100644 lib/funktionen/konto/nickpage.php diff --git a/content/konto/nickpage.php b/content/konto/nickpage.php index 0ac36b3..d2b6ea3 100644 --- a/content/konto/nickpage.php +++ b/content/konto/nickpage.php @@ -4,44 +4,16 @@ $nickpage = mysqli_fetch_array(db_query("SELECT * FROM ".$db_prefix."_nickpage W $userdaten = mysqli_fetch_array(db_query("SELECT * FROM ".$db_prefix."_userdaten WHERE uid=".$_SESSION['uid']."")); $esc = mysqli_fetch_array(db_query("SELECT bdate FROM ".$db_prefix."_userdaten WHERE uid = '". mysqli_real_escape_string($sql_open,$_SESSION['uid']) ."' ")); -if ($_POST['aendern_nickpage']) { - if ($nickpage['uid'] != $_SESSION['uid']) { - db_query("INSERT ".$db_prefix."_nickpage SET uid = '".$_SESSION['uid']."'"); - } - $explode = explode(".",$_POST['bdate']); - $bdate = mktime(0,0,0,$explode[1],$explode[0],$explode[2]); - db_query("UPDATE ".$db_prefix."_nickpage SET - sex = '".htmlspecialchars($_POST['sex'])."', - ort = '".htmlspecialchars($_POST['ort'])."', - land = '".htmlspecialchars($_POST['land'])."', - hobbys = '".htmlspecialchars($_POST['hobbys'])."', - beruf = '".htmlspecialchars($_POST['beruf'])."', - icq = '".htmlspecialchars($_POST['icq'])."', - msn = '".htmlspecialchars($_POST['msn'])."', - aim = '".htmlspecialchars($_POST['aim'])."', - skype = '".htmlspecialchars($_POST['skype'])."', - www = '".htmlspecialchars($_POST['www'])."', - www1 = '".htmlspecialchars($_POST['www1'])."', - www2 = '".htmlspecialchars($_POST['www2'])."', - www3 = '".htmlspecialchars($_POST['www3'])."' - WHERE uid=".$_SESSION['uid'].""); - db_query("UPDATE ".$db_prefix."_userdaten SET bdate = '". mysqli_real_escape_string($sql_open,$bdate) ."' WHERE uid = '". mysqli_real_escape_string($sql_open,$_SESSION['uid']) ."' "); - - if ($_POST['ava'] == '') { - db_query("UPDATE ".$db_prefix."_nickpage SET ava = '' WHERE uid=".$_SESSION['uid'].""); - - } else { - db_query("UPDATE ".$db_prefix."_nickpage SET ava = '".mysqli_real_escape_string($sql_open,$_POST['ava'])."' WHERE uid=".$_SESSION['uid'].""); - - } - $meldung = 'Deine Daten wurden aktualisiert!<br>'; - $nickpage = mysqli_fetch_array(db_query("SELECT * FROM ".$db_prefix."_nickpage WHERE uid=".$_SESSION['uid']."")); - $esc = mysqli_fetch_array(db_query("SELECT bdate FROM ".$db_prefix."_userdaten WHERE uid = '". mysqli_real_escape_string($sql_open,$_SESSION['uid']) ."' ")); +if($esc['bdate'] == 0){ + $bdate = 'placeholder="TT.MM.JJJ'; +}else{ + $bdate = 'value="'. date("d.m.Y", $esc['bdate']) .'"'; } + ?> <form action="" method="post"> -<table cellspacing="3" align="center"> +<table class="table"> <tr> <td><strong>Geschlecht: </strong></td> <td> @@ -54,7 +26,7 @@ if ($_POST['aendern_nickpage']) { </tr> <tr> <td><b>Geburtsdatum: </b></td> - <td><input type="date" name="bdate" class="tcal" value="<?php echo date("d.m.Y", $esc['bdate']);?>"></td> + <td><input type="date" name="bdate" class="tcal" <?php echo $bdate;?>></td> </tr> <tr> <td><strong>Wohnort: </strong></td> @@ -121,21 +93,20 @@ if ($_POST['aendern_nickpage']) { <? } ?> </td> </tr> - <tr> - <td height="10" colspan="2"></td> - </tr> <tr> <td colspan="2" align="center"> - <img src="<? if ($nickpage['ava'] == '') {echo 'images/noava.gif';} else { echo $nickpage['ava'];}?>" style="max-height:250; max-width:200; border-width:1px;"><br> - <br> - <input type="submit" name="aendern_nickpage" value="Änderungen speichern"> + <?php + if($nickpage['ava'] == ''){ + echo '<div class="alert alert-info">Kein Avatar gewählt</div>'; + }else{ + echo '<a href="#" class="thumbnail"><img src="'. $nickpage['ava'] .'" alt="'. $_SESSIOn['uid'] .'"></a>'; + } + ?> </td> </tr> </table> - -<center> -<br> - <?php echo $meldung;?> -</center> +<div class="text-center"> + <input type="submit" name="aendern_nickpage" class="btn btn-success" value="Änderungen speichern"> +</div> </form> diff --git a/content/konto/refuebersicht.php b/content/konto/refuebersicht.php index b259e3c..8d02e68 100644 --- a/content/konto/refuebersicht.php +++ b/content/konto/refuebersicht.php @@ -16,9 +16,9 @@ if (mysqli_num_rows($ebene1)){ $count++; if ($count % 2 == 0){$row = 0;}else{$row = 1;} - if ($user1['last_active'] >= (time()-(86400*7))) $refstatus = '<img src="./images/gruen.gif" width="15" height="15" border="0" alt="'.date("d.m.y - H:i",$user1['last_active']).'">'; - if ($user1['last_active'] < (time()-(86400*7))) $refstatus = '<img src="./images/gelb.gif" width="15" height="15" border="0" alt="'.date("d.m.y - H:i",$user1['last_active']).'">'; - if ($user1['last_active'] <= (time()-(86400*30))) $refstatus = '<img src="./images/rot.gif" width="15" height="15" border="0" alt="'.date("d.m.y - H:i",$user1['last_active']).'">'; + if ($user1['last_active'] >= (time()-(86400*7))) $refstatus = '<span class="glyphicon glyphicon-certificate" aria-hidden="true" style="color:green;" alt="'.date("d.m.y - H:i",$user1['last_active']).'"></span>'; + if ($user1['last_active'] < (time()-(86400*7))) $refstatus = '<span class="glyphicon glyphicon-certificate" aria-hidden="true" style="color:yellow;" alt="'.date("d.m.y - H:i",$user1['last_active']).'"></span>'; + if ($user1['last_active'] <= (time()-(86400*30))) $refstatus = '<span class="glyphicon glyphicon-certificate" aria-hidden="true" style="color:red;" alt="'.date("d.m.y - H:i",$user1['last_active']).'"></span>'; $anz .= ' <tr class="tr_row'.$row.'"> @@ -41,9 +41,9 @@ $ebene2 = db_query("SELECT werber.*, u.nickname, k.last_active FROM $count++; if ($count % 2 == 0){$row = 0;}else{$row = 1;} - if ($user2['last_active'] >= (time()-(86400*7))) $refstatus = '<img src="./images/gruen.gif" width="15" height="15" border="0" alt="'.date("d.m.y - H:i",$user2['last_active']).'">'; - if ($user2['last_active'] < (time()-(86400*7))) $refstatus = '<img src="./images/gelb.gif" width="15" height="15" border="0" alt="'.date("d.m.y - H:i",$user2['last_active']).'">'; - if ($user2['last_active'] <= (time()-(86400*30))) $refstatus = '<img src="./images/rot.gif" width="15" height="15" border="0" alt="'.date("d.m.y - H:i",$user2['last_active']).'">'; + if ($user2['last_active'] >= (time()-(86400*7))) $refstatus = '<span class="glyphicon glyphicon-certificate" aria-hidden="true" style="color:green;" alt="'.date("d.m.y - H:i",$user2['last_active']).'"></span>'; + if ($user2['last_active'] < (time()-(86400*7))) $refstatus = '<span class="glyphicon glyphicon-certificate" aria-hidden="true" style="color:yellow;" alt="'.date("d.m.y - H:i",$user2['last_active']).'"></span>'; + if ($user2['last_active'] <= (time()-(86400*30))) $refstatus = '<span class="glyphicon glyphicon-certificate" aria-hidden="true" style="color:red;" alt="'.date("d.m.y - H:i",$user2['last_active']).'"></span>'; $anz2 .= ' <tr class="tr_row'.$row.'"> @@ -66,9 +66,9 @@ $ebene3 = db_query("SELECT werber.*, u.nickname, k.last_active FROM $count++; if ($count % 2 == 0){$row = 0;}else{$row = 1;} - if ($user3['last_active'] >= (time()-(86400*7))) $refstatus = '<img src="./images/gruen.gif" width="15" height="15" border="0" alt="'.date("d.m.y - H:i",$user3['last_active']).'">'; - if ($user3['last_active'] < (time()-(86400*7))) $refstatus = '<img src="./images/gelb.gif" width="15" height="15" border="0" alt="'.date("d.m.y - H:i",$user3['last_active']).'">'; - if ($user3['last_active'] <= (time()-(86400*30))) $refstatus = '<img src="./images/rot.gif" width="15" height="15" border="0" alt="'.date("d.m.y - H:i",$user3['last_active']).'">'; + if ($user3['last_active'] >= (time()-(86400*7))) $refstatus = '<span class="glyphicon glyphicon-certificate" aria-hidden="true" style="color:green;" alt="'.date("d.m.y - H:i",$user3['last_active']).'"></span>'; + if ($user3['last_active'] < (time()-(86400*7))) $refstatus = '<span class="glyphicon glyphicon-certificate" aria-hidden="true" style="color:yellow;" alt="'.date("d.m.y - H:i",$user3['last_active']).'"></span>'; + if ($user3['last_active'] <= (time()-(86400*30))) $refstatus = '<span class="glyphicon glyphicon-certificate" aria-hidden="true" style="color:red;" alt="'.date("d.m.y - H:i",$user3['last_active']).'"></span>'; $anz3 .= ' <tr class="tr_row'.$row.'"> @@ -151,8 +151,8 @@ echo "<center>Noch keine Refs in Ebene 3</center>"; <br><hr width="90%"><br><center> <table width="60%" cellpadding="3" cellspacing="1" border="0"><tr><td><center> <b>Infos zur Refübersicht:</b><br><br> -<img src="images/rot.gif"> User war mind. 30 Tage nicht mehr aktiv.<br> -<img src="images/gelb.gif"> User war mind. 7 Tage nicht mehr aktiv.<br> -<img src="images/gruen.gif"> User war in den letzen 7 Tagen aktiv.<br></center> +<span class="glyphicon glyphicon-certificate" aria-hidden="true" style="color:red;"></span> User war mind. 30 Tage nicht mehr aktiv.<br> +<span class="glyphicon glyphicon-certificate" aria-hidden="true" style="color:yellow;"></span> User war mind. 7 Tage nicht mehr aktiv.<br> +<span class="glyphicon glyphicon-certificate" aria-hidden="true" style="color:green;"></span> User war in den letzen 7 Tagen aktiv.<br></center> </td></tr></table></center> <?php foot();?> \ No newline at end of file diff --git a/content/konto/userprofil.php b/content/konto/userprofil.php index 825522b..811801c 100644 --- a/content/konto/userprofil.php +++ b/content/konto/userprofil.php @@ -100,10 +100,10 @@ die Paidmails wenn Du keine habe möchtest!<br> <?php head("$seitenname - Profildaten");?> <form action="" method="post"> - <table width="100%" border="0" cellpadding="1" cellspacing="1"> + <table class="table"> <tr> - <td>Nickname:</td> - <td><?php echo $info['nickname'];?></td> + <td>Nickname/UID:</td> + <td><?php echo $info['nickname'];?> / <?php echo $_SESSION['uid'];?></td> </tr> <tr> <td>Name:</td> @@ -117,10 +117,6 @@ die Paidmails wenn Du keine habe möchtest!<br> <td>Emailadresse:</td> <td><input type="text" name="emailadresse" value="<?php echo $info['emailadresse'];?>"></td> </tr> - <tr> - <td><?php echo $waehrung; ?>-Id:</td> - <td><?php echo $_SESSION['uid'];?></td> - </tr> <tr> <td>Neues Passwort:</td> <td><input type="password" name="pwd"></td> diff --git a/install/mysql.txt b/install/mysql.txt index 6bd1bd4..7d841f1 100644 --- a/install/mysql.txt +++ b/install/mysql.txt @@ -311,6 +311,23 @@ CREATE TABLE IF NOT EXISTS `vms_news_komment` ( INSERT INTO `vms_news_komment` (`id`, `uid`, `datum`, `news`, `kommentar`) VALUES (1, 1, 1459701800, 1, 'Das ist der erste Test'); +CREATE TABLE `vms_nickpage` ( + `uid` int(11) NOT NULL, + `sex` int(11) NOT NULL, + `ort` int(11) NOT NULL, + `land` int(11) NOT NULL, + `hobbys` int(11) NOT NULL, + `beruf` int(11) NOT NULL, + `icq` int(11) NOT NULL, + `msn` int(11) NOT NULL, + `aim` int(11) NOT NULL, + `skype` int(11) NOT NULL, + `www` int(11) NOT NULL, + `www1` int(11) NOT NULL, + `www2` int(11) NOT NULL, + `www3` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + CREATE TABLE IF NOT EXISTS `vms_paidmails_empfaenger` ( `uid` int(7) NOT NULL DEFAULT '0', `gueltig` int(11) NOT NULL DEFAULT '0', @@ -503,15 +520,17 @@ CREATE TABLE IF NOT EXISTS `vms_userblacklist` ( `zeit` bigint(11) NOT NULL DEFAULT '0' ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -CREATE TABLE IF NOT EXISTS `vms_userdaten` ( +CREATE TABLE `vms_userdaten` ( `uid` int(7) NOT NULL DEFAULT '0', `nickname` varchar(255) NOT NULL DEFAULT '', `vorname` varchar(50) NOT NULL DEFAULT '', `nachname` varchar(50) NOT NULL DEFAULT '', `angemeldet_seit` int(10) NOT NULL DEFAULT '0', `max_forced` int(11) NOT NULL DEFAULT '5', + `max_paidlinks` int(11) NOT NULL DEFAULT '5', `notizen` text NOT NULL, - `chat_sperre` int(11) NOT NULL DEFAULT '0' + `chat_sperre` int(11) NOT NULL DEFAULT '0', + `bdate` int(11) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO `vms_userdaten` (`uid`, `nickname`, `vorname`, `nachname`, `angemeldet_seit`, `max_forced`, `notizen`, `chat_sperre`) VALUES diff --git a/lib/class/chat.class.php b/lib/class/chat.class.php index 4d853b7..fc9d9c6 100644 --- a/lib/class/chat.class.php +++ b/lib/class/chat.class.php @@ -4,9 +4,10 @@ class chatClass { public static function getRestChatLines($id) { + global $db_host,$db_user,$db_pass,$db_base; $arr = array(); $jsonData = '{"results":['; - $db_connection = new mysqli( mysqlServer, mysqlUser, mysqlPass, mysqlDB); + $db_connection = new mysqli( $db_host, $db_user, $db_pass, $db_base); $db_connection->query( "SET NAMES 'UTF8'" ); $statement = $db_connection->prepare( "SELECT id, absender, nachricht, time FROM vms_chat WHERE id > ? "); $statement->bind_param( 'i', $id); diff --git a/lib/functions.lib.php b/lib/functions.lib.php index 43eb778..5c4a1af 100644 --- a/lib/functions.lib.php +++ b/lib/functions.lib.php @@ -258,5 +258,14 @@ function ageCalculator( $day, $month, $year ) { else return $calc_year; -} +} + +function sonderzeichen($text){ + if(preg_match('#[!"§$%&/()=?`\']#', $text)){ + $err = true; + }else{ + $err = false; + } + return $err; +} ?> diff --git a/lib/funktionen/konto/anmelden.php b/lib/funktionen/konto/anmelden.php index 87b4963..2d9a450 100644 --- a/lib/funktionen/konto/anmelden.php +++ b/lib/funktionen/konto/anmelden.php @@ -78,6 +78,9 @@ if (!isset($ak)) $ak = ""; ('" . mysqli_real_escape_string($sql_open,$uid) . "', '" . mysqli_real_escape_string($sql_open,$ak) . "') "); + db_query("INSERT INTO ". $db_prefix ."_nickpage (uid) VALUES ( + '". mysqli_real_escape_string($sql_open,$uid) ."' + )"); $email_message = 'Hallo ' . $_POST['nickname'] . ', Du hast Dich soeben erfolgreich bei ' . $seitenname . ' angemeldet. diff --git a/lib/funktionen/konto/nickpage.php b/lib/funktionen/konto/nickpage.php new file mode 100644 index 0000000..99c1044 --- /dev/null +++ b/lib/funktionen/konto/nickpage.php @@ -0,0 +1,60 @@ +<?php + + $error = 0; + $meldung = ''; + + if(sonderzeichen($_POST['sex'])){ $error = 1; $meldung .= 'Geschlächt enthält ungültige Zeichen.<br>';} + if(sonderzeichen($_POST['ort'])){ $error = 1; $meldung .= 'Ort enthält ungültige Zeichen.<br>';} + if(sonderzeichen($_POST['land'])){ $error = 1; $meldung .= 'Land enthält ungültige Zeichen.<br>';} + if(sonderzeichen($_POST['hobbys'])){ $error = 1; $meldung .= 'Hobbys enthält ungültige Zeichen.<br>';} + if(sonderzeichen($_POST['beruf'])){ $error = 1; $meldung .= 'Beruf enthält ungültige Zeichen.<br>';} + if(sonderzeichen($_POST['icq'])){ $error = 1; $meldung .= 'ICQ enthält ungültige Zeichen.<br>';} + if(sonderzeichen($_POST['msn'])){ $error = 1; $meldung .= 'MSN enthält ungültige Zeichen.<br>';} + if(sonderzeichen($_POST['aim'])){ $error = 1; $meldung .= 'aim enthält ungültige Zeichen.<br>';} + if(sonderzeichen($_POST['skype'])){ $error = 1; $meldung .= 'Skype enthält ungültige Zeichen.<br>';} + + if($error == 0){ + if($_POST['bdate'] != ''){ + $explode = explode(".",$_POST['bdate']); + $bdate = mktime(0,0,0,$explode[1],$explode[0],$explode[2]); + }else{ + $bdate = 0; + } + + + $update = db_query("UPDATE ".$db_prefix."_nickpage SET + sex = '".htmlspecialchars($_POST['sex'])."', + ort = '".htmlspecialchars($_POST['ort'])."', + land = '".htmlspecialchars($_POST['land'])."', + hobbys = '".htmlspecialchars($_POST['hobbys'])."', + beruf = '".htmlspecialchars($_POST['beruf'])."', + icq = '".htmlspecialchars($_POST['icq'])."', + msn = '".htmlspecialchars($_POST['msn'])."', + aim = '".htmlspecialchars($_POST['aim'])."', + skype = '".htmlspecialchars($_POST['skype'])."', + www = '".htmlspecialchars($_POST['www'])."', + www1 = '".htmlspecialchars($_POST['www1'])."', + www2 = '".htmlspecialchars($_POST['www2'])."', + www3 = '".htmlspecialchars($_POST['www3'])."' + WHERE uid=".$_SESSION['uid'].""); + db_query("UPDATE ".$db_prefix."_userdaten SET bdate = '". mysqli_real_escape_string($sql_open,$bdate) ."' WHERE uid = '". mysqli_real_escape_string($sql_open,$_SESSION['uid']) ."' "); + + if ($_POST['ava'] == '') { + db_query("UPDATE ".$db_prefix."_nickpage SET ava = '' WHERE uid=".$_SESSION['uid'].""); + + } else { + db_query("UPDATE ".$db_prefix."_nickpage SET ava = '".mysqli_real_escape_string($sql_open,$_POST['ava'])."' WHERE uid=".$_SESSION['uid'].""); + + } + if($update == true){ + $meldung = 'Daten erfolgreich gespeichert.<br>'; + }else{ + $meldung = 'Fehler beim speichern.<br>'.mysqli_error($sql_open); + } + $nickpage = mysqli_fetch_array(db_query("SELECT * FROM ".$db_prefix."_nickpage WHERE uid=".$_SESSION['uid']."")); + $esc = mysqli_fetch_array(db_query("SELECT bdate FROM ".$db_prefix."_userdaten WHERE uid = '". mysqli_real_escape_string($sql_open,$_SESSION['uid']) ."' ")); + } + + echo $meldung; + +?> \ No newline at end of file diff --git a/lib/run.inc.php b/lib/run.inc.php index a3b3606..045b350 100644 --- a/lib/run.inc.php +++ b/lib/run.inc.php @@ -2,33 +2,39 @@ //Chat if(isset($_POST['chat_absenden'])){ if($_POST['chat_absenden'] == 'Absenden' && $_SESSION['uid'] != 0){ - require_once('lib/funktionen/chat.php'); + require('lib/funktionen/chat.php'); } } //News //Kommentar Speichern if(isset($_POST['news_komment'])){ if($_POST['news_komment'] == 'Kommentar Speichern' && $_SESSION['uid'] != 0){ - require_once('lib/funktionen/news/kommentar.php'); + require('lib/funktionen/news/kommentar.php'); } } //Konto //Anmelden if(isset($_POST['news_komment'])){ if($_POST['anmelden'] == 'Jetzt anmelden!' && $_SESSION['uid'] == 0){ - require_once('lib/funktionen/konto/anmelden.php'); + require('lib/funktionen/konto/anmelden.php'); } } //Ãœberweisen if(isset($_POST['news_komment'])){ if($_POST['ueberweisen'] == 'Senden' && $_SESSION['uid'] != 0){ - require_once('lib/funktionen/konto/ueberweisen.php'); + require('lib/funktionen/konto/ueberweisen.php'); } } //Auszahlen if(isset($_POST['news_komment'])){ if($_POST['ueberweisen'] == 'Senden' && $_SESSION['uid'] != 0){ - require_once('lib/funktionen/konto/ueberweisen.php'); + require('lib/funktionen/konto/ueberweisen.php'); + } + } + //Nickpage + if (isset($_POST['aendern_nickpage'])){ + if($_POST['aendern_nickpage'] == 'Änderungen speichern' && $_SESSION['uid'] != 0){ + require('lib/funktionen/konto/nickpage.php'); } } ?> \ No newline at end of file diff --git a/lib/session.lib.php b/lib/session.lib.php index a0adc6d..f4d9453 100644 --- a/lib/session.lib.php +++ b/lib/session.lib.php @@ -1,5 +1,5 @@ <?php -/* +/*G8UqVbtH Datei : session.lib.php Änderungen in dieser Datei nur dann vornehmen wenn Sie wissen was Sie tun! */ -- GitLab