Advertisement
Guest User

Untitled

a guest
Feb 10th, 2017
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.83 KB | None | 0 0
  1. <?php
  2. header('Content-Type: text/html; charset=UTF-8');
  3. if(!function_exists(mb_strlen)) { echo '<div style="color:red;">השרת איננו תומך בפונקציה mb_strlen. <BR> בקש מבעל השרת להתקינה.</div>'; die(); }
  4. $make = $_GET['make'];
  5. if($make == 'actions') {
  6. $do = $_GET['do'];
  7. if($do == step1) {
  8. $server = $_POST['server']; $duser = $_POST['duser']; $dname = $_POST['dname']; $dpass = $_POST['dpass'];
  9. if($server == Null || $duser == Null || $dname == Null || $dpass == Null) {
  10. echo 'e1';
  11. }else{
  12. $mysqli = new mysqli($server,$duser,$dpass,$dname);
  13. if($mysqli->connect_error) {
  14. echo 'e2';
  15. }else{
  16. if(!is_writable('config.php')) {
  17. echo 'e3';
  18. }else{
  19. $file = fopen('config.php', 'w');
  20. $text = '<?php
  21. $dbserver = "'.$server.'"; $dbusername = "'.$duser.'"; $dbname = "'.$dname.'"; $dbpassword = "'.$dpass.'";
  22. $mysqli = new mysqli("$dbserver", "$dbusername", "$dbpassword","$dbname");
  23. ?>';
  24. fwrite($file, $text);
  25. require_once('config.php');
  26. $mysqli->query("CREATE TABLE IF NOT EXISTS `up2_comments` (
  27. `id` int(11) NOT NULL AUTO_INCREMENT,
  28. `user` int(11) NOT NULL,
  29. `img` text NOT NULL,
  30. `content` text NOT NULL,
  31. `date` text NOT NULL,
  32. PRIMARY KEY (`id`)
  33. )");
  34. $mysqli->query("CREATE TABLE IF NOT EXISTS `up2_gallery` (
  35. `id` int(11) NOT NULL AUTO_INCREMENT,
  36. `name` text NOT NULL,
  37. `date` date NOT NULL,
  38. `user` int(11) NOT NULL,
  39. PRIMARY KEY (`id`)
  40. )");
  41. $mysqli->query("CREATE TABLE IF NOT EXISTS `up2_images` (
  42. `id` int(11) NOT NULL AUTO_INCREMENT,
  43. `name` text NOT NULL,
  44. `fname` text NOT NULL,
  45. `size` text NOT NULL,
  46. `date` datetime NOT NULL,
  47. `ip` text NOT NULL,
  48. `user` int(11) NOT NULL,
  49. `cat` text NOT NULL,
  50. `page` text NOT NULL,
  51. `private` int(11) NOT NULL,
  52. PRIMARY KEY (`id`)
  53. )");
  54. $mysqli->query("CREATE TABLE IF NOT EXISTS `up2_noti` (
  55. `id` int(11) NOT NULL AUTO_INCREMENT,
  56. `from` int(11) NOT NULL,
  57. `to` int(11) NOT NULL,
  58. `img` text NOT NULL,
  59. `date` text NOT NULL,
  60. `viewed` int(11) NOT NULL,
  61. `more` text NOT NULL,
  62. `type` int(11) NOT NULL,
  63. PRIMARY KEY (`id`)
  64. )");
  65. $mysqli->query("CREATE TABLE IF NOT EXISTS `up2_reports` (
  66. `id` int(11) NOT NULL AUTO_INCREMENT,
  67. `com` int(11) NOT NULL,
  68. `reason` text NOT NULL,
  69. `user` int(11) NOT NULL,
  70. `date` text NOT NULL,
  71. PRIMARY KEY (`id`)
  72. )");
  73. $mysqli->query("CREATE TABLE IF NOT EXISTS `up2_settings` (
  74. `id` int(11) NOT NULL AUTO_INCREMENT,
  75. `url` text NOT NULL,
  76. `adminmail` text NOT NULL,
  77. `sname` text NOT NULL,
  78. `maxsize` text NOT NULL,
  79. `maxfiles` text NOT NULL,
  80. `rules` text NOT NULL,
  81. PRIMARY KEY (`id`)
  82. )");
  83. $mysqli->query("CREATE TABLE IF NOT EXISTS `up2_users` (
  84. `id` int(11) NOT NULL AUTO_INCREMENT,
  85. `username` text NOT NULL,
  86. `password` text NOT NULL,
  87. `mail` text NOT NULL,
  88. `ip` text NOT NULL,
  89. `date` text NOT NULL,
  90. `group` text NOT NULL,
  91. `re` text NOT NULL,
  92. `private` int(11) NOT NULL,
  93. `img` text NOT NULL,
  94. `salt` text NOT NULL,
  95. `ban` text NOT NULL,
  96. PRIMARY KEY (`id`)
  97. )");
  98. } } }
  99. }else{
  100. require_once('config.php');
  101. if($do == step2) {
  102. $url = $_POST['url']; $am = $_POST['adminmail']; $sname = $_POST['sname']; $rules = $_POST['rules']; $maxsize = $_POST['maxsize']; $maxfiles = $_POST['maxfiles'];
  103. if($url == Null || $am == Null || $sname == Null || $rules == Null || $maxsize == Null || $maxfiles == Null) {
  104. echo 'e1';
  105. }else{
  106. $mysqli->query("INSERT INTO `up2_settings`(`url`,`adminmail`,`sname`,`rules`,`maxsize`,`maxfiles`) VALUES('$url','$am','$sname','$rules','$maxsize','$maxfiles')");
  107. }
  108. }else{
  109. if($do == step3) {
  110. $username = $_POST['username']; $password = $_POST['password']; $mail = $_POST['mail']; $ip = $_SERVER['REMOTE_ADDR']; $date = date("j.n.y");
  111. if($username == Null || $password == Null || $mail == Null) {
  112. echo 'e1';
  113. }else{
  114. $pass = md5($password);
  115. $mysqli->query("INSERT INTO `up2_users`(`username`,`password`,`mail`,`ip`,`date`,`group`) VALUES('$username','$pass','$mail','$ip','$date','2')");
  116. if(!unlink("install.php")) { echo '<BR><span style="color:#843E43;font-weight:bold;">השרת לא הצליח למחוק את הקובץ install.php. <BR> עשה זאת ידנית.</span>'; }
  117. if(!chmod("i",0777)) { echo '<BR><span style="color:#843E43;font-weight:bold;">השרת לא הצליח לתת גישת 0777 לתיקיה i. <BR> עשה זאת ידנית.</span>'; }
  118. }
  119. }else{
  120. echo 'Error!';
  121. } } }
  122. die;
  123. }
  124. $rules = '<ol>
  125. <li>
  126. אין להעלות לאתר קבצים המפרים את חוקי מדינת ישראל.
  127. </li>
  128. <li>
  129. הקבצים המועלים לאתר הינם באחריותו של המעלה בלבד, ואין צוות האתר ישא את התוצאות.
  130. </li>
  131. <li>
  132. אין להעלות לאתר קבצים שאינם קבצי תמונה (להלן: jpg,jpeg,png,gif,bmp).</li>
  133. <li>
  134. בעת העלאת הקובץ הינך מאשר כי הקובץ אינו שמור ע"י זכויות יוצרים, וכי צוות האתר לא ישא בתוצאות.
  135. </li>
  136. </ol>';
  137. if(!chmod("config.php",0666)) { $econ = '<span style="color:#843E43;font-weight:bold;">השרת לא הצליח לתת גישת 0666 לקובץ config.php. <BR> עשה זאת ידנית.</span>'; }
  138. $siteu = str_replace("/install.php","","http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]");
  139. echo <<<Print
  140. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  141. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="rtl">
  142. <head>
  143. <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
  144. <title>התקנת המערכת UpPASS3</title>
  145. <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
  146. <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
  147. <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/blitzer/jquery-ui.css" type="text/css" media="all"/>
  148. <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
  149. <style type="text/css">
  150. body {background:#7BC1C6; font-family:arial; font-size:10pt;}
  151. .page,.page2,.page3,.page4 {background:#FFFFFF; width:800px; position:absolute;}
  152. .title {background:#00B5FA; padding:10px; font-size:15pt; color:white; font-weight:bold;}
  153. input[type=text],textarea,input[type=password] {background:white; border:1px solid #777777; padding:3px; color:#010101; font-family:arial;}
  154. input[type=text]:hover,input[type=text]:focus,textarea:hover,textarea:focus,input[type=password]:hover,input[type=password]:focus {border:1px solid #3399FF;}
  155. .next {background:#EBEBEB; padding:12px; margin-top:5px;}
  156. input[type=submit] {background:#F05100; border:none; padding:7px 10px; color:white; font-weight:bold; font-size:14pt; font-family:arial; float:left;}
  157. input[type=submit]:hover {opacity:0.9;}
  158. .done {background:#0440B8; border:none; padding:7px 10px; color:white; font-weight:bold; font-size:14pt; font-family:arial; float:left; cursor:default;}
  159. .done:hover {opacity:0.9;}
  160. .fullwin {background:black; opacity:0.4; width:100%; height:100%; position:absolute; top:0; right:0; z-index:5; display:none;}
  161. .error {background:#696969; width:100%; padding:20px 0 20px; color:white; position:absolute;
  162. top:40px; right:0; left:0; margin:auto; z-index:6; font-size:13pt; display:none;}
  163. .ok {background:#26A0DA; border:none; padding:5px 15px; color:white; font-size:10pt; font-family:arial; float:left; cursor:default;}
  164. .ok:hover {opacity:0.9;}
  165. </style>
  166. <script type="text/javascript">
  167. $(document).ready(function() {
  168. var surl;
  169. $(".ok").click(function() {
  170. $(".fullwin,.error").fadeOut(300);
  171. });
  172. $(".nextstep").click(function(eventObject) { $(".page").animate({"opacity":"0.3"},300);
  173. eventObject.preventDefault();
  174. var server = $("#server").val(),duser = $("#duser").val(),dname = $("#dname").val(),dpass = $("#dpass").val();
  175. $.ajax({type:"POST",url:"?make=actions&do=step1",data:({server:server,duser:duser,dname:dname,dpass:dpass}),success:function(data) { $(".page").animate({"opacity":"1"},300);
  176. if(data == "e1") {
  177. $(".fullwin,.error").fadeIn(300);
  178. $(".err").html("אחד מהשדות נשאר ריק.");
  179. }else{
  180. if(data == "e2") {
  181. $(".fullwin,.error").fadeIn(300);
  182. $(".err").html("לא ניתן להתחבר למסד.");
  183. }else{
  184. if(data == "e3") {
  185. $(".fullwin,.error").fadeIn(300);
  186. $(".err").html("לא ניתן לערוך את config.php. בדוק כי נתת הרשאת 666 לקובץ.");
  187. }else{
  188. $(".page").hide("slide",{direction:"up",easing:"easeInOutCirc"},800);
  189. $(".page2").show("slide",{direction:"down",easing:"easeInOutCirc"},800);
  190. } } } }
  191. });
  192. });
  193. $(".nextstep2").click(function(eventObject) { $(".page2").animate({"opacity":"0.3"},300);
  194. eventObject.preventDefault();
  195. var url = $("#url").val(),adminmail = $("#adminmail").val(),sname = $("#sname").val(),rules = $("#rules").val(),maxsize = $("#maxsize").val(),maxfiles = $("#maxfiles").val();
  196. surl = url;
  197. $.ajax({type:"POST",url:"?make=actions&do=step2",data:({url:url,adminmail:adminmail,sname:sname,rules:rules,maxsize:maxsize,maxfiles:maxfiles}),success:function(data) { $(".page2").animate({"opacity":"1"},300);
  198. if(data == "e1") {
  199. $(".fullwin,.error").fadeIn(300);
  200. $(".err").html("אחד מהשדות ריק.");
  201. }else{
  202. $(".page2").hide("slide",{direction:"up",easing:"easeInOutCirc"},800);
  203. $(".page3").show("slide",{direction:"down",easing:"easeInOutCirc"},800);
  204. } }
  205. });
  206. });
  207. $(".nextstep3").click(function(eventObject) { $(".page3").animate({"opacity":"0.3"},300);
  208. eventObject.preventDefault();
  209. var username = $("#username").val(), password = $("#password").val(), mail = $("#mail").val();
  210. $.ajax({type:"POST",url:"?make=actions&do=step3",data:({username:username,password:password,mail:mail}),success:function(data) { $(".page3").animate({"opacity":"1"},300);
  211. if(data == "e1") {
  212. $(".fullwin,.error").fadeIn(300);
  213. $(".err").html("אחד מהשדות ריק.");
  214. }else{
  215. $(".steperrors").html(data);
  216. $(".page3").hide("slide",{direction:"up",easing:"easeInOutCirc"},800);
  217. $(".page4").show("slide",{direction:"down",easing:"easeInOutCirc"},800);
  218. } }
  219. });
  220. });
  221. $(".done").click(function() {
  222. window.location.assign(surl);
  223. });
  224.  
  225. $(".firstintro img").delay(300).show(1000);
  226. $(".firstintro div").delay(2000).show("drop",{direction:"up"},1000);
  227. $(".firstintro").delay(4000).fadeOut(1000);
  228. $(".second").delay(5200).show("drop",{direction:"up"},1000);
  229.  
  230.  
  231. });
  232. </script>
  233. <div class="firstintro" style="margin:15% auto;text-align:center;position:absolute;right:0;left:0;"><img src="images/logo.png" style="display:none;"><div style="font-size:20pt;color:white;display:none;">ברוכים הבאים להתקנה של UpPASS3!</div></div>
  234. <div class="second" style="display:none;">
  235. <div style="margin:10px 0 10px;">
  236. <div style="background:rgb(81, 176, 172); width:770px; margin:auto; font-size:25pt; text-align:center; color:white; padding:10px 15px; font-weight:bold;">
  237. התקנת המערכת UpPASS 3
  238. </div></div>
  239. <div class="fullwin"></div><div class="error"><div style="width:700px; margin:auto;"><span style="font-size:30pt;">שגיאה!</span><div class="err"></div><BR><div class="ok">אישור</div></div></div>
  240. <div style="width:800px; margin:auto;">
  241. <div class="page">
  242. <div class="title">שלב 1 - תחילת ההתקנה</div>
  243. <form action='' method="POST">
  244. <div style="padding:5px 10px;">
  245. ברוכים הבאים להתקנה של UpPASS 3! <BR>
  246. $econ
  247. <BR>
  248. <b>פרטי SQL:</b><BR>
  249. <table style="margin:auto;">
  250. <tr><td>שרת: </td><td><input type="text" id="server" value="localhost" autocomplete="off" required></td></tr>
  251. <tr><td>שם משתמש: </td><td><input type="text" id="duser" autocomplete="off"></td></tr>
  252. <tr><td>שם: </td><td><input type="text" id="dname" autocomplete="off"></td></tr>
  253. <tr><td>סיסמא: </td><td><input type="password" id="dpass" autocomplete="off"> </td></tr>
  254. </table>
  255. </div>
  256. <div class="next"><input type="submit" value="הבא" name="submit" class="nextstep"><div style="clear:both;"></div></div>
  257. </form>
  258. </div>
  259. <div class="page2" style="display:none;">
  260. <div class="title">שלב 2 - הגדרות בסיסיות</div>
  261. <form action='' method="POST">
  262. <div style="padding:5px 10px;">
  263. מלא את ההגדרות הבאות. ניתן לאחר מכן לערוך אותן דרך הפאנל. <BR>
  264. <table style="margin:auto;">
  265. <tr><td>כתובת האתר:</td><td><input type="text" id="url" placeholder="http://example.com" value="$siteu"></td></tr>
  266. <tr><td>מייל לצור קשר:</td><td><input type="text" id="adminmail" placeholder="admin@example.com"></td></tr>
  267. <tr><td>שם האתר:</td><td><input type="text" id="sname" placeholder="UpPASS 3"></td></tr>
  268. <tr><td>גודל מקסימלי לקובץ:</td><td><input type="text" id="maxsize" value="5" size="2"> MB</td></tr>
  269. <tr><td>מקסימום קבצים להעלאה בבת אחת:</td><td><input type="text" id="maxfiles" value="10"></td></tr>
  270. <tr><td>תקנון:</td><td><textarea cols="30" rows="5" id="rules">$rules</textarea></td></tr>
  271. </table>
  272. </div>
  273. <div class="next">
  274. <input type="submit" value="הבא" name="submit" class="nextstep2"><div style="clear:both;"></div>
  275. </div>
  276. </form>
  277. </div>
  278. <div class="page3" style="display:none;">
  279. <div class="title">שלב 3 - הגדרת האדמין</div>
  280. <form action='' method="POST">
  281. <div style="padding:5px 10px;">
  282. הכנס את פרטי המשתמש הראשי שלך.
  283. <table style="margin:auto;">
  284. <tr><td>שם משתמש:</td><td><input type="text" id="username"></td></tr>
  285. <tr><td>סיסמא:</td><td><input type="password" id="password"></td></tr>
  286. <tr><td>מייל:</td><td><input type="text" id="mail"></td></tr>
  287. </table></div>
  288. <div class="next">
  289. <input type="submit" value="הבא" class="nextstep3"><div style="clear:both;"></div>
  290. </div>
  291. </form>
  292. </div>
  293. <div class="page4" style="display:none;">
  294. <div class="title">שלב 4 - סיום ההתקנה</div>
  295. <div style="padding:5px 10px;">
  296. ההתקנה הושלמה בהצלחה!
  297. <div class="steperrors"></div>
  298. </div>
  299. <div class="next">
  300. <div class="done">לאתר</div><div style="clear:both;"></div>
  301. </div></div>
  302. </div>
  303. </div>
  304.  
  305. Print;
  306. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement