Jump to content
php.lv forumi

Sesijas pārbaude:


wayfarer

Recommended Posts

Sadomāju uzrakstīt sesijas pārbaudi, lai nevar tikt iekšā pa tiešo :) bet ar to gāja/iet raibi.

Variants Nr.1

 

<?php

session_start();

if (!session_is_registered("username")){

header("../index.php");

}

?>

 

Viss Ok, mierīgi tiek iekšā ja zin ceļu...

 

Variants Nr.2

 

<?php

session_start();

$_SESSION['username'] == $username;

header ("location: ../index.php");

 

?>

 

Netieku pats klāt ar paroli un user...:)

 

Palīdziet kāds atrast kļūdu !

Edited by wayfarer
Link to comment
Share on other sites

vai arī lai novērstu iespēju tikt lapā ja zin ceļu (www.manalapa/foledris/tram/pam/index.php)

 

Nu kā, www.manalapa/foledris/tram/pam/index.php augšā ieliec

 

start_session();
if(!$_SESSION['logged_in']){
 header("Location:log_in.php");
}

 

Nu kaut tā...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...