Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
<?
$action=$HTTP_GET_VARS['action'];
if ($action=="") {
header("Location: default.php");
} elseif ($action=="links") {
header("Location: n1.php");
} elseif ($action=="mail") {
header("Location: n2.php");
} else {
header("Location: err.php")
}
?>
Как в този код да му дам...
porostorm каза:Как в този код да му дам ако се вкарва страница, която не съществува да изведе "Грешка" ?Код:<?php switch($_GET['action']) { default: include("default.php"); break; case "links"; include("n1.php"); break; case "mail"; include("n2.php"); break; } ?>
Как в този код да му дам...
С две думи - няма начин. :?Wrox Press Professional PHP Programming book каза:Conditional Statements
Conditional statements allow us to specify blocks of code which will be executed only if certain
conditions are met. PHP provides two conditional constructions. The first is if ... elseif ...
else, which allows us to test a number of expressions and execute statements according to their value. If
we wish to test a single expression against a number of values, PHP also provides a switch ... case
construction which simplifies this operation.
mute каза:<?php
switch($_GET['action']) {
case "links": include("n1.php"); break;
case "mail": include("n2.php"); break;
default: include("default.php"); break;
}
?>
porostorm каза:Мхм, не съм казал, че трябва задължително да извежда грешка. Идеята да върне default страницата е даже по-добра но как ще стане?
$masiv = array (
'links' => 'n1.php',
'mail' => 'n2.php',
);
$action = $_GET['action'];
if (array_key_exists($action, $masiv)) include('./'.$masiv[$action]);
else include('default.php');
porostorm каза:http://roverclub-bg.com/index.php?page=vin
http://roverclub-bg.com/index.php?page=vin312
:roll:
porostorm каза:И с на муте case и с на админ if пак неще :lol:
porostorm каза:Оправих се![]()
не ме издавай беbafitu каза:$_GET['page'] му е променливата за скрипта за .. странициране и става дублиране..