Location: PHPKode > scripts > Upcoming Events > kbupcomingevents/index.php
<?PHP
include "config.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>
  <title>Free PHP Scripts</title>
  <meta name="description" content="KB Kunal Bansal is a web hub that provides the user with the 

free PHP script, tools, site references ,php hosting, php tools and much more..."/>
  <meta name="keywords" content="web hub, scripts, free php scripts, php, free, php tools, php 

information, php hosting, php softwares,php affiliate script, php theme script, php login script, 

free webspace, free homepage, webpage, website, web site, free web site, web host, web hosting, 

free web host, free web hosting, cheap web host, cheap web hosting, building a web site, hosting 

a web site, web publishing, web site tools, web authoring, Free domain name, domains, site host, 

building a blog, web site creation tools, domain hosting, top hosts, free scripts,compare"/>
  <meta name="ROBOTS" content="ALL"/>
</head>

<body>

<h1>Upcoming Events</h1>
<p>The demo shows upcoming events for next 7 days. If there is an event today then that event is highlighted. You can click on More to see Upcoming Events in Next 25 days.</p>

<table border='0' cellspacing='0' cellpadding='0'>
<tr>
<td>
<?php

$wherequery="WHERE calitmact='1'";

$dtenow_ist= gmdate("Y-m-d" , time() +19800);
$yearnow_ist= gmdate("Y" , time() +19800);
$monthnow_ist= gmdate("m" , time() +19800);
$daydtenow_ist= gmdate("d" , time() +19800);
$mondaydtenow_ist= gmdate("m-d" , time() +19800);

$daydte7days_ist= gmdate("d" , strtotime ($dtenow_ist . '+7 days'));

if($daydtenow_ist>'25')
{
$monnext_ist= gmdate("m" , strtotime ($dtenow_ist . '+1 months'));
$yearnext_ist= gmdate("m" , strtotime ($dtenow_ist . '+1 years'));

$wherequery2="
(
calitmtypid='0' AND 
((MONTH(calitmdte)='$monthnow_ist' AND DAY(calitmdte) >='$daydtenow_ist')
OR
(MONTH(calitmdte)='$monnext_ist' AND DAY(calitmdte) <='$daydte7days_ist'))
)
";


$wherequery3="
(
calitmtypid='1' AND 
((YEAR(calitmdte)='$yearnow_ist' AND MONTH(calitmdte)='$monthnow_ist' AND DAY(calitmdte) >='$daydtenow_ist')
OR
(YEAR(calitmdte)='$yearnow_ist' AND MONTH(calitmdte)='$monnext_ist' AND DAY(calitmdte) <='$daydte7days_ist')
OR
(YEAR(calitmdte)='$yearnext_ist' AND MONTH(calitmdte)='$monnext_ist' AND DAY(calitmdte) <='$daydte7days_ist'))
)
";
}
else
{
$wherequery2="
(
calitmtypid='0' AND 
MONTH(calitmdte)='$monthnow_ist' AND DAY(calitmdte) >='$daydtenow_ist' AND DAY(calitmdte) <='$daydte7days_ist'
)
";

$wherequery3="
(
calitmtypid='1' AND 
YEAR(calitmdte)='$yearnow_ist' AND MONTH(calitmdte)='$monthnow_ist' AND DAY(calitmdte) >='$daydtenow_ist' AND DAY(calitmdte) <='$daydte7days_ist'
)
";
}


$wherequery="$wherequery AND ($wherequery2 OR $wherequery3)";

//echo "$wherequery";

$orderby="ORDER BY MONTH(calitmdte), DAY(calitmdte)";

 	$qry_calitems="SELECT * FROM scrupcomingevents $wherequery $orderby"; 
	$rsl_calitems=mysql_query($qry_calitems); 	
	$n_calitems = mysql_num_rows($rsl_calitems); 
	//$arr_calitems =  mysql_fetch_row($rsl_calitems);


if($n_calitems=='0')
{
echo "No Upcoming Events found in coming days<br>";
}
else
{
//echo "<b>$n_calitems Upcoming Events</b><br>";

echo "<ul>";
for($i=0; $i<$n_calitems; $i++)
{
$arr_calitems =  mysql_fetch_row($rsl_calitems);

$calitmdte_format=date('M jS',strtotime($arr_calitems[6]));
$calitmdte_format2=date('m-d',strtotime($arr_calitems[6]));

if($calitmdte_format2==$mondaydtenow_ist)
{
$eventtdy_fontsize="font-size:14px; background-color: #CECEF6; border: 2px dotted #0000FF; padding: 2px;";
}
else
{
$eventtdy_fontsize="";
}

//echo "$calitmdte_format2 $mondaydtenow_ist";

if($arr_calitems[7]=='0')
{

if($arr_calitems[10]!='')
{
$searchterm=$arr_calitems[10];
}
else
{
$searchterm=$arr_calitems[3];
}

$event_echo="<li style='$eventtdy_fontsize'>$calitmdte_format - <a href='index.php?page=d/search/basic&searchsub=1&searchterm=$searchterm' title='View our Collection on $arr_calitems[3]'><b>$arr_calitems[3]</b></a></li>";
}
else
{
$event_echo="<li style='$eventtdy_fontsize'>$calitmdte_format - <a href='index.php?page=d/ctg/item&itmctgid=$arr_calitems[7]' title='View our Collection on $arr_calitems[3]'><b>$arr_calitems[3]</b></a></li>";

}
echo "$event_echo";
}
echo "</ul>";
}

?>
</td>
</tr>

<tr>
<td>
<table width='100%'>
<tr>
<td align='right' class='itmusrby'>
<a href='upcomingevents.php' title='Click to View more Upcoming Events!'>More..</a>
</td>
</tr>
</table>
</td>
</tr>
</table>


</body>
</html>
Return current item: Upcoming Events