Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Securing a page

Posted on 2002-05-13
1
Medium Priority
?
170 Views
Last Modified: 2006-11-17
I want to submit a hardcoded userid & password to a page and show some data if it's right.

Something like ->

<?php
if txtUser == "Admin" and txtPWD == "pwd"
?>
   Here's the data
<?php
  else
?>
  Tell user they can't see data

But is this legal in PHP

0
Comment
Question by:tyy8
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 4

Accepted Solution

by:
lokeshv earned 200 total points
ID: 7007435
legal ?? :o)

yeha it is..

do something like this..

if($user=='admin'&&pwd='pwd'){
echo'show the user';

}
else{
echo'you are not authorized to view this page';
die;
}


Hope this helps.

Lk
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question