Monday, 22 February 2016

SIMPLE PORTAL PRACTICE EXAMPLE

05:08

IN THIS PORTAL LEST START A JOB PORTAL ,IN THIS   THERE ARE   THREE MODULES:

(1)ADMIN MODULE
(2)RECRUITER MODULE
(3)JOB SEEKER MODULE

Lets start with  Job Seeker  Module:


(1)first   write code for  registration .html file:
<!DOCTYPE html>
<html lang="en">
  <head>
   
<script>
function valid()
                                                {
                                                                if(myform.name.value=="")
                                                                {
                                                                                alert("Enter your name");
                                                                                return false;
                                                                                document.myform.name.focus();
                                                                }
                                                                if(myform.address.value=="")
                                                                {
                                                                                alert("Enter your address");
                                                                                return false;
                                                                                document.myform.address.focus();
                                                                }
                                                                if(myform.contact.value=="")
                                                                {
                                                                                alert("Enter your contact no");
                                                                                return false;
                                                                                document.myform.contact.focus();
                                                                }
                                                                if(isNaN(myform.contact.value))
                                                                {
                                                                                alert("Enter numeric value only");
                                                                                return false;
                                                                                document.myform.contact.focus();
                                                                }
                                                                var a=document.myform.contact.value;
                                                                if(a.length>10)
                                                                {
                                                                                alert("Enter 10 digits only");
                                                                                return false;
                                                                                document.myform.contact.focus();
                                                                }
                                                                 if(myform.gender.value=="")
                                                                 {
                                                                 alert("Select gender");
                                                                 return false;
                                                                 }
                                                                 if(myform.details.value=="")
                                                                 {
                                                                 alert("select your qualification and experience");
                                                                 return false;
                                                                 }
                                                                 if(myform.language.value=="")
                                                                 {
                                                                 alert("Enter languages");
                                                                 return false;
                                                                 }
                                                                if (document.getElementById("hindi").checked == false &&   
                                                                document.getElementById("english").checked == false && document.getElementById("marathi").checked == false)   
                                                                {
                                                                                alert ('You did not choose any of the checkboxes yet.');
                                                                                return false;
                                                                }
                                                                if(myform.email.value=="")
                                                                {
                                                                                alert("Enter your email");
                                                                                return false;
                                                                                document.myform.contact.focus();
                                                                }
                                                                var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
                                                                if(!myform.email.value.match(mailformat))

                                                                {
                                                                alert("You have entered an invalid email address!");
                                                                document.myform.email.focus();
                                                                return false;
                                                                }
                                                                if(myform.password.value=="")
                                                                {
                                                                                alert("Enter your password");
                                                                                return false;
                                                                                document.myform.password.focus();
                                                                }
                                                                if(myform.cpassword.value=="")
                                                                {
                                                                                alert("Confirm your password");
                                                                                return false;
                                                                                document.myform.cpassword.focus();
                                                                }
                                                                if(myform.password.value!==myform.cpassword.value)
                                                                {
                                                                                alert("Password not match");
                                                                                return false;
                                                                                document.myform.password.focus();
                                                                }
                                                                return true;
                                                }
</script>
</head>

  <body role="document">
 
 
<h1><i><b>Job seeker registration</b></i></h1>
<form name=myform action="validation.php" method=post onsubmit=return(valid());>
<table border=0>
<tr>
                <td>Name          :</td>
                <td>
<input id="name" name="name" type="text" class="form-control"><br></td>
</tr>
<tr>
                <td>Address      :</td>
                <td><textarea rows=4 cols=20 name=address id=address class="form-control"></textarea><br></td>
                </tr>
<tr>
                <td>Contact       :</td>
                <td><input id="contact" name="contact" type="contact" class="form-control"><br></td>
</tr>
<tr>
                <td>Gender       :</td>
                <td><input type="radio"  name=gender value=male>Male
                <input type="radio" name=gender  value=female>Female<br></td>
</tr>
<tr>
                <td>Qualification and experience            :</td>
                <td><textarea rows=4 cols=20 name=details id=details class="form-control"></textarea><br></td>
