Solved

Securing a page

Posted on 2002-05-13
1
149 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
1 Comment
 
LVL 4

Accepted Solution

by:
lokeshv earned 50 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

708 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now