Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> jak zmienic includowanie
marezo
post
Post #1





Grupa: Zarejestrowani
Postów: 26
Pomógł: 0
Dołączył: 15.08.2006

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


  1. <html>
  2. <head>
  3.  
  4.  
  5.  
  6. <title>HURTOWNIA WARZYW I OWOCÓW</title>
  7.  
  8. <link href="style.css" rel="stylesheet" type="text/css">
  9. <meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
  10. </head>
  11. <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
  12.  
  13. <center><table id="Table_01" width="778" height="801" border="0" cellpadding="0" cellspacing="0">
  14. <tr>
  15. <td colspan="2" rowspan="2">
  16. <img src="images/index_01.jpg" width="51" height="292" alt=""></td>
  17. <td colspan="5">
  18. <img src="images/index_02.jpg" width="246" height="153" alt=""></td>
  19. <td colspan="3">
  20. <img src="images/index_03.jpg" width="429" height="153" alt=""></td>
  21. <td colspan="2" rowspan="2">
  22. <img src="images/index_04.jpg" width="52" height="292" alt=""></td>
  23. </tr>
  24. <tr>
  25. <td colspan="8">
  26. <img src="images/index_05.jpg" width="675" height="139" alt=""></td>
  27. </tr>
  28. <tr>
  29. <td colspan="3">
  30. <img src="images/index_06.jpg" width="87" height="62" alt=""></td>
  31. <td>
  32. <a href="index.php?s=firma"><img src="images/index_07.jpg" width="72" height="62" alt="" border="0"></td>
  33. <td colspan="2">
  34. <a href="index.php?s=oferta"><img src="images/index_08.jpg" width="105" height="62" alt="" border="0"></td>
  35. <td colspan="2">
  36. <a href="index.php?s=kontakt"><img src="images/index_09.jpg" width="103" height="62" border="0"></td>
  37. <td>
  38. <img src="images/index_10.jpg" width="155" height="62" alt=""></td>
  39. <td colspan="3">
  40. <img src="images/index_11.jpg" width="256" height="62" alt=""></td>
  41. </tr>
  42. <tr>
  43. <td>
  44. <img src="images/index_12.jpg" width="12" height="385" alt=""></td>
  45. <td colspan="4">
  46. <img src="images/index_13.jpg" width="213" height="385" alt=""></td>
  47. <td colspan="6">
  48. <?php
  49. if(empty($_GET['s'])) include"firma.php"; else include $_GET['s'].'.php';
  50. ?></td>
  51.  
  52. <td>
  53. <img src="images/index_15.jpg" width="22" height="385" alt=""></td>
  54. </tr>
  55. <tr>
  56. <td colspan="12">
  57. <img src="images/index_16.jpg" width="778" height="19" alt=""></td>
  58. </tr>
  59. <tr>
  60. <td colspan="12">
  61. <img src="images/index_17.jpg" width="778" height="42" alt=""></td>
  62. </tr>
  63. <tr>
  64. <td>
  65. <img src="images/spacer.gif" width="12" height="1" alt=""></td>
  66. <td>
  67. <img src="images/spacer.gif" width="39" height="1" alt=""></td>
  68. <td>
  69. <img src="images/spacer.gif" width="36" height="1" alt=""></td>
  70. <td>
  71. <img src="images/spacer.gif" width="72" height="1" alt=""></td>
  72. <td>
  73. <img src="images/spacer.gif" width="66" height="1" alt=""></td>
  74. <td>
  75. <img src="images/spacer.gif" width="39" height="1" alt=""></td>
  76. <td>
  77. <img src="images/spacer.gif" width="33" height="1" alt=""></td>
  78. <td>
  79. <img src="images/spacer.gif" width="70" height="1" alt=""></td>
  80. <td>
  81. <img src="images/spacer.gif" width="155" height="1" alt=""></td>
  82. <td>
  83. <img src="images/spacer.gif" width="204" height="1" alt=""></td>
  84. <td>
  85. <img src="images/spacer.gif" width="30" height="1" alt=""></td>
  86. <td>
  87. <img src="images/spacer.gif" width="22" height="1" alt=""></td>
  88. </tr>
  89. </table>
  90. <!-- End ImageReady Slices -->
  91. </body>
  92. </html>



cos jest nie tak z tym kodem. Niby wszystko działa ale ostatnio znajmy mówił żebym poprawił ten kod (includowanie)



Ten post edytował marezo 22.03.2008, 14:54:53
Go to the top of the page
+Quote Post
l0ud
post
Post #2





