Advertisement
Guest User

Untitled

a guest
Feb 2nd, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 9.90 KB | None | 0 0
  1. <?php
  2.  
  3. require_once('./data_classes/server-data.php_data_classes-core.php.php');
  4.  
  5. $pagename = "Meus Detalhes";
  6. $body_id = "profile";
  7. $pageid = "2";
  8.  
  9. if(isset($_GET['web-profile-tab'])){
  10.     if($_GET['web-profile-tab'] < 2 || $_GET['web-profile-tab'] > 5 || !$_GET['web-profile-tab']){
  11.         header("Location: ".$path."/profile/2");
  12.         $tab = 0;
  13.         exit;
  14.     } else {
  15.         $tab = FilterText($_GET['web-profile-tab']);
  16.     }
  17. } else {
  18.     $tab = "2";
  19. }
  20.  
  21. if($tab == "2"){
  22.     if(isset($_POST['save'])){
  23.     $motto = $_POST['motto'];
  24.     $chr = chr(1);
  25.     $chr2 = chr(2);
  26.     $motto2 = str_replace($chr, "", $motto);
  27.     $motto3 = str_replace($chr2, "", $motto);
  28.  
  29.         if(strlen($motto3) > 24){
  30.             $result = "Sua missão é muito larga!";
  31.             $error = "1";
  32.         } else {
  33.             if($_POST['block_newfriends'] == "true"){ $block_newfriends = '0'; }else{ $block_newfriends = '1'; }
  34.  
  35.             mysql_query("UPDATE users SET motto = '".mysql_real_escape_string($motto3)."', visibility = '".mysql_real_escape_string($_POST['visibility'])."', block_newfriends = '".mysql_real_escape_string($block_newfriends)."', mymusik = '".mysql_real_escape_string($_POST['mymusik'])."' WHERE id = '".$my_id."' LIMIT 1") or die(mysql_error());
  36.             $result = "Seu perfil foi atualizado corretamente!";
  37.         }
  38.     }
  39. } else if($tab == "3"){
  40.     if(isset($_POST['save'])){
  41.     $pass1 = FilterText($_POST['password']);
  42.     $pass1_hash = HoloHashMD5($pass1, $myrow['username']);
  43.     $mail1 = FilterText($_POST['email']);
  44.     $themail = $mail1;
  45.         //checks password --encryption--
  46.         if($pass1_hash == $myrow['password'] ){
  47.         $email_check = preg_match("/^[a-z0-9_\.-]+@([a-z0-9]+([\-]+[a-z0-9]+)*\.)+[a-z]{2,7}$/i", $mail1);
  48.             if($email_check == "1"){
  49.             mysql_query("UPDATE users SET mail = '".$mail1."' WHERE username = '".$rawname."' and password = '".$rawpass."'") or die(mysql_error());
  50.  
  51.             $result = "A atualização do e-mail \"".$mail1."\" foi realizada corretamente!";
  52.             } else {
  53.             $result = "A atualização de e-mail está incorreta!";
  54.             $error = "1";
  55.             }
  56.         } else {
  57.         $result = "Seus dados estão incorretos!";
  58.         $error = "1";
  59.         }
  60.     } else {
  61.     $themail = $myrow['mail'];
  62.     }
  63.  
  64. } else if($tab == "4"){
  65.     if(isset($_POST['save'])){
  66.     $pass1 = FilterText($_POST['password']);
  67.     //Hashes and salts the old password with the user id (in lowercase) --encryption--
  68.     $pass1_hash = HoloHashMD5($pass1, $myrow['name']);
  69.     $newpass = FilterText($_POST['pass']);
  70.     //Hashes and salts the new password with the user id (in lowercase) --encryption--
  71.     $newpass_hash = HoloHashMD5($newpass, $rawname);
  72.     $newpass_conf = FilterText($_POST['confpass']);
  73.         if($pass1_hash == $myrow['password'] ){
  74.             if($newpass == $newpass_conf){
  75.                 if(strlen($newpass) < 6){
  76.                 $result = "A senha fornecida é muito curta, digite uma de pelo menos 6 carácteres!";
  77.                 $error = "1";
  78.                 } else {
  79.                     if(strlen($newpass) > 51){
  80.                     $result = "A senha é muito longa, forneça uma senha com menos de 50 carácteres!";
  81.                     $error = "1";
  82.                     } else {
  83.                     //Updates password --encryption--
  84.                     mysql_query("UPDATE users SET password = '".$newpass_hash."' WHERE username = '".$rawname."' and password = '".$rawpass."'") or die(mysql_error());
  85.                     $result = "A senha foi alterada. Por favor faça login novamente.";
  86.                     }
  87.                 }
  88.             } else {
  89.             $result = "As senhas não coincidem.";
  90.             $error = "1";
  91.             }
  92.         } else {
  93.         $result = "Preencha todos os campos requeridos!";
  94.         $error = "1";
  95.         }
  96.     }
  97.  
  98. }
  99.  
  100. require_once('./templates/community_subheader.php');
  101. require_once('./templates/community_header.php');
  102.  
  103. ?>
  104.  
  105. <div id="container">
  106.     <div id="content">
  107.     <div>
  108. <div class="content">
  109. <div class="habblet-container" style="float:left; width:210px;">
  110. <div class="cbb settings">
  111.  
  112. <h2 class="title">Preferências</h2>
  113. <div class="box-content">
  114.             <div id="settingsNavigation">
  115.             <ul>
  116.         <?php
  117.         if($tab == "2"){
  118.                 echo "<li class='selected'>Meus detalhes
  119.                </li>";
  120.         } else {
  121.                 echo "<li><a href='".$path."/profile/2'>Meus detalhes</a>
  122.                </li>";
  123.         }
  124.  
  125.         if($tab == "4"){
  126.                 echo "<li class='selected'>Minha senha
  127.                </li>";
  128.         } else {
  129.                 echo "<li><a href='".$path."/profile/4'>Minha senha</a>
  130.                </li>";
  131.         }
  132.         ?>
  133.             </ul>
  134.             </div>
  135. </div></div>
  136. <?php if($hc > 1){ ?>
  137.     <div class="cbb habboclub-tryout">
  138.         <h2 class="title"><?php echo $shortname; ?> VIP</h2>
  139.         <div class="box-content">
  140.             <div class="habboclub-banner-container habboclub-clothes-banner"></div>
  141.             <p class="habboclub-header"><?php echo $shortname; ?> VIP são as pessoas destacadas do Hotel, elas têm uma larga lista de benefícios e comandos exclusivos! Faça parte dos membros VIP imediatamente!</p>
  142.             <p class="habboclub-link"><a href="credits/vip">Ver mais benefícios »</a></p>
  143.         </div>
  144.     </div>
  145. <?php } ?>
  146. </div>
  147.  
  148. <?php if($tab == "2"){ ?>
  149.     <div class="habblet-container " style="float:left; width: 560px;">
  150.         <div class="cbb clearfix settings">
  151.  
  152.             <h2 class="title">Mudar Perfil</h2>
  153.             <div class="box-content">
  154.  
  155.  
  156.  
  157. <form action="profile/2" method="post">
  158. <input type="hidden" name="tab" value="2" />
  159. <input type="hidden" name="__app_key" value="HoloCMS" />
  160.  
  161. <?php
  162.  
  163. if(!empty($result)){
  164.     if($error == "1"){
  165.         echo "<div class='rounded rounded-red'>";
  166.     } else {
  167.         echo "<div class='rounded rounded-green'>";
  168.     }
  169.  
  170.     echo $result . "<br />
  171.     </div><br />";
  172. }
  173.  
  174. $user_sql = mysql_query("SELECT * FROM users WHERE id = '".$my_id."'");
  175. $user_row = mysql_fetch_assoc($user_sql);
  176.  
  177. ?>
  178.  
  179. <h3><?php echo $shortname; ?> Home</h3>
  180.  
  181. <p>
  182. Quem verá sua <?php echo $shortname; ?> home?<br>
  183. <label><input name="visibility" value="EVERYONE" <?php if($user_row['visibility'] == "EVERYONE"){ ?>checked="checked" <?php } ?>type="radio">Todos</label>
  184. <label><input name="visibility" value="FRIENDS" <?php if($user_row['visibility'] == "FRIENDS"){ ?>checked="checked" <?php } ?>type="radio">Meus amigos</label>
  185. <label><input name="visibility" value="NOBODY" <?php if($user_row['visibility'] == "NOBODY"){ ?>checked="checked" <?php } ?>type="radio">Ninguém</label>
  186. </p>
  187.  
  188. <h3>Pedidos de amizade</h3>
  189. <p>
  190.  
  191. <label>
  192. <input name="block_newfriends" <?php if($user_row['block_newfriends'] == 0){ ?>checked="checked"<?php } ?> value="true" type="checkbox">
  193. Pedidos de amizade ativado
  194. </label></p>
  195.  
  196. <h3>Online Status</h3>
  197. <p>
  198.  
  199. <label>
  200. <input name="hide_online" <?php if($user_row['hide_online'] == 0){ ?>checked="checked"<?php } ?> value="true" type="checkbox">
  201. Todos podem me ver online
  202. </label></p>
  203.  
  204. <h3>Preferências "Siga-me"</h3>
  205. <p>
  206.  
  207. <label>
  208. <input name="hide_inroom" <?php if($user_row['hide_inroom'] == 0){ ?>checked="checked"<?php } ?> value="true" type="checkbox">
  209. Todos podem me seguir
  210. </label></p>
  211.  
  212. <div class="settings-buttons">
  213. <input type="submit" value="Salvar" name="save" class="submit" />
  214. </div>
  215.  
  216. </form>
  217.  
  218. </div></div>
  219.     </div>
  220. <?php } else if($tab == "3"){ ?>
  221. </div>
  222.  
  223.  
  224. </div>
  225. </div>
  226.  
  227. <?php } else if($tab == "4"){ ?>
  228.  
  229. <div class="habblet-container " style="float:left; width: 560px;">
  230.         <div class="cbb clearfix settings">
  231.  
  232.             <h2 class="title">Mudar senha</h2>
  233.             <div class="box-content">
  234.  
  235. <?php
  236. if(!empty($result)){
  237.     if($error == "1"){
  238.     echo "<div class='rounded rounded-red'>";
  239.     } else {
  240.     echo "<div class='rounded rounded-green'>";
  241.     }
  242.     echo "".$result."<br />
  243.     </div><br />";
  244. }
  245. ?>
  246.  
  247.  
  248. <form action="profile/4" method="post" id="passwordform">
  249. <input type="hidden" name="tab" value="4" />
  250. <input type="hidden" name="__app_key" value="HoloCMS" />
  251.  
  252. <div class="settings-step">
  253.  
  254. <p>
  255.  <label for="currentpassword">Senha atual</label><br />
  256.  <input type="password" size="32" maxlength="32" name="password" id="currentpassword" class="currentpassword " />
  257. </p>
  258.  
  259. <div>
  260.  
  261.  
  262.     </div>
  263. </div>
  264. <div class="settings-step">
  265.  
  266. <p>
  267. <label for="pass">Nova senha</label><br />
  268. <input type="password" name="pass" id="password" size="32" maxlength="48" value="" />
  269. </p>
  270.  
  271. <p>
  272. <label for="confpass">Re-digite a nova senha</label><br/>
  273. <input type="password" name="confpass" id="password" size="32" maxlength="48" value="" />
  274. </p>
  275.  
  276.     </div>
  277. </div>
  278.  
  279. <div class="settings-buttons">
  280. <input type="submit" value="Mudar senha" name="save" class="submit" />
  281. </div>
  282.  
  283. </form>
  284.  
  285. </div></div></div></div>
  286.  
  287.  
  288. </div>
  289. </div>
  290.  
  291.  
  292.  
  293. <script type="text/javascript">
  294.   L10N.put("friendmanagement.tooltip.deletefriends", "Ausgewählte Freunde wirklich löschen?\n<div class=\"friendmanagement-small-icons friendmanagement-save friendmanagement-tip-delete\"\>\n    <a class=\"friends-delete-button\" id=\"delete-friends-button\"\>Löschen</a\>\n</div\>\n<div class=\"friendmanagement-small-icons friendmanagement-remove friendmanagement-tip-cancel\"\>\n    <a id=\"cancel-delete-friends\"\>Beenden</a\>\n</div\>\n\n");
  295.   L10N.put("friendmanagement.tooltip.deletefriend", "Ausgewählter Freund wirklich löschen?\n<div class=\"friendmanagement-small-icons friendmanagement-save friendmanagement-tip-delete\"\>\n    <a id=\"delete-friend-%friend_id%\"\>Löschen</a\>\n</div\>\n<div class=\"friendmanagement-small-icons friendmanagement-remove friendmanagement-tip-cancel\"\>\n    <a id=\"remove-friend-can-%friend_id%\"\>Beenden</a\>\n</div\>");
  296.   L10N.put("friendmanagement.tooltip.deletecategory", "Diese Kategorie wirklich löschen?\n<div class=\"friendmanagement-small-icons friendmanagement-save friendmanagement-tip-delete\"\>\n    <a class=\"delete-category-button\" id=\"delete-category-%category_id%\"\>Löschen</a\>\n</div\>\n<div class=\"friendmanagement-small-icons friendmanagement-remove friendmanagement-tip-cancel\"\>\n    <a id=\"cancel-cat-delete-%category_id%\"\>Beenden</a\>\n</div\>");
  297.   new FriendManagement({ currentCategoryId: 0, pageListLimit: 30, pageNumber: 1});
  298. </script>
  299.  
  300.     </div>
  301.     </div>
  302. <?php } else { header("location: ".$path.""); exit; } require_once('./templates/community_footer.php'); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement