Hi trying to following program
<?php
//define class database connectivity
class dbconnect
{
var $conn;
function dbcon()
{
if(!isset($conn)) //database connectivity
{
$conn = mysqli_connect('localhost','root','username','password');
}
if($conn==false)
{
return mysqli_connect_error(); // return error message if connection fails
}
return $conn; // return connectivity
}
}
//define class sql injection
class injection extends dbconnect
{
function inject($char)
{
$data=new dbconnect;
$dataobj=$data->dbcon(); // create object database connection
$char=trim($char); //inject whitespace
$char = stripcslashes($char); // inject slashes
$char = htmlspecialchars($char); // inject special characters
$char = mysqli_real_escape_string($dataobj,$char); // mysql injection variable,databaseobject variable
return $char; // return safe data
}
}
$injobj=new injection;
$injobj->inject("name"); //create object sql injection class
//define the class staff
class staff
{
function stafffun()
{
$dbconnection = new dbconnect; //create database object
$dbobj= $dbconnection->dbcon();
$sql = "SELECT username from team_management where status='1'" ;
// select data from table
$rs = mysqli_query($dbobj,$sql);
$select = "<select name='username'>";
// output data of each row
while($row = mysqli_fetch_array($rs))
{
$select.="
<option value='".$row["username"]."'>"."</option>";
}
$select.="</select>";
return $select;
}
}
$staffobj1=new staff;
$staffobj2 = $staffobj1->stafffun();
class state
{
function statefun()
{
$dbconnection = new dbconnect; //create database object
$dbobj= $dbconnection->dbcon();
$sql = "select name from newstates where ccode=122" ;
// select data from table
$rs = mysqli_query($dbobj,$sql);
$select = "<select name='name'>";
// output data of each row
while($row = mysqli_fetch_array($rs))
{
$select.="
<option value='".$row["name"]."'>"."</option>";
}
$select.="</select>";
return $select;
}
}
$stateobj1=new state;
$stateobj2 = $stateobj1->statefun();
//define class allocate
class allocate
{
function allocatefun($state,$staff)
{
$dbconnection = new dbconnect; //create database object
$dbobj= $dbconnection->dbcon();
for($i=0;$i<7;$i++)
{
$rs="insert into v2_followup_history1(profileid) select pro_profileid from profile
where pro_state='$state' and pro_adminappstatus='1'and pro_profileid not in(select profileid from v2_followup_histroy1) ORDER BY RAND() LIMIT 120)";
}
//update the datafollowup_history1 table
$upda="update v2_followup_history1 set flw_staff='$staff',date=curdate(),status='1'";
$result=mysqli_query($dbobj,$upda);
if($result)
echo "success";
else
echo "fail";
}
}
if(isset($_POST['submit']))
{
$state=$_POST['pro_state'];
$staff=$_POST['flw_staff'];
$allobj1=new allocate ;
$allobj2 = $allobj1->allocatefun($state,$staff);
}
?>
<!DOCTYPE HTML>
<html>
<head>
</head>
<body oncontextmenu="return false"> <!--- Right click enable to the website --->
<form name="frm" method="post">
Staff Name:
<?php echo $staffobj2;?>
State
<?php echo $stateobj2;?><br><br>
<input type="submit" name="submit" value="submit" >
</form>
</body>
</html>
It display the error page
Notice: Undefined index: pro_state in /var/www/vhosts/alpha.nikah.com/httpdocs/testcode/demo/profile.php on line 125
Notice: Undefined index: flw_staff in /var/www/vhosts/alpha.nikah.com/httpdocs/testcode/demo/profile.php on line 128
success
Please help me how can i retrieve