Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Securing a page

Posted on 2002-05-13
1
Medium Priority
?
173 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 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

824 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