Advertisement
Guest User

adabb

a guest
Feb 9th, 2016
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.41 KB | None | 0 0
  1. <?php
  2. if(!isset($_SESSION['UserData']['Username'])){
  3. //header("location: ucp.php");
  4. echo 'Nemos to bajo moj!';
  5. exit;
  6. }else{
  7. ?>
  8. <div class="header">
  9. <img src="slike/logo.png" alt="City of Crime logo" class="login-logo">
  10. </div>
  11. <div class="nav">
  12. <a href="index.php">POCETNA</a>
  13. <a class="selected" href="index.php?akcija=profil">POODESAVANJA</a>
  14. <a href="index.php?akcija=signatura">SIGNATURA</a>
  15. <a href="index.php?akcija=statistika">SERVER</a>
  16. <a href="index.php?akcija=logout">ODJAVI SE</a>
  17. </div>
  18. <div class="ucp-box" style="background: transparent;">
  19. <div class="ucp">
  20. <div class="simple-box">
  21. <div class="stats-title">PROMJENA SIFRE</div>
  22. <?php
  23. }
  24. // PROMJENA SIFRE
  25. if(isset($_POST['submit'])){
  26. $password_old = udb_hash($_POST['password_old']);
  27. $password_new = udb_hash($_POST['password_new']);
  28. $ime = $_SESSION['ime'];
  29. // FTP
  30. $ftpip = $config['ftp-ip'];
  31. $ftpuser = $config['ftp-username'];
  32. $ftppass = $config['ftp-password'];
  33. $ftppath = $config['ftp-pathdokorisnika'];
  34. $filename = "ftp://$ftpuser:$ftppass@$ftpip/$ftppath/$ime.ini";
  35. $contents = file_get_contents($filename);
  36. $ini = parse_ini_string($contents, true);
  37. // UZIMA PASSWORD IZ .INI IGRACA
  38. $pass = $ini['data']['Password'];
  39. //
  40. if($password_old != $pass){
  41. $msg = "Trenutna sifra nije tacna!";
  42. }
  43. if(empty($password_old) || empty($password_new)){
  44. $msg = "Niste popunili sva polja!";
  45. }
  46. if($password_old == $pass and $password_new){
  47. $ftp_path = $filename;
  48. $stream_options = array('ftp' => array('overwrite' => true));
  49. $stream_context = stream_context_create($stream_options);
  50. $old = "Password = $password_old";
  51. $new = "Password = $password_new";
  52. $str=implode("",file($filename));
  53. $str=str_replace("$old", "$new",$str);
  54. if ($fh = fopen($ftp_path, 'w', 0, $stream_context)){
  55. fputs($fh, $str);
  56. fclose($fh);
  57. $msg = "Uspjesno ste promijenili sifru!";
  58. }else{ die('Could not open file.');}
  59. }else{
  60. if(empty($password_old)){
  61. $msg = "Niste upisali trenutnu sifru!";
  62. }else if(empty($password_new)){
  63. $msg = "Niste upisali novu sifru!";
  64. }
  65. }
  66. }
  67. //PROMJENA SKINA
  68. if(isset($_POST['submit2'])){
  69. $skin_new = $_POST['skin'];
  70. $ime = $_SESSION['ime'];
  71. // FTP
  72. $ftpip = $config['ftp-ip'];
  73. $ftpuser = $config['ftp-username'];
  74. $ftppass = $config['ftp-password'];
  75. $ftppath = $config['ftp-pathdokorisnika'];
  76. $filename = "ftp://$ftpuser:$ftppass@$ftpip/$ftppath/$ime.ini";
  77. $contents = file_get_contents($filename);
  78. $ini = parse_ini_string($contents, true);
  79. // UZIMA SKIN IZ .INI IGRACA
  80. $skin_old = $ini['data']['Skin'];
  81. if(empty($skin_new)){
  82. $msg = "Niste unijeli zeljeni ID skina!";
  83. }else{
  84. $ftp_path = $filename;
  85. $stream_options = array('ftp' => array('overwrite' => true));
  86. $stream_context = stream_context_create($stream_options);
  87. $old = "Skin = $skin_old";
  88. $new = "Skin = $skin_new";
  89. $str=implode("",file($filename));
  90. $str=str_replace("$old", "$new",$str);
  91. if ($fh = fopen($ftp_path, 'w', 0, $stream_context)){
  92. fputs($fh, $str);
  93. fclose($fh);
  94. $msg = "Uspjesno ste promijenili skin!";
  95. }
  96. }
  97. }
  98. ?>
  99. <form action="" method="post">
  100. <?php if(isset($msg)){?>
  101. <?php echo '<div class="error"><hr>'.$msg.'<hr></div><br>';?>
  102. <?php } ?>
  103. Trenutna sifra: <br><input name="password_old" type="password" class="Input"><br>
  104. Nova sifra: <br><input name="password_new" type="password" class="Input"><br><br>
  105. <input name="submit" type="submit" value="Promeni" class="dugme">
  106. </form>
  107. </div>
  108. <div class="simple-box">
  109. <div class="stats-title">PROMJENA SKINA</div>
  110. <form action="" method="post">
  111. <?php
  112. $skins = 0;
  113. for ($idx = 1; $idx <= 311; $idx++)
  114. {
  115. if(file_exists("slike/skins/".$idx.".png"))
  116. {
  117. $skins ++;
  118. echo '<i><a STYLE=text-decoration:none href="index.php?s='.$idx.'"><img SRC="slike/skins/'.$idx.'.png" width="93" height="120"></i></a>';
  119. if($skins >5)
  120. {
  121. echo '<br>';
  122. $skins = 0;
  123. }
  124. }
  125. }
  126. echo '</center>';
  127. ?><br>
  128. ID Skina: <a href="https://wiki.sa-mp.com/wiki/Skins:All">ID-ovi skinova</a><br><input name="skin" type="text" class="Input"><br><br>
  129. <input name="submit2" type="submit" value="Promeni" class="dugme">
  130. </form>
  131. </div>
  132. </div>
  133. </div>
  134. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement