Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> problem z funkcja
adisoft
post
Post #1





Grupa: Zarejestrowani
Postów: 92
Pomógł: 0
Dołączył: 24.01.2004
Skąd: Witten Zentrum <==> Chorzów Batory

Ostrzeżenie: (10%)
X----


witam mam malutka strone oparta na plikach inc i wykorzystujaca

  1. <?php
  2. $HTTP_GET_VARS
  3. ?>


oto kodzik

  1. <?php
  2.  
  3.      $where = $HTTP_GET_VARS['cmd'];
  4.      $allowed_values = array
  5.      
  6.      (
  7.             &#092;"news\" => \"news.inc\",
  8.             &#092;"clan_history\" => \"clan_history.inc\",
  9.             &#092;"clan_members\" => \"clan_members.inc\",
  10.             &#092;"nbkadi\" => \"nbkadi.inc\",
  11.             &#092;"nbkmatus\" => \"nbkmatus.inc\",
  12.             &#092;"nbkmody\" => \"nbkmody.inc\",
  13.             &#092;"nbkfrantz\" => \"nbkfrantz.inc\",
  14.             &#092;"nbkgaret\" => \"nbkgaret.inc\",
  15.             &#092;"nbkiker\" => \"nbkiker.inc\",
  16.             &#092;"clan_matches\" => \"clan_matches.inc\",
  17.             &#092;"clan_awards\" => \"clan_awards.inc\",
  18.             &#092;"sponsoring\" => \"sponsoring.inc\"
  19.             
  20.      );
  21.      
  22.      if ($allowed_values[$where] != '')
  23.      
  24.      {
  25.  
  26.             include(&#092;"main.inc\");
  27.             include(&#092;"$allowed_values[$where]\");
  28.             include(&#092;"stopka.inc\");
  29.             
  30.      }
  31.      
  32.      else
  33.      
  34.      {
  35.      
  36.             include(&#092;"main.inc\");
  37.             include(&#092;"news.inc\");
  38.             include(&#092;"stopka.inc\");
  39.             
  40.      }
  41. ?>

pierwszego pliku czyli index.php ktory wszystko wczytuje mam maly problem albowiem w pozniejszej fazie strony dyrektywa odnosnie linku do jakiegos dzialu wyglada nastepujaco

<a href="index.php?cmd=clan_members" target="_parent">link do clan members</a>

a chcialem zrobic tak aby byla mozliwosc

wejscia do clan members > nastepnie wybor jakis (przykladowo czlonek nbkadi) i klikniecie nbkadi i aby pojawila sie strona nbkadi.inc a link aby byl w takiej formie

<a href="index.php?cmd=clan_members?id=nbkadi" target="_parent">nbkadi</a>

czyli chodzi o ?id=cosik

Jest ktos w stanie mi pomoz co mam jeszcze zmienic w glownym index.php aby dzialalo ?id=jakis_inc (IMG:http://forum.php.pl/style_emoticons/default/sadsmiley02.gif) wiecie o co chodzi (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) moze jestescie jakos w stanie mi pomoc

Ten post edytował adisoft 17.09.2004, 06:45:43
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
cim
post
Post #2





Grupa: Zarejestrowani
Postów: 208
Pomógł: 28
Dołączył: 9.08.2004
Skąd: Stargard

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


  1. <?php
  2.  
  3. $where = $HTTP_GET_VARS['cmd'];
  4. $where2 = $HTTP_GET_VARS['id'];
  5.  $allowed_values = array
  6.  
  7.  (
  8. &#092;"news\" => \"news.inc\",
  9. &#092;"clan_history\" => \"clan_history.inc\",
  10. &#092;"clan_members\" => \"clan_members.inc\",
  11. &#092;"nbkadi\" => \"nbkadi.inc\",
  12. &#092;"nbkmatus\" => \"nbkmatus.inc\",
  13. &#092;"nbkmody\" => \"nbkmody.inc\",
  14. &#092;"nbkfrantz\" => \"nbkfrantz.inc\",
  15. &#092;"nbkgaret\" => \"nbkgaret.inc\",
  16. &#092;"nbkiker\" => \"nbkiker.inc\",
  17. &#092;"clan_matches\" => \"clan_matches.inc\",
  18. &#092;"clan_awards\" => \"clan_awards.inc\",
  19. &#092;"sponsoring\" => \"sponsoring.inc\"
  20.  
  21.  );
  22.  
  23.  if ($allowed_values[$where] != '')
  24.  
  25.  {
  26.  
  27. include(&#092;"main.inc\");
  28. include(&#092;"$allowed_values[$where]\");
  29. if(!empty($allowed_values[$where2]) include(&#092;"$allowed_values[$where2]\");
  30. include(&#092;"stopka.inc\");
  31.  
  32.  }
  33.  
  34.  else
  35.  
  36.  {
  37.  
  38. include(&#092;"main.inc\");
  39. include(&#092;"news.inc\");
  40. include(&#092;"stopka.inc\");
  41.  
  42.  }
  43.  
  44. ?>


hmm,... taki kod wyświetli plik wskazany przez 'id' (o ile będzie wskazany) pod plikiem wskazanym przez 'cmd' - o to chodziło? bo nie bardzo rozumiem...
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 28.12.2025 - 06:38