| Server IP : 127.0.0.1 / Your IP : 216.73.216.48 Web Server : Apache/2.4.58 (Win64) OpenSSL/3.1.3 PHP/8.2.12 System : Windows NT DESKTOP-3H4FHQJ 10.0 build 19045 (Windows 10) AMD64 User : win 10 ( 0) PHP Version : 8.2.12 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : D:/New folder/ |
Upload File : |
<html>
<?php
session_start();
include('db.php');
//include('function.php');
?>
<?php
if(isset($_SESSION['id']))
{
//$_SESSION['email']=$user_email;
$my_id = $_SESSION['id'];
//echo"$my_id";
}
?>
<div style="display:none;">
<input type="text" id="my_id" class="helping_id" style="display:none;" value="<?php echo $my_id;?>">
<?php
$user_ip = getenv('REMOTE_ADDR');
$geo = unserialize(file_get_contents("http://www.geoplugin.net/php.gp?ip=$user_ip"));
$city = $geo["geoplugin_city"];
$region = $geo["geoplugin_regionName"];
$country = $geo["geoplugin_countryName"];
/*echo"$user_ip";
echo "City: ".$city."<br>";
echo "Region: ".$region."<br>";
echo "Country: ".$country."<br>";
/*
geoplugin_request
geoplugin_status
geoplugin_credit
geoplugin_city
geoplugin_region
geoplugin_areaCode
geoplugin_dmaCode
geoplugin_countryCode
geoplugin_countryName
geoplugin_continentCode
geoplugin_latitude
geoplugin_longitude
geoplugin_regionCode
geoplugin_regionName
geoplugin_currencyCode
geoplugin_currencySymbol
geoplugin_currencySymbol_UTF8
geoplugin_currencyConverter
*/
?>
</div>
<head>
<title>crane blue online store</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--link rel="icon" href="kvt_con/khalaf_log.jpg" type="image/ico"-->
<link rel="stylesheet" type="text/css" href="main_css/upload_ad.css" />
</head>
<body>
<div class="main_home_area">
<a href="http://craneblue.com/market/store"><div class="main_home_tile">CB market</div></a>
<div class="sub_home_btn_area">
<a href="http://craneblue.com/market/store"><button class="home_btn">Home</button></a>
<?php
if($my_id=2)
{?>
<button onClick="show_add_cat_div()" class="home_btn">Add Cat</button>
<?php } ?>
<!--a href="log_out.php"><button class="home_upload_ad_btn">Logout</button></a-->
<?php
if(isset($_SESSION['id']))
{?>
<a href="log_out"><button class="home_upload_ad_btn">Logout</button></a>
<a href="upload_ad"><button class="home_upload_ad_btn">Upload Ad</button></a>
<!--button onClick="show_add_cat_div()" class="home_upload_ad_btn">Add Cat</button-->
<?php }else{ ?>
<a href="login"><button class="home_upload_ad_btn">Login</button></a>
<a href="login"><button class="home_upload_ad_btn">Upload Ad</button></a>
<?php } ?>
</div>
<script>
</script>
</div>
<div class="positioning_div"></div>
<!--div class="upoad_new_ad_input_div">
<form method="post" enctype="multipart/form-data" >
<div class="upload_ad_title" >Upload the your Ad</div>
<select type="text" id="ad_cartegory" name="ad_cartegory" class="upload_ad_input" >
<option selected disabled class="category_btn">Select Cartegory</option>
<option class="category_btn">Computers</option>
<option class="category_btn">Phones</option>
<option class="category_btn">Phones Accessories</option>
<option class="category_btn">Electronics</option>
<option class="category_btn">Beauty Health</option>
<option class="category_btn">Furniture</option>
<option class="category_btn">Appliances</option>
<option class="category_btn">Sports Outdoors</option>
<option class="category_btn">Men Fashion</option>
<option class="category_btn">Women Kids Goods</option>
<option class="category_btn">Home Garden</option>
</select>
<select type="text" id="product_status" name="product_status" class="upload_ad_input" >
<option selected disabled class="category_btn">Select Product Status</option>
<option class="category_btn">brand new</option>
<option class="category_btn">second hand</option>
</select>
<input type="text" id="product_name" name="product_name" class="upload_ad_input" placeholder="Product name" />
<textarea type="text" id="product_details" name="product_details" class="product_details" maxlength="97" placeholder="Product details" ></textarea>
<input type="text" id="product_price" name="product_price" class="upload_ad_input" placeholder="optional" />
<input type="text" id="product_url" name="product_url" class="upload_ad_input" placeholder="Product url" />
<input type="file" id="product_file" name="product_file" class="select_image_btn" />
<!--button onclick="document.getElementById('ad_file').click();" class="select_image_btn">Select Image</button-->
<!--div class="selected_file_name"></div-->
<!--div id="ad_input_output" class="ad_input_output"></div>
<button id="upload_ad_final_btn" name="upload_ad_final_btn" class="upload_ad_btn" style="display:none;">Upoad Now</button>
</form>
<button id="upload_ad_next_btn" onclick="start_upload_ad();" class="upload_ad_btn">Next</button>
<script>
function start_upload_ad()
{
cartegory_ad = document.getElementById('ad_cartegory').value;
product_status = document.getElementById('product_status').value;
product_name = document.getElementById('product_name').value;
product_details = document.getElementById('product_details').value;
product_file = document.getElementById('product_file').value;
if(cartegory_ad =="Select Cartegory" || product_status =="Select Product Status"|| product_name=="" || product_details=="" || product_file=="" ){
document.getElementById('ad_input_output').innerHTML="<span style='color:red;'>Fill All The Spaces</span>";
}else{
document.getElementById('upload_ad_final_btn').style.display="block";
document.getElementById('upload_ad_next_btn').style.display="none";
}
}
</script>
<?php
/*
if(isset($_POST['upload_ad_final_btn']))
{
$product_name = $_POST['product_name'];
$product_name = mysqli_real_escape_string($con,$product_name);
$product_details = $_POST['product_details'];
$product_details = mysqli_real_escape_string($con,$product_details);
$ad_cartegory = $_POST['ad_cartegory'];
$product_price = $_POST['product_price'];
$product_status = $_POST['product_status'];
$product_url = $_POST['product_url'];
$product_file = $_FILES['product_file']['name'];
$type = explode('.',$product_file);
$type = end($type);
$random_name = rand();
$tmp_image = $_FILES['product_file']['tmp_name'];
$insert_ad ="insert into adverttb(my_id,product_name,product_detail,product_cartegory,product_price,product_image,product_url,product_status,curr_date,curr_time)
values('$my_id','$product_name','$product_details','$ad_cartegory','$product_price','$random_name.$type','$product_url','$product_status',CURDATE(),CURTIME() )";
$run_insert_ad = mysqli_query($con,$insert_ad);
if($run_insert_ad){
move_uploaded_file($tmp_image,'advert_images/'.$random_name.'.'.$type);
}else{echo"<span style='color:red;'>Something Went Wrong,Your Information Has Not Been Saved</span>";}
}
*/
?>
</div><!--end of upoad_new_ad_input_div-->
<div id="add_cat_div" class="add_cat_div">
<div class="add_cat_title" >Add Category</div>
<form method="post" enctype="multipart/form-data">
<div class="add_cat_lebal" >Category Name</div>
<input type="text" id="cat_name" name="cat_name" class="cat_name" />
<div class="add_cat_lebal">Category Image</div>
<input type="file" id="cat_img" name="cat_img" class="cat_name" />
<?php
if(isset($_POST['save_category'])){
$cat_name = $_POST['cat_name'];
$cat_img = $_FILES['cat_img']['name'];
if($cat_name =="" || $cat_img ==""){}else{
$type = explode('.',$cat_img);
$type = end($type);
$random_name = rand();
$tmp_image = $_FILES['cat_img']['tmp_name'];
$cat_name = mysqli_real_escape_string($con,$cat_name);
$insert_ad ="insert into categorytb(my_id,cat_img,cat_name,cur_country,cur_city,cur_date,cur_time)
values('$my_id','$random_name.$type','$cat_name','$country','$city',CURDATE(),CURTIME() )";
$run_insert_ad = mysqli_query($con,$insert_ad);
if($run_insert_ad){
move_uploaded_file($tmp_image,'category_img/'.$random_name.'.'.$type);
//if(move_uploaded_file){}else{echo"Something Went Wrong, Data Not Saved.";}
echo"<div style='float:left;width:90%;height:40px;line-height:40px;color:green;text-align:center;'>Your File Has Been Uploaded!</div>";
}else{echo"<div style='float:left;width:90%;height:40px;line-height:40px;color:red;text-align:center;'>Something Went Wrong, Data Not Saved!</div>";}
}
}
?>
<button name="save_category" class="add_cat_btn" style="color:green;" >Add</button>
</form>
<button onClick="close_add_cat_div();" class="add_cat_btn" style="color:red;" >Cancel</button>
</div>
<div class="upoad_new_ad_input_div">
<form method="post" enctype="multipart/form-data" >
<div class="upload_ad_title" >Upload your Product</div>
<select type="text" id="ad_cartegory" name="ad_cartegory" class="upload_ad_input" >
<option selected disabled class="category_btn">Select Cartegory</option>
<?php
$search_input = $_GET['search_input'];
$get_more_cat ="select * from categorytb where cat_name like '%$search_input%' ";
$run_more_cat = mysqli_query($con,$get_more_cat);
while($row_more_cat = mysqli_fetch_array($run_more_cat))
{
$more_cat_name = $row_more_cat['cat_name'];
echo"<option>$more_cat_name</option>";
}
?>
</select>
<select type="text" id="product_status" name="product_status" class="upload_ad_input" >
<!--option selected disabled class="category_btn">Select Product Status</option-->
<option class="category_btn">Brand New</option>
<option class="category_btn">Second Hand</option>
</select>
<input type="text" id="product_name" name="product_name" class="upload_ad_input" placeholder="Product name" />
<!--input type="text" id="product_url" name="product_url" class="upload_ad_input" placeholder="Qty" /-->
<input type="text" id="product_be4_price" name="product_be4_price" class="upload_ad_input" placeholder="Before Price" />
<input type="text" id="product_price" name="product_price" class="upload_ad_input" placeholder="Price" />
<!--input type="text" id="product_city" name="product_city" class="upload_ad_input" placeholder="City" />
<input type="text" id="product_adress" name="product_adress" class="upload_ad_input" placeholder="Adress" />
<input type="text" id="product_contact" name="product_contact" class="upload_ad_input" placeholder="Contact" /-->
<textarea type="text" id="product_details" name="product_details" class="product_details" maxlength="97" placeholder="Product details" ></textarea>
<input type="file" id="product_file" name="product_file" onchange="show_file_name();" class="select_image_original_btn" />
<input type="file" id="product_file2" name="product_file2" onchange="show_file2_name();" class="select_image_original_btn" />
<input type="file" id="product_file3" name="product_file3" onchange="show_file3_name();" class="select_image_original_btn" />
<input type="file" id="product_file4" name="product_file4" onchange="show_file4_name();" class="select_image_original_btn" />
<button id="sub_upload_ad_final_btn" name="upload_ad_final_btn" class="upload_ad_btn" style="display:none;">Click</button>
</form>
<button onclick="document.getElementById('product_file').click();" id="select_image_btn" class="select_image_btn">Select Image 1</button>
<div id="selected_file_name" class="selected_file_name"></div>
<button onclick="document.getElementById('product_file2').click();" id="select_image2_btn" class="select_image2_btn">Select Image 2</button>
<div id="selected_file_name2" class="selected_file_name"></div>
<button onclick="document.getElementById('product_file3').click();" id="select_image3_btn" class="select_image_btn">Select Image 3</button>
<div id="selected_file_name3" class="selected_file_name"></div>
<button onclick="document.getElementById('product_file4').click();" id="select_image4_btn" class="select_image2_btn">Select Image 4</button>
<div id="selected_file_name4" class="selected_file_name"></div>
<div id="ad_input_output" class="ad_input_output"></div>
<button id="upload_ad_next_btn" onclick="start_upload_ad();" stylek="display:none;" class="upload_ad_next_btn">Next</button>
<button id="upload_ad_final_btn" onclick="document.getElementById('sub_upload_ad_final_btn').click();" style="background:green;display:none;" class="upload_ad_next_btn">Finish</button>
<script>
function show_file_name()
{
file_name = document.getElementById('product_file').files[0].name;
document.getElementById('selected_file_name').innerHTML=file_name;
document.getElementById('select_image_btn').innerHTML="Image 1 Selected";
document.getElementById('select_image_btn').style="background:green;";
//alert(file_name);
}
function show_file2_name()
{
file_name = document.getElementById('product_file2').files[0].name;
document.getElementById('selected_file_name2').innerHTML=file_name;
document.getElementById('select_image2_btn').innerHTML="Image 2 Selected";
document.getElementById('select_image2_btn').style="background:green;";
//alert(file_name);
}
function show_file3_name()
{
file_name = document.getElementById('product_file3').files[0].name;
document.getElementById('selected_file_name3').innerHTML=file_name;
document.getElementById('select_image3_btn').innerHTML="Image 3 Selected";
document.getElementById('select_image3_btn').style="background:green;";
//alert(file_name);
}
function show_file4_name()
{
file_name = document.getElementById('product_file4').files[0].name;
document.getElementById('selected_file_name4').innerHTML=file_name;
document.getElementById('select_image4_btn').innerHTML="Image 4 Selected";
document.getElementById('select_image4_btn').style="background:green;";
//alert(file_name);
}
function start_upload_ad()
{
cartegory_ad = document.getElementById('ad_cartegory').value;
product_status = document.getElementById('product_status').value;
product_name = document.getElementById('product_name').value;
product_details = document.getElementById('product_details').value;
product_file = document.getElementById('product_file').value;
// ad_currency_name = document.getElementById('ad_currency_name').value;
if(cartegory_ad =="Select Cartegory" || product_name=="" || product_details=="" || product_file=="" ){
document.getElementById('ad_input_output').innerHTML="<span style='color:red;'>Fill All The Spaces</span>";
}else{
document.getElementById('upload_ad_final_btn').style.display="block";
document.getElementById('upload_ad_next_btn').style.display="none";
}
}
</script>
<?php
if(isset($_POST['upload_ad_final_btn']))
{
$product_name = $_POST['product_name'];
$product_name = mysqli_real_escape_string($con,$product_name);
$product_details = $_POST['product_details'];
$product_details = mysqli_real_escape_string($con,$product_details);
$ad_cartegory = $_POST['ad_cartegory'];
$product_price = $_POST['product_price'];
$product_be4_price = $_POST['product_be4_price'];
//$ad_city = $_POST['product_city'];
//$ad_adress = $_POST['product_adress'];
//$ad_contact = $_POST['product_contact'];
$product_status = $_POST['product_status'];
//$product_url = $_POST['product_url'];
//$ad_currency_name = $_POST['ad_currency_name'];
$product_file = $_FILES['product_file']['name'];
/*$product_file2 = $_FILES['product_file2'];
$product_file3 = $_FILES['product_file3'];
$product_file4 = $_FILES['product_file4'];*/
?>
<script>
document.getElementById('upload_ad_final_btn').style.display="none";
//document.getElementById('upload_ad_next_btn').style.display="none";
</script>
<?php
$type = explode('.',$product_file);
$type = end($type);
$random_name = rand();
$tmp_image = $_FILES['product_file']['tmp_name'];
$product_file2 = $_FILES['product_file2']['name'];
if($product_file2==""){$random_name2 ='clear1'; $type_mo2='clear'; $tmp_image2='clear2';}else{
//echo"2 $product_file2";
$type_mo2 = explode('.',$product_file2);
$type_mo2 = end($type_mo2);
$random_name2 = rand();
$tmp_image2 = $_FILES['product_file2']['tmp_name'];}
$product_file3 = $_FILES['product_file3']['name'];
if($product_file3==""){$random_name3 ='clear1'; $type_mo3='clear'; $tmp_image3='clear3';}else{
//echo"3 $product_file3";
$type_mo3 = explode('.',$product_file3);
$type_mo3 = end($type_mo3);
$random_name3 = rand();
$tmp_image3 = $_FILES['product_file3']['tmp_name'];}
$product_file4 = $_FILES['product_file4']['name'];
if($product_file4==""){$random_name4 ='clear1'; $type_mo4='clear';$tmp_image4='clear4';}else{
//echo"4 $product_file4";
$type_mo4 = explode('.',$product_file4);
$type_mo4 = end($type_mo4);
$random_name4 = rand();
$tmp_image4 = $_FILES['product_file4']['tmp_name'];
}
$insert_ad ="insert into adverttb(my_id,product_name,product_detail,product_category,product_price,before_price,country,city,product_image,product_status,curr_date,curr_time)
values('$my_id','$product_name','$product_details','$ad_cartegory','$product_price','$product_be4_price','$country','$city','$random_name.$type','$product_status',CURDATE(),CURTIME() )";
$run_insert_ad = mysqli_query($con,$insert_ad);
if($run_insert_ad){
move_uploaded_file($tmp_image,'advert_images/'.$random_name.'.'.$type);
echo"<div style='float:left;width:100%;height:30px;line-height:30px;text-align:center;color:green;'>Product Added.</div>";
$get_advert = "select * from adverttb where product_image ='$random_name.$type'";
$run_advert = mysqli_query($con,$get_advert);
while($row_advert = mysqli_fetch_array($run_advert))
{
$advert_id = $row_advert['id'];
$insert_more_img =" insert into more_advert_imagestb ( my_id,advert_id,image_url2,image_url3,image_url4,date,time ) values( '$my_id','$advert_id','$random_name2.$type_mo2','$random_name3.$type_mo3','$random_name4.$type_mo4',CURDATE(),CURTIME() )";
$run_more_image = mysqli_query($con,$insert_more_img);
if($run_more_image){
move_uploaded_file($tmp_image2,'more_advert_images/'.$random_name2.'.'.$type_mo2);
move_uploaded_file($tmp_image3,'more_advert_images/'.$random_name3.'.'.$type_mo3);
move_uploaded_file($tmp_image4,'more_advert_images/'.$random_name4.'.'.$type_mo4);
}
//echo"$random_name";
}
}else{echo"<span style='color:red;'>Something Went Wrong,Your Information Has Not Been Saved</span>";}
}
?>
</div><!--end of upoad_new_ad_input_div-->
<div class="footer" >
<div class="information_footer" >
<div class="title_footer" >INFORMATION</div>
<div class="links_footer" >About us</div>
<div class="links_footer" >Contact us</div>
<?php
if(isset($_SESSION['id']))
{?>
<a href="upload_ad"><div class="links_footer" >Upload Ad</button></div></a>
<div onClick="show_add_cat_div()" class="links_footer" >Add Cat</button></div>
<a href="log_out"><div class="links_footer" >Logout</button></div></a>
<?php }else{ ?>
<a href="login"><div class="links_footer" >Upload Ad</button></div></a>
<a href="login"><div class="links_footer" >Login</button></div></a>
<?php } ?>
</div>
<div class="information_footer" >
<div class="title_footer" >POLICY USE</div>
<div class="links_footer" >Terms of use</div>
<div class="links_footer" >Security</div>
<div class="links_footer" >Cookie Policy</div>
</div>
<div class="information_footer" >
<div class="title_footer" >LOCATIONS</div>
<div class="links_footer" >Kampala</div>
<div class="links_footer" >Mukono</div>
<div class="links_footer" >Mbarara</div>
</div>
</div><!--end of footer-->
<script>
function show_add_cat_div()
{
document.getElementById('add_cat_div').style.display="block";
}
function close_add_cat_div()
{
document.getElementById('add_cat_div').style.display="none";
document.getElementById('cat_name').value="";
document.getElementById('cat_img').value="";
}
</script>
</body>
</html>