Jump to content
php.lv forumi

Neincludo lapu


Cibiņš

Recommended Posts

Tātad lapas linku sistēmu failā index.php darbina šis skripts:

 

<?php 
$pg = $_GET['pg'];
if(isset($_GET['pg'])&&$_GET['pg'] != "")
{
if(file_exists('mape/'.$pg.'.php'))
{
include('mape/'.$pg.'.php');
}
}
else
{
include('mape/lapa.php');
}
?>

 

Man interesē, kāpēc pa tiešo šis skripts (lejā) ievadot adresi URL laukā mbindex.php?MBID=1 strādā, bet ja includo ar to linku sistēmas skriptu tad nestrādā?? Piem linku sistēmai uz kaukādu failu pārslēdzot adrese aiz index.php ir ?pg=lapa..viņa beigās iznāk tā adrese ?pg=mbindex?MBID=1

 

Kautkā neritīgi, nestrādā kautkas..bet nezinu kas.

 

mbindex.php

 

<?php
   if (!isset($_GET['MBID'])) exit;  

       function showpost(&$parent) {
       extract($parent, EXTR_PREFIX_ALL, "msg");
       $msg_DateSubmitted = date("jS of F Y", $msg_DateSubmitted);
       echo "<li><A HREF=\"read.php?Msg=$msg_ID\">$msg_Title</a> posted by <a href=\"mailto:$msg_Email\">$msg_Poster</a> on $msg_DateSubmitted";
       $result = mysql_query("SELECT ID, Title, Poster, Email, DateSubmitted FROM pg_home_data WHERE MBID = {$_GET['MBID']} AND Parent = $msg_ID ORDER BY DateSubmitted DESC;");

       if (mysql_num_rows($result)) {
           echo "<ul>";
           while ($row = mysql_fetch_assoc($result)) {
               showpost($row);
           }
           echo "</ul>";
       }
   }

   $result = mysql_query("SELECT ID, Title, Poster, Email, DateSubmitted FROM pg_home_data WHERE MBID = {$_GET['MBID']} AND Parent = 0 ORDER BY DateSubmitted DESC;");
   if (!$result) exit;
   if (!mysql_num_rows($result)) {
       echo "This messageboard has no posts.";
   } else {
       echo "<ul>";
       while ($row = mysql_fetch_assoc($result)) {
           showpost($row);
       }
       echo "</ul>";
   }
?>

Edited by MCWeb.lv
Link to comment
Share on other sites

?pg=mbindex?MBID=1

 

vai pareizāk nebūtu šitā?

 

?pg=mbindex&MBID=1

 

 

Un kas notiek, ja pg vietā es padodu "../cita_mape/cits_fails" ?

 

Paldies briedi :D Strādā :) A kādēļ īsti jālieto tas &?? Tipa tas ir kā UN?

Edited by MCWeb.lv
Link to comment
Share on other sites

? zīme apzīme to, ka būs GET parametri un & zīme vienkārši atdala parametra, vertības pārus

 

index.php?parametrs1=vertiba&param2=vertiba2&param3=vertiba3 utt utt

 

Bet tu arī ņem vērā to ko es tev tur vēl teici, citādi galīgi nedrošs kods tev sanāk.

Edited by briedis
Link to comment
Share on other sites

? zīme apzīme to, ka būs GET parametri un & zīme vienkārši atdala parametra, vertības pārus

 

index.php?parametrs1=vertiba&param2=vertiba2&param3=vertiba3 utt utt

 

Bet tu arī ņem vērā to ko es tev tur vēl teici, citādi galīgi nedrošs kods tev sanāk.

 

Ok skaidrs. Nu ja tā pg vietā ieliek kkādu šmurgu piem /mape1/mape2/ tad nekas tur nestrādā balta lapa vienkarši.

Edited by MCWeb.lv
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...