SkyD Posted December 18, 2005 Report Share Posted December 18, 2005 parbaude.php <? session_start(); include("config.php"); $sesija1 = $_SESSION['username']=$_POST["username"]; $sesija2 = $_SESSION['password']=$_POST["password"]; // meklejam vainiigo!! $result=mysql_query("select * from admini where logins='$sesija1' and parole=md5('$sesija2')"); // atgriezh skaitu $num=mysql_num_rows($result); // pareizi vai nepareizi if($num < 1){ print('<meta http-equiv="REFRESH" content="0;url=index.php">'); } else { include('lapa.php'); } ?> Nu liidz parbaudei, vai pareizi, vai nee ir viss ok... Ja ok, tad aizmet uz lapa.php lapa.php <a href="iziet.php">Iziet</a> <a href="?id=1">Cool</a> <? error_reporting (E_ALL ^ E_NOTICE); if($_GET['id'] == "1"){ echo 'spljaujam'; } ?> Bet, kad tiek nospiests links COOL, izmet uz index.php ...!! Laikam sessiju neatver,ja?? Kaaa buutu taa lieta risinaama?? Link to comment Share on other sites More sharing options...
Vebers Posted December 18, 2005 Report Share Posted December 18, 2005 ieliec lapa.php saakumaa arii session_start(); Link to comment Share on other sites More sharing options...
SkyD Posted December 18, 2005 Author Report Share Posted December 18, 2005 Nu nekas neizdodas... Link to comment Share on other sites More sharing options...
Grey_Wolf Posted December 18, 2005 Report Share Posted December 18, 2005 (edited) <a href="?id=1">Cool</a> un kur peec tavaam domaam vinjam vajadzeetu iet? adrese ir ?id=1 parveersh par index.*?id=1 *= HTML/HTM/PHP nu kas nu tev ir uzstaadiitc.... edit: sesijas vispaar tur neprichom.... elementars HTML ,pat ne PHP ;) Edited December 18, 2005 by Grey_Wolf Link to comment Share on other sites More sharing options...
SkyD Posted December 18, 2005 Author Report Share Posted December 18, 2005 aa nu jaa.. tnx.. =]]~~ piemirsies bija bik!! =]] Link to comment Share on other sites More sharing options...
SkyD Posted December 18, 2005 Author Report Share Posted December 18, 2005 (edited) Pie paarbaudiishanas es veel izdariiju taa, ja logins un parole sakriit, tad iet uz lapa.php, kur atrodas visa navigaacija un piemetu veel klaat: setcookie("sesija", $_SESSION['username']); un lapa.php saturs: <?php session_start(); if (!isset($_COOKIE["sesija"])) { echo 'bez cepuminja te nenaakt..'; exit; } ?> <a href="iziet.php">Iziet</a> <a href="lapa.php?id=1">Cool</a> <a href="lapa.php?id=2">CooL2</a> <?PHP error_reporting (E_ALL ^ E_NOTICE); if($_GET['id'] == "" or $_GET['id'] == "1"){ echo '1'; } elseif($_GET['id'] == "2"){ echo '2'; } ?> Un tagad man ir jautaajums taads... Ja es ielogojos iekshaa, uzliek cookie, tad piemeram citi uzrakstot www.adrese.lv/lapa.php --> neparaadiisies navigaacija?? -- Jo vajag, lai pasaka "bez cepuminja te nenaakt.."...!! Kaa tur ir.. Katram lietotaajam tiek uztaisiits savs cookijs? !!?? EDIT: veel ir probleema taada, ka pirmo reizi uzrakstot pareizi vinjsh neizmet uz lapa.php, bet otreiz uzrakstot aizmet...!! Edited December 18, 2005 by SkyD Link to comment Share on other sites More sharing options...
Grey_Wolf Posted December 18, 2005 Report Share Posted December 18, 2005 kam tev to? pie logoshanaas seesijaa ieraksti usernaami un katraa nakamaa lapaa paarbaudi vai sesijaa ir tas username vai nav? ja nav tad naff ja ir ta Ok P.S. ja useris nebuus aktivizeejis cockijus tad arii sesija nebuus. preciizaak buus tikai no usera nevarees dabuut sesijas id un nekas nestraadaas... lai varetu bez cocijiem tad var ses_id padot caur URL print SID.... Link to comment Share on other sites More sharing options...
SkyD Posted December 18, 2005 Author Report Share Posted December 18, 2005 Laikam izdevaas...;] $_SESSION['sesija'] = $_POST["username"] && $_POST["password"]; un <?php session_start(); if(isset($_SESSION['sesija'])) { print("Sessija ir!"); } else { header("Location: index.php"); //sessijas nav!! } ?> Link to comment Share on other sites More sharing options...
v3rb0 Posted December 18, 2005 Report Share Posted December 18, 2005 (edited) session_start() - tak sāk sessiju _vienmēr_ (izņemot gadījumus, kad sakonfigurēts tā ka nedarbojas sessijas) priekš kam to vai ir nopostēts username glabāt sessijā? Edited December 18, 2005 by v3rb0 Link to comment Share on other sites More sharing options...
SkyD Posted December 18, 2005 Author Report Share Posted December 18, 2005 ... ar ko parbaudija browseri ? Vajag, lai pasaka, ka ar firefox shito nevar skatiities..!! Link to comment Share on other sites More sharing options...
Grey_Wolf Posted December 18, 2005 Report Share Posted December 18, 2005 SkyD--> ar JS .... un kaadeelj nevar ar FF? normaali ir taa ka tas nav atkariigs no brauzera ;) ar sho tu pasaki ka ~20% useru var iet '@^$&@@@'.... iznjeemums buutu kaada ljoti specefiska dalja/proga teiksim CMS kuru taapat skataas 1-10 cilveeki - nu tiem jau var pateikt ka vajag taadu un taadu brauzeri... kaa obligaatu pielikumu tai progai ;) Link to comment Share on other sites More sharing options...
php_Stopp Posted December 18, 2005 Report Share Posted December 18, 2005 <a href="?id=1">Cool</a> un kur peec tavaam domaam vinjam vajadzeetu iet? adrese ir ?id=1 parveersh par index.*?id=1 *= HTML/HTM/PHP nu kas nu tev ir uzstaadiitc.... edit: sesijas vispaar tur neprichom.... elementars HTML ,pat ne PHP ;) nēēēēē....... :) nezinu, kādos konfigos tas varbūt ir maināms, bet notestēju gan ar ff, gan ar ie, un <a href="?1"> aiziet uz fails?1, nevis index?1.. Link to comment Share on other sites More sharing options...
bubu Posted December 18, 2005 Report Share Posted December 18, 2005 ?x aiziet uz tekošā failu ar x kā GET parametrs(-i). Link to comment Share on other sites More sharing options...
Paulinjsh Posted December 18, 2005 Report Share Posted December 18, 2005 Uz m$ un iis 5 saskāros ar problēmu, ka bija nepieciešams norādīt pilnu index.php?bla Link to comment Share on other sites More sharing options...
SkyD Posted December 19, 2005 Author Report Share Posted December 19, 2005 Krch ir man sadalja stili - stili.php <a href="stili.php?stils=1">Stils[1]</a> <a href="stili.php?stils=2">Stils[2]</a> <?PHP error_reporting (E_ALL ^ E_NOTICE); $stils = $_GET['stils']; switch($stils) { case '1': $stils = 'stils1'; setcookie("stils", $stils); break; case '2': $stils = 'stils2'; setcookie("stils", $stils); break; default: $stils = 'stils1'; setcookie("stils", $stils); break; } ?> lapa.php <? print("<LINK href='style/".$_COOKIE['stils'].".css' rel='stylesheet' type='text/css'>"); ?> 1kaart., ja man ir ielikts tas default: nevar nemaz atvert sadalju, bet ja nav, tad var.. Atverot, es uzspiezhu piem uz stils[2] atveraas vajadziigais, viss straadaa, liidzko beidzu sessiju, eju pa jaunu iekshaa, un nav neviens stils/// Kur proba? Link to comment Share on other sites More sharing options...
Recommended Posts