Friday, 27 June 2014

Get Array Value in Combobox From MYSQL DataBase PHP

<?php
    @$conn = mysql_connect("localhost", "root", "");
    mysql_select_db("test", $conn);

    $query = "SELECT * from member";
    $result = mysql_query($query, $conn) or die(mysql_error());
    $num= mysql_num_rows($result);


    if ($num> 0) {
     while ($row = mysql_fetch_assoc($result)) {
        $array[] = array(
           'uid' => $row["uid"],
           'fname' => $row["fname"]
        );
     }
    }
    ?>

<form name="form" action="next.php" method="get">
        <select name="uid">
        <?php
        foreach($array as $value) {
          print("<option value=\"{$value['uid']}\">{$value['fname']}</option>");
        }
        ?>
        </select>
        <input type="submit" value="Send" />
</form>

Wednesday, 4 June 2014

Access control modifiers in php


There are a number of special keywords you can place before a class, a class function definition, or a class variable to alter the way PHP works with it - here's the full list, along with what each of them does:
  • Public: This variable or function can be used from anywhere in the script
  • Private: This variable or function can only be used by the object it is part of; it cannot be accessed elsewhere
  • Protected: This variable or function can only be used by the object it is part of, or descendents of that class
  • Final: This variable or function cannot be overridden in inherited classes
  • Abstract: This function or class cannot be used directly - you must inherit from them first
That is just a vague description of what each of them do - to make sure you fully understand each of them, here are examples:




<?php


class Example {
    public $a = 1;
    protected $b = 2;
    private $c = 3;
    
    function show_abc()
{
        echo $this -> a ;
        echo $this -> b;
        echo $this -> c;
    }
}

$example = new Example();


echo "Publc a: {$example->a}<br/>";
//echo "Protected b: {$example->b}<br/>";
//echo "Private c: {$example->c}<br/>";


$example->show_abc();



?>

understanding class inheritance

<?php

class car{
    var $wheels = 4;
    var $doors = 4;
    function wheelsdoors(){
        return $this->wheels + $this->doors;
        
    }
    
    
}


class CompactCar extends car{
    
    var $doors = 2;
        
}

$car1 = new car();
$car2 = new CompactCar();


echo $car1->wheels . "<br>";
echo $car1->doors . "<br>";
echo $car1->wheelsdoors(). "<br>";
echo  "<br>";
echo  "<br>";
echo  "<br>";


echo $car2->wheels . "<br>";
echo $car2->doors . "<br>";
echo $car2->wheelsdoors(). "<br>";




?>

Monday, 26 May 2014

Passing PHP form variables from one page to other pages

 File:form.php

<form method="post" action="form2.php">
    <input type="text" name="name">
    <input type="text" name="email_address">
    <input type="submit" value="Go To Step 2">
</form>







<?php

//let's start the session  File:form2.php
session_start();

//now, let's register our session variables
 $name = $_SESSION['name'];
$email = $_SESSION['email_address'];


//finally, let's store our posted values in the session variables
$_SESSION['name'] = $_POST['name'];
$_SESSION['email_address'] = $_POST['email_address'];

?>
<form method="post" action="form3.php">
<input type="radio" name="membership_type" value="Free">
<input type="radio" name="membership_type" value="Normal">
<input type="radio" name="membership_type" value="Deluxe">
<input type="checkbox" name="terms_and_conditions">
<input type="submit" value="Go To Step 3">
</form>




<?php

//let's start the session  File:form3.php
session_start();

//now, let's register our session variables

$membership_type = $_SESSION['membership_type'];
$terms_and_conditions = $_SESSION['terms_and_conditions'];
//session_register('membership_type');
//session_register('terms_and_conditions');

//finally, let's store our posted values in the session variables
$_SESSION['membership_type'] = $_POST['membership_type'];
$_SESSION['terms_and_conditions'] = $_POST['terms_and_conditions'];

