473,698 Members | 2,250 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2514
up********@gmai l.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($_SESSI ON["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_r ead_this_I_am_s pammed_too_m... @spamyourself.c omwrote:
upendra...@gmai l.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($_SESSI ON["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
3539
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 execution and immediately shoot back to the calling page without running through the rest of the code on the executed page. im not sure if this is possible but any help would be much appreciated. tia
2
2716
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
2659
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 WebService might run a big query that a client has written, it eventually recycles my workerprocess... How to I abort the WebService execution I tried to set httpRuntime executionTimeout in my Web.Config and Machine.config... <httpRuntime...
2
8630
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 continues to the custom user control code and it blows there because of the error occured initially in the ASPX page. When it blows it displays as unhandled error even though I have try catch in my ASPX page and in the custom user control.
2
1631
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 keep those from firing while still displaying the rest of the html on the page?
4
1956
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 break point hit is thousands of itterations into the process (from a previous instance). I get a very random step behavior. Know I am watching a database continue to be updated 10 minutes after I stopped the front-end process. I have to stop IIS...
9
4907
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 at these breakpoints but unfortunatly it does not.. I had allowed script debugging in both iis home directory and in internet explorer. Also i added everyone from active directory to be members of debugging group. Web Server is W2k sp4 and iis...
0
1381
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 upper part of the method, so i kept a break point in the upper part. The code execution comes to a break in that point. I examined the values and clicked "stop debugging" i.e., well before calling send email. But strangely it continued to send the...
3
3234
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 the SQL execution in server continue or immediately stop.If it still continue how I can stop the execution (by disconnecting the present database connection ???). Please help.
0
8675
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9160
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9029
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8897
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7729
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.