</tr>
<tr>
                <td>Language   :</td>
                <td><input type="checkbox"  id=hindi name=language[]  value=hindi>Hindi
<input type="checkbox"  id=english name=language[]   value=english>English
<input type="checkbox"  id=marathi name=language[]   value=marathi>Marathi<br></td>
</tr>
<tr>
                <td>Email            :</td>
                <td><input id="email" name="email" type="text" class="form-control"><br></td></tr>
<tr>
                <td>Password   :</td>
                <td><input id="password"    name="password"     type="password" class="form-control"><br></td></tr>
<tr>
                <td>cPASSWORD             :</td>
                <td><input id="cpassword"    name="cpassword"     type="password" class="form-control"><br></td></tr>
<div id="status"></div>
<tr>
                <td><input name="myBtn" type="submit" value="Register"  class="btn btn-lg btn-primary btn-block" > </td></tr>
</table>
                </form>
               
  </body>
</html>
(2)now write code for  validation.php file:
<?php

$name=$_POST['name'];

$address=$_POST['address'];

$contact=$_POST['contact'];

$gender=$_POST['gender'];

$details=$_POST['details'];

$language=implode(',',$_POST['language']);

$email=$_POST['email'];

$password=$_POST['password'];

$cpassword=$_POST['cpassword'];

include("connect.php");

$sql="select * from  userrecord where   email='$email'";

$result=mysql_query($sql);

$num=mysql_num_rows($result);

if($num>0)
{

echo "<font color=red>email id is already used please use another email id</font>";

}



else 

{


$sql1="insert into userrecord(name,address,contact,gender,details,language,email,password)values('$name','$address','$contact','$gender','$details','$language','$email','$password')";

mysql_query($sql1);

echo "<font color=red>successfully  registered </font>";

}



?>

(3)now  write code for  userlogin.html file:
<form action='userlogin.php' method=post>
                                                <table border=0>
                                                                <tr>
                                                                                <td>Email            :</td>
                                                                                <td><input type=text name=email class="form-control"><br></td>
                                                                </tr>
                                                                <tr>
                                                                                <td>Password   :</td>
                                                                                <td><input type=password name=password class="form-control"><br></td>
                                                                </tr>
                                                                <tr>
                                                                                <td><input type=submit name=submit value=Login class="btn btn-lg btn-primary btn-block"></td>
                                                                </tr>
                                                </table>
                                </form>
(4)now write code for userlogin.php  file:
<?php
ob_start();
include('connect.php');

$email=mysql_escape_string($_POST["email"]);

$password=mysql_escape_string($_POST["password"]);

$sql="select email,password from userrecord where email='$email' AND password='$password'";

$result=mysql_query($sql);

$num=mysql_num_rows($result);

if($num>0)

{


session_start();

$_SESSION['email']=$email;

header("Location:userwelcome.php");

}

else

{

echo"invalid login";


}


?>

(5)now  write code for userwelcome.php  file :
<?php
                session_start();
                if(!isset($_SESSION['email']))
                {
                                header('location:uerror.php');
                }
                ?>
               
                <!DOCTYPE html>
<html lang="en">
  <head>
   
