|
$sql1="select * from `rf_projects` where `proj_state`=1";
$res1=mysql_query($sql1);
$tno=mysql_num_rows($res1);
$current_timestamp=mktime(0,0,0);//Current date Timestamp while($row1=mysql_fetch_object($res1))
{
$date_array=explode("-",$row1->end_date);
$date_timestamp=mktime(0,0,0,$date_array[1],$date_array[2],$date_array[0]);
$diff=$date_timestamp-$current_timestamp;
$days_diff=getdate($diff);
$days=$days_diff[yday];
if($diff<0)
{
$upd_query="update `rf_projects` set `proj_state`=0 where proj_ID=$row1->proj_ID";
mysql_query($upd_query);
}//if
}//while
$no_row=15;
if(isset($_GET['incr']) && $_GET[incr]!='')
$incr += $_GET['incr'];
else
$incr=$no_row;
if(isset($_GET['start_lim']))
{
if($_POST[srno])
$start_lim = 0;
else
$start_lim+=$_GET['start_lim'];
}//if(isset($_GET['start_lim']))
else
{
$start_lim = 0;
}//else
if(isset($_GET['total_rows']))
{
if($_POST[srno])
$total_rows=$tno;
else
$total_rows=$_GET['total_rows'];
}//if(isset($_GET['total_rows']))
else
$total_rows = $tno;
if(isset($_GET['end_lim']))
$end_lim=$_GET['end_lim'];
else
$end_lim = $incr;
if(isset($_GET['title'])&&($_GET['title']!=""))
$title=$_GET['title'];
else
$title=$_POST['title'];
if(isset($_GET['search'])&&($_GET['search']!=""))
$search=$_GET['search'];
else
$search="all";
if(isset($_GET['find'])&&($_GET['find']!=""))
$find=$_GET['find'];
else
$find="all";
$name=array('Datewise'=>'dtwise','Monthwise'=>'mthwise');
$month=array('January'=>'01', 'February'=>'02', 'March'=>'03', 'April'=>'04', 'May'=>'05', 'June'=>'06', 'July'=>'07', 'August'=>'08', 'September'=>'09', 'October'=>'10', 'November'=>'11', 'December'=>'12');
$year=array('2006'=>'2006', '2007'=>'2007', '2008'=>'2008', '2009'=>'2009', '2010'=>'2010', '2011'=>'2011', '2012'=>'2012', '2013'=>'2013', '2014'=>'2014', '2015'=>'2015', '2016'=>'2016', '2017'=>'2017', '2018'=>'2018', '2019'=>'2019', '2020'=>'2020');
?>
if($_POST[search]=="Search")
{
?>
}
else //if(isset($_GET[search]))
{
?>
}
?>
if(($_POST[search]=="Search")||(isset($_GET[search])))
{
if($_POST[srno]=="all")
$sql1="select * from `rf_projects` where `proj_state`=1";
else if($_POST[srno]=="dtwise")
{
$d = explode("-", $_POST[searchval]);
$searchval = $d[2]."-".$d[0]."-".$d[1];
$sql1="select * from `rf_projects` where `proj_state`=1 and `start_date`='$searchval' order by start_date DESC";
}
else if($_POST[srno]=="mthwise")
{
$sql1="select * from `rf_projects` where `proj_state`=1 and MONTH(start_date)=$_POST[month] and YEAR(start_date)=$_POST[year] order by start_date DESC";
}
$res1=mysql_query($sql1);
$tno=mysql_num_rows($res1);
if(isset($_GET['incr']) && $_GET[incr]!='')
$incr = $_GET['incr'];
else
$incr=$no_row;
if(isset($_GET['start_lim']))
{
if($_POST[srno])
$start_lim = 0;
else
$start_lim=$_GET['start_lim'];
}//if(isset($_GET['start_lim']))
else
{
$start_lim = 0;
}//else
if(isset($_GET['total_rows']))
{
if($_POST[srno])
$total_rows=$tno;
else
$total_rows=$_GET['total_rows'];
}//if(isset($_GET['total_rows']))
else
$total_rows = $tno;
if(isset($_GET['end_lim']))
$end_lim=$_GET['end_lim'];
else
$end_lim = $incr;
if(isset($_GET['title'])&&($_GET['title']!=""))
$title=$_GET['title'];
else
$title=$_POST['title'];
if(isset($_GET['search'])&&($_GET['search']!=""))
$search=$_GET['search'];
else
$search="all";
if(isset($_GET['find'])&&($_GET['find']!=""))
$find=$_GET['find'];
else
$find="all";
if($_POST[search]=="Search")
{
if((($_POST[srno]=="dtwise")&&($_POST[searchval]!="")))
{
$d = explode("-", $_POST[searchval]);
$searchval = $d[2]."-".$d[0]."-".$d[1];
$proj_query="select * from `rf_projects` where `proj_state`=1 and `start_date`='$searchval' order by start_date DESC limit $start_lim, $end_lim";
$search="dtwise";
$find=$_POST[searchval];
}
if($_POST[srno]=="mthwise")
{
$proj_query="select * from `rf_projects` where `proj_state`=1 and MONTH(start_date)=$_POST[month] and YEAR(start_date)=$_POST[year] order by start_date DESC limit $start_lim, $end_lim";
$search="mthwise";
$find=$_POST[month]."|".$_POST[year];
}
if((($_POST[srno]=="all")))
{
$proj_query="select * from `rf_projects` where `proj_state`=1 order by start_date DESC limit $start_lim, $end_lim";
$search="all";
}
}
else if(isset($_GET[search]))
{
if(((isset($_GET[find]))&&($_POST[find]!="")) || ((isset($_GET[search])) && ($_GET[search]=="dtwise")))
{
$d = explode("-", $_GET[find]);
$searchval = $d[2]."-".$d[1]."-".$d[0];
$proj_query="select * from `rf_projects` where `proj_state`=1 and `start_date`='$searchval' order by start_date DESC limit $start_lim, $end_lim";
$search="dtwise";
$find=$_GET[find];
}
if(((isset($_GET[find]))&&($_POST[find]!="")) || ((isset($_GET[search])) && ($_GET[search]=="mthwise")))
{
$f = explode("|",$_GET[find]);
$find=$f[0]."|".$f[1];
$proj_query="select * from `rf_projects` where `proj_state`=1 and MONTH(start_date)=$f[0] and YEAR(start_date)=$f[1] order by start_date DESC limit $start_lim, $end_lim";
$search="mthwise";
}
if((isset($_GET[search])) && ($_GET[search]=="all"))
{
$proj_query="select * from `rf_projects` where `proj_state`=1 order by start_date DESC limit $start_lim, $end_lim";
$search="all";
}
}
$proj_rs=@mysql_query($proj_query);
$proj_no=@mysql_num_rows($proj_rs);
if(($proj_no>0)||($proj_no!=NULL))
{
?>
while($proj_row=@mysql_fetch_array($proj_rs))
{
?>
print $proj_row['proj_title']; ?> |
$stdt = explode("-",$proj_row['start_date']);
foreach($month as $key=>$val)
{
if($stdt[1]==$val)
// print $stdt[2]." ".$key.", ".$stdt[0];
print $key." ".$stdt[2].", ".$stdt[0];
}
?>
|
| print $proj_row['proj_desc']; ?> |
|
}
?>
if ($start_lim !=0)
{
print "<- Previous ";
}//if ($start_lim !=0)
if ($start_lim < ($total_rows-$incr))
{
print "Next ->";
}//if ($start_lim < ($total_rows-$incr))
}
else
{
?>
Currently there are no Projects |
}
}
else
{
$proj_query="select * from `rf_projects` where `proj_state`=1 order by start_date DESC limit $start_lim, $end_lim";
$proj_rs=mysql_query($proj_query);
$proj_no=mysql_num_rows($proj_rs);
if($proj_no>0)
{
?>
while($proj_row=mysql_fetch_array($proj_rs))
{
?>
print $proj_row['proj_title']; ?> |
$stdt = explode("-",$proj_row['start_date']);
foreach($month as $key=>$val)
{
if($stdt[1]==$val)
print $key." ".$stdt[2].", ".$stdt[0];
//print $stdt[2]." ".$key.", ".$stdt[0];
}
?>
|
| print $proj_row['proj_desc']; ?> |
|
}
?>
if ($start_lim !=0)
{
print "<- Previous ";
}//if ($start_lim !=0)
if ($start_lim < ($total_rows-$incr))
{
print "Next ->";
}//if ($start_lim < ($total_rows-$incr))
}
else
{
?>
Currently there are no proj |
}
}//else
?>
|