D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home3
/
antlerworldwide
/
public_html
/
admin
/
Filename :
magazine.php
back
Copy
<?php include('checklogin.php')?> <?php include('include/header.php')?> <!--// top-bar --> <!-- Forms content --> <section class="forms-section"> <!--********************************************************************************************************************************************************************--> <!--*************************************************************************** Start Add Details ****************************************************************--> <!--********************************************************************************************************************************************************************--> <?php include('include/conectdb.php'); $error=''; if(isset($_POST['vchangeProfile'])) { $name=$_POST['name']; $country=$_POST['country']; $circulation=$_POST['circulation']; $frequency=$_POST['frequency']; $language=$_POST['language']; $readership=$_POST['readership']; $subscriber=$_POST['subscriber']; $category=$_POST['category']; $price=$_POST['price']; $text=$_POST['text']; $text=str_replace("'","\'",$text); if(empty($error)) { $target = "upload/"; $home_image=$_FILES['uploaded']['name']; $target = $target . basename($_FILES['uploaded']['name']) ; $ok=1; //This is our size condition if($home_image!='') { //$res=mysqli_query("SELECT `tlb_image` FROM `tlb_cms` WHERE `tlb_cms_id`=$pid"); //$row=mysqli_fetch_array($res); // if ($home_image > 1200000) // { // echo "Your file is too large.<br>"; // $ok=0; // } //This is our limit file type condition if ($home_image =="text/php") { echo "No PHP files<br>"; $ok=0; } //Here we check that $ok was not set to 0 by an error if ($ok==0) { echo "Sorry your file was not uploaded"; } //If everything is ok we try to upload it else { if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { $sql = mysqli_query($dbc,"INSERT INTO `magazine` (`id`, `name`,`country`,`circulation`,`frequency`,`language`,`readership`,`subscriber`,`category`,`price`,`tlb_image`,`tlb_des`) VALUES (NULL, '$name','$country','$circulation','$frequency','$language','$readership','$subscriber','$category','$price','$home_image','$text')"); if($row['trr_url']) { unlink('upload/'.$row[0]); } else { echo ''; } if($sql) { echo'<span class="successmssg">Content succeessfully added to the website, <br/> <a href="magazine.php" class="btn btn-primary">click to add more</a> <b></span>'; exit(); } else { echo 'Database Problem'; } } else { echo "Sorry, there was a problem uploading your file."; } } } else { $sql = mysqli_query($dbc,"INSERT INTO `magazine` (`id`, `name`,`country`,`circulation`,`frequency`,`language`,`readership`,`subscriber`,`category`,`price`,`tlb_des`) VALUES (NULL, '$name','$country','$circulation','$frequency','$language','$readership','$subscriber','$category','$price','$text')"); echo'<span class="successmssg">Content succeessfully added to the website, <br/> <a href="magazine.php" class="btn btn-primary">click to add more</a> <b></span>'; exit(); } } } ?> <div class="outer-w3-agile mt-3"> <h4 class="tittle-w3-agileits mb-4">Add Detail</h4> <form action="" method="post" enctype="multipart/form-data"> <div class="form-row"> <div class="form-group col-md-4"> <label for="inputCity">Name</label> <input type="text" name="name" class="form-control"> </div> <div class="form-group col-md-2"> <label for="inputCity">Country Orgin</label> <input type="text" name="country" class="form-control"> </div> <div class="form-group col-md-2"> <label for="inputCity">Circulation</label> <input type="text" name="circulation" class="form-control"> </div> <div class="form-group col-md-2"> <label for="inputCity">Frequency</label> <input type="text" name="frequency" class="form-control"> </div> <div class="form-group col-md-2"> <label for="inputCity">Language</label> <input type="text" name="language" class="form-control"> </div> <div class="form-group col-md-3"> <label for="inputCity">Readership</label> <input type="text" name="readership" class="form-control"> </div> <div class="form-group col-md-3"> <label for="inputCity">Subscriber</label> <input type="text" name="subscriber" class="form-control"> </div> <div class="form-group col-md-3"> <label for="inputCity">Category</label> <input type="text" name="category" class="form-control"> </div> <div class="form-group col-md-3"> <label for="inputCity">Cover Price</label> <input type="text" name="price" class="form-control"> </div> <div class="form-group col-md-6"> <label for="inputCity">Image</label> <div class="row"> <div class="col-md-8"><input type="file" name="uploaded" class="form-control" accept="image/*" onchange="loadFile(event)"></div> <div class="col-md-4 text-right"><img class="img-preview" id="output"></div> </div> </div> <div class="form-group col-md-12"> <label for="inputCity">Desicription</label> <textarea name="text" id="summernote"></textarea> </div> </div> <div class="form-group col-md-12 text-center mt-4"> <button type="submit" name="vchangeProfile" id="vchangeProfile" class="btn btn-primary" data-dismiss="modal" aria-hidden="true" title="submit">Add</button> <a href="welcome.php" class="btn btn-primary" data-dismiss="modal" aria-hidden="true" title="cancel">Cancel</a> </div> </form> </div> <!--********************************************************************************************************************************************************************--> <!--*************************************************************************** Start Table List ****************************************************************--> <!--********************************************************************************************************************************************************************--> <script type="text/javascript"> function delconf(id) { var msg="Are you sure to deletd Information# "+id+"?"; var reply=confirm(msg); return reply; } </script> <div class="outer-w3-agile mt-3"> <h4 class="tittle-w3-agileits mb-4">View Details</h4> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"> <div class=" table-responsive"> <table id="datatable" class="table table-striped table-bordered" cellspacing="0" width="100%"> <thead> <tr> <th>Action</th> <th>Sr.No.</th> <th>Name</th> <th>Country Orgin</th> <th>Circulation</th> <th>Frequency</th> <th>Language</th> <th>Readership</th> <th>Subscriber</th> <th>Category</th> <th>Cover Price</th> <th>Image</th> <th>Desicription</th> </tr> </thead> <tbody> <?php include('include/conectdb.php'); $inc=1; //$bg=''; $sql=mysqli_query($dbc,"SELECT * FROM `magazine`"); if(mysqli_num_rows($sql)>0) { ?> <?php while($row=mysqli_fetch_array($sql)) { //$bg=($bg=='#E3EDF0'?'#ffffff':'#E3EDF0'); ?> <tr> <td> <a href="magazine_edit.php?id=<?php echo $row['id']; ?>" class="btn btn-success btn-xs" data-title="View" title="edit"> <span><i class="fa fa-edit" aria-hidden="true"></i></span></a> <a href="magazine_delete.php?id=<?=$row['id']?>" onclick="return delconf('<?=$row['id']?>')" class="btn btn-danger btn-xs"> <span><i class="fa fa-trash" aria-hidden="true"></i></span></button> </td> <td><?php echo $inc++; ?></td> <td><?=$row['name']?></td> <td><?=$row['country']?></td> <td><?=$row['circulation']?></td> <td><?=$row['frequency']?></td> <td><?=$row['language']?></td> <td><?=$row['readership']?></td> <td><?=$row['subscriber']?></td> <td><?=$row['category']?></td> <td><?=$row['price']?></td> <td><?php if($row['tlb_image']!=''){?><img src="upload/<?=$row['tlb_image']?>" class="size-100"><?php } ?></td> <td><?=substr($row['tlb_des'],0,100)?></td> </tr> <?php }?> <?php }?> <?php if(mysqli_num_rows($sql)=='') { echo 'Sorry!! No Data Found'; } ?> </tbody> </table> </div> </div> </div> </section> <!--// Forms content --> <?php include('include/footer.php') ?>