Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 331
  • Last Modified:

Save PHP Page to PC Hard Disk? - PHP Webpages

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
F-J-K
Asked:
F-J-K
  • 2
  • 2
  • 2
  • +2
1 Solution
 
djcybexCommented:
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
 
F-J-KAuthor Commented:
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
 
sudhakarsp06Commented:
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
Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

 
KalpanCommented:
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
 
djcybexCommented:
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
 
Ray PaseurCommented:
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
 
F-J-KAuthor Commented:
Exact answer i'm looking for...
0
 
Ray PaseurCommented:
Thanks for the points -- it's a great question! ~Ray
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

  • 2
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now