Tuesday, 24 September 2013

What is CMS or Content Management System ?

Introduction to CMS
                           CMS is Content Management System used to create Website. It is the Technology in the world of Web. CMS is very useful tool for creating User Friendly, Interactive, Innovative Websites. We can easily learn CMS and create websites within sort time. If you are programmer or not You can Easily create an eye catchy website with the help of Content Management System.
                           If you are creating a website that have to more than ten pages you have probably run into the problems associated with adding new pages, or groups of new pages into the website. It becomes difficult to add to the menu of every existing page. A Content Management System handles the Menu's, And navigational aids for you. CMS free you to concentrate on your writing for your website. 
                          Several Popular CMS in the world are :
                          1. Wordpress
                          2. Joomla
                          3. Drupal
                          4. Modx
                          5. TinyCMS , etc.

Advantages of CMS : 
                        1. CMS is very useful for creating article or webpage content and we can easily modify or delete the content of the webpage. 
                         2. The template of the website also managed well.Using only a single click we can change the layout or template of the whole website.
                         3. We can also add lots of addon or modules into the CMS which are already created by the group of contributors or professionals. 
                          4. Menu management is also there and we can position our menu to different location on the webpage.
                           

                           
                            
Learn PHP CMS visit website : Click Here

   


Tuesday, 21 May 2013

What is Apache Web Server ???


Originally Developed at National Center for Supercomputing Applications in 1994 .
It is Open Source And The First project / product of the Apache Foundation.

Brian Behlendorf founded Apache .
Now it is used with Php and Mysql.

Friday, 3 May 2013

MyAccount- Change Password using PHP and MySQL code

Change Password Using PHP and MySQL.

If user wants to change their password then put update query of MySQL using PHP webpage scripting.

First Step to check weather user had input their old password, new password and confirm new password.
If not then give error message using PHP script.

After that check database connection and write query to update oldpass with newpass.

Here is the full code to change your password using PHP  + MySQL.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title> Change Password </title>
<?php
if(isset($_POST['submit']))
{
include('dbconn.php');
$old=trim($_POST['oldpass']);
$new=trim($_POST['newpass']);
$cnew=trim($_POST['cnewpass']);
if(empty($old))
{
echo "<p style='color:red;'> Please Enter Your Old Password </p>";
}
elseif(empty($new))
{
echo "<p style='color:red;'> Please Enter Desired New Password </p>";
}
elseif(empty($cnew))
{
echo "<p style='color:red;'> Please Enter Confirm New Password </p>";
}
elseif(strcmp($new,$cnew))
{
echo "<p style='color:red'> New Password And Confirm New Password Does Not Match </p>";
}
else
{
$sql="SELECT * FROM tbl_employer_reg WHERE password='$old'";
$result=mysqli_query($con,$sql);
$num_rows=mysqli_num_rows($result);
if($num_rows==1)
{
$sql="UPDATE `tbl_employer_reg` SET `password`= '$new' WHERE `password`= '$old'";
$r=mysqli_query($con,$sql);
echo "<p style='color:red;'> Your Password Has Been Changed</p>";

}
else
{
echo "<p style='color:red;'> Incorrect Password </p>";
}

}
$_POST['oldpass']="";
$_POST['newpass']="";
$_POST['cnewpass']="";
}
?>
</head>

<body>
<div style="width:520px;padding:10px;border:5px solid blue;margin:150px 250px;border-radius:25px;">
<h2 style="color:red"><center>  CHANGE PASSWORD </center></h2>
<form name="change_pass" id="change_pass" method="post" action="">
<table border="0" cellpadding="6">
<tr> 
<td style="color:#0000FF; font-weight:bolder; font-size:18px;">Enter Old Password : </td>
<td> <input type="password" name="oldpass" value="<?php if(isset($_POST['oldpass'])) {echo $_POST['oldpass'];} ?>"  size="40" /></td>
</tr>
<tr> 
<td style="color:#0000FF; font-weight:bolder; font-size:18px;">Enter New Password : </td>
<td> <input type="password" name="newpass" value="<?php if(isset($_POST['newpass'])) {echo $_POST['newpass'];} ?>" size="40" /></td>
</tr>
<tr> 
<td style="color:#0000FF; font-weight:bolder;font-size:18px;">Confirm New Password : </td>
<td> <input type="password" name="cnewpass" value="<?php if(isset($_POST['cnewpass'])){echo $_POST['cnewpass'];} ?>" size="40" /></td>
</tr>
<tr>
<td> </td>
<td> <input type="submit" name="submit" value="SUBMIT" style="color:#0033FF;background-color:#CCCCCC; font-weight:bolder;font-size:22px"  /> </td>
</tr>
</table>

</form>
</div>

</body>

</html>

Learn PHP Project Training 
visit website: Project Training Using PHP Technologies

Forgot Password Code for PHP + MySQL

Forgot Password PHP Language code.

If any user forgot their password then you can send them email or
To give them password on the same web page.
Here is the code which shows the password if user forgot it. Enter Username and Mobile no to show the password.


<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Forgot Password </title>
<?php
if(isset($_POST['submit']))
{
include('myconnection.php');
$un=trim($_POST['username']);
$mn=trim($_POST['mobileno']);

if(empty($un))
{
echo "<p style='color:red;'> Please Enter Your UserName </p>";
}
elseif(empty($mn))
{
echo "<p style='color:red;'> Please Enter Your Mobileno </p>";
}
else
{
$sql="select `password` from tbl_employer_reg where `emailid`='$un' and `mobile`='$mn'";
$result=mysqli_query($con,$sql);
$num_rows=mysqli_num_rows($result);
if($num_rows==1)
{
while($line=mysqli_fetch_array($result))
{
echo "your Password is ".$line['password'];
}
}
else
{
echo "Invalid Username/Mobileno";
}
}
}
?>
</head>

<body>

<h2 style="color:red"><center>  FORGOT PASSWORD </center></h2>
<form name="form"  method="post" action="">
<table border="0" >
<tr>
<td >Enter Your Username: </td>
<td> <input type="text" name="username" value=""  size="40" /></td>
</tr>
<tr>
<td >Enter your mobile no : </td>
<td> <input type="text" name="mobileno" value="" size="40" /></td>
</tr>
<tr>
<td> </td>
<td> <input type="submit" name="submit" value="SUBMIT"   /> </td>
</tr>
</table>

</form>
</div>
</body>
</html>

Thursday, 2 May 2013

Delete record using php + MySQL

Delete Record Using PHP + MySQL.

If Any web programmer of Web Developer doing code for delete any record from the table then
1. He/She must have to see all the records of the table
2. And select the record to delete and press on delete button.
3. After deleting the record he/she must have to see the records of the table.

Here is the full code to see the records from the table and search the user according to the username.
If records are not more then see all the records by search with empty textbox and click on SUBMIT button.
After Search Result is generated Press on Delete.


Table Name of MySQL is tblreg
Have columns
1. id
2. username
3. hobbies
4. gender
5. emailid
6. mobileno

1. showreg.php file code


<?php
if(isset($_GET['submit']))
{
$s=trim($_GET['search']);
$con=mysqli_connect(@"localhost","root","","phpdemo") or die("Unable to connect to the database of Mysql name :  phpdemo");
if(empty($s))
{
$sql="select * from tblreg";
}
else
{
$sql="select * from tblreg where username='$s'";
}
echo "<center>";
echo "<h1 style=\"color:Yellow;background-color:Black \">Show Registration Details</h1>";
$result=mysqli_query($con,$sql);
echo "<table border=\"2\" style=\"color:Black;background-color:#ffffcc\">";
echo "<th>Userid</th><th>Username</th><th>Hobbies</th><th>Gender</th><th>Emailid</th><th>Mobileno</th>";
while($line= mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>";
echo $line['id'];
echo "</td>";
echo "<td>";
echo $line['username'];
echo "</td>";
echo "<td>";
echo $line['hobbies'];
echo "</td>";
echo "<td>";
echo $line['gender'];
echo "</td>";
echo "<td>";
echo $line['emailid'];
echo "</td>";
echo "<td>";
echo $line['mobileno'];
?>
<input type="text" name="chid" value="<?php echo $line['id']; ?>" />
<?php
echo "</td>";

echo '<td><b><font color="#663300"><a href="delete.php?id=' . $line['id'] . '">Delete</a></font></b></td>';
echo "</tr>";

}
echo "</table>";

}
?>
<body>
<form id="showform" name="showform" method="get" action="">
<input type="text" name="search" />
<input type="submit" name="submit" value="submit" />
</form>



To Delete Record of The User write code on delete.php File.2.  delete.php After Deleting the record he/she must reach at showreg.php to see the records of the table tblreg.






<?php
$con=mysqli_connect(@"localhost","root","","phpdemo") or die("Unable to connect to the database of Mysql name :  phpdemo");
$id = $_REQUEST['id'];
echo "id is $id<br>";
$sql="DELETE FROM `tblreg` WHERE `id`='$id'";
$result = mysqli_query($con,$sql) or die("Error in Deleting!!!");
header("Location: showreg.php");
?>

PHP code to send email

after hosting is done for your website.
you can send email by using the below code of mail function in PHP


