Просмотр файла admin/add.php

Размер файла: 4Kb
  1. <?php
  2.  
  3. /*********************************************************************
  4. *
  5. * WapSite powered by CsC Portal. WapSite[tm] is module of CsC Portal.
  6. *
  7. * (C) 2004. CsC Portal. All rights reserved.
  8. *
  9. * http://cscp.cs-centar.net | http://www.cs-centar.net
  10. *
  11. ********************************************************************/
  12.  
  13. // File: admin/add.php
  14. // Desc: Use to add news & new pages to the database
  15. // Written on: 24.04.2004
  16.  
  17. include("../wap_db.php");
  18. include("../db_connect.php");
  19.  
  20. if ($_GET['substr'] == "news" && $_GET['act'] == "add") {
  21.  
  22. include("ad_header.php");
  23.  
  24. $news_check = mysql_query("SELECT * from cscp_wap_news WHERE news_name LIKE '%".$news_name."%'", $db);
  25.  
  26. $news_check_f = mysql_fetch_row($news_check);
  27.  
  28. if ($news_check_f[0] == $news_name) {
  29.  
  30. echo "<br><center><b>$lang_error[news_same]</b></center>";
  31.  
  32. include("ad_footer.php");
  33.  
  34. exit;
  35.  
  36. } else {
  37.  
  38. $news_text = str_replace("\n","<br>", $news_text);
  39.  
  40. $news_add = mysql_query("INSERT into cscp_wap_news VALUES('$news_name', '$news_text', '$news_date')", $db);
  41.  
  42. // checking if email func. is on
  43.  
  44. $email_send = mysql_query("SELECT * from cscp_wap_options WHERE id = 'news'", $db);
  45.  
  46. $email_send_f = mysql_fetch_row($email_send);
  47.  
  48. if ($email_send_f[3] == "yes") {
  49.  
  50. include("temp/$SiteLang/mail_send.tmp");
  51.  
  52. mail($AdminEmail, "$lang_sendm[news]", $send_message[news]);
  53.  
  54. echo "<br><center><b>$lang_sendm[info]</b></center>";
  55.  
  56. }
  57.  
  58. echo "<br><br><center><b>$lang_display_news[success]</b></center>";
  59.  
  60. include("ad_footer.php");
  61.  
  62. }
  63.  
  64. }
  65.  
  66. // starting page add
  67.  
  68. if ($_GET['substr'] == "edit_delete" && $_GET['act'] == "add") {
  69.  
  70. include("ad_header.php");
  71.  
  72. $page_check = mysql_query("SELECT * from cscp_wap_page WHERE page_name LIKE '%".$page_name."%'", $db);
  73.  
  74. $page_check_f = mysql_fetch_row($page_check);
  75.  
  76. if ($page_check_f[0] == $page_name) {
  77.  
  78. echo "<br><center><b>$lang_error[page_same]</b></center>";
  79.  
  80. include("ad_footer.php");
  81.  
  82. exit;
  83.  
  84. } else {
  85.  
  86. $page_text = str_replace("\n","<br>", $page_text);
  87.  
  88. $page_add = mysql_query("INSERT into cscp_wap_page VALUES('$page_name', '$page_subject', '$page_text')", $db);
  89.  
  90. $page_add_2 = mysql_query("INSERT into cscp_wap_menu VALUES('$page_subject', '$page_id')", $db);
  91.  
  92. // checking if email func. is on
  93.  
  94. $email_send = mysql_query("SELECT * from cscp_wap_options WHERE id = 'page'", $db);
  95.  
  96. $email_send_f = mysql_fetch_row($email_send);
  97.  
  98. if ($email_send_f[3] == "yes") {
  99.  
  100. include("temp/$SiteLang/mail_send.tmp");
  101.  
  102. mail($AdminEmail, "$lang_sendm[page]", $send_message[page]);
  103.  
  104. echo "<br><center><b>$lang_sendm[info]</b></center>";
  105.  
  106. }
  107.  
  108. echo "<br><br><center><b>$lang_display_p[success]</b></center>";
  109.  
  110. include("ad_footer.php");
  111.  
  112. }
  113.  
  114. }
  115.  
  116. // starting file upload
  117.  
  118. if ($_GET['substr'] == "file" && $_GET['act'] == "upload") {
  119.  
  120. include("ad_header.php");
  121.  
  122. $file_check = mysql_query("SELECT * from cscp_wap_files WHERE file_name LIKE '%".$userfile."%'", $db);
  123.  
  124. $file_check_f = mysql_fetch_row($file_check);
  125.  
  126. if ($file_check_f[1] == $userfile) {
  127.  
  128. echo "<br><center><b>$lang_error[file_same]</b></center>";
  129.  
  130. include("ad_footer.php");
  131.  
  132. exit;
  133.  
  134. } else {
  135.  
  136. $file_id_count = mysql_query("SELECT * from cscp_wap_files", $db);
  137.  
  138. $file_id_count_f = mysql_num_rows($file_id_count);
  139.  
  140. $count_id = rand(0,1000);
  141.  
  142. include("ad_functions.php");
  143.  
  144. upload_file();
  145.  
  146. $file_size = number_format($userfile_size);
  147.  
  148. $file_add = mysql_query("INSERT into cscp_wap_files VALUES('$count_id', '$userfile_name', '$file_size')", $db);
  149.  
  150. // checking if email func. is on
  151.  
  152. $email_send = mysql_query("SELECT * from cscp_wap_options WHERE id = 'file'", $db);
  153.  
  154. $email_send_f = mysql_fetch_row($email_send);
  155.  
  156. if ($email_send_f[6] == "yes") {
  157.  
  158. include("temp/$SiteLang/mail_send.tmp");
  159.  
  160. mail($AdminEmail, "$lang_sendm[file]", $send_message[file]);
  161.  
  162. echo "<br><center><b>$lang_sendm[info]</b></center>";
  163.  
  164. }
  165.  
  166. echo "<br><br><center><b>$lang_display_files[success]</b></center>";
  167.  
  168. include("ad_footer.php");
  169.  
  170. }
  171.  
  172. }
  173.  
  174. ?>