?>
<form method="post" action="form_process.php">
<input type="text" name="name_on_card">
<input type="text" name="credit_card_number">
<input type="text" name="credit_card_expiration_date">
<input type="submit" value="Finish">
</form>




<?php
 //form_process.php
//let's start our session, so we have access to stored data
    session_start();
   
    $_SESSION['name_on_card'] = $_POST['name_on_card'];
     $_SESSION['credit_card_number'] = $_POST['credit_card_number'];
      $_SESSION['credit_card_expiration_date'] = $_POST['credit_card_expiration_date'];
   
   

 echo $name = $_SESSION['name'];
 echo $email = $_SESSION['email_address'];
echo $membership_type = $_SESSION['membership_type'];
echo $terms_and_conditions = $_SESSION['terms_and_conditions'];


 echo $name_on_card = $_SESSION['name_on_card'];
echo $credit_card_number = $_SESSION['credit_card_number'];
echo $credit_card_expiration_date = $_SESSION['credit_card_expiration_date'];

 ?>

Friday, 23 May 2014

Taskfeed Project Management Software - CodeCanyon



Download















IMPORTANT!!!

Taskfeed PE v1.45 now available! Supports UTF 8 / Unicode application wide! Please upgrade now

What is TASKFEED?

Taskfeed is a Project Management Software built upon ideas and experiences from real life project cycle and interactions. Over the years I’ve used many Project Management tools. While many of them served the purpose right, I found them bloated or overly complicated at times.
I realized that, Task/Project Management software can do a world of good if there was a Team Environment. A way to keep it simple, clean and elegant. Taskfeed is meant for TeamWork. Create your team and manage your projects together! Get notified on the go and have fun organizing your ever so cluttered project queue.
Taskfeed Currently features (but is not limited to)
  • Responsive UI
  • Invitation to join Taskfeed/Your Project by email.
  • Creating your own team to work with.
  • Apps for To-Do, Milestones and Discussion.
  • Attachment in discussion.
  • Threaded Discussion View.
  • Email Notification for all major events on a project.
  • Runs on simple Apache Server
  • User Roles as Project Owner and Contractors.
  • Managing your priority Queue
  • Task Calendar.
  • Public 3D Business Card!
  • Task and Project Management Panels.

Manage Your Team!


Create and manage your team easily with TaskFeed! Just type in the email address or username of the person you want in your team and hit ENTER! If the user is already in Taskfeed, he’ll get notified immediately, if he’s not, the system will send an invitation to the email address and request him/her to join TAKSFEED. In Taskfeed or not, after registration and logging in, there will be the notification waiting and reminding the user to join your team!

Dashboard


The TASKFEED dashboard is your hub to link up all the happenings at Taskfeed that you care. You can jump onto all the discussions ToDo and milestones directly from the Dashboard links. You can view the Task Calendar too. All the actions of Taskfeed can be accessed from the colorful buttons on the right side bar.

Manage Your Task


Shows you all the projects you are currently working on. Quickly access and browse through your current projects or take required actions. You may leave any project from this window when and if you need to.

Manage Your Projects


As the title says, it lets you manage all your projects. You can view, jump to discussion or remove a project from here.

Discussion APP


Inside every project, you can install the DISCUSSION App. Helps you keep connected with the contractors and discuss about whats going on or what needs to be done. You and the other parties can attach files and screenshots and whatever needed to assist the progress of the project.

Simple Stock Manager - codecanyon



DEMO











Summary codecanyonsimple

EmployeeBook is a simple CodeIgniter based system that helps organizations manage employees. It can be used by all organizations. Some of the main features are user management, task management, role management and leave management.

Demo Credentials


Admin Login: Demo URL : http://codeigniterforms.com/EmployeeBook
Admin Username: admin
Admin Password: password

Employee login:
Employee Username: employee
Employee Password: password


Supervisor login:
Supervisor Username: demo
Supervisor Password: password
The above accounts shouldn’t be edited. All data entered will be removed in a day or two.

What is this

EmployeeBook is an efficient employee management system for organisations. Using this system you can easily manage your employees.

Following are the main modules :
  1. User Manager : Provides user management functionality with ACL.
  2. Leave Manager : Provides leave management functionality with approve/reject feature.
  3. Task Manager : Handles the daily task of employees.
  4. Role Manager : Deals with the user levels.

Why this

It is very easy to use and has the following features :
  • 100% Responsive and works in all platforms(Mobile, Tablets & Desktops).
  • Email notifications.
  • Export leave to CSV.
  • Allot leave and leave balance feature.
  • Apply for Team leave functionality.
  • Approve/reject team leave functionality.
  • Powerful ACL.
  • Simple Interface.
  • Apply for leave functionality.
  • Leave can be applied for Full day or half day(First half or second half)
  • Approve/Reject/Cancel Leave functionality.
  • Add/Edit task functionality.
  • Leave listing with advanced filters.
  • Task listing with edit task functionality.
  • Standalone based on codeigniter

Get Started

There is an automated installation process which will install the setup at your server or your local environment. You need to just copy and paste the contents of the folder “EmployeeBook” at your hosting.
This installation process will install all the necessary files and database.

  • Next you can add your employees from the “Add Employee” section and assign their role “Employee”.
  • Provide your employees with their username and password.
  • Now your employees can login from the login panel and perform their tasks.
  • Employees can add their daily tasks as well as edit the details of the added
    task.
  • Employee can apply for a leave from the “Apply Leave” section.
  • Those added tasks and leaves can be viewed from the “Task list” and the “All leave listing” sections.
  • Hence you can manage the progress as well as the leaves of your employees.
  • You can also maintain a healthy competitive environment from the “Recent Updates” section.

Leave Manager

Leave management plays an important role in any successful organisation to work efficiently.
EmployeeBook provides an efficient leave management interface to the organisation where employees can apply for a leave and the HR can take necessary action on the applied leave (ApproveReject or cancel) and the employee can view the status of the applied leave instantly.

Apply Leave
Here the employee can apply for a leave by selecting the type of leave(Annual, medical..) date and submit it to the HR for review.

Apply Team Leave
Here the supervisor can apply for leave on behalf of team member.

Email notifications
  • Email notifications are sent to the Supervisor when a leave is applied.
  • When the supervisor Approves or Rejects a leave the the employee is sent an email regarding approval or rejection.
Allot leave and leave balance feature
  • Leave need to be allotted to the employee based on the leave types. Like 20 Annual leave alloted to some demo employee..
  • Leave record is maintained for each and every employee.
  • IMPORTANT: For an employee to apply for a leave, leave have to allotted by admin or supervisor first.
  • When an employee apply for a leave then leave is deducted from that particular leave type. like if an employee has 18 Annual leaves and applies for 2 annual leave then the leave balance will be: 16
Team Feature
By this feature we can maintain individual functional groups
  • In this feature the Supervisors can view their team members leave.
  • They can take necessary actions such as Approve team members leave, reject team members leave based on permissions.
  • Supervisor can also apply for a leave on behalf of team member.
My Leave List
Here the employee can see the applied leaves and their status

Leave Listing
This section is restricted for the HR and Admin. Here the HR gets a listing of leaves submitted by all the employees of the organisation and can take necessary action.

Task Manager

Task manager provides an interface to the employees of the organisation for maintaining their daily tasks.They can add their daily task and at the end of the day they can edit the status of the task.
The Admnistrator of the organisation can see a listing of the task added by all the employees and can trace the work progress.

Add Task
Here the employees can add their task by writing the title description of the task with the estimated time.

My Task List
Here the employees can see their task listing and take the required action on their task.

Edit Task
Here the employee can change the status of the selected task.

Task List
Here the admin can see the task of all the employees and trace the work done.

User Manager

