savejais Posted July 11, 2006 Report Share Posted July 11, 2006 Lūk kods: <?php if($_POST["meklis"] == 'cls') { header("Location: index.php"); } if($_POST["meklis"] == 'dir') { header("Location: dir.php"); } if($_POST["meklis"] == 'par.exe') { header("Location: par.php"); } if($_POST["meklis"] == 'palidziba.bat') { header("Location: help.php"); } if($_POST["meklis"] == 'urlas.exe') { header("Location: urlas.php'); } ?> Es mēģinu uztaisīt lapu MS-DOS 5.0 izskatā. Katrā lapā ir vieta kur ierakstīt piemēram C:\ dir, nu protams C:\ nav jāievada... Nu lūk, kad mēģinu ietestēt lapu tad parādas - Unexpected $ in C:\Server\meklis.php on line 17. Uz 17 rindiņas nav neviena $. Nesaprotu! Link to comment Share on other sites More sharing options...
Grey_Wolf Posted July 11, 2006 Report Share Posted July 11, 2006 (edited) savejais--> apskati ljoti ruupiigi priekspeedeejo (15) koda rindinju ;) Sveeti ieteiktu izmantot redaktoru kur var redzeet vai ir aizvertas pedinjas/ iekavas utt.... P.S. pats lietoju Notepad++ .... Edited July 11, 2006 by Grey_Wolf Link to comment Share on other sites More sharing options...
savejais Posted July 11, 2006 Author Report Share Posted July 11, 2006 savejais--> apskati ljoti ruupiigi peedeejo koda rindinju ;) ?> Kas vainas? Ir aizvērts... Link to comment Share on other sites More sharing options...
Grey_Wolf Posted July 11, 2006 Report Share Posted July 11, 2006 (edited) nu nu ( " Location: urlas.php' ); edit: vai tad pedinjas ir aizveertas? edit: haa tiko pamaniju ka ir labais faila nosaukums URLAS ;) Edited July 11, 2006 by Grey_Wolf Link to comment Share on other sites More sharing options...
john.brown Posted July 11, 2006 Report Share Posted July 11, 2006 Šitas tagad saucas "aizvērtas"? "Location: urlas.php' Link to comment Share on other sites More sharing options...
savejais Posted July 11, 2006 Author Report Share Posted July 11, 2006 Ui bļin! Link to comment Share on other sites More sharing options...
Delfins Posted July 11, 2006 Report Share Posted July 11, 2006 mjā, skatos un brīnos ;) Galvenais ka eggogs pareizajā rindā ;) Link to comment Share on other sites More sharing options...
savejais Posted July 11, 2006 Author Report Share Posted July 11, 2006 edit: haa tiko pamaniju ka ir labais faila nosaukums URLAS ;) Nu tur es domāju linkus... URL`as :D Link to comment Share on other sites More sharing options...
Kristabs Posted July 11, 2006 Report Share Posted July 11, 2006 if(){ //ja izpildaas shis nosaciijums } elseif(){ //paarbauda vai izpildaas shis nosaciijums, tikai tad, ja nav izpildiijies ieprieksheejais } else{ //ja neviens cits neizpildaas } Link to comment Share on other sites More sharing options...
john.brown Posted July 11, 2006 Report Share Posted July 11, 2006 Nu, tad jau laikam tomēr šitā: <?php switch($_POST['meklis']) { case 'cls': header("Location: index.php"); break; case 'dir': header("Location: dir.php"); break; case 'par.exe': header("Location: par.php"); break; case 'palidziba.bat': header("Location: help.php"); break; case 'urlas.exe': header("Location: urlas.php"); break; } ?> Link to comment Share on other sites More sharing options...
savejais Posted July 12, 2006 Author Report Share Posted July 12, 2006 <?phpswitch($_POST['meklis']) { case 'cls': header("Location: index.php"); break; case 'dir': header("Location: dir.php"); break; case 'par.exe': header("Location: par.php"); break; case 'palidziba.bat': header("Location: help.php"); break; case 'urlas.exe': header("Location: urlas.php"); break; } ?> Priekškam tik garu? Link to comment Share on other sites More sharing options...
Grey_Wolf Posted July 12, 2006 Report Share Posted July 12, 2006 savejais --> saprotamaaks kods (un skjiet ka arii mazliet atraak izpildaas) Peec idejas ir taa ja japarbauda 1 nosacijums izmanto IF ja 2-4 ELSEIF ja vairaak tad SWITCH Link to comment Share on other sites More sharing options...
bubu Posted July 12, 2006 Report Share Posted July 12, 2006 Šajā gadījumā izmantot switch vai if ir pilnīgi lieki. Pareizais veids būtu ar array("cls" => "index.php", "dir" => "dir.php", ...); Link to comment Share on other sites More sharing options...
Recommended Posts