ziedinjsh Posted April 1, 2010 Report Share Posted April 1, 2010 ielogojoties mani parmet uz mainpage kur atrodas šāds kods: nclude "misc/db.php"; session_start(); if(!session_is_registered($email)){ header("index.php"); } echo "esmu iekshaa | <a href='logout.php'>Iziet</a>"; ielogoties var viss ir ok, bet man rādās šāds teksts: Deprecated: Function session_is_registered() is deprecated in D:\WEB\www\2\test.php on line 4 kas nav tur ar to if (!session_is_register($email)) ?? Quote Link to comment Share on other sites More sharing options...
Pentiums Posted April 1, 2010 Report Share Posted April 1, 2010 Mūsdienās galīgi vairs kļūdu ziņojumus nemākam lasīt... iz http://php.net/manual/en/function.session-is-registered.php This function has been DEPRECATED as of PHP 5.3.0. Quote Link to comment Share on other sites More sharing options...
php newbie Posted April 1, 2010 Report Share Posted April 1, 2010 http://translate.google.com/#en|lv|Deprecated%3A%20Function%20session_is_registered()%20is%20deprecated%20in%20D%3A%5CWEB%5Cwww%5C2%5Ctest.php%20on%20line%204%0D%0A Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted April 1, 2010 Author Report Share Posted April 1, 2010 esmu apjucis un nesaprotu kas tagad jādara :D index.php - tur ir logins <?php error_reporting(E_ALL); include "misc/db.php"; session_start(); if (isset($_POST['login'])){ $errors = array(); $email = htmlspecialchars(addslashes($_POST['email'])); $password = md5($_POST['password']); if (!$email | !$password){ echo "Kaads no laukiem nav aizpildiits. "; $error[]="Kads tuks lauks"; } if(empty($error)){ $sql="SELECT * FROM users WHERE email='$email' and password='$password'"; $result=mysql_query($sql); $count=mysql_num_rows($result); if($count==1){ session_register('email'); session_register('password'); header("location:test.php"); }else { echo "Wrong Username or Password"; } } } echo "<form method='post' action='".$_SERVER['PHP_SELF']."'>"; echo "e-mail:<input type='text' name='email'>"; echo "password:<input type='password' name='password'>"; echo "<input type='submit' name='login' value='Login'>"; echo "</form>"; echo "<br>"; echo "<a href='register.php'>Register</a>"; ?> un te ir mainpage <?php include "misc/db.php"; session_start(); if(!session_is_registered($email)){ header("index.php"); } echo "esmu iekshaa | <a href='logout.php'>Iziet</a>"; ?> kā lai es uztaisu lai man nav novecojis? Quote Link to comment Share on other sites More sharing options...
Aleksejs Posted April 1, 2010 Report Share Posted April 1, 2010 raksti: if(isset($_SESSION['email')) lai pārbaudītu un $_SESSION['email'] = ... lai uzstādītu Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted April 1, 2010 Author Report Share Posted April 1, 2010 es laikam esmu tups, bet es nevaru iebraukt kur man viņi ir jāliek! :@ if(isset($_SESSION['email'])){ headr("Location:index.php"); }else{ echo "esmu iekshaa"; } tā jāizskatās?? un kas ir ar šo $_SESSION['email'] = ? Quote Link to comment Share on other sites More sharing options...
2easy Posted April 1, 2010 Report Share Posted April 1, 2010 sākumā iepazīsties ar savu skriptu, pirms tu to gribi mainīt :D Quote Link to comment Share on other sites More sharing options...
kraistaps Posted April 1, 2010 Report Share Posted April 1, 2010 Pēc sekmīgas ielogošanās tiek uzstādīta sessija. Lai parādītu kādu informāciju, kura ir domāta autorizētam lietotājam, sākumā pārbauda vai sesija ir izveidota. if(isset($_SESSION['kautkas'])) { echo "Labdien lietotaj!"; } else{ echo "Ludzu ielogojies!"; //vai ari pārmet uz login lapu, } Un attiecīgi pie izlogošanās, vērtības no sesijās tiek izdzēstas ar unset, vai vienkārši session_destroy(); Iesaku palasīt par vairāk informācijas un iedziļināties, savādāk koda rakstīšana priekšā tev nedos nekādu izpratni un līdzīgās situācijās atkal radisies jautājumi. Quote Link to comment Share on other sites More sharing options...
Aleksejs Posted April 1, 2010 Report Share Posted April 1, 2010 Jā, tā jāizskatās... savukārt $_SESSION['mainigavards']=$mainigavertiba; ir session_register('mainiga_vards'); vietā. Quote Link to comment Share on other sites More sharing options...
ziedinjsh Posted April 1, 2010 Author Report Share Posted April 1, 2010 Tā man arī likās :) Liels paldies! :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.