Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> problem z plikami tpl
dvdx95
post
Post #1





Grupa: Zarejestrowani
Postów: 47
Pomógł: 3
Dołączył: 11.10.2016

Ostrzeżenie: (0%)
-----


siema potrzebuje otworzyc plik tpl na serwerze . glowny plik index napisany jest w php i wywala mi takie coś 404 Not Found .
serwer jest na ubuntu 16.04 Apache/2.4.18 ktoś coś wie dlaczego tak się dzieje?

  1. <?php
  2. if (!isset($_GET['page'])) {
  3. header('Location: template/main.tpl');
  4. exit();
  5. }
  6.  
  7. ini_set('display_errors','Off');
  8. try {
  9. $db = new PDO('mysql:host=localhost;dbname=123', 'root', 'Tome', array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
  10. } catch (PDOException $e) {
  11. exit($e->getMessage());
  12. }
  13.  
  14. if (isset($_COOKIE['hash'])) {
  15. $sql = $db->query("SELECT * FROM `users` WHERE `hash` = " . $db->quote($_COOKIE['hash']));
  16. if ($sql->rowCount() != 0) {
  17. $row = $sql->fetch();
  18. $user = $row;
  19. }
  20. }
  21.  
  22.  
  23. switch ($_GET['page']) {
  24. case 'main':
  25. $page = getTemplate('main.tpl', array('user'=>$user));
  26. echo $page;
  27. break;
  28. }
  29. function getTemplate($name, $in = null) {
  30. extract($in);
  31. include "template/" . $name;
  32. $text = ob_get_clean();
  33. return $text;
  34. }
  35.  
  36. function curl($url) {
  37. $ch = curl_init();
  38.  
  39. curl_setopt($ch, CURLOPT_HEADER, 0);
  40. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  41. curl_setopt($ch, CURLOPT_URL, $url);
  42. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  43. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  44. curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt');
  45. curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt');
  46. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  47.  
  48. $data = curl_exec($ch);
  49. curl_close($ch);
  50.  
  51. return $data;
  52. }
  53. >?


  1. Not Found
  2.  
  3. The requested URL /main was not found on this server.

a tu po wejsciu na serwer strony

Ten post edytował dvdx95 11.10.2016, 21:46:38
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 00:38