Просмотр файла download/files.php

Размер файла: 2.95Kb
  1. <?php
  2. /*
  3. =============================================
  4. Движок: SHCMS Engine
  5. =============================================
  6. Название файла: Обменник
  7. =============================================
  8. Official website: http://shcms.ru
  9. =============================================
  10. */
  11. define('SHCMS', true);
  12. include_once'../system/inc/basic_settings.php';
  13. if($_GET['id']){$id = $_GET['id'];}
  14. $rfil = mysql_fetch_array(mysql_query("SELECT * FROM download_file WHERE id=$id"));
  15. $shcmsengine['title'] = ''.$rfil['names'].'';
  16.  
  17. include_once'../template/head.php';
  18. if(!$id)
  19. {
  20. echo 'Ошибка';
  21. header("Refresh: 1; url=/download/index.php");
  22. include_once '../template/foot.php';
  23. exit();
  24. }
  25. $screen_file = mysql_fetch_array(mysql_query("SELECT * FROM download_file WHERE id=$id"));
  26. if(!$screen_file['screen'] == null)
  27. echo '<img src="/download/screen/'.$screen_file['screen'].'"/><br/>';
  28. echo 'Описание: '.$rfil['message'].'<br/>';
  29. echo 'Добавил: <a href="'.DIR_SHCMS.'change_view.php?id='.$rfil['user_id'].'">'.$rfil['author'].'</a> ('.date('d.m.y',$rfil['time']).' в '.date('H:i:s',$rfil['time']).')<br/>';
  30. echo 'Размер файла: '.size($rfil['size']).'<br/>';
  31.  
  32.  
  33. echo '<hr/>';
  34.  
  35. $komm = mysql_result(mysql_query("SELECT COUNT(*) FROM down_comment WHERE id_file = $id"),0);
  36.  
  37. echo '<div class="posts">Скопировать ссылку:<br/><input type="text" value="http://'.$_SERVER['HTTP_HOST'].'/download/files_obmen/'.$rfil['name'].'"></div>';
  38.  
  39. echo '<div class="posts"><a href="loading.php?id='.$rfil['id'].'">Скачать</a> ('.$rfil['cou'].')<br/>';
  40. echo '<a href="comment.php?id='.$rfil['id'].'">Комментарии</a> ('.$komm .')<br/>';
  41. if($user_id == $rfil['user_id'])
  42. {
  43. echo'<a href="?id='.$id.'&edit">Изменить файл</a>';
  44. }
  45. echo '</div>';
  46. if(isset($_GET['edit']))
  47. {
  48. if($user_id == $rfil['user_id'])
  49. {
  50. $edit_files = mysql_fetch_array(mysql_query("SELECT * FROM download_file WHERE id=$id"));
  51. echo '<div class="user_foot">Редактировать файл</div><br/>';
  52.  
  53. if(isset($_POST['submit_edit']))
  54. {
  55. if(isset($_POST['texta'])){$texta = $_POST['texta'];}
  56. if(isset($_POST['names'])){$names = $_POST['names'];}
  57. $ok_edi = mysql_query("UPDATE download_file SET message='$texta',names='$names' WHERE id=$id");
  58. if($ok_edi == true)
  59. {
  60. echo '<div class="actshcms">Файл успешно изменен</div>';
  61. header("Refresh: 1; url=?id=$id");
  62. include_once'../template/foot.php';
  63. exit();
  64. }
  65. else
  66. {
  67. echo '<div class="errors">Файл не изменен</div>';
  68. header("Refresh: 1; url=?id=$id");
  69. include_once'../template/foot.php';
  70. exit();
  71. }
  72. }
  73. echo '<form action="?id='.$id.'&edit" method="post">';
  74. echo '<input type="text" name="names" value="'.$edit_files['names'].'"><br/>';
  75. echo '<textarea name="texta">'.$edit_files['message'].'</textarea>';
  76. echo '<input type="submit" name="submit_edit" value="Изменить">';
  77. echo '</form>';
  78. }
  79. }
  80.  
  81. include_once'../template/foot.php';
  82. ?>