Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [php] index.php?id=
Forum PHP.pl > Forum > Przedszkole
TheWatcher
Witam!

Mam problem ze skryptami robiącymi linki z id=. Próbowałem kilku skryptów ale żadne nie działały. Zawsze wyświetlało się 'Połączenie zostało zresetowane'.

Spróbowałem każdego skryptu stąd.

Jeśli macie jakiś dobry skrypt to zapostujcie go tutaj, proszę.

Pozdrawiam, Disturbed

[+] edit
Z takimi pytaniami to proszę na Przedszkole,
następnym razem. Przenoszę..
---
~strife
JaRoPHP
No dobrze - próbowałeś, ale niestety nie napisałeś, gdzie pojawia sie problem... Proponuję, abyś wkleił swój kod, wtedy będzie łatwiej Ci pomóc...
Cytat
Jeśli macie jakiś dobry skrypt to zapostujcie go tutaj, proszę.
Nie wydaje mi się to na tyle skomplikowane, aby tego nie napisać samemu. Niestety nie rozumiem, co znaczy "Mam problem ze skryptami robiącymi linki z id=" - gdzie jest ten problem?
Darti
a zrób sobie skrypt z zawartością:
  1. <?php
  2. echo $_GET['id'];
  3. ?>
i wywolaj go:

nazwa_skryptu.php?id=10

i powiedz czy wyświetliło się 10...
kubarek
tamto forum wygląda na beznadziejne
anyway:

  1. <?php
  2. $plik = $_GET['plik'];
  3.  
  4. include "pliki/$plik.php";
  5. ?>


stwórz parę linków
Kod
<a href="index.php?plik=a">A</a>
<a href="index.php?plik=bcd">bcd</a>
<a href="index.php?plik=efg">efg</a>


a w katalogu 'pliki' odpowiednio a.php, bcd.php i efg.php

ogólnie plik index.php ma wyglądać tak:
Kod
...
<a href="index.php?plik=a">A</a>
<a href="index.php?plik=bcd">bcd</a>
<a href="index.php?plik=efg">efg</a>
...
<?php

if (isset($_GET['plik'])){

  $plik = $_GET['plik'];
  include "pliki/$plik.php";

  echo "Wybrałeś: $plik.";
}else{

echo 'Domyślna strona';

}
?>
...

co robi kod:
wyświetla listę linków
w bloku php sprawdza, czy wprowadzono parametr plik= w adresie
jeśli taki parametr jest, to wczytuje i wyświetla odpowiednią stronę ( na podstawie właśnie tego parametru ) z katalogu 'pliki'
jeśli parametru nie ma, to wyświetla 'Domyślna strona'

przydało by się, żebyś poznał podstawy php, jeśli dalej nie rozumiesz kodu
TheWatcher
Cytat
No dobrze - próbowałeś, ale niestety nie napisałeś, gdzie pojawia sie problem... Proponuję, abyś wkleił swój kod, wtedy będzie łatwiej Ci pomóc...


Ja powiedziałem że:
Cytat
Zawsze wyświetlało się 'Połączenie zostało zresetowane'.


Co do kodu to były wszystkie kody z http://webmer.pl/readarticle.php?article_id=7.

Cytat
a zrób sobie skrypt z zawartością:

  1. <?php
  2. echo $_GET['id'];
  3. ?>


i wywolaj go:

nazwa_skryptu.php?id=10

i powiedz czy wyświetliło się 10...


Skopiowałem i wkleiłem to co mi kazałeś w body strony. Kiedy wszedłem na index.php?id=10 to wyświetlił mi się normalny index.php.
Darti
Cytat(TheWatcher @ 17.06.2007, 17:23:37 ) *
Skopiowałem i wkleiłem to co mi kazałeś w body strony. Kiedy wszedłem na index.php?id=10 to wyświetlił mi się normalny index.php.