<?php
if(isset($_POST['submit']))
{
$errors = '';

if(empty($_POST['name'])  ||
   empty($_POST['toemail'])||
   empty($_POST['subject']) ||
   empty($_POST['email']) ||
   empty($_POST['message']))
{
    $errors .= "\n Error: all fields are required";
}
$myemail = $_POST['toemail'];//<-----Put Your email address here.
$name = $_POST['name'];
$email_address = $_POST['email'];
$message = $_POST['message'];
$subject = $_POST['subject'];

if (!preg_match(
"/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i",
$email_address))
{
    $errors .= "<br> Error: Invalid email address";
}

if( empty($errors))
{
$to = $myemail;
$email_subject = "Contact form submission: $name";
$email_body = "You have received a new message. ".
" Here are the details:\n\n Name: $name \n\n Subject: $subject \n\n Email: $email_address \n\n Message \n\n $message";

$headers = "From: $email_address\n";
$headers .= "Reply-To: $email_address";

mail($to,$email_subject,$email_body,$headers);
echo "<center><p style=\"color:Green\"> Thank you !!! We will come to you shortly</p></center>";
}
else
{
echo "<center><p style=\"color:Red\">".$errors."</p></center>";
}
}
?>
<html>
<head>
<title>Send email using php</title>
</head>
<body>
<form id="form" name="form" method="post" action="">
<center>
<table>
<tr><td>Enter emailid for To : </td><td><input type="text" name="toemail" /></tr>
<tr><td>Enter your Name : </td><td><input type="text" name="name" /></tr>
<tr><td>Enter your Email : </td><td><input type="text" name="email" /></tr>
<tr><td>Enter your Subject : </td><td><input type="text" name="subject" /></tr>
<tr><td>Enter your Message : </td><td><input type="text" name="message" /></tr>
<tr><td></td><td>
<input type="submit" name="submit" value="submit" /></tr>
</table>
</center>
</form>
</body>
</html>


Tuesday, 23 April 2013

How to Add New State into the database of PHP + MySQL ???

For Add new state countries must fill from the database table of the country.
To add state information according to the selected country using PHP and MySQL, here's the process in simple terms:

Database Setup:

Create two tables: one for countries and one for states.
The countries table holds the list of countries.
The states table stores the states along with a reference (foreign key) to the country they belong to.
Insert Data:

Add some sample countries like "USA", "India", and "Canada" in the countries table.
Add related states like "California" and "New York" for the USA, and "Maharashtra" and "Gujarat" for India in the states table, with a link to the respective country.
User Interface:

Display a country dropdown in an HTML form.
When the user selects a country from this dropdown, an AJAX request is sent to the server to retrieve the corresponding states for that country.
Server-Side Processing:

On the server-side (PHP), receive the selected country ID from the AJAX request.
Query the states table in the database to fetch the states related to the chosen country.
Send back the list of states as options to be displayed in a second dropdown (the states dropdown).
User Experience:

The user first selects a country, and the states dropdown automatically updates with the relevant states.
This is done without needing to refresh the page, creating a smooth and dynamic experience.
In summary, the process involves linking states to countries in the database, dynamically fetching states based on the selected country using PHP, and updating the UI with the state data via AJAX.


Here is one example of it


<html>
<head>

<title>Title of Page</title>
<script language="javascript" type="text/javascript">
function showState(countryid)
{
 document.form1.submit();
}
</script>
<?php
include('myconnection.php');
if(isset($_POST['submit']))
{
$sname=trim($_POST['statename']); 
$cid=trim($_POST['countryid']); 
if(empty($sname))
{
echo "<center><p style=\"color:Red\" >Please Enter State name</p><center>";
}
else
{ $sql="insert into tblstate(`id`,`countryid`,`statename`) values(NULL,'$cid','$sname');";
if(mysqli_query($con,$sql))
{
echo "<center><p style=\"background-color:#000;width:450px;color:#fdd000\" >Statename is successfully inserted !!!</p><center>";
}
else
{
echo "error".mysqli_error();
}
}
}
?>
</head>
<body>
<form id="form1" name="form1" method="POST"  action="">
<center><fieldset style="width:450px">
<legend ><h1 style="background-color:#000fdd;color:#ffff00">Add New State</h1></legend>
<table>
<tr><td colspan="2"></td></tr>
<tr>
<td>Select Country</td>
<td>
<?php
$query = "SELECT * FROM tblcountry";
$result = mysqli_query($con,$query);
?>
<select name="countryid" id="countryid"  onChange="showState(this.value);">
<option value="">--- Select Country---</option>

<?php
while ($line = mysqli_fetch_array($result)) {
?>

<option value="<?php echo $line['id'];?>" > <?php echo $line['countryname'];?> </option>

<?php
}
?>
</td></tr>
<tr><td>StateName</td><td><input type="text" name="statename" value="" /></td></tr>
<tr><td></td><td><input type="submit" name="submit" value="submit"><input type="reset" name="reset" value="reset">
</td>
</tr>
</table>
</fieldset>

</center>
</form>
</body>

</html>