</head>
<body role="document">
<div class="container">

          
               
                                               
                                 <li><a href="userwelcome.php">View profile</a></li>
                <li><a href="ujobdisplay.php">Job offers</a></li>
                <li><a href="uuploadresume.php">Upload resume</a></li>
                <li><a href="uchangepassword1.php">Change password</a></li>
                <li><a href="userlogout.php">Logout</a></li>
               
                               
  <h1><b>User Profile</b></h1>
               
                <?php
                $session=$_SESSION['email'];
                echo "welocme                :".$session.'<br>';
                include("connect.php");
                $sql="select * from  userrecord  where email='$session'";
                $result=mysql_query($sql);
                echo '<table class="table table-striped">';
                                while($row=mysql_fetch_array($result))
                                 {
                               
                                               
                                                echo '<tr>';
                                                                echo '<td>';
                                                                                echo "Name       :";
                                                                echo '</td>';
                                                                echo '<td>';
                                                                                echo $row['name'].'<br><br>';
                                                                echo '</td>';
                                                echo '</tr>';
                                                echo '<tr>';
                                                                echo '<td>';
                                                                                echo "Address  :";
                                                                echo '</td>';
                                                                echo '<td>';
                                                                                echo $row['address'].'<br><br>';
                                                                echo '</td>';
                                                echo '</tr>';
                                                echo '<tr>';
                                                                echo '<td>';
                                                                                echo "Contact No.           :";
                                                                echo '</td>';
                                                                echo '<td>';
                                                                                echo $row['contact'].'<br><br>';
                                                                echo '</td>';
                                                echo '</tr>';
                                                echo '<tr>';
                                                                echo '<td>';
                                                                                echo "Gender   :";
                                                                echo '</td>';
                                                                echo '<td>';
                                                                                echo $row['gender'].'<br><br>';
                                                                echo '</td>';
                                                echo '</tr>';
                                                echo '<tr>';
                                                                echo '<td>';
                                                                                echo "Qualification and experience         :";
                                                                echo '</td>';
                                                                echo '<td>';
                                                                                echo $row['details'].'<br><br>';
                                                                echo '</td>';
                                                echo '</tr>';
                                                echo '<tr>';
                                                                echo '<td>';
                                                                                echo "Language                :";
                                                                echo '</td>';
                                                                echo '<td>';
                                                                                echo $row['language'].'<br><br>';
                                                                echo '</td>';
                                                echo '</tr>';
                                                echo '<tr>';
                                                                echo '<td>';
                                                                                echo "Email        :";
                                                                echo '</td>';
                                                                echo '<td>';
                                                                                echo $row['email'].'<br><br>';
                                                                echo '</td>';
                                                echo '</tr>';
                                                echo '<tr>';
                                                                echo '<td>';
                                                                                echo "Password               :";
                                                                echo '</td>';
                                                                echo '<td>';
                                                                                echo $row['password'].'<br><br>';
                                                                echo '</td>';
                                                echo '</tr>';
                                                echo '<tr>';
               
                                                                echo '<td>';
                                                                                echo '<button>
                                                                                                                                <a href=userupdate.php>Update</a>
                                                                                                                </button>';
                                                                echo '</td>';
                                                echo '</tr>';      
                                 }
                                 echo '</table>';
                                 
?>

(6)now write code for userupdate.php file:
<?php
session_start();
                if(!isset($_SESSION['email']))
                {
                   header('location:uerror.php');
                                                                                                                                                                                                                                                                                                                                                                                                                                  
                }
                ?>

<!DOCTYPE html>
<html lang="en">
  <head>
    <script type="text/javascript">
                                                function valid()
                                                {
                                                                if(myform.name.value=="")
                                                                {
                                                                                alert("Enter your name");
                                                                                return false;
                                                                                document.myform.name.focus();
                                                                }
                                                                if(myform.address.value=="")
                                                                {
                                                                                alert("Enter your address");
                                                                                return false;
                                                                                document.myform.address.focus();
                                                                }
                                                                if(myform.contact.value=="")
                                                                {
                                                                                alert("Enter your contact");
                                                                                return false;
                                                                                document.myform.contact.focus();
                                                                }
                                                                var a=document.myform.contact.value;
                                                                if(a.length>10 || a.length<10)
                                                                {
                                                                                alert("Enter 10 digits only");
                                                                                return false;
                                                                                document.myform.contact.focus();
                                                                }
                                                                if(isNaN(myform.contact.value))
                                                                {
                                                                                alert("Enter numeric value only");
                                                                                return false;
                                                                                document.myform.contact.focus();
                                                                }
                                                                if(myform.gender.value=="")
                                                                 {
                                                                 alert ("select your gender");
                                                                 return false;
                                                                 }
                                                                 if(myform.details.value=="")
                                                                 {
                                                                 alert ("select your qualification and experience");
                                                                 return false;
                                                                 }
                                                                  if(myform.language.value=="")
                                                                 {
                                                                 alert ("Select language");
                                                                 return false;
                                                                 }
                                                                if (document.getElementById("hindi").checked == false &&   
                                                                document.getElementById("english").checked == false && document.getElementById("marathi").checked == false)   
                                                                {
                                                                                alert ('You did not choose any of the checkboxes yet.');
                                                                                return false;
                                                                }
                                                               
                                                                if(myform.password.value=="")
                                                                {
                                                                                alert("Enter your password");
                                                                                return false;
                                                                                document.myform.password.focus();
                                                                }
                                                                return true;
                                                }
                                </script>

