Advertisement
Guest User

Untitled

a guest
Mar 24th, 2016
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.17 KB | None | 0 0
  1. //FTP USER srv1100
  2. //FTP HOST 51.254.124.152
  3. //SERVERIP 51.254.124.152:7770
  4. //Za sifru mi stavi "SifraOdBaze"
  5. //Korisnici se nalaze u /scriptfiles/korisnici
  6. //Sifra se cuva kao "Sifra" u .ini
  7.  
  8. <?php
  9. if(!isset($_SESSION['Username'])&&!isset($_SESSION['Password'])&&!isset($_POST['Username']) && !isset($_POST['Password']))
  10. {
  11. echo '<form name="form1" method="post" action="index.php">
  12. <strong><span style="color:black">UCPi Login</span></strong><br>
  13. Username: <input name="Username" type="text" id="Username"><br>
  14. Password: <input name="Password" type="password" id="Password"><br>
  15. <input type="submit" name="Submit" value="Login">
  16. </form>';
  17. }
  18. else
  19. {
  20. require_once 'Config/Lite.php';
  21.  
  22. $FTP_HOST = "HOST";
  23. $FTP_USER = "USER";
  24. $FTP_PASS = "PASS";
  25.  
  26. // set up basic connection
  27. $cHandle = ftp_connect($FTP_HOST) or die("Server can't connect to ftp");
  28.  
  29. // login with username and password
  30. $login_result = ftp_login($cHandle, $FTP_USER, $FTP_PASS) or die("Server can not login to ftp!");
  31.  
  32. $user['Name'] = 'ftp://'.$FTP_USER.':'.$FTP_PASS.'@YOURSERVERIPHERE/samp03/users/'.$_SESSION['Username'].'.ini';
  33.  
  34. $file = new Config_Lite($user['Name']);//Get INI file
  35.  
  36. //Check If account exists
  37. if (!file_exists($user['Name'])) {
  38. unset ($_SESSION['Password'],$_SESSION['Username']);
  39. echo 'Invalid Account name!
  40. <meta HTTP-EQUIV="REFRESH" content="3; url=index.php">';
  41. } else
  42. {
  43. //GetData
  44. $user['Password'] = $file->get(null, 'Password');
  45. $user["Money"] = $file->get(null, 'Money');
  46. $user["Score"] = $file->get(null, 'Score');
  47. $user["Admin"] = $file->get(null, 'Admin');
  48. $user["VIP"] = $file->get(null, 'VIP');
  49. $user["Skin"] = $file->get(null, 'Skin');
  50. $user["ID"] = $file->get(null, 'ID');
  51. $user["RegOn"] = $file->get(null, 'RegDate');
  52. $password1 = $_SESSION['Password'];
  53.  
  54. //Hashing Pass..
  55. $hashed = hash('whirlpool', $password1);
  56. //Checking Pass
  57. if($user['Password'] != $hashed)
  58. {
  59. unset ($_SESSION['Password'],$_SESSION['Username']);
  60. echo 'Invalid Password, Please try again!
  61. <meta HTTP-EQUIV="REFRESH" content="3; url=index.php">';
  62. } else
  63. {
  64. if(!isset($_GET['page']))
  65. {
  66. $_GET['page'] = 0;
  67. }
  68. $page = $_GET['page'];
  69. if($page == 0)
  70. {
  71. echo '<table align="center" width="80%"><TR VALIGN=TOP><td><span style="color:black">
  72. </td>
  73. <td>';
  74. echo '<br><img align="left" SRC="images/skins/'.$user['Skin'].'.jpg">';
  75. echo '<h1 style="color:red" align="center">Your Stats:</h1>';
  76. echo "<br><span style='color:black'><h2 align='center'>Money: ".$user['Money']."</span>";
  77. echo "<br><span style='color:black'>Score: ".$user['Score']."</span>";
  78. echo "<br><span style='color:black'>AdminLevel: ".$user['Admin']."</span>";
  79. echo "<br><span style='color:black'>VIPLevel: ".$user['VIP']."</span>";
  80. echo "<br><span style='color:black'>Skin: ".$user['Skin']."</span>";
  81. echo "<br><span style='color:black'>Registered On: ".$user['RegOn']."</span>";
  82. echo "</h2>";
  83. echo'</td></tr></table>';
  84. } else
  85. if($page == 1)
  86. {
  87. if(!isset($_GET['ac']))
  88. {
  89. $_GET['ac'] = 0;
  90. }
  91. $acc = $_GET['ac'];
  92. if($acc == 0)
  93. {
  94. echo '<h1><a href="index.php?page=1&ac=1">Change Password</a></h1>';
  95. } else
  96. if($acc == 1)
  97. {
  98. if(!isset($_POST['password']))
  99. {
  100. echo '<center>
  101. New Password: <form action="index.php?page=1&ac=1" method="post">
  102. <input type="text" name="password" />
  103. <input type="submit" value="Change" />
  104. </form>
  105. <center>';
  106. }
  107. else
  108. {
  109. //Hashing Pass..
  110. $hashed = hash('whirlpool', $_POST['password']);
  111. $file->set(null, 'Password', $hashed);//Set password
  112. $file->save();//save file
  113. echo "Your password have been changed successfully";
  114. unset ($_SESSION['Password'],$_SESSION['Username']);
  115. echo '<br>Please Login Again, with new password!
  116. <meta HTTP-EQUIV="REFRESH" content="3; url=index.php">';
  117.  
  118. }
  119. }
  120. }
  121. else
  122. if($page == 2)
  123. {
  124. if(!isset($_POST['name']))
  125. {
  126. echo '<center><br>Type the username below to generate:<br>
  127. <form action="index.php?page=2" method="post">
  128. <input type="text" name="name" />
  129. <input type="submit" value="Show" />
  130. </form>
  131. <center>';
  132. }
  133. else
  134. {
  135. $user['Name'] = 'ftp://'.$FTP_USER.':'.$FTP_PASS.'@YOURSERVERIPHERE/samp03/users/'.$_POST['name'].'.ini';
  136.  
  137. $file = new Config_Lite($user['Name']);//Get INI file
  138. if (!file_exists($user['Name'])) {
  139. echo 'No such user exists.
  140. <meta HTTP-EQUIV="REFRESH" content="3; url=index.php?page=2">';
  141. } else
  142. {
  143. //GetData Of user.
  144. $user["Money"] = $file->get(null, 'Money');
  145. $user["Score"] = $file->get(null, 'Score');
  146. $user["Admin"] = $file->get(null, 'Admin');
  147. $user["VIP"] = $file->get(null, 'VIP');
  148. $user["Skin"] = $file->get(null, 'Skin');
  149. $user["ID"] = $file->get(null, 'ID');
  150. $user["RegOn"] = $file->get(null, 'RegDate');
  151.  
  152. $add = "images/generate.jpg";
  153. $tsrc = "sig\/".$_POST['name'].".jpg";
  154. $im = ImageCreateFromJPEG($add);
  155. $green = imagecolorallocate($im,41,175,72);
  156. $pink = imagecolorallocate($im,222,0,225);
  157. $font2 = 'arial.ttf';
  158. $font = 'arialbd.ttf';
  159. imagettftext($im, 20, 0 ,80 ,25, $green, $font,$_POST['name']);
  160. imagettftext($im, 10, 0 ,80 ,60, $pink, $font,"Cash ".$user['Money']);
  161. imagettftext($im, 10, 0 ,80 ,80, $pink, $font,"Score ".$user['Score']);
  162. imagettftext($im, 10, 0 ,80 ,100, $pink, $font,"SkinID ".$user['Skin']);
  163.  
  164. imagettftext($im, 10, 0 ,170 ,60, $pink, $font,"AdminLevel ".$user['Admin']);
  165. imagettftext($im, 10, 0 ,170 ,80, $pink, $font,"VIPLevel ".$user['VIP']);
  166. imagettftext($im, 10, 0 ,170 ,100, $pink, $font,"Registered On ".$user['RegOn']);
  167. ImageJpeg($im,$tsrc);
  168. echo "<h1 style='color:red' align='center'>".$_POST['name']."'s statics has been generated:</h1>";
  169. echo '<center><img src="sig/'.$_POST['name'].'.jpg"></img></center>';
  170. }
  171. }
  172. }
  173. else
  174. if($page == 3)
  175. {
  176. if(!isset($_POST['name']))
  177. {
  178. echo '<center><br>Type the username below:<br>
  179. <form action="index.php?page=3" method="post">
  180. <input type="text" name="name" />
  181. <input type="submit" value="Show" />
  182. </form>
  183. <center>';
  184. }
  185. else
  186. {
  187. $user['Name'] = 'ftp://'.$FTP_USER.':'.$FTP_PASS.'@YOURSERVERIPHERE/samp03/users/'.$_POST['name'].'.ini';
  188.  
  189. $file = new Config_Lite($user['Name']);//Get INI file
  190. if (!file_exists($user['Name'])) {
  191. echo 'No such user exists.
  192. <meta HTTP-EQUIV="REFRESH" content="3; url=index.php?page=3">';
  193. } else
  194. {
  195. //GetData Of user.
  196. $user["Money"] = $file->get(null, 'Money');
  197. $user["Score"] = $file->get(null, 'Score');
  198. $user["Admin"] = $file->get(null, 'Admin');
  199. $user["VIP"] = $file->get(null, 'VIP');
  200. $user["Skin"] = $file->get(null, 'Skin');
  201. $user["ID"] = $file->get(null, 'ID');
  202. $user["RegOn"] = $file->get(null, 'RegDate');
  203.  
  204. echo '<table align="center" width="80%"><TR VALIGN=TOP><td><span style="color:black">
  205. </td>
  206. <td>';
  207. echo "<h1 style='color:red' align='center'>".$_POST['name']." stats:</h1>";
  208. echo "<span style='color:black'><h2 align='center'>Money: ".$user['Money']."</span>";
  209. echo "<br><span style='color:black'>Score: ".$user['Score']."</span>";
  210. echo "<br><span style='color:black'>AdminLevel: ".$user['Admin']."</span>";
  211. echo "<br><span style='color:black'>VIPLevel: ".$user['VIP']."</span>";
  212. echo "<br><span style='color:black'>Skin: ".$user['Skin']."</span>";
  213. echo "<br><span style='color:black'>Registered On: ".$user['RegOn']."</span>";
  214. echo "</h2>";
  215. echo'</td></tr></table>';
  216. }
  217. }
  218. }
  219.  
  220. else
  221. if($page == 4)
  222. {
  223. unset ($_SESSION['Password'],$_SESSION['Username']);
  224. echo '<span style="color:red">Logging you out...</span><meta HTTP-EQUIV="REFRESH" content="2; url=index.php">';
  225. }
  226. else
  227. {
  228. $_GET['page'] = 0;
  229. echo 'Invalid page, redirecting you to profile.
  230. <meta HTTP-EQUIV="REFRESH" content="2; url=index.php">';
  231. }
  232. }
  233. }
  234. }
  235. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement