<?php include("header.php"); ?>
Just some queries.
1. PHP include
I use it in most of my pages to give a connection and select the database. I want to know how secure it is? I have heard that the header.php file is not very secure.Code:<?php include("header.php"); ?>
2. How to auto generate/create a page?
Example. When I joined facebook it did not give me specific page for my profile. The one day it asked me to select a page name for it. I selected one name and the page got generated. What is this technique called? How to auto generated such pages?
1. What kind of security are you talking about. You can chmod the file. And as cromwell said you can make some changes in the code. What exactly did you hear about header.php being not very secure?Just some queries.
1. PHP include
I use it in most of my pages to give a connection and select the database. I want to know how secure it is? I have heard that the header.php file is not very secure.Code:<?php include("header.php"); ?>
2. How to auto generate/create a page?
Example. When I joined facebook it did not give me specific page for my profile. The one day it asked me to select a page name for it. I selected one name and the page got generated. What is this technique called? How to auto generated such pages?
I think what he is talking about is due to the behaviour of the php intrepreter. Lets say you have a php file which manages your connection credentials and someone were to either make an error or intentionally wanted to mess it up and removed the starting <?php. Any page which was including this file would have the contents displayed for all to see.1. What kind of security are you talking about. You can chmod the file. And as cromwell said you can make some changes in the code. What exactly did you hear about header.php being not very secure?
I did not really understand that.2.You can use php file handling to create a new php page with the profile details as saved as variables. Like you can have a template with appropriate variable to create a php page for every user. Or you can use query strings and url masking. I think facebook uses URL masking
As long as you have a server with the php parser they can't get the code unless they break into the server itself. At which time that's probably the least of your trouble.I want to know how safe is the header.php file? I put my connection details in it. What if someone gets the code on it? They will hack my whole site. I know the php code isn't displayed on Pages but is there a way to see it? I am not aware of any way, if there is a way then what are the preventions?
I did not really understand that.
Example, if I put some text in a text box, e.g name, then after hitting submit I want it to create a page automatically, like sitename.com/name.
The above code works fine and prints hello properly, can anyone tell me how to print "Hello" in Bold or Italics or any other format?Code:<?php $fp=fopen("mywork.doc","w"); $str="Hello"; fwrite($fp, $str); fclose($fp); ?>
You should just be able to add HTML bold tags around it (<b></b>). If you would like to do a lot of formatting and visual things in PHP, it would do you good to learn how to integrate some HTML/CSS into your code.
I have created login page for my website, it checks the username and password and the if successful creates a session for that user.
Example: $_Session['user']=$username;
I want to know if other user logs into my site then will the $_Session['user'] variable be overwritten?
Will there be confusion or any bugs?
Is there a method to solve this problem?
I want to create two different sessions for these two users accessing my site concurrently, how to identify the users?