<?
	include("head.php");
	include("../include/db.inc.php");
	include("../include/pager.php");
	//include("function.php");	
	$db1=new db;
    $db1->open();mysql_query("SET NAMES 'utf8'");

	if($_SESSION['uid']=='' || $_SESSION['pwd']=='')
	{
		//header("location:login.php");
	}
	
	if($_POST['add'])
	{
	extract($_POST);
	$desc1=nl2br($desc);
	
    $query="insert into hotspot set name='$name',cuisine='$cuisine',location='$location',city='$city',website='$website',
            phone='$phone',time1='$time1',time2='$time2',time3='$time3',pay='$pay',price1='$price1',price2='$price2',
		reco='$reco',description='$desc1',break='$break',lunch='$lunch',dinner='$dinner',delivery='$delivery',takeout='$takeout',
			parking='$parking',dining='$dining',transport='$transport',mincharge='$mincharge'";
	mysql_query($query)or die(mysql_error());
	$hotid=mysql_insert_id();
	header("location:img_hotspot.php?hotid=$hotid");	
	
	}
	if($_GET['editid'])
	{
	$hid=$_GET['editid'];	
	
	
	$qq="select name,cuisine,location,city,website,phone,time1,time2,time3,pay,price1,price2,reco,description,break,
	lunch,dinner,delivery,takeout,parking,dining,transport,mincharge from hotspot where id='$hid'";
	list($name,$cuisine,$location,$city,$website,$phone,$time1,$time2,$time3,$pay,$price1,$price2,$reco,$desc,$break,
	$lunch,$dinner,$delivery,$takeout,$parking,$dining,$transport,$mincharge)=mysql_fetch_array(mysql_query($qq));
	
	if($_POST['update'])
	    {
		extract($_POST);
		$desc1=nl2br($desc);
		
	     $query="update hotspot set name='$name',cuisine='$cuisine',location='$location',city='$city',website='$website',
            phone='$phone',time1='$time1',time2='$time2',time3='$time3',pay='$pay',price1='$price1',price2='$price2',
		reco='$reco',description='$desc1',break='$break',lunch='$lunch',dinner='$dinner',delivery='$delivery',takeout='$takeout',
			parking='$parking',dining='$dining',transport='$transport',mincharge='$mincharge' where id=$hid";
	mysql_query($query)or die(mysql_error());	
	header("location:list_hotspot.php"); 
	 
		}
	
	
	}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="content-type" content="text/html; charset=utf-8">

<title><?=_TITLE1_?> Administrator Panel</title>
<script language="javascript">
function validate()
{

     if(document.frm.name.value=='')
	{
		 alert("Enter Your Name");
		 document.frm.name.focus();
		return false;

	} 
	
     if(document.frm.cuisine.value=='')
	{
		 alert("Enter Your Cuisine");
		 document.frm.cuisine.focus();
		return false;

	} 
	
     if(document.frm.location.value=='')
	{
		 alert("Enter Your Location");
		 document.frm.location.focus();
		return false;

	} 
 
	if(document.frm.website.value='')
	{
	alert("Enter Your Website");
	document.frm.website.focus();
	return false;
	}
	}
	</script>
</head>

<body bgcolor="#ffffff">
<div class="admin_wrapper">
<div class="logo_show"><? include("minorlogout.php");?></div>
<div style="float:left; width:200px">
<div class="topg_links_show"><? include("left.php");?></div>
<div class="top_links_show"><? include("belowleft1.php");	?></div></div>
<div style="float:left; width:800px">
<div class="maximum">

<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::header starts:::::::::::::::::::::::::::::::::::::::::::::::::::::-->

<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse;">
  <tr>
    <td><?  //include("header.php");?></td>
  </tr>
</table>
<!-- ImageReady Slices (apanel.psd) -->

<div style="margin-top:5px">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%" style="border-collapse:collapse;">
  <tr height="417">
<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::left starts:::::::::::::::::::::::::::::::::::::::::::::::::::::-->   
    
<td width="85%" bgcolor="#FFFFFF" valign="top">	
		<!--Start Main Body-->
		  <table  width="100%" border="0" cellpadding="0" cellspacing="0" class="bodytxt">
  <tr> 
    <td width="15" valign="top">&nbsp;</td>
          <td valign="top"><br> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="bodytxt">
        <tr> 
          <td width="33" valign="top"><img src="img/03.gif" width="33" height="23"></td>
                  
                <td background="img/bg01.gif"><strong>ADD OR UPDATE HOTSPOTS </strong></td>
          <td width="35"><img src="img/04.gif" width="35" height="23"></td>
        </tr>
      </table>
      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="bodytxt">
        <tr> 
          <td width="22" height="185" valign="top" background="img/tbl-left04.gif">
          <img border='0' src="img/tbl-left04.gif" width="22" height="13"></td>
          <td valign="top" align="center"><br>		
		<form name="frm" action="" method="post" onSubmit="return validate();">
		<table width="92%" cellpadding="1" cellspacing="1" border="0" class="bodytxt"  bgcolor="#E6F2FF" style="margin-left:20px;">
       
          <tr >
            <td width="14%">Name</td>
            <td width="56%"><input type="text" name="name" value="<?=$name?>"></td>
          </tr>
          <tr bgcolor="#FFFFFF">
            <td>Cuisine</td>
            <td><input type="text" name="cuisine" value="<?=$cuisine?>"></td>
          </tr>
          <tr>
            <td>Location</td>
            <td><input type="text" name="location" value="<?=$location?>"></td>
          </tr>
		  <? $cityq=mysql_query("select * from country")or die(mysql_error());									
		   ?>
          <tr bgcolor="#FFFFFF">
            <td>Country</td>
            <td><select name="city">
            <option value="0"></option>
			<? while($rec=mysql_fetch_array($cityq))
			{ ?>			
				<option value="<?=$rec['id']?>" <? if($rec['id']==$city)echo "selected";?>><?=$rec['state']?></option>
			<? }?>			
			</select></td>
          </tr>
          <tr>
            <td>Website</td>
            <td><input type="text" name="website" value="<?=$website?>"></td>
          </tr>
          <tr bgcolor="#FFFFFF">
            <td>Telephone</td>
            <td><input type="text" name="phone" value="<?=$phone?>"></td>
          </tr>
          <tr>
            <td>Hours</td>
            <td><select name="time1" style="width:50px">
			<? for($i=1;$i<24;$i++) {?>
			<option <? if($i==$time1)echo "selected";?>><?=$i?></option>
			<? }?>
			</select>  -
			
			<select name="time2" style="width:50px">
			<? for($i=1;$i<24;$i++) {?>
			<option <? if($i==$time2)echo "selected";?>><?=$i?></option>
			<? }?>
			</select>
			&nbsp;&nbsp;
			<input type="text" name="time3" value="<?=$time3?>">			</td>
          </tr>
          <tr bgcolor="#FFFFFF">
            <td>Payments</td>
            <td><input type="text" name="pay" value="<?=$pay?>"></td>
          </tr>
          <tr >
            <td>Meals Served </td>
            <td><input type="checkbox" name="break" value="1" <? if($break==1)echo"checked";?>>Breakfast&nbsp;
			<input type="checkbox" name="lunch" value="1" <? if($lunch==1)echo"checked";?>>Lunch&nbsp;
			<input type="checkbox" name="dinner" value="1" <? if($dinner==1)echo"checked";?>>Dinner </td>
          </tr>
          <tr bgcolor="#FFFFFF">
            <td>Price</td>
            <td>
			$<select name="price1">
			<? for($i=100;$i<2100;$i=$i+100) {?>
			<option <? if($i==$price1)echo "selected";?>><?=$i?></option>
			<? }?>
			</select> -
			
			$<select name="price2">
			<? for($i=100;$i<2100;$i=$i+100) {?>
			<option <? if($i==$price2)echo "selected";?>><?=$i?></option>
			<? }?>
			</select>			</td>
          </tr>
          <tr >
            <td>Features</td>
            <td><input type="checkbox" name="delivery" value="1" <? if($delivery==1)echo"checked";?>>Delivery Available&nbsp;&nbsp;
			<input type="checkbox" name="dining" value="1" <? if($dining==1)echo"checked";?>>Dining Alone </td>
          </tr>
          <tr bgcolor="#FFFFFF">
            <td>&nbsp;</td>
            <td><input type="checkbox" name="takeout" value="1" <? if($takeout==1)echo"checked";?>>Takeout Available&nbsp;&nbsp;&nbsp;
			<input type="checkbox" name="transport" value="1" <? if($transport==1)echo"checked";?>>Transporting </td>
          </tr>
          <tr >
            <td>&nbsp;</td>
            <td><input type="checkbox" name="parking" value="1" <? if($parking==1)echo"checked";?>>Parking Available&nbsp;&nbsp;&nbsp;&nbsp;
			<input type="checkbox" name="mincharge" value="1" <? if($mincharge==1)echo"checked";?>>No Minimum charge</td>
          </tr>
          <tr bgcolor="#FFFFFF">
            <td>Chef's Recommendations </td>
            <td><input type="text" name="reco" value="<?=$reco?>"></td>
          </tr>
          <tr >
            <td>Description</td>
            <td><textarea name="desc" rows="3" cols="30"><?=$desc?></textarea></td>
          </tr>
		  <tr bgcolor="#FFFFFF"><td colspan="2" align="right"><? if($_GET['editid']){ ?><a href="photo_hotspot.php?hotid=<?=$hid?>">Edit photos</a><? }?></td></tr>
		  <tr>
            <td></td>
            <td><? if($_GET['editid']){ ?>
			<input type="submit" name="update" value="Update"> <? }
			else {
			?>
			<input type="submit" name="add" value="Continue">
			<? }?>
			</td>
          </tr>
        </table>
		</form>
	 <!--End Main Body-->
		</td>
          <td width="19" valign="top" background="img/tbl-right04.gif"><img src="img/tbl-right04.gif" width="19" height="9"></td>
        </tr>
      </table>
      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="bodytxt">
              <tr> 
                <td width="33"><img src="img/tbl-bot01.gif" width="33" height="12"></td>
                <td  width="709" align="right" background="img/tbl-bg.gif"></td>
                <td width="33"><img src="img/tbl-right05.gif" width="35" height="12"></td>
              </tr>
            </table>
      </td>
  </tr>
  
</table></td></tr></table>
</div>


<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::center ends:::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::footer starts:::::::::::::::::::::::::::::::::::::::::::::::::::::-->

</div></div>
<div class="bottom_links_show"><? include("footer.php");	?></div>
</div>
<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::footer ends:::::::::::::::::::::::::::::::::::::::::::::::::::::-->
</body>
</html>