Nie czytasz ze zrozumieniem.
Nie kazałem wklejać w żadne body tylko w nowy, czysty świeżutki plik php (dajmy na to nazwa_skryptu.php) i tam wkleić co napisałem w php. I powiedzieć czy wyświetla się po wywołaniu strony liczba 10 czy może inne bzdury ?
TheWatcher
Cytat(kubarek @ 17.06.2007, 18:19:27 ) *
ogólnie plik index.php ma wyglądać tak:
Kod
...
<a href="index.php?plik=a">A</a>
<a href="index.php?plik=bcd">bcd</a>
<a href="index.php?plik=efg">efg</a>
...
<?php

if (isset($_GET['plik'])){

  $plik = $_GET['plik'];
  include "pliki/$plik.php";

  echo "Wybrałeś: $plik.";
}else{

echo 'Domyślna strona';

}
?>
...



Zrobiłem tak ale jak wchodze w index.php?plik=a to mi firefox pokazuje:

Cytat
Połączenie zostało zresetowane

Połączenie z serwerem zostało zresetowane podczas wczytywania strony.


Cytat(Darti @ 17.06.2007, 18:27:40 ) *
Nie czytasz ze zrozumieniem.
Nie kazałem wklejać w żadne body tylko w nowy, czysty świeżutki plik php (dajmy na to nazwa_skryptu.php) i tam wkleić co napisałem w php. I powiedzieć czy wyświetla się po wywołaniu strony liczba 10 czy może inne bzdury ?


Tak, pokazuje mi się 10.
JaRoPHP
Cytat(TheWatcher @ 17.06.2007, 17:23:37 ) *
Co do kodu to były wszystkie kody z http://webmer.pl/readarticle.php?article_id=7.
Ok, to rozumiem, ale nie wiem, jak wygląda Twój kod (może wprowadziłeś jakieś zmiany) - nie wiem, bo wróżką nie jestem.

Czy tak trudno jest pokazać swój kod?
TheWatcher
Kod
<html>
<head>
<title>disturbed studio</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body bgcolor="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<?
switch($id) { default: include('index.php');
break; case "portfolio": include('porfolio.php');
}
?>
<center>
<table id="disturbed" width="1225" height="801" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td background="images/index_01.png" width="70" height="674" rowspan="12"></td>
        <td background="images/index_02.png" width="1065" height="203" colspan="21"></td>
        <td background="images/index_03.png" width="89" height="800" rowspan="13"></td>
        <td>
            <img src="images/spacer.gif" width="1" height="203" alt=""></td>
    </tr>
    <tr>
        <td background="images/index_04.png" width="16" height="191" colspan="2" rowspan="9"></td>
        <td rowspan="6">
            <a href="index.html"><img src="images/index_05.png" width="138" height="131" border="0" alt="Disturbed Design"></a></td>
        <td background="images/index_06.png" width="45" height="23" colspan="2" rowspan="2"></td>
        <td background="images/index_07.png" width="105" height="23" colspan="3" rowspan="2"></td>
        <td background="images/index_08.png" width="761" height="5" colspan="13"></td>
        <td>
            <img src="images/spacer.gif" width="1" height="5" alt=""></td>
    </tr>
    <tr>
        <td background="images/index_09.png" width="113" height="18" colspan="3"></td>
        <td rowspan="2">
            <a href="index.html"><img src="images/index_10.png" width="78" height="58" border="0" alt="Home"></a></td>
        <td background="images/index_11.png" width="56" height="62" rowspan="3"></td>
        <td colspan="2" rowspan="3">
            <a href="portfolio.html"><img src="images/index_12.png" width="100" height="62" border="0" alt="Portfolio"></a></td>
        <td background="images/index_13.png" width="60" height="62" rowspan="3"></td>
        <td rowspan="2">
            <a href="firma.html"><img src="images/index_14.png" width="79" height="58" border="0" alt="Firma"></a></td>
        <td background="images/index_15.png" width="59" height="62" rowspan="3"></td>
        <td rowspan="2">
            <a href="linki.html"><img src="images/index_16.png" width="62" height="58" border="0" alt="Linki"></a></td>
        <td background="images/index_17.png" width="59" height="62" rowspan="3"></td>
        <td rowspan="3">
            <a href="kontakt.html"><img src="images/index_18.png" width="95" height="62" border="0" alt="Kontakt"></a></td>
        <td>
            <img src="images/spacer.gif" width="1" height="18" alt=""></td>
    </tr>
    <tr>
        <td background="images/index_19.png" width="31" height="168" rowspan="7"></td>
        <td valign="top" background="images/index_20.png" width="192" height="108" colspan="6" rowspan="4"><form method="get" action="http://www.google.com/custom" target="_top">