This section is restricted to the Administrator for managing the employees and their details.
Here the administrator can add a new employee, see a listing of all the employees
and edit the details of any employee.
From the employee listing the admin can activate/deactivate any employee and go to the edit section for editing employee details.

Add Employee
Admin can add a new employee from this panel by providing a username, password, email, date of joining, role and supervisor.

User List
Here you can see a listing of all the employees and perform various actions such as edit particulars of the selected employee, activate/deactivate the employee and delete a particular employee.

Edit Employee
Here you can edit the particulars of any employee and change the details of the selected employee.

Activate/Deactivate
Here you can deactivate a particular employee and that employee will not be able to login.

Delete Employee
Here you can delete the employee.

Role Manager

In an organisation we have different levels such as Employee, HR, Manager, Admin etc. We can call these as categories within which we can distribute our organisation and every user level has its own work.
We can categories our work and create as many roles as we want from the create new role panel.
After creating new role we will have to decide their capabilities and assign permissions to them.

Add New Role
Here you can add a new role by providing name and description of the role eg role can be HR and description Human Resource Department

Role Listing
Here you have the listing of all the roles in the organisation and you can perform various operations on those roles such as view, edit and permissions

Edit Role
Here you can edit the role name and description.

Permission
Here you can provide module wise permissions to the selected role. By providing permissions theemployee falling underthose rolescan access those modules.











Donwload Link




Monday, 5 May 2014

Login and Registration System 2.0



SQL




