raivis Posted December 3, 2004 Report Share Posted December 3, 2004 !?Kā lai uz php uzdabūju: 1..lai nenostrādātu Back poga=> header("location: $REQUEST_URI"); --- 2..uzspiežot Back=> session_destroy(); session_start(); header("Cache-control: private"); if(@$_SESSION['user']) { header("location: index.php?id=login"); } .. JavaSriptā var izmantot: //lock if (document.all){ document.onkeydown = function (){ var key_f5 = 116; // 116 = F5 if (key_f11==event.keyCode){ alert("F5 pressed"); return false; } } } function showDown(evt) { evt = (evt) ? evt : ((event) ? event : null); if (evt) { if (event.keyCode == 8 && (event.srcElement.type != "text" && event.srcElement.type != "textarea" && event.srcElement.type != "password")) { // When backspace is pressed but not in form element cancelKey(evt); } else if (event.keyCode == 116) { // When F5 is pressed cancelKey(evt); } else if (event.ctrlKey && (event.keyCode == 78 || event.keyCode == 82)) { // When ctrl is pressed with R or N cancelKey(evt); } } } function cancelKey(evt) { if (evt.preventDefault) { evt.preventDefault(); return false; } else { evt.keyCode = 0; evt.returnValue = false; } } // Additional code for NS if (navigator.appName=="Netscape") { document.addEventListener("keypress",showDown,true); } document.onkeydown = showDown; bet tas nav gluži tas, ko vēlētos.. Link to comment Share on other sites More sharing options...
bubu Posted December 4, 2004 Report Share Posted December 4, 2004 1) Back poga strādā neatkarīgi no tava php skripta. Browseris pats var izdomāt, kad pieprasīt vai nepieprasīt datus 2) JavaScript vienmēr var atslēgt, tāpēc kāda jēga pūlēties kautko aizliegt, ja to var elementāri atslēgt? Link to comment Share on other sites More sharing options...
Venom Posted December 6, 2004 Report Share Posted December 6, 2004 un priekš kam tas vajadzīgs? session_start(); if (!isset($_SESSION['visited'])) $_SESSION['visited']=array(); if (!in_array($_SERVER['QUERY_STRING'],$_SESSION['visited'])) $_SESSION['visited'][]=$_SERVER['QUERY_STRING'];//primo reiz else { //otro reiz header(...); exit; } Link to comment Share on other sites More sharing options...
raivis Posted December 7, 2004 Author Report Share Posted December 7, 2004 Izmantojot: session_start(); if (!isset($_SESSION['user'])) $_SESSION['user']=array(); if (!in_array($_SERVER['QUERY_STRING'],$_SESSION['user'])) $_SESSION['user'][]=$_SERVER['QUERY_STRING'];//primo reiz else { //otro reiz header(...); exit; } man gļuko lapu - uzrādot, ka kļūda ir rindā: if (!in_array($_SERVER['QUERY_STRING'],$_SESSION['user'])) Link to comment Share on other sites More sharing options...
Venom Posted December 8, 2004 Report Share Posted December 8, 2004 kāda veida kļūda arī teiksi? Link to comment Share on other sites More sharing options...
bubu Posted December 8, 2004 Report Share Posted December 8, 2004 man gļuko lapu - uzrādot, ka kļūda ir rindā: Lapas negļuko, gļuko nepareizi kodi, un nevis gļuko, bet nestrādā pareizie, tb rāda kļūdu!!!!! Link to comment Share on other sites More sharing options...
raivis Posted December 14, 2004 Author Report Share Posted December 14, 2004 !nenostrādā.. session_start(); header("Cache-control: private"); if(!isset($_POST['user']) && !isset($_SESSION['user']) && !isset($_POST['pass']) && !isset($_SESSION['pass'])) { echo "<form action=\"\" method=\"POST\"> Login:<input type=\"text\" name=\"user\"><br> Pass:<input type=\"password\" name=\"pass\"><br> <input type=\"submit\" value=\"Login\"> </form>"; } else { echo "<a href=\"javascript:window.location=window.location\">Refresh</a> "; if(@$_SESSION['user'] && @$_SESSION['pass']){ echo "<a href=\"?id=logout\">Logout</a><hr>ok! ".$user." ".$pass; //header('location: index.php?id=login'); } else { $_SESSION['user']=array(); $_SESSION['pass']=array(); $_SESSION["name"] = $name; $_SESSION["surename"] = $surename; $_SESSION["user"] = $user; $_SESSION["pass"] = $pass; if (!in_array($_SERVER['QUERY_STRING'],@$_SESSION['user'] && @$_SESSION['pass'])) { @$_SESSION['user'] && @$_SESSION['pass'][]=$_SERVER['QUERY_STRING']; } else { header("locarion: index.php"); exit; } } } if ($id==logout) { if(@$_SESSION['user'] && @$_SESSION['pass']){ $_SESSION["name"] = false; $_SESSION["surename"] = false; $_SESSION["user"] = false; $_SESSION["pass"] = false; session_destroy(); } echo "<br>You are <b>logout!</b>"; //header('location: index.php?id=logout'); } Link to comment Share on other sites More sharing options...
raivis Posted December 20, 2004 Author Report Share Posted December 20, 2004 ?varbūt vaina ir php.ini » QUERY_STRING no value Link to comment Share on other sites More sharing options...
raivis Posted December 20, 2004 Author Report Share Posted December 20, 2004 Venom, varēsi man izpalīdzēt? Link to comment Share on other sites More sharing options...
Venom Posted December 20, 2004 Report Share Posted December 20, 2004 up close & personal jautājiens ;) no redzētā: if(@$_SESSION['user'] && @$_SESSION['pass']){ echo "<a href=\"?id=logout\">Logout</a><hr>ok! ".$user." ".$pass; $user un $pass iepriekš nav definēti arī tālāk: $_SESSION["name"] = $name; ... neredzu no kurienes tie rodas (!in_array($_SERVER['QUERY_STRING'],@$_SESSION['user'] && @$_SESSION['pass']) ko atrgiež (array() && array()), manuprāt false vai true, ja abos masīvos kaut kas bijis, bet nu nekādīgi ne kopmasīvu, ar + vēl varbūt, tomēr tik un tā - no kurienes tur query_stringam rasties? NB: you are logged out @$mainigais vietā vēlams izmantot !empty($mainigais) Link to comment Share on other sites More sharing options...
Recommended Posts