<table align="center" border="0" background="images/index_20.png">
<tr><td nowrap="nowrap" valign="top" align="left" height="32"></td>
<td nowrap="nowrap">
<input type="hidden" name="domains" value="d-studio.pl"></input>
<label for="sbi" style="display: none">Wprowadź wyszukiwane hasła</label>
<input type="text" name="q" size="20" maxlength="255" value="" id="sbi"></input>
<label for="sbb" style="display: none">Prześlij formularz wyszukiwania</label>
<input type="image" name="sa" value="Szukaj" id="sbb" src="images/search.png" style="vertical-align: middle; border: 0;" />
</td></tr>
<tr>
<td>&nbsp;</td>
<td nowrap="nowrap">
<table>
<tr>
<td>
<input type="radio" name="sitesearch" value="" checked id="ss0">
</input>
<span class="style9">
<label for="ss0" title="Szukaj w Internecie"><font color="#000000">WWW</font></label>
</span></td>
<td>
<input type="radio" name="sitesearch" value="d-studio.pl" id="ss1">
</input>
<span class="style2">
<span class="style8">
<span class="style9">
<label for="ss1" title="Wyszukaj d-studio.pl"><font color="#000000">Strona</font></label>
</span> </span></span></td>
</tr>
</table>
<input type="hidden" name="client" value="pub-8418100694947246"></input>
<input type="hidden" name="forid" value="1"></input>
<input type="hidden" name="ie" value="ISO-8859-2"></input>
<input type="hidden" name="oe" value="ISO-8859-2"></input>
<input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;LH:95;LW:100;L:http://images22.fotosik.pl/163/e1947964ba9974a8.png;S:http://d-studio.pl;LP:1;FORID:1"></input>
<input type="hidden" name="hl" value="pl"></input>
</td></tr></table>
</form></td>
        <td background="images/index_21.png" width="40" height="44" rowspan="2"></td>
        <td>
            <img src="images/spacer.gif" width="1" height="40" alt=""></td>
    </tr>
    <tr>
        <td background="images/index_22.png" width="78" height="4"></td>
        <td background="images/index_23.png" width="79" height="4"></td>
        <td background="images/index_24.png" width="62" height="4"></td>
        <td>
            <img src="images/spacer.gif" width="1" height="4" alt=""></td>
    </tr>
    <tr>
        <td background="images/index_25.png" width="688" height="32" colspan="11"></td>
        <td>
            <img src="images/spacer.gif" width="1" height="32" alt=""></td>
    </tr>
    <tr>
        <td background="images/index_26.png" width="242" height="59" colspan="4" rowspan="3"></td>
        <td background="images/index_27.png" width="32" height="372" rowspan="6"></td>
        <td valign="top" background="images/index_28.png" width="414" height="372" colspan="6" rowspan="6"><br><br><br><span class="style9"><font color="#0e9a00"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~nowy layout</font> | 11.09.2001 | <a href="forum/viewtopic.php?p=1">1 komentarz</a><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Lorem ipsum dolor sit amet enim. Etiam ullamcorper. Suspendisse a pellentesque dui, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;non felis. Maecenas malesuada elit lectus felis, malesuada ultricies. Curabitur et ligula. Ut &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;molestie a, ultricies porta urna. Vestibulum commodo volutpat a, convallis ac, laoreet &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;enim. Phasellus fermentum in, dolor. Pellentesque facilisis. Nulla imperdiet sit amet magna. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Vestibulum dapibus, mauris nec malesuada fames ac turpis velit, rhoncus eu, luctus et &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;interdum adipiscing wisi. Aliquam erat ac ipsum. Integer aliquam purus. Quisque lorem &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tortor fringilla sed, vestibulum id, eleifend justo vel bibendum sapien massa ac turpis &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;faucibus orci luctus non, consectetuer lobortis quis, varius in, purus. Integer ultrices &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;posuere cubilia Curae, Nulla ipsum dolor lacus, suscipit adipiscing.
</span></td>
        <td>
            <img src="images/spacer.gif" width="1" height="32" alt=""></td>
    </tr>
    <tr>
        <td background="images/index_29.png" width="138" height="60" rowspan="3"></td>
        <td background="images/index_30.png" width="46" height="13" colspan="3"></td>
        <td background="images/index_31.png" width="137" height="27" colspan="2" rowspan="2"></td>
        <td background="images/index_32.png" width="9" height="27" rowspan="2"></td>
        <td>
            <img src="images/spacer.gif" width="1" height="13" alt=""></td>
    </tr>
    <tr>
        <td background="images/index_33.png" width="33" height="78" colspan="2" rowspan="3"></td>
        <td background="images/index_34.png" width="13" height="327" rowspan="4"></td>
        <td>
            <img src="images/spacer.gif" width="1" height="14" alt=""></td>
    </tr>


cdn...

Kod
    <tr>
        <td valign="top" background="images/index_35.png" width="388" height="313" colspan="7" rowspan="3"><span class="style9"><font color="#0e9a00"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~nowy layout</font> | 11.09.2001 | <a href="forum/viewtopic.php?p=1">1 komentarz</a><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Lorem ipsum dolor sit amet enim. Etiam ullamcorper. Suspendisse a pellentesque &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dui, non felis. Maecenas malesuada elit lectus felis, malesuada ultricies. Curabitur et &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ligula. Ut molestie a, ultricies porta urna. Vestibulum commodo volutpat a, convallis &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ac, laoreet enim. Phasellus fermentum in, dolor. Pellentesque facilisis. Nulla &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;imperdiet sit amet magna. Vestibulum dapibus, mauris nec malesuada fames ac &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;turpis velit, rhoncus eu, luctus et interdum adipiscing wisi. Aliquam erat ac ipsum. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Integer aliquam purus. Quisque lorem tortor fringilla sed, vestibulum id, eleifend &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;justo vel bibendum sapien massa ac turpis faucibus orci luctus non, consectetuer &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lobortis quis, varius in, purus. Integer ultrices posuere cubilia Curae, Nulla ipsum &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dolor lacus, suscipit adipiscing.</span></td>
        <td>
            <img src="images/spacer.gif" width="1" height="33" alt=""></td>
    </tr>
    <tr>
        <td background="images/index_36.png" width="1" height="280" rowspan="2"></td>
        <td background="images/index_37.png" width="184" height="31" colspan="3"></td>
        <td>
            <img src="images/spacer.gif" width="1" height="31" alt=""></td>
    </tr>
    <tr>
        <td valign="top" background="images/index_38.png" width="217" height="249" colspan="5">
<?php
$banner[]=array("images/projekty/1.jpg","projekt1.html");
$banner[]=array("images/projekty/2.jpg","projekt2.html");
$rand = rand(0,count($banner)-1);
?>
<p align="center">
<a href=<?=$banner[$rand][1]?>><img src="<?=$banner[$rand][0]?>" alt="" border="0"></a></p>
        
        </td>
        <td>
            <img src="images/spacer.gif" width="1" height="249" alt=""></td>
    </tr>
    <tr>
        <td background="images/index_39.png" width="1135" height="126" colspan="22"></td>
        <td>
            <img src="images/spacer.gif" width="1" height="126" alt=""></td>
    </tr>
    <tr>
        <td>
            <img src="images/spacer.gif" width="70" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="15" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="138" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="31" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="14" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="19" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="13" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="73" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="64" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="9" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="40" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="78" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="56" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="68" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="32" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="60" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="79" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="59" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="62" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="59" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="95" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="89" height="1" alt=""></td>
        <td></td>
    </tr>
</table>
</center>
</body>
</html>
jarekh
  1. <?
  2. switch($id) { default: include('index.php');
  3. break; case "portfolio": include('porfolio.php');
  4. }
  5. ?>


Czy mi sie zdaje czy do index.php includujesz index.php....?
TheWatcher
Chodzi o to żeby pokazywało że index.php?id=, ja tylko kopiowałem skrypt tongue.gif
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.