CREATE TABLE IF NOT EXISTS `members` (
  `member_id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(100) NOT NULL,
  `password` varchar(100) NOT NULL,
  `firstname` varchar(100) NOT NULL,
  `lastname` varchar(20) NOT NULL,
  `status` int(1) NOT NULL,
  PRIMARY KEY (`member_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;

--
-- Dumping data for table `members`
--

INSERT INTO `members` (`member_id`, `username`, `password`, `firstname`, `lastname`, `status`) VALUES
(1, 'admin', 'admin', 'System', 'admin ', 1),
(2, 'les', 'les', 'Leslie Vinky', 'Pepito', 1),
(3, 'al', 'al', 'Albert', 'Pepito', 0),
(4, 'yana', 'yana', 'Gelia', 'Pepito', 1),
(5, 'allie', 'allie', 'Ma. Junallie', 'Pomperada', 1),
(7, 'ali', 'ali', 'Ali', 'Amar', 0);




////////////////////////////

<!-- login.php -->
<!-- Created By: Mr. Aamir Javed Awan -->
<!-- Tools : PHP/MySQL -->
<html>
<head>
<title>Login Security 1.0</title>
<script type="text/javascript">
function setFocus()
{
     document.getElementById("user").focus();
}

function focusReset(){
           document.login.user.value="";
             document.login.pass.value="";
            document.login.user.focus();
        }

function Blank_Validator()
{
if (document.login.user.value == "" )
{
     alert("Please fill the user name.");
    document.login.user.focus();
  return (false);
}
else  if (document.login.pass.value == ""  ){
 alert("Please fill the password.");
   document.login.user.focus();
     return (false);
}
return (true);
}
</script>
</head>
<style>
input[type='text'] { font-size: 20px; color: blue; }
input[type='password'] { font-size: 20px; color: blue;}

.uni, .uni td,.uni th, .uni tr
{
font-family:comic sans ms;
font-size:15pt;
color: blue;
}
</style>
<?php
include 'connect.php';

 if (isset($_REQUEST['ok']))
 {
 // Grab User submitted information
$user = $_REQUEST["user"];
$pass = $_REQUEST["pass"];

$result=mysql_query("select * from members where username='$user'
          AND password='$pass'")or die (mysql_error());
       
$count=mysql_num_rows($result);
$row=mysql_fetch_array($result);

$result2 =mysql_query("select * from members where username='$user'
          AND password='$pass' and status = 0")or die (mysql_error());

$count2=mysql_num_rows($result2);
$row2=mysql_fetch_array($result2);

$faculty_query =mysql_query("select * from members where username='$user'
          AND password='$pass' and status = 2")or die (mysql_error());

$count3=mysql_num_rows($faculty_query);
$row3=mysql_fetch_array($faculty_query);
         
if ($count > 0 )
  {
   session_start();
  $_SESSION['member_id']=$row['member_id'];
  $message =  "<script language=javascript>  location.href='welcome.php' </script>";
   }
   else
{
$message=  "<script language=javascript>
            alert(\"Sorry Invalid Password And User Name. Register Please\");</script>";
    }

 if ($count2 == true)
{

 $message =  "<script language=javascript>  location.href='hello.php' </script>";
//$message=  "<script language=javascript>
  //       alert(\"This account is deactivated. Please contact us for account activation.\");</script>";
    }
   
    if ($count3 == true)
    {
     $message =  "<script language=javascript>  location.href='faculty.php' </script>";
     }
   
mysql_close($con);
}
?>


<br><br>
<font size=12 face="comic sans ms" color="blue"> <center>
Login Security </font> </center>
<br>
<body bgcolor="lightgreen" onload="setFocus()">
    <center>
    <form name="login"  method="post" action=""
    onsubmit="return Blank_Validator()" >
        <table  border class="uni">
            <tr>
                <td><label for="users">Username</label></td>
                <td><input type="text" name="user" id="user"></td>
            </tr>
            <tr>
                <td><label for="pass">Password</label></td>
                <td><input type="password" name="pass"    id="pass"></input></td>
            </tr>
            <tr>
                <td><input type="submit" name="ok" value="   OK    "
                title="Click here to login in the system"/>
                <td>
                 <input type="button"  value=" CLEAR " onClick='focusReset()'
                title="Click here to clear the text box"/>
            </tr>
           
        </table>
     </form>
     <font face="comic sans ms">
     <center><h3><a href='registerform.php' title='Click here to Register New Use Account.'>Registration</a></h3></center> </font>
    </center>
    <?php echo $message ?>
</body>
</html>









<?php
//connect.php -->
 error_reporting(0);
// Connect to the database
$con = mysql_connect("localhost","root","");
// Make sure we connected succesfully
if(!$con)
{
    die('Connection Failed'.mysql_error());
}
// Select the database to use
mysql_select_db("user_pass",$con);
?>




<?php
// config_all.php
// creation of database,table and insert of sample records.

$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
if (mysql_query("CREATE DATABASE user_pass",$con))
  {
 echo "<br><br>";
 echo "<h3>Your database has been created !!! <h3>";
  }
else
  {
  echo "Error creating database: " . mysql_error();
  }
 
mysql_select_db ("user_pass", $con);

$query1 = 'CREATE TABLE members( '.
         'member_id INT(11) NOT NULL AUTO_INCREMENT, '.
         'username VARCHAR(100) NOT NULL, '.
         'password VARCHAR(100) NOT NULL, '.
         'firstname VARCHAR(100) NOT NULL, '.
         'lastname VARCHAR(20) NOT NULL, '.
          'status INT(1) NOT NULL, '.
       
         'PRIMARY KEY(member_id))';

if (mysql_query($query1,$con))
{
echo "<h3> Your table has also created !!! </h3>";
 }
else
  {
  echo "<br>";
  echo "Error creating table: " . mysql_error();
  }

mysql_query("INSERT INTO members
(member_id,username, password,firstname,lastname,status)
 VALUES  ('1', '123','123','Jake', 'Pomperada ',0),
         ('2', 'les', 'les', 'Leslie Vinky', 'Pepito',1),
         ('3', 'al', 'al', 'Albert', 'Pepito',0),
         ('4', 'yana', 'yana', 'Gelia', 'Pepito',1),
         ('5', 'allie', 'allie','Ma. Junallie', 'Pomperada',1)
         ") or die(mysql_error()); 
echo "<h3> Record has been inserted in table. </h3>";
mysql_close($con);
?>





//register.php
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Registration Form</title>
</head>
<body  bgcolor="lightgreen"    style="color:blue;">
<?php
$servername="localhost";
    $username="root";
    $conn=  mysql_connect($servername,$username)or die(mysql_error());
    mysql_select_db("user_pass",$conn);
if ( !$conn )
{
die( 'Could not connect: ' . mysql_error() );
}
$username =   $_GET['regusername'];
 $password =   $_GET['regpassword'];

 $firstname =  ucfirst($_REQUEST['regfirstname']);
 $lastname =   ucfirst($_REQUEST['reglastname']);
  $status = $_REQUEST['status'];


if (mysql_num_rows(mysql_query("SELECT *
    FROM members WHERE username = '$username' AND
    password = '$password'"))) {
   
 $message=  "<script language=javascript>
            alert(\"Username and Password Already Exist.\");</script>";
   echo $message;
  
  $message2 =  "<script language=javascript>  location.href='registerform.php' </script>";
  echo $message2;
   }
   else
{

$sql = mysql_query("INSERT INTO members (username, password, firstname, lastname,status)
             VALUES ('$username', '$password', '$firstname','$lastname','$status')");

   $result=mysql_query($sql,$conn);

mysql_close($conn);
    }


    print "<h1>Congratulation you have registered sucessfully</h1>";
  
    print "<a href='index.php'>go to login page</a>";
?>
</body>


//registerform.php


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Registration Form</title>
</head>
<body  bgcolor="lightgreen"    style="color:blue;">
<FORM ACTION="register.php" METHOD=get>
<font face="Comic Sans Ms">
<h1>Welcome To Registration Form</h1>
Please input the registration details to create an account here<br> <br>
<table border="2">
<tr>
<td>User Name :</td><td><input name="regusername" type="text" size"20"></input></td>
</tr>
<tr>
<td>Password :</td><td><input name="regpassword" type="password" size"20"></input></td>
</tr>

<tr>
<td>First Name :</td><td><input name="regfirstname" type="text" size"20"></input></td>
</tr>
<tr>
<td>Last Name :</td><td><input name="reglastname" type="text" size"20"></input></td>
</tr>

<td>Status : 1 - Active 0 - Non Active</td><td><input name="status" type="text" size"1"></input></td>
</tr>


</table> </form> <br>
 <input type="submit" value="Register me!"></input>
</FORM>
</body>
</html>



hello.php

<html>
<body bgcolor="Blue">
<h1 align="center">
Your are deactivated in your account please contact us asap !!!!
</h1>
</body>
</html>

Faculty.php
<html>
<body bgcolor="yellow">
<h1 align="center">
Welcome to Faculty Page!!!!
</h1>
</body>
</html>
<?php
include 'connect.php';
session_start();
if (!isset($_SESSION['member_id'])){
header('location:index.php');
}
?>
<html>
<body bgcolor="lightgreen">
<hr noshade size="10" color="red">
<center> <h2>
<font color="blue" face="Comic Sans MS">
Welcome to the Main Page
</center> </h2> </font>
<hr noshade size="10" color="red">
<br><br>
<center>
<?php
 $member_id=$_SESSION['member_id'];
$result=mysql_query("SELECT * FROM members WHERE member_id='$member_id'")
or die(mysql_error());
$row=mysql_fetch_array($result);
$FirstName=$row['firstname'];
$LastName= $row['lastname'];
?>
 


welcome.php
 <?php
echo "<br>";
echo "<font size=6 name='comic sans ms' color='blue'>";
echo "Hello "  .$FirstName." ".$LastName;
echo "</font>";
?>
<br><br><br>
<font size=5 name="comic sans ms" >
<a href="logout.php" title="click here to logout.">
Logout</a>
</font> </center>
</body>
</html>




logout.php
<?php
// logout.php
session_start();
session_destroy();
header('location:index.php');
?>