<html>
<title>Create Banner Add</title>
<?php include "inc/def.php"; ?>
<?php include "inc/usrchk.php";
if($guest==1) {
header("location:index.php");
} ?>
<?php include "inc/header.php"; ?>
<div class="line">Create Text Ad.</div>
<?php
/*$getu = mysql_query("SELECT * FROM users WHERE user='$user'");
$getu1 = mysql_fetch_array($getu);
$id = $getu1['id'];
$get = mysql_query("SELECT * FROM comp WHERE uid='$id'") or die();
$hmm = mysql_num_rows($get);
if($hmm>6){
echo "<div class='prob'>You can create only 7 compaigns !</div>";
die();
}
*/
if((isset($_POST['title']))&&(isset($_POST['url']))) {
$getu = mysql_query("SELECT * FROM users WHERE user='$user'");
$getu1 = mysql_fetch_array($getu);
$uid = $getu1['id'];
$get = mysql_query("SELECT * FROM comp WHERE uid='$uid'") or die();
$hmm = mysql_num_rows($get);
/*if($hmm>6){
echo "<div class='prob'>You can create only 7 campaigns !</div>";
die();
}
*/
$title = secure('title');
$url = secure('url');
$adult = secure('adult');
$cat=secure('cat');
/*$img = $_FILES['img'];
*/
$img=secure('img');
$data = mysql_fetch_array($get);
/*$uid = $data['id'];
*/
if((empty($title))||(empty($url))||(empty($img))) {
print "<div class='prob'>One ore more required fields were left blank !!</div>";
die();
}
/*
$done=0;
$target_path = "imgs/";
$rnd =date("U");
$filename = $rnd."-". $_FILES["img"]["name"];
$filename1 = basename( $_FILES['img']['name']);
$target_path = $target_path . $filename;
$ext = substr($filename1, strrpos($filename1, '.') + 1);
if(($ext == "jpg")||($ext == "JPG")||($ext == "gif")||($ext == "GIF")) {
if (($_FILES["img"]["type"] == "image/jpeg") ||($_FILES["img"]["type"] == "image/gif") )
{
if(move_uploaded_file($_FILES["img"]["tmp_name"], $target_path)) {
echo "<div class='done'>The img has been uploaded</div>";
$done = 1;
} else{
echo "<div class='prob'>There was an error uploading the file, please try again!</div>";
die();
}
} else {
echo "<div class='prob'>The img is too big or format not supported !</div>";
die();
}
}
else {
echo "<div class='prob'>The img is too big or format not supported !</div>";
die();
}
*/
if(!$adult==1) {
$adult=0;
}
$type=2;
$status=0;
/*$img=$filename;
*/
function rndgen ($minlength, $maxlength, $useupper, $usespecial, $usenumbers)
{
$charset = "abcdefghijklmnopqrstuvwxyz";
if ($useupper) $charset .= "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if ($usenumbers) $charset .= "0123456789";
if ($usespecial) $charset .= "~@#$%^*()_+-={}|]["; // Note: using all special characters this reads: "~!@#$%^&*()_+`-={}|\\]?[\":;'><,./";
if ($minlength > $maxlength) $length = mt_rand ($maxlength, $minlength);
else $length = mt_rand ($minlength, $maxlength);
for ($i=0; $i<$length; $i++) $key .= $charset[(mt_rand(0,(strlen($charset)-1)))];
return $key;
}
$rnd = rndgen(20,20,false,false,true);
$do = mysql_query("INSERT INTO comp (title,uid,url,type,adult,img,cat,lang,intr1,intr2,intr3,intr4,intr5,ckey,st) VALUES ('$title','$uid','$url','$type','$adult','$img','$cat','$lang','$country1','$country2','$country3','$country4','$country5','$rnd','$status')") or die("Unable to Process Your Request. Contact Adsalvo Team !".mysql_error());
if($do) {
print "<div class='done'>Campaign is Created Successfully !. Campaign is Created.Waiting For Admin Approval</div>";
echo '<div class="lgn"><a href="adv_view.php"><b>View Campaigns</b></a></div>';
}
}
?>
<form action="adv_banner_new.php" method="POST" enctype="multipart/form-data">
<div class="lwt">
<label for="title"><b>Title :</b></label><br />
<input type="text" size="30" name="title" max="35" />
</div>
<div class="lgn">
<label for="url"><b>URL :</b></label><br />
<input type="text" size="30" name="url" value="http://" />
</div><div class="lwt">
<label for="cat"><b>Category :</b></label><br />
<select name="cat"><option value="Entertainment" selected="selected">Entertainment</option><option value="Download">Download</option><option value="Forum">Forum/chats</option><option value="Portal">Portal/Search</option><option value="Personal">Personal</option><option value="Services">Useful Services</option><option value="Hobbys">Hobbys/Interests</option><option value="Toplists">Toplists/Promotions</option><option value="Media">Media & Politics</option></select>
</div>
<!-- <div class="lgn">
<label for="img"><b>Banner Img:</b></label><br />
<input name="img" type="file"/>
</div>
-->
<div class="lgn">
<label for="img"><b>Banner Image Url :</b></label><br />
<input type="text" value="http://" name="img" />
</div>
<div class="lwt">
<label for="adult"><b>Adult Site ? :</b></label>
<input name="adult" type="checkbox" value="1" />
</div><div class="lgn"><center>
<input type="submit" value="Create" /></center>
</div>
</form>
<?php include "inc/footer.php"; ?>
</html>