?
Solved

Save PHP Page to PC Hard Disk? - PHP Webpages

Posted on 2010-01-09
8
Medium Priority
?
327 Views
Last Modified: 2012-05-08
Can somebody save my PHP web pages that requires username and password (in some point) to his/her PC so that he/she can use the service offline?
0
Comment
Question by:F-J-K
[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
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 1

Expert Comment

by:djcybex
ID: 26272677
No.
You can not see PHP code because it is server side compiled. You can see only HTML at client side. It is not the same as Javascript when you Open the source and you see the code.
The only way someone can see your php code is to break into your computer/server directly and download the php files.
0
 
LVL 1

Author Comment

by:F-J-K
ID: 26272698
What if one of the users login to the membership site and save every page which is also in PHP, can't he/she access the service for free from the local page saved on disk?
0
 
LVL 4

Expert Comment

by:sudhakarsp06
ID: 26272699
Hi there

you can use the below code to set the password for any page

<?php


      // Key is asked at the first start
if (!isset($_SERVER['PHP_AUTH_PW'])) {
    header('WWW-Authenticate: Basic realm="'. utf8_decode($text) .'"');
    header('HTTP/1.0 401 Unauthorized');
   // echo "Ask password";
    exit;
}
else
{
   if( $_SERVER['PHP_AUTH_PW'] == 'test' && $_SERVER['PHP_AUTH_USER'] == 'test' )
   {
     echo 'Auth Working well';
   }
   else
   {
    header('WWW-Authenticate: Basic realm="'. utf8_decode($text) .'"');
    header('HTTP/1.0 401 Unauthorized');
      exit;
   }
}
0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 
LVL 14

Expert Comment

by:Kalpan
ID: 26272700
Unfortunately, it is not possible to store the PHP pages from live site to Client PC's hard disk...it's jeopardizing the security of the PHP standards with Web format..which is not functional with php engine...

You can set the offline user, passwords with you php page to set the cookie of the browser, which help browser to remember the user for the next login process..

 setcookie('username', $_POST['username'], false, '/account', 'www.example.com');
 setcookie('password', md5($_POST['password']), false, '/account', 'www.example.com');

hope this will be convenient for you...

Thanks,

Kalpan
0
 
LVL 1

Expert Comment

by:djcybex
ID: 26272754
kalmax why unfortunately?

you can only store/download PHP pages:
- if they are not server side compiled... for exaple if you have page.php but your server doesn't have PHP engine installed. Then browser will want to download the page instead of display it.
- if you have direct access (FTP, SSH, ...) to the website's directory
0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 26273087
PHP is a server-side scripting language and none of the PHP code is sent over the internet.  Instead PHP generates HTML code, and that is what is sent to the client machine.  There may also be JavaScript, CSS, Flash, etc., but you get the point, I'm sure.  Your PHP code and your data base are kept on the server, and the rules of engagement with the client machines protect your server data, as well as protect the client machine.

That said, what if you wanted to present your PHP code (for example, to other developers)?  There is this function to help with the presentation:
http://us3.php.net/manual/en/function.highlight-string.php

Best regards, ~Ray
0
 
LVL 1

Author Closing Comment

by:F-J-K
ID: 31676292
Exact answer i'm looking for...
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 26304580
Thanks for the points -- it's a great question! ~Ray
0

Featured Post

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

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

FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
Suggested Courses

770 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