marcho10 Posted March 26, 2007 Report Share Posted March 26, 2007 <?php Header("Content-type: text/html"); echo "$first умножить на $second получится ", $first*$second; ?> Nevaru saprast norakstu no graamatas vienalga kļūda! Notice: Undefined variable: first in c:\easyphp1-8\www\metrum\test1.php on line 3 Notice: Undefined variable: second in c:\easyphp1-8\www\metrum\test1.php on line 3 умножить на получится Notice: Undefined variable: first in c:\easyphp1-8\www\metrum\test1.php on line 3 Notice: Undefined variable: second in c:\easyphp1-8\www\metrum\test1.php on line 3 Kas par lietu? Link to comment Share on other sites More sharing options...
andrisp Posted March 26, 2007 Report Share Posted March 26, 2007 Pavisam vienkārši - $first un $second mainīgie nav definēti. Link to comment Share on other sites More sharing options...
marcho10 Posted March 26, 2007 Author Report Share Posted March 26, 2007 A kaa viņus definēt? Link to comment Share on other sites More sharing options...
andrisp Posted March 26, 2007 Report Share Posted March 26, 2007 $mainigaa_nosaukums = 'taa saturs'; ? Link to comment Share on other sites More sharing options...
bubu Posted March 26, 2007 Report Share Posted March 26, 2007 Apmēram šādi: $first = 1; $second = 2; Link to comment Share on other sites More sharing options...
marcho10 Posted March 26, 2007 Author Report Share Posted March 26, 2007 Bet man ir forma. Formaa es ievadu shos divus laukus bet man viņš nereizina. Link to comment Share on other sites More sharing options...
andrisp Posted March 26, 2007 Report Share Posted March 26, 2007 Skaidrs, grāmata, no kurienes tu mācies, paļaujas uz register_globals On. Tā ir slikta prakse. Ja izmanto GET (mainīgie tiek padoti caur URL), tad šiem mainīgajiem piekļūsti no $_GET masīva. Piem. $_GET['first']; Ja forma tiek submitēta ar POST, tad attiecīgi izmanto $_POST masīvu, lai piekļūtu padotajiem mainīgajiem. Link to comment Share on other sites More sharing options...
v3rb0 Posted March 27, 2007 Report Share Posted March 27, 2007 cerams tas gudrīc, kurš izdomāja register_globals=on naktīs var labi gulēt.. :) Link to comment Share on other sites More sharing options...
hackerman Posted March 27, 2007 Report Share Posted March 27, 2007 OK, es saprotu, ka register_globals on ir drošības caurums, bet kapēc, tad vispār tāds ir izdomāts? o.0 Kam vajag liekas problēmas? Link to comment Share on other sites More sharing options...
rpr Posted March 27, 2007 Report Share Posted March 27, 2007 gan jau vinjsh ir izdariijis pashnaaviibu... kolektiivu pashnaaviibu, jo ne jau viens cilveeks noleema kaadi buus nokluseetie parametri. pieljaujua arii, ka tas vareetu buut apzinaati izveidots. lai arii caurums, tomeer iesaaceejiem uztveramaak, bet kad skripti jau sarakstiiti, tad atliek tikai visiem skriptotaajiem pieveerst uzmaniibu register globals. Link to comment Share on other sites More sharing options...
hackerman Posted March 27, 2007 Report Share Posted March 27, 2007 Varbūt kāds var iedot linku, kur tieši aprakstīts, kādas kļūdas globals on pieļauj? Nu, kur tieši ir tas caurums.. Link to comment Share on other sites More sharing options...
andrisp Posted March 27, 2007 Report Share Posted March 27, 2007 hackerman, izvērtē šo kodu: <?php if (authorized()) { $authorized = 1; } if ($authorized == 1) { // slepenais kontents } ?> Link to comment Share on other sites More sharing options...
hackerman Posted March 27, 2007 Report Share Posted March 27, 2007 Cik sapratu, ja globals ir on, tad var iemānīt mainīgo? Bet otrajā variantā to nevar, ja? Link to comment Share on other sites More sharing options...
bubu Posted March 27, 2007 Report Share Posted March 27, 2007 Pareizi saprati. Link to comment Share on other sites More sharing options...
Recommended Posts