<?php
session_start();
 if(!($_SESSION['log'])){
	  header("Location:index.php");
	  }  
  	 include('includes/php/dbconnection.php');
	 
	if($_REQUEST['addbanner'])
	{
	
	 if($_POST['status'] != 1) 
	{
		 $status = 0;
	}
	else
	{
		 $status = 1;
	}	
	
	
	
	if($_FILES['banner']['tmp_name']!="")
	{
		$targetpath="../uploads/advertise/";
		$image_name=$_FILES['banner']['name'];
		
		if(move_uploaded_file($_FILES['banner']['tmp_name'], $targetpath.$image_name)) {
		
		
		$prod_img=$_FILES['banner']['name'];
		}
	
	}
	
	$result_sortorder = mysql_query("SELECT MAX( sort_order  ) AS sortord FROM  `tbl_advertise` ");
	$row_order = mysql_fetch_array($result_sortorder);
	$order = $row_order["sortord"] + 1 ;
	
	
	 $query_user="INSERT INTO  `tbl_advertise` set img_name='".$prod_img."',img_url='".$_REQUEST['addurl']."', sort_order='".$order."',	status='".$status."'";
	
	mysql_query($query_user) or die('Error, insert query failed');
	$id = mysql_insert_id();
	
	$_SESSION['msg']="New Advertise Added Successfully";	
	header("location:advertise.php");
	exit;
	
	}

?>
<script language="javascript" type="text/javascript">
function mailcontent()
{
	var type = document.getElementById('type').value;
	window.location = "cmspages.php?type="+type;
}
</script>
	
	
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>...:: Vertigo Ventures - Admin ::...</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="includes/css/style.css" rel="stylesheet" type="text/css">
<script language="JavaScript">
</script>
<link href="includes/php/style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {color: #999999}
.style3 {color: #2788BF; }
-->
</style>
</head>
<body topmargin="0" bottommargin="0">
<table width="80%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0"  class="border-leftt">
  <tr> 
    <td height="10" colspan="2"><?php include('includes/php/top.php'); ?></td>
  </tr>
  <tr> 
     <td width="25%" valign="top"  bgcolor="#F2F2F4" style="padding-left:5px"><?php include("includes/php/left.php");?></td>
    <td width="75%"  valign="top" class="border-right">
<form action="" method="post" enctype="multipart/form-data" name="form1">
  <table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td width="100%" colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2" class="heading-nml">&nbsp;&nbsp;Add Advertise </td>
    </tr>
    <tr>
      <td class="err-mesage"><?php echo $_SESSION['msg']; unset($_SESSION['msg']);?></td>
      <td align="right">&nbsp;</td>
    </tr>
    <tr><td colspan="2" align="center" class="err-mesage"><table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" bordercolor="#EDA846" bgcolor="">
          <tr class="">
            <td>
			
			
		<input type="hidden" name="addbanner" id="addbanner" value="newbanner" />	
			
			
			<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
				
                <tr class="cpHeading" bgcolor="#618e20">
                  <td height="23" bgcolor="#2788BF"   style="padding-left: 5px; color:#FFFFFF;">&nbsp;</td>
				  <td width="35%"   style="padding-left: 5px; color:#FFFFFF;" bgcolor="#2788BF">&nbsp;</td>
				  <td width="17%"   style="padding-left: 5px; color:#FFFFFF;" bgcolor="#2788BF">&nbsp;</td>
				  <td width="7%"   style="padding-left: 5px; color:#FFFFFF;" bgcolor="#2788BF">&nbsp;</td>
				  <td width="25%" bgcolor="#2788BF" style="color:#FFFFFF;">&nbsp;</td>
                </tr>
                
				
                
				
				<tr >
                  <td height="35" class="welcome-text" style="padding-left: 5px;"><span class="welcome-text" style="padding-left: 5px;">Banner Image</span></td>
                  <td class="welcome-text" style="padding-left: 5px;"><label>
                    
                  </label>                    <input type="file" name="banner"></td>
                  <td height="35" colspan="3" class="welcome-text" style="padding-left: 5px;"><span style="color:#CC3333;">Please Upload the  suitable image size with 250X706 to maintain the banner quality.</span></td>
                  </tr>
				
				<tr >
                  <td height="35" class="welcome-text" style="padding-left: 5px;">Page Status               </td>
                  <td height="35" class="welcome-text" style="padding-left: 5px;">  <input name="addurl" type="text" id="addurl" ></td>
                  <td height="35" colspan="3" class="welcome-text" style="padding-left: 5px;">&nbsp;</td>
                  </tr>
				
				<tr >
                  <td height="35" class="welcome-text" style="padding-left: 5px;"><span class="welcome-text" style="padding-left: 5px;">Page Status</span></td>
                  <td height="35" colspan="4" class="welcome-text" style="padding-left: 5px;">
                    <input name="status" type="checkbox" value="1">                 </td>
                  </tr>
				
				<tr>
                  <td height="1" colspan="2" align="center"><input type="submit" name="SaveTextData" value="Save"></td>
                  <td height="1" colspan="6" align="center">&nbsp;</td>
                  </tr>
				<tr>
                  <td height="1">&nbsp;</td>
                  <td height="1">&nbsp;</td>
                  <td height="1">&nbsp;</td>
                  <td height="1">&nbsp;</td>
                  <td height="1" colspan="4">&nbsp;</td>
                  </tr>
				
				<tr>
                  <td height="1" colspan="8" bgcolor="#dfd4d0"></td>
                </tr>
            </table></td>
          </tr>
      </table>
	  </td>
    <tr>
      <td colspan="2" align="left">
	  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#EDA846">
          <tr>
            <td height="18" colspan="5" align="center"></td>
          </tr>
      </table></td>
    </tr>
  </table>
</form>
    </td>
  </tr>
  <tr> 
    <td height="10" colspan="2"><?php include('includes/php/bottom.php'); ?></td>
  </tr>
</table>
</body>
</html>

