-1

I have created a page linked to my databases so I can easly manipulate it so , should I put this page on the public_html directory or there is some securised directory ?

  • To implement a better security practice, keep that file in a directory with an uncommon name. i.e. yoursite.com/admnbcknd/ or so on. – Rehmat Dec 10 '15 at 04:47

1 Answers1

1

There isn't any "securised directory" on your web server accessible only by you from your browser, you have to create an user/login system to access to the admin page you created.

There are many ways to do it, the simplest but also the less secure is to create 2 files:

index.php

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <title>Sign in page</title>
</head>
<body>
    <form action="validate_login.php" method="POST" name="loginform" novalidate>
       <input type="text" name="users_email" placeholder="Username">
       <input type="password" name="users_pass" placeholder="Password">
       <input type="submit" value="Submit">
    </form>
</body>
</html>

validate_login.php

<?php
// Get Username/Password submitted information
$email = $_POST["users_email"];
$pass = $_POST["users_pass"];
?>    

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <title>Admin page</title>
</head>
<body>
   <?php
      if($email==USERNAME && $pass==PASSWORD) {
        echo 'OK you are logged in';
        //YOUR CONTENT HERE ....
      } else {
       echo '<a href="index.php"><p>Sorry, invalide username/password. Please try again.</p></a>';
      };
   ?> 
</body>
</html>

Change USERNAME and PASSWORD with your username and password.

Hoping to be helpful. :)

Gianca
  • 481
  • 1
  • 3
  • 9