djmartins Posted December 19, 2005 Report Share Posted December 19, 2005 kaa lai ar php izsauc komandu lai taja add_news.php ieejot ja nav ielogojies tad aizmet uz index.php kur ir sis autorizesanas scripts? <script language="javascript"> <!--// /*This Script allows people to enter by using a form that asks for a UserID and Password*/ function pasuser(form) { if (form.id.value=="niks") { if (form.pass.value=="parole") { location="add_news.php" } else { alert("Invalid Password") } } else { alert("Invalid UserID") } } //--> </script> <center> <table bgcolor="white" cellpadding="12" border="1"> <tr><td colspan="2"><center><h1><i><b>Login Area</b></i></h1></center></td></tr> <tr><td><h1><i><b>UserID:</b></i></h1></td><td><form name="login"><input name="id" type="text"></td></tr> <tr><td><h1><i><b>Password:</b></i></h1></td><td><input name="pass" type="password"></td></tr> <tr><td><center><input type="button" value="Login" onClick="pasuser(this.form)"></center></td><td><center><br><input type="Reset"></form></td></tr></table></center> Link to comment Share on other sites More sharing options...
KAC Posted December 19, 2005 Report Share Posted December 19, 2005 (edited) Tas JS prikolam? Labaak palasi http://lv.php.net/manual/en/function.header.php http://lv.php.net/manual/en/features.http-auth.php Edited December 19, 2005 by KAC Link to comment Share on other sites More sharing options...
[Ya] Posted December 19, 2005 Report Share Posted December 19, 2005 ar JS nav gudri tā darīt, jebkurš var apčekot paroli un izdarīt ko grib ;) Link to comment Share on other sites More sharing options...
djmartins Posted December 19, 2005 Author Report Share Posted December 19, 2005 Ir kaadi citi ieteikumi?Varbut piemeri? Link to comment Share on other sites More sharing options...
v3rb0 Posted December 19, 2005 Report Share Posted December 19, 2005 www.php.lv/f paskaties, tur noteikti ir runāts par sessijām un `if(nav useris) - ej prom!` Link to comment Share on other sites More sharing options...
[Ya] Posted December 19, 2005 Report Share Posted December 19, 2005 taisi loginu PHP :) ar sesijām/ bez tā jau tālāk ir tava darīšana Link to comment Share on other sites More sharing options...
djmartins Posted December 19, 2005 Author Report Share Posted December 19, 2005 es jau skatijos tajas temas kuras par aut un sesijam tiek runats bet neesmu tik gudrs lai izprastu to visu lietu. Link to comment Share on other sites More sharing options...
v3rb0 Posted December 19, 2005 Report Share Posted December 19, 2005 idejiski: 1. visās lapās pirmais ko dari - session_start() 2. visas lapaas tiksi pie masiva $_SESSION kura saturs paliek mainot lapas 3. masīvā $_SESSION ieliec kaut kādā brīdī kādu pazīmi ka useris ir ielogojies 4. kur vajag tikai ar loginu pārbaudi vai $_SESSION masīvā ir pazīme ka useris ir ielogojies. Link to comment Share on other sites More sharing options...
[Ya] Posted December 19, 2005 Report Share Posted December 19, 2005 uztaisi failu "check.php" or whatever kā nosauksi, katra PHP faila sākumā kur vajadzīga autorizēšanās ieraksti include("check.php"); un fails check.php <? $loginlapa="links uz login"; session_start(); if(!isset($_SESSION['loggedin']) && $_SESSION['loggedin']==true) { header("location:$loginlapa"); } ?> un attiecīgi PHP kods ielogoties if(isset($_POST['login']) { // vai ir nospiesta OK poga $username='tavs lietotaajs'; $password='Tava parole'; if($_POST['user']==$username && $_POST['pass']==$password) { //user un pass check $_SESSION['loggedin']=true; } else { echo "Kautkas saliecās, nav kautkas pareizi"; } } un problēma atrisinata, attiecīgi login formu nu gan es tev netaisiishu pac uztaisi Link to comment Share on other sites More sharing options...
djmartins Posted December 19, 2005 Author Report Share Posted December 19, 2005 tnx :) Link to comment Share on other sites More sharing options...
boon Posted January 1, 2006 Report Share Posted January 1, 2006 Man jau patiik kkas taads : http://bh.deals.lv/source/atlaid.php :) Link to comment Share on other sites More sharing options...
Recommended Posts