Jump to content

include php file


raduenea

Recommended Posts

I want to include a php file after an succesfully login.

Let's suposed that I have a login form on index.php. If the login was ok I want to include a php file with some content instead of the login form.

Something like:

<?
if($_POST['ok']){
     require('content.php');
} else {
//login form
}
?>

 

It's ok to include in the code the name of the file that you have on server ? From security point of view.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/236775-include-php-file/
Share on other sites

So if I want to include multiple php file using the link for exemple:

 

index.php?page=account

or

index.php?page=add

 

I can use:

<?php
if($_SESSION['logged_in']){
    require($_GET['page'] . '.php');
} else{
    require('loginform.html');
}

 

It's ok ?

 

Link to comment
https://forums.phpfreaks.com/topic/236775-include-php-file/#findComment-1217911
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.