Posts

Showing posts from February, 2017

How To Create Your Own Search Engine On Your Website.

1 Create a search form on your website. 2 connect to your database with config.php file 3 create new page searh.php for show search results. //                                     code for search form                                           // <?php ?> <form action="serch.php" method="GET">  <input type="text" name="query" placeholder="search Your Room According To Your Prefered location like sardarpura, basni.." />       <input type="submit" value="search" />       </form> //                                       Code for show search results on search.php page          // <...

PHP interview questions and answers for PHP developers

What is PHP? PHP is a server side scripting language commonly used for web applications. PHP has many frameworks and cms for creating websites.Even a non technical person can cretae sites using its CMS.WordPress,osCommerce are the famus CMS of php.It is also an object oriented programming language like java,C-sharp etc.It is very eazy for learning What is the use of "echo" in php? It is used to print a data in the webpage, Example: <?php echo 'Car insurance'; ?> , The following code print the text in the webpage How to include a file to a php page? We can include a file using "include() " or "require()" function with file path as its parameter. What's the difference between include and require? If the file is not found by require(), it will cause a fatal error and halt the execution of the script. If the file is not found by include(), a warning will be issued, but execution will continue. require_once(), require(), include(...

How to redirect with java script

<?php require('config.php'); SESSION_start(); print_r($_SESSION); if(empty($_SESSION['username']) ) { echo "hello"; echo "<script> window.location = 'http://gm.roomonrentjodhpur.com/admin/login.php';</script>"; } ?>

How to create admin panel login page in php

<?php session_start();  require('config.php'); //3. If the form is submitted or not. //3.1 If the form is submitted if (isset($_POST['username']) and isset($_POST['password'])){ //3.1.1 Assigning posted values to variables. $username = $_POST['username']; $password = $_POST['password']; //3.1.2 Checking the values are existing in the database or not $query = "SELECT * FROM `user` WHERE username='$username' and password='$password'"; $result = mysql_query( $query) ; $count = mysql_num_rows($result); //3.1.2 If the posted values are equal to the database values, then session will be created for the user. if ($count == 1){ $_SESSION['username'] = $username; }else{ //3.1.3 If the login credentials doesn't match, he will be shown with an error message. $fmsg = "Invalid Login Credentials."; } } //3.1.4 if the user is logged in Greets the user with message if (isset($_SESSION[...