hackerman Posted December 2, 2006 Report Share Posted December 2, 2006 (edited) Tātad man ir skripts, kurš aizsargā konkrētu vietu ar paroli. Viņš prasa paroli, bet es gribu, lai prasa arī username :) <form name="pp" method="post" action="check.php"> <p align="left">Lietotājvārds:<input type="username" name="username"><br></p> <p align="left">Parole:<input type="password" name="pass"></p> <input type="submit" value="Ielogoties"></p></form> check.php <?php if ($_POST['pass'] == "hackerman") { include ("infopanel.php"); } else { header("Location: error.php"); } ?> Es nezinu kā var pievienot if ($_POST['username'] == "hackerman") { Edited December 2, 2006 by hackerman Link to comment Share on other sites More sharing options...
andrisp Posted December 2, 2006 Report Share Posted December 2, 2006 (edited) Šādi neiedomājies?: if ($_POST['username'] == "hackerman" && $_POST['pass'] == "hackerman") PS. http://www.php.net/manual/en/langref.php Edited December 2, 2006 by andrisp Link to comment Share on other sites More sharing options...
hackerman Posted December 2, 2006 Author Report Share Posted December 2, 2006 Nē, neiedomājos :D Bet paldies Tev =] Link to comment Share on other sites More sharing options...
Val Posted December 2, 2006 Report Share Posted December 2, 2006 Kāda aizsardzība pret infopanel.php iedrukāšanu pārlūkā pa tiešo? - 0 Link to comment Share on other sites More sharing options...
hackerman Posted December 2, 2006 Author Report Share Posted December 2, 2006 (edited) A tu zini, kas man tur būs rakstīts infopanel vietā? P.S. Bet vispār, ja kāds var, tad labāk pasakiet, ko tur varētu darī drošībai :D Edited December 2, 2006 by hackerman Link to comment Share on other sites More sharing options...
andrisp Posted December 2, 2006 Report Share Posted December 2, 2006 Vari tajā check.php failā sākumā definēt kaut kādu konstanti, un pēc tam inkludfailos pārbaudīt vai attiecīgā konstante ir uzsetota. Ja cilvēks mēģinās pa taisno atvērt šo inkludi, tad nekas nesanāks. PS. Tikai neprasi, kas ir konstantes. Skaties linkā, ko iedevu. Link to comment Share on other sites More sharing options...
rpr Posted December 2, 2006 Report Share Posted December 2, 2006 paarbaudi liec infopanel.php skriptaa Link to comment Share on other sites More sharing options...
hackerman Posted December 2, 2006 Author Report Share Posted December 2, 2006 (edited) Nu piemēram kā būtu pareizi? define("logins", "hackerman"); define("parole", "hackerman123"); Un ko tālāk? tajā otrā skriptā jāliek <?php define("logins", "hackerman"); define("parole", "hackerman123"); echo logins; echo parole; ?> Tā ir pareizi? edited... Tā nav pareizi ^^ japalasa būs vairāk tur :) Edited December 2, 2006 by hackerman Link to comment Share on other sites More sharing options...
andrisp Posted December 2, 2006 Report Share Posted December 2, 2006 Nē taču. Iekš galvenā faila: define('x', true); Iekš infopanel.php: if (defined('x')) Link to comment Share on other sites More sharing options...
Ghenis Posted December 3, 2006 Report Share Posted December 3, 2006 sesijas ???? check.php <?php session_start(); if ($_POST['pass'] == "hackerman" && $_POST['lusername'] == luser) { $_SESSION['pass']=md5($_POST['pass']); include ("infopanel.php"); } else { header("Location: error.php"); } ?> infopanel.php <? if($_SESSION['pass'] != md5('hackerman'){ header("Location: error.php"); } ?> Link to comment Share on other sites More sharing options...
andrisp Posted December 3, 2006 Report Share Posted December 3, 2006 Nu - sesijas.. a kas ? :) Link to comment Share on other sites More sharing options...
GedroX Posted December 4, 2006 Report Share Posted December 4, 2006 Ja visas saita lapas iet caur check.php failu, tad nav jēgas definēt konstantes un vērt sesijas. Vienkārši neliec pārējos *.php failus iekš webroot. Link to comment Share on other sites More sharing options...
andrisp Posted December 4, 2006 Report Share Posted December 4, 2006 Arī labs variants, bet daži hostingi neļauj likt failus ārpus webroot. Link to comment Share on other sites More sharing options...
Recommended Posts