Grupa: Zarejestrowani
Postów: 1 387
Pomógł: 273
Dołączył: 18.02.2008

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


To poważna dziura bezpieczeństwa, dlatego usuń link z forum - nie jest on potrzebny do rozwiązania problemu, a tak zaraz strona może przestać istnieć.


--------------------
XMPP: l0ud@chrome.pl
Go to the top of the page
+Quote Post
marezo
post
Post #3





Grupa: Zarejestrowani
Postów: 26
Pomógł: 0
Dołączył: 15.08.2006

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


juz smile.gif jak teraz to zmienic. questionmark.gif
Go to the top of the page
+Quote Post
nowotny
post
Post #4





Grupa: Zarejestrowani
Postów: 875
Pomógł: 122
Dołączył: 2.02.2008

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


W pasku adresu daj sobie index.php?s=http://wp.pl/index i zobaczysz dlaczego jest to niebezpieczne...

Widzę że masz raptem 3 podstrony... w tym wypadku najlepiej zapisać sobie ich nazwy w tablicy i sprawdzać czy zawartość zmiennej $_GET['s'] znajduje się w tej tablicy...

Ten post edytował nowotny 22.03.2008, 15:01:08
Go to the top of the page
+Quote Post
l0ud
post
Post #5





Grupa: Zarejestrowani
Postów: 1 387
Pomógł: 273
Dołączył: 18.02.2008

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


Ok, oto jak najprościej to poprawić:

zamień

  1. <?php
  2. if(empty($_GET['s'])) include"firma.php"; else include $_GET['s'].'.php';
  3. ?>


na

  1. <?php
  2. if(empty($_GET['s'])) include('firma.php');
  3. else {
  4. if ($_GET['s'] == 'oferta') include('oferta.php');
  5. else if ($_GET['s'] == 'kontakt') include('kontakt.php');
  6. else include('firma.php');
  7. }
  8. ?>


czyli po prostu przewidujemy wszystkie możliwości i dołączamy odpowiednie podstrony

Ten post edytował l0ud 22.03.2008, 15:02:14


--------------------
XMPP: l0ud@chrome.pl
Go to the top of the page
+Quote Post
marezo
post
Post #6





Grupa: Zarejestrowani
Postów: 26
Pomógł: 0
Dołączył: 15.08.2006

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


dzieki wielkie:)



  1. <?php
  2. if(empty($_GET['s'])) include('firma.php');
  3. else {
  4. if ($_GET['s'] == 'oferta') include('oferta.php');
  5. else if ($_GET['s'] == 'kontakt') include('kontakt.php');
  6. else include('firma.php');
  7. }
  8. ?>



a jak bym do tego chcial wiecej podstron dac to jak??
Go to the top of the page
+Quote Post
wizu
post
Post #7





Grupa: Zarejestrowani
Postów: 127
Pomógł: 15
Dołączył: 16.02.2008
Skąd: Sanok

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


W tym wypadku lepsze będzie switch

  1. <?php
  2. switch ($_GET['s']) {
  3. case ' oferta': 
  4. include('oferta.php');
  5. break;
  6. case 'praca': 
  7.  include('praca.php');
  8.  break;
  9. case 'x': 
  10. include('x.php');
  11. break;
  12. default:
  13. include('firma.php');
  14. break;
  15. }
  16. ?>


Ten post edytował wizu 22.03.2008, 16:18:01
Go to the top of the page
+Quote Post
tomko222
post
Post #8





Grupa: Zarejestrowani
Postów: 3
Pomógł: 0
Dołączył: 24.04.2006

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


Switch będzie lepsze ale można też dodać kolejne else if:

  1. <?php
  2. if(empty($_GET['s'])) include('firma.php');
  3. else {
  4. if ($_GET['s'] == 'oferta') include('oferta.php');
  5. else if ($_GET['s'] == 'kontakt') include('kontakt.php');
  6. else if ($_GET['s'] == 'aaaaa') include('aaaaa.php');
  7. else if ($_GET['s'] == 'bbbbb') include('bbbbb.php');
  8. else include('firma.php');
  9. }
  10. ?>


smile.gif

Ten post edytował tomko222 22.03.2008, 16:23:49
Go to the top of the page
+Quote Post
nowotny
post
Post #9





Grupa: Zarejestrowani
Postów: 875
Pomógł: 122
Dołączył: 2.02.2008

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


A ja nadal twierdzę że najlepsza będzie tablica... tongue.gif dopisujemy jeden element i finito... nie trzeba kombinować z kolejnymi caseami czy elseifami... smile.gif
Go to the top of the page
+Quote Post

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: 20.08.2025 - 06:30