</head>
<body role="document">
          
               
                                               
                                 <li><a href="userwelcome.php">View profile</a></li>
                <li><a href="ujobdisplay.php">Job offers</a></li>
                <li><a href="uuploadresume.php">Upload resume</a></li>
                <li><a href="uchangepassword1.php">Change password</a></li>
                <li><a href="userlogout.php">Logout</a></li>
                                                 
               
          </ul>
        </div><!--/.nav-collapse -->
                                </div>
    </nav>
               
<h1><i><b>Update profile</b></i></h1>

                <?php
                include("connect.php");
                $session=$_SESSION['email'];
                $sql="select * from userrecord where email='$session'";

                $result=mysql_query($sql);
                echo '<table border=0>';
                while($row=mysql_fetch_array($result))
                {
                echo '<form action="userfinalupdate.php" method="post" name=myform onsubmit=return(valid());>';


                echo '<tr>';
                                echo '<td>';
                                                                echo 'Name :';
                                                echo '</td>';
                                                echo '<td>';
                                                                echo '<input type=text name=name value="'.$row['name'].'"class="form-control"><br>';
                                                echo '</td>';
                                echo '</tr>';
                                echo '<tr>';
                                                echo '<td>';
                                                echo 'Address   :';
                                                echo '</td>';
                                                echo '<td>';
                                                                echo '<textarea rows=3 cols=20 name=address class="form-control">'.$row['address'].'</textarea><br>';
                                                echo '</td>';
                                echo '</tr>';
                                echo '<tr>';
                                                echo '<td>';
                                                                echo 'Contact    :';
                                                echo '</td>';
                                                echo '<td>';
                                                                echo '<input type=text name=contact value="'.$row['contact'].'" class="form-control"><br>';
                                                echo '</td>';
                                echo '</tr>';
                                echo '<tr>';
                                                echo '<td>';
                                                                echo 'Gender    :';
                                                echo '</td>';
                                                echo '<td>';
                                                                echo '<input type=text name=gender value="'.$row['gender'].'" class="form-control"><br>';
                                                echo '</td>';
                                echo '</tr>';
                                echo '<tr>';
                                                echo '<td>';
                                                echo 'Qualification and experience          :';
                                                echo '</td>';
                                                echo '<td>';
                                                                echo '<textarea rows=3 cols=20 name=details class="form-control">'.$row['details'].'</textarea><br>';
                                                echo '</td>';
                                echo '</tr>';
                                echo '<tr>';
                                                echo '<td>';
                                                                echo 'Language :';
                                                echo '</td>';
                                                echo '<td>';
                                                                echo '<input type=text name=language value="'.$row['language'].'" class="form-control"><br>';
                                                echo '</td>';
                                echo '</tr>';
                                echo '<tr>';
                                                echo '<td>';
                                                                echo 'Password                :';
                                                echo '</td>';
                                                echo '<td>';
                                                                echo '<input type=text name=password value="'.$row['password'].'" class="form-control"><br>';
                                                echo '</td>';
                                echo '</tr>';
                echo '<tr>';
                                echo '<td><input type=submit name=submit value=Update class="btn btn-lg btn-primary btn-block"><td>';
                echo '</tr>';

                echo '</form>';

                }
                echo '</table>';

?>
(6)now write code for userfinalupdate.php  file:
<?php
                session_start();
                if(!isset($_SESSION['email']))
                {
                                 header('location:uerror.php');
                                                                                                                                                                                                                                                                                 
                }
$session=$_SESSION['email'];
                $name=$_POST['name'];
                $address=$_POST['address'];
                $contact=$_POST['contact'];
                $gender=$_POST['gender'];
                $details=$_POST['details'];
                $language=$_POST['language'];
                $password=$_POST['password'];
               
               
                include("connect.php");
                $sql="update userrecord set name='$name',address='$address',contact='$contact',gender='$gender',details='$details',language='$language',password='$password' where email='$session'";
               
mysql_query($sql);
               

                header('Location:userwelcome.php');
?>

(7)now write code for uploadresume.php file:
<?php
session_start();
                if(!isset($_SESSION['email']))
                {
                   header('location:uerror.php');
                                                                                                                                                                                                                                                                                                                                                                                                                                  
                }
                ?>

<!DOCTYPE html>
<html lang="en">
  <head>
    <script type="text/javascript">
                                                function valid()
                                                {
                                                                if(myform.file.value=="")
                                                                {
                                                                                alert("Enter your file");
                                                                                return false;
                                                                                document.myform.file.focus();
                                                                }
                                                               
                                                }
                                </script>

</head>
<body role="document">
                                 <li><a href="userwelcome.php">View profile</a></li>
                <li><a href="ujobdisplay.php">Job offers</a></li>
                <li><a href="uuploadresume.php">Upload resume</a></li>
                <li><a href="uchangepassword1.php">Change password</a></li>
                <li><a href="userlogout.php">Logout</a></li>
               
                                                 
               
         
               
<h1><i><b>Upload resume</b></i></h1>

                <?php
                include("connect.php");
                $session=$_SESSION['email'];
                $sql="select * from userrecord where email='$session'";

                $result=mysql_query($sql);
                echo '<table class="table table-striped">';
                while($row=mysql_fetch_array($result))
                {
                echo '<form action="uuploadresume1.php" method="post" name=myform onsubmit=return(valid()); enctype="multipart/form-data">';

                echo '<tr>';
                                echo '<td>Qualification and experience                :</td>';
                                echo '<td>';
                                                echo '<input type=text name=details value="'.$row['details'].'" class="form-control"><br> ';
                                echo '</td>';
                echo '</tr>';
               
                echo '<tr>';
                                echo '<td>Upload resume           :</td>';
                                echo '<td>';
                                               
                                                echo '<input type=file name=file value="'.$row['file'].'" class="form-control"><br> ';
                                echo '</td>';
                echo '</tr>';
                echo '<tr>';
                                echo '<td><input type=submit name=submit value="Upload resume" class="btn btn-lg btn-primary btn-block"><td>';
                echo '</tr>';

                echo '</form>';

                }
                echo '</table>';

?>
(9)now  write code for uploadresume1.php file:
<?php
session_start();
                if(!isset($_SESSION['email']))
                {
                                header('location:uerror.php');
                }
               
$session=$_SESSION['email'];
$details=$_POST['details'];
$file=$_FILES['file']['name'];



//$con=mysql_connect("localhost","root","");

//mysql_select_db("portal",$con);

include("connect.php");


$sql1="update userrecord set details='$details',file='$file' where email='$session'";

mysql_query($sql1);
move_uploaded_file($_FILES['file']['tmp_name'],"resume/".$_FILES['file']['name']);
echo "<font color=red>resume successfully updated </font>";





?>
(10)now    write code for userlogout.php   file:
<?php
                session_start();
                session_destroy();
                header('Location:userlogin.html');
?>


                

Written by

We are Creative Blogger Theme Wavers which provides user friendly, effective and easy to use themes. Each support has free and providing HD support screen casting.

0 comments:

Post a Comment

PHP Training Mumbai, PHP MySQL Training Mumbai, PHP Course Mumbai, PHP Institute Mumbai

 

© 2013 PHP TRAINING IN MUMBAI BY OM SIR . All rights resevered. Designed by OM SIR

Back To Top