473,405 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

How to stop direct execution to my page

Dear frindes,
I am new to php. in my 'php' code when someone
login into my page he/she awail the necessary page rights, it's quite
ok. but when it click on the page and someone direct copy & paste the
url he also access the page without proper login.
How it could be possible that someone access only after
the login and not direct copy & paste the desired url.

with session & without session.

Thanx in advance.

situ.

Sep 5 '07 #1
2 2495
up********@gmail.com wrote:
Dear frindes,
I am new to php. in my 'php' code when someone
login into my page he/she awail the necessary page rights, it's quite
ok. but when it click on the page and someone direct copy & paste the
url he also access the page without proper login.
How it could be possible that someone access only after
the login and not direct copy & paste the desired url.

with session & without session.

Thanx in advance.

situ.
Hi,

Answer: Sessions.

loginpage posts to a check username/password page.
On succes set a sessionvariable, eg:
[stupid example]
session_start();
if (($_POST["username"] == "situ") && ($_POST["password"] == "secret")){
$_SESSION["validUser"] = "Y";
} else {
header ("Location: loginpage.php");
exit;
}
Then from every other page that requires a validated user:
session_start();
if ((isset($_SESSION["validUser"])) && ($_SESSION["validUser"] == "Y")){
// OK
} else {
// NOT ok
header ("Location: loginpage.php");
exit;
}

Go to www.php.net to learn more about sessions.

Regards,
Erwin Moller
Sep 5 '07 #2
On Sep 5, 2:23 pm, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@spam yourself.comwrote:
upendra...@gmail.com wrote:
Dear frindes,
I am new to php. in my 'php' code when someone
login into my page he/she awail the necessary page rights, it's quite
ok. but when it click on the page and someone direct copy & paste the
url he also access the page without proper login.
How it could be possible that someone access only after
the login and not direct copy & paste the desired url.
with session & without session.
Thanx in advance.
situ.

Hi,

Answer: Sessions.

loginpage posts to a check username/password page.
On succes set a sessionvariable, eg:
[stupid example]
session_start();
if (($_POST["username"] == "situ") && ($_POST["password"] == "secret")){
$_SESSION["validUser"] = "Y";} else {

header ("Location: loginpage.php");
exit;

}

Then from every other page that requires a validated user:
session_start();
if ((isset($_SESSION["validUser"])) && ($_SESSION["validUser"] == "Y")){
// OK} else {

// NOT ok
header ("Location: loginpage.php");
exit;

}

Go towww.php.netto learn more about sessions.

Regards,
Erwin Moller
Thank you very much for quick reply I think this definately help me
a lot.

regards
situ

Sep 5 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: JT | last post by:
is it possible to somehow "jump out of" an ASP page that is executed from another page via the Server.Execute method? on the page being executed i have several instances where i need to stop the...
2
by: Tom | last post by:
A Java applet has two methods stop() and destroy() that get called when the user moves to a different page. Does javascript have anything similar? thanks tom
1
by: Jack Wright | last post by:
Dear All, I have observed that if I call a synchronous WebService from my aspx page then even if I set oProxy.TimeOut = 1000, the WebService thread execution is still running... Since my...
2
by: Gopal Krish | last post by:
Folks, My ASPX page uses a custom user control. What happens here is that when a runtime error occurs in the ASPX page, the error is caught in the error handler and then strangely, the execution...
2
by: TS | last post by:
when i try to do a response.flush and .end, the screen ends up blank. I want all page processing to quit when a check in the pageload event fails. Since control events occur after load, how do i...
4
by: Chip | last post by:
Can somebody explain to me why my process continues to run after I halt execution? This plays havoc with debugging. I expect to be starting a new instance at the beginning of a loop and the first...
9
by: Rea | last post by:
Hi eb I set some 'Stop' statements and also visual breakpoints in asp code (vbscript). I am doing that in Microsoft Script debugger. Than I refresh the original page and expect execution to halt...
0
by: Saran | last post by:
Hi, I am having a method that handles the click event of a button on the page. This method will also send an email. Sending email comes after several lines of code in the method. I was testing...
3
by: =?Utf-8?B?UmludSBHb3BhbGFrcmlzaG5hIFBpbGxhaQ==?= | last post by:
Hi All, I have a ASP/C# application that connect to Oracle database . After issuing my SQL query if I close the browser or move into another page ( ie whle executing in the databse serevr) will...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.