TurboSasa Posted December 31, 2005 Report Share Posted December 31, 2005 <?php // vai ir nospiesta OK poga if(isset($_POST['login'])){ $user='sasa'; $pass='sasabizhatcomadminmod'; //user un pass check if($_POST['user']==$username && $_POST['pass']==$password) { //$_SESSION['loggedin']=true; ?> <"meta http-equiv="Refresh" content="1; url=http://127.0.0.1:8080/sasa_webroot/main_admin_mod.php"> <? } else { echo "Access Denied!"; } } ?> man vajadziiga redirekteeshana uz kaadu citu lapu. ide jaatada ja ievadiitas user un pass sakriir tad ietu uz Admin lapu bet ja nee tad nee. sakumaa meeginaaju kaut ko ar sesijaam bet man nesanaaca tad meeginaaju shadu variantu bet varbuut ir kaada cita iespeeja? Link to comment Share on other sites More sharing options...
rpr Posted December 31, 2005 Report Share Posted December 31, 2005 liiikaak jau varis nevar uzrakstiit! labi penjemsim, ka shis ir pseidokods. bet taadaa gadiijumaa, tev arii mod lapaa jaapaarbauda vai ir ielogojies. labaak paaradresaaciju lik ar hederi nevis ar html meta tagu. ja akses denied, tad arii labaak pielikt hederi kautkaadu 30x Link to comment Share on other sites More sharing options...
TurboSasa Posted December 31, 2005 Author Report Share Posted December 31, 2005 (edited) njaa tagad es sapratu ka to meta tagu nav veert izmantot bet kaa man izmantot headeri un kaa uzlikt ja access denied tos 30x. vareetu kaut kaa siikaak konkreeti par manu kjuudu! kaa labaak uztasiit taa ka arii paarbauda tanii admin mod lapaa ka ir jau ielogojie, jo pashlaik man sanaak ka to lapu var ierakstiit browsera adress baraa un tiksi pie admineeshanas bez nekaadas ielogoshanas! paldies par sapratni! EDIT: tagad jauna probleema ... tagad redirekteeju caur headeri bet kaa es varu paarbeudiit vai ir izpildiita ielogoshanas nevis browsera adreess baraa ierakstiita taa vieta kuraa atrodas mana admineeshanas lapa! ceru ka saprataat kas man ir par probleemu! Edited December 31, 2005 by TurboSasa Link to comment Share on other sites More sharing options...
rpr Posted December 31, 2005 Report Share Posted December 31, 2005 nu pie access denied vajadzeeja navis 30x kljuudas, bet konkreeti shajaa gadijumaa nenaaktu par labu 401. to var noraadiit kautkaa liidziigi shim header("HTTP/1.0 401 Authorization Required"); saglabaa sesijaa, ka lietotaajs ielogojies un peec tam mod lapaa paarbaudi sesijas mainiigos. Link to comment Share on other sites More sharing options...
TurboSasa Posted December 31, 2005 Author Report Share Posted December 31, 2005 saglabaa sesijaa, ka lietotaajs ielogojies un peec tam mod lapaa paarbaudi sesijas mainiigos. kas es kaut ko taadu meeginaaju man bija vesela virkne erroru! koda dalja ielogoshanai! if(isset($_POST['pass'])){ $user='1'; $pass='2'; //user un pass check if($_POST['user']==$user && $_POST['pass']==$pass){ $_SESSION['loggedin']=true; //header("Location: main_admin_mod.php"); } else { echo "Access denied" } } <? $loginlapa="main_admin_mod.php"; session_start(); if(!isset($_SESSION['loggedin']) && $_SESSION['loggedin']==true) { header("location:$loginlapa"); } ?> shito koda dalju es pievienoju taam lapaam kuraam ir nepiecieshama ielogoshanaas! <?php include("login_validation.php"); ?> kad shitais viss ir izdariits tad man paradaas sekojoshas kjuudas: Warning: session_start(): open(/tmp\sess_7d37dcc10e11a81211394bd31843ee8c, O_RDWR) failed: No such file or directory (2) in C:\WebServer\www\sasa_webroot\login_validation.php on line 3 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at C:\WebServer\www\sasa_webroot\login_validation.php:3) in C:\WebServer\www\sasa_webroot\login_validation.php on line 3 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at C:\WebServer\www\sasa_webroot\login_validation.php:3) in C:\WebServer\www\sasa_webroot\login_validation.php on line 3 tagad izvadas taa lapa uz kuru radirektaaja uz zem taas lapas turpinaas kjuudas Warning: Unknown(): open(/tmp\sess_7d37dcc10e11a81211394bd31843ee8c, O_RDWR) failed: No such file or directory (2) in Unknown on line 0 Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0 PS. sesijaas es pilniigi nekaa nesaprotu! varbuut varat paliideet un pateikt kam kaa jaabuut! Link to comment Share on other sites More sharing options...
rpr Posted December 31, 2005 Report Share Posted December 31, 2005 ja saprot anglju valodu, tad jau viss tur ir rakstiits: *open(/tmp\sess_7d37dcc10e11a81211394bd31843ee8c, O_RDWR) failed:* nav iespeejams nolasiit/saglabaat failu. iespeejams, ka ini failaa nepareizi noraadiita tmp direktorija. vai ari tmp direktorijai nav rakstiishanas/lasiishanas tiesiibas *Warning: session_start(): Cannot send session cookie - headers already sent by (output started at* paaraak tipiska kljuuda - pirms headera jau ir izvadiita informaacija. Link to comment Share on other sites More sharing options...
Grey_Wolf Posted December 31, 2005 Report Share Posted December 31, 2005 abas ir ljoti tipiskas kljuudas dodu 90% garantijas ka, ja uztaisiisi uz C: tmp direktoriju buus krietni labaak... Win uztaisa temp nevis tmp sii iemesla deelj biezji vien tiek pienjemts - kaa man tachu ir temp drektorija- kapeec nestraadaa Starpiiba 1 burtaa, bet kas par efektu ;) Link to comment Share on other sites More sharing options...
TurboSasa Posted December 31, 2005 Author Report Share Posted December 31, 2005 taa tagad es satasiiju to tmp direktoriju un par sesijaam man nekas nebljustaas bet tafad man kaut kaadu iemeslu deelj nepalaizhas shitais kods if(isset($_POST['pass'])){ $user='1'; $pass='2'; //user un pass check if($_POST['user']==$user && $_POST['pass']==$pass){ $_SESSION['loggedin']=true; //header("Location: main_admin_mod.php"); } else { echo "Access denied" } } kaut ari ievadu pareizu user vardu un pass bet nekas nenotiek nekas neielaadeejas varbuut man sesijas nepalaizhas... kaa man palais sesiju? Link to comment Share on other sites More sharing options...
Vebers Posted January 1, 2006 Report Share Posted January 1, 2006 (edited) header("HTTP/1.0 401 Authorization Required"); šie headeri man k-kā negrib strādāt vismaz browserī nekas neparādas.. Kpc tā ? Katras lapas sākumā pieliec session_start(); , tad palaidīsies sessijas un būs pieejami visi sesiju mainīgie.. Edited January 1, 2006 by MakaTaNaw Link to comment Share on other sites More sharing options...
TurboSasa Posted January 1, 2006 Author Report Share Posted January 1, 2006 man tagad palaizhas sesijas bet es esmu biki sajucis savaa kodaa ... ar vienkaarshiem piemeeriem man sanaak no vienas sesijas ievadiitos datus nolasiit pavisam citaa failaa un redzu ka mainiigie parceljo no vienas lapas uz citu lapu... Bet tagad es nezinu kaa maneejaa lapaa sakaartot tos skriptus es tagad bik nesaprotu kas man jaabuut tanii lapaa kur jaaielogojas tad man ir atsevishkja lapa kura paarbauda vai ielogoshanaas vispaar ir notikusi, ja notikusi tad redirektee un to lapu un taajaa lapaa es inkluudoju failu kursh cheko vai ir notikusi ielogoshanaas (tas pats fails kas paarbauda vai ielogoshanaas vispaar ir notikusi)! Link to comment Share on other sites More sharing options...
rpr Posted January 1, 2006 Report Share Posted January 1, 2006 pec header("HTTP/1.0 401 Authorization Required"); veel vajag pieivenot kaut kaadu ouputu, jo brouzers vizuaali neko tev neraadiis (iznjemot varbuut ie). peec tam pieliec veel echo" nav autorizeeejies";exit; saakumaa varbuut nebuutu par ljaunu izprast http principus. paskaties vai peec session start session_id ir viens un tas pats. Link to comment Share on other sites More sharing options...
TurboSasa Posted January 2, 2006 Author Report Share Posted January 2, 2006 nesaprotu! Link to comment Share on other sites More sharing options...
Blackout Posted January 6, 2006 Report Share Posted January 6, 2006 (edited) tev sessijas īsti pareizi nav sāktas Piemērs: session_start(); session_register("login"); $_SESSION['login'] = true; šitā būs pareizi. Un kā tu gribi uztaisīt aizsardzību pret tiem kas nav ielogojušies? if ($_SESSION['login'] != "true" ) { echo("ej dirst); } else { echo("admins"); } Edited January 6, 2006 by Blackout Link to comment Share on other sites More sharing options...
TurboSasa Posted January 8, 2006 Author Report Share Posted January 8, 2006 tik un taa man nepaarbauda tanii lapaa vai tika veikta ielogoshanaas. to lapu browserii var ierakstiit un tu vinjaa mieriigi tiksi. nekaadiigi nevaru atrisinaat sho probleemu! :( Link to comment Share on other sites More sharing options...
Blackout Posted January 9, 2006 Report Share Posted January 9, 2006 tik un taa man nepaarbauda tanii lapaa vai tika veikta ielogoshanaas. to lapu browserii var ierakstiit un tu vinjaa mieriigi tiksi. nekaadiigi nevaru atrisinaat sho probleemu! :( tu uztaisiji pēc mana principa? parādi scriptus. izlabošu. Link to comment Share on other sites More sharing options...
Recommended Posts