Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP] Include, a zmienne typu GET
S_Olewniczak
post 29.03.2008, 18:40:00
Post #1





Grupa: Zarejestrowani
Postów: 189
Pomógł: 1
Dołączył: 28.01.2008

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


Mam w PHP plik index.php, który wygląda tak:
Kod
   <?php
   $kolorTla = 'white';
   include('class/generatorTresci.php?funkcja=deklaracjaDokumentu');
   include('class/generatorTresci.php?funkcja=generujFormLog');
   include('class/generatorTresci.php?funkcja=koniecDokumentu');
   ?>

I plik generatorTresci.php:
Kod
   if ($_GET['funkcja'] == 'generujFormLog') {//tworzenie formularzu logowania
   print '<table border="0" cellpadding="5" cellspacing="5">
   <tr>
           <td>';
     print '<p class="zwyklytekstrid"><b>Witamy w strefie konsultanta. Podaj swoją nazwę użytkownika i hasło, aby się zalogować:</b></p>';
       print "<form action=\"index.php\" method=\"POST\">";
     print "<table><tr><td><p class=\"mala\">użytkownik: </p></td></tr><tr><td><input type=\"text\" name=\"uzytkownik\" value=\"".$_POST['uzytkownik']."\"></td></tr>";
     print "<tr><td><p class=\"mala\">hasło: </p></td></tr><tr><td><input type=\"password\" name=\"haslo\"></td></tr></table>";        
     print '
   <input type="submit" value="Zaloguj">';
     print '</from>';    
  
   print    '</table>';
   print '
  
  
   ';//formularz logowania
  
   }
   elseif ($_GET['funkcja'] == 'deklaracjaDokumentu') {
  
   print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
   <html>
   <head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
   <meta http-equiv="Reply-to" content="szymon.olewniczak@rid.pl">
   <meta http-equiv="Content-Language" content="pl">
   <meta name="author" content="Szymon Olewniczak">
   <title>Wirtualny Pełnomocnik</title>
   <link rel="stylesheet" href="css/strefakon.css" type="text/css" />
   </head>
   <body style="background-color: '.$kolorTla.'">';
   }
   elseif ($_GET['funkcja'] == 'koniecDokumentu') {
   ?>
   </body>
   </html>
   <?
   }

i gdy chcę uruchomić plik index.php PHP wyrzuca mi taki komunikat:

Kod
   Warning: require_once(class/generatorTresci.php?funkcja=deklaracjaDokumentu) [function.require-once]: failed to open stream: No such file or directory in /opt/lampp/htdocs/Rid/wirtualny_pelnomocnik/index.php on line 10
  
   Fatal error: require_once() [function.require]: Failed opening required 'class/generatorTresci.php?funkcja=deklaracjaDokumentu' (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/Rid/wirtualny_pelnomocnik/index.php on line 10

Czy ktoś wie gdzie popełniłem błąd?
Go to the top of the page
+Quote Post
Lejto
post 29.03.2008, 18:42:09
Post #2





Grupa: Zarejestrowani
Postów: 1 385
Pomógł: 48
Dołączył: 23.05.2007

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


Fatal error: require_once() [function.require]: Failed opening required 'class/generatorTresci.php?funkcja=deklaracjaDokumentu' (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/Rid/wirtualny_pelnomocnik/index.php on line 10
błędna ścieżka do pliku, podaj cały index.php

Ten post edytował Lejto 29.03.2008, 18:42:19


--------------------
Go to the top of the page
+Quote Post
S_Olewniczak
post 29.03.2008, 18:46:48
Post #3





Grupa: Zarejestrowani
Postów: 189
Pomógł: 1
Dołączył: 28.01.2008

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


Cały plik index.php:

Kod
<?php
session_start();
if (($_POST['uzytkownik']) && ($_POST['haslo'])) { //wartości są wpisane
include("class/logIwylog.php");
$logowanie = new logIwylog;
$logowanie->_construct($_POST['uzytkownik'],$_POST['haslo'],'konsultanci','username','haslo','index.php','ramka_strefakon.php');

}//koniec pętli sprawdzającej czy wpisano dane
$kolorTla = 'white';
require_once('class/generatorTresci.php?funkcja=deklaracjaDokumentu');
require_once('class/generatorTresci.php?funkcja=generujFormLog');
require_once('class/generatorTresci.php?funkcja=koniecDokumentu');

?>
Go to the top of the page
+Quote Post
pyro
post 29.03.2008, 18:48:43
Post #4





Grupa: Zarejestrowani
Postów: 2 148
Pomógł: 230
Dołączył: 26.03.2008

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


Cytat(S_Olewniczak @ 29.03.2008, 18:46:48 ) *
Cały plik index.php:

Kod
<?php
session_start();
if (($_POST['uzytkownik']) && ($_POST['haslo'])) { //wartości są wpisane
include("class/logIwylog.php");
$logowanie = new logIwylog;
$logowanie->_construct($_POST['uzytkownik'],$_POST['haslo'],'konsultanci','username','haslo','index.php','ramka_strefakon.php');

}//koniec pętli sprawdzającej czy wpisano dane
$kolorTla = 'white';
require_once('class/generatorTresci.php?funkcja=deklaracjaDokumentu');
require_once('class/generatorTresci.php?funkcja=generujFormLog');
require_once('class/generatorTresci.php?funkcja=koniecDokumentu');

?>

w require i include nie mozna dodawac takiego czegos: ?funkcja=deklaracjaDokumentu, musisz podawac sciezke do PLIKU


--------------------
ET LINGUA EIUS LOQUETUR IUDICIUM
Go to the top of the page
+Quote Post
kubap007
post 10.12.2010, 20:32:44
Post #5





Grupa: Zarejestrowani
Postów: 38
Pomógł: 0
Dołączył: 29.05.2007

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


A są jakiekolwiek funkcje gdzie można to zrobić?
Go to the top of the page
+Quote Post
c4ash
post 11.12.2010, 05:54:43
Post #6





Grupa: Zarejestrowani
Postów: 73
Pomógł: 9
Dołączył: 14.01.2010

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


Przeciez wczytujesz plik generator tresci, wiec co za problem w pliku generator tresci napisac funkcje: deklaracjaDokumentu, generujFormLog i koniecDokumentu, a nastepnie tylko odwolywac sie do nich?

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 Wersja Lo-Fi Aktualny czas: 8.07.2025 - 18:01