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
Solved

Securing a page

Posted on 2002-05-13
1
153 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Eloquent ORM manual paginator defaults to simple 2 31
Wordpress French and English Site 6 76
PHP Query return divisible by 3 3 26
What's wrong with this PDO query? 5 27
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
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.

840 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