I have a simple problem. I have this script. Now when a user signs up and is ready to add a advertisment ad. They have to chose impressions ( CPM )or clicks ( CPC ).
Well thats the way it should work. Because right now they can chose nothing and thier ad still gets shown.
What I want to do is force them to chose one or the other. when they put in thier ad.
How do i change this code to do that ? I have included some of the code as the page is actually to long to show it all.
--------------------------------------------------------------------
<? include "./session_check.php" ?>
<? include "./includes/config.php" ?>
<? include "./includes/config2.php" ?>
<?php
$query_admin = "SELECT * FROM ".$prefix."_admin";
$admin = mysql_query($query_admin) or die(mysql_error());
$row_admin = mysql_fetch_array($admin);
$totalRows_admin = mysql_num_rows($admin);
?>
<?php
$maxRows_account_his = 10;
$pageNum_account_his = 0;
if (isset($HTTP_GET_VARS['pageNum_account_his'])) {
$pageNum_account_his = $HTTP_GET_VARS['pageNum_account_his'];
}
$startRow_account_his = $pageNum_account_his * $maxRows_account_his;
$colname_account_his = "1";
if (isset($HTTP_SESSION_VARS['user_id'])) {
$colname_account_his = (get_magic_quotes_gpc()) ? $HTTP_SESSION_VARS['user_id'] : addslashes($HTTP_SESSION_VARS['user_id']);
}
mysql_select_db($database_ads);
$query_account_his = sprintf("SELECT * FROM ".$prefix."_adhistory WHERE user_id = '%s'", $colname_account_his);
$query_limit_account_his = sprintf("%s LIMIT %d, %d", $query_account_his, $startRow_account_his, $maxRows_account_his);
$account_his = mysql_query($query_limit_account_his) or die(mysql_error());
$row_account_his = mysql_fetch_assoc($account_his);
if (isset($HTTP_GET_VARS['totalRows_account_his'])) {
$totalRows_account_his = $HTTP_GET_VARS['totalRows_account_his'];
} else {
$all_account_his = mysql_query($query_account_his);
$totalRows_account_his = mysql_num_rows($all_account_his);
}
$totalPages_account_his = ceil($totalRows_account_his/$maxRows_account_his)-1;
?>
<?php
$maxRows_show_ads = 10;
$pageNum_show_ads = 0;
if (isset($HTTP_GET_VARS['pageNum_show_ads'])) {
$pageNum_show_ads = $HTTP_GET_VARS['pageNum_show_ads'];
}
$startRow_show_ads = $pageNum_show_ads * $maxRows_show_ads;
$colname_show_ads = "1";
if (isset($HTTP_SESSION_VARS['$user_id'])) {
$colname_show_ads = (get_magic_quotes_gpc()) ? $HTTP_SESSION_VARS['$user_id'] : addslashes($HTTP_SESSION_VARS['$user_id']);
}
mysql_select_db($database_ads);
$query_show_ads = sprintf("SELECT * FROM ".$prefix."_ad WHERE user_id = '$user_id' and active=1", $colname_show_ads);
$query_limit_show_ads = sprintf("%s LIMIT %d, %d", $query_show_ads, $startRow_show_ads, $maxRows_show_ads);
$show_ads = mysql_query($query_limit_show_ads) or die(mysql_error());
$row_show_ads = mysql_fetch_assoc($show_ads);
if (isset($HTTP_GET_VARS['totalRows_show_ads'])) {
$totalRows_show_ads = $HTTP_GET_VARS['totalRows_show_ads'];
} else {
$all_show_ads = mysql_query($query_show_ads);
$totalRows_show_ads = mysql_num_rows($all_show_ads);
}
$totalPages_show_ads = ceil($totalRows_show_ads/$maxRows_show_ads)-1;
?>
<? //getting the balance of the account
$result1=mysql_query("select * from ".$prefix."_adaccount where user_id='$user_id'");
$row1=mysql_fetch_array($result1);
$amount= $row1['amount'];
if ($amount>0){
echo number_format($amount,2);
}else {
$adres=mysql_query("select * from ".$prefix."_ad where user_id='$user_id'");
$adrows=mysql_num_rows($adres);
mysql_query("update ".$prefix."_adaccount set amount=0 where user_id='$user_id'");
while ($adrows=mysql_fetch_array($adres)){
mysql_query("update ".$prefix."_ad set active=0 where user_id='$user_id'");
}
echo "Your ads have been frozen because your account balance is $0.00";
}
//getting the first name of the user
$user_res=mysql_query("select * from ".$prefix."_user where ID='$user_id'");
$user_info=mysql_fetch_array($user_res);
?>
<form action="insert_ad.php" method="post" name="form2" onSubmit=" MM_validateForm('title2','','R','description','','R','short_url','','R');return document.MM_returnValue">
<table width="100%" border="0">
<tr bgcolor="#CC3300">
<td colspan="3" class="fonttext"><strong>Create New Ad:</strong></td>
</tr>
<tr>
<td width="33%" height="32" class="fonttext">Title:</td>
<td colspan="2" class="fonttext"> <span class="fonttext">
<input name="title" type="text" class="fields" id="title2">
</span></td>
</tr>
<tr>
<td class="fonttext">Description:</td>
<td colspan="2" class="fonttext"> <span class="fonttext">
<input name="description" type="text" class="fields" id="description" value="" maxlength="<?echo"$desc_maxlength";?>">
</span></td>
</tr>
<tr>
<td class="fonttext">Short Url:</td>
<td colspan="2" class="fonttext"> <span class="fonttext">
<input name="short_url" type="text" class="fields" id="short_url">
</span></td>
</tr>
<tr>
<td class="fonttext">Ad type:</td>
<td width="29%" class="fonttext"> <span class="fonttext">
<input name="radiobutton" type="radio" class="fields" value="cpm">
CPM</span></td>
<td width="38%" class="fonttext"> <span class="fonttext">
<input name="radiobutton" type="radio" class="fields" value="cpc">
CPC</span></td>
</tr>
<tr>
<td class="fonttext">Full Url:</td>
<td colspan="2" class="fonttext"> <span class="fonttext">
<input name="full_url" type="text" class="fields" id="full_url" value="http://">
</span></td>
</tr>
<tr>
<td> </td>
<td colspan="2" class="fonttext"> <span class="fonttext">
<input type="submit" name="Submit2" value="Submit Ad">
</span></td>
</tr>
</table>
</form>