0% found this document useful (0 votes)
34 views2 pages

MGMT Body, h1, h2, h3, h4, h5, h6 (Font-Family: "Raleway", Sans-Serif)

This document contains PHP code to manage user sessions on a website. It checks if a user session is active, and redirects to the login page if not. It also contains code to delete an image file from the server and database when a delete URL parameter is passed, and displays a success message if the delete is successful. Finally it includes additional PHP pages for navigation, headers, searches, photo grids and footers on the page.

Uploaded by

ravikkota
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views2 pages

MGMT Body, h1, h2, h3, h4, h5, h6 (Font-Family: "Raleway", Sans-Serif)

This document contains PHP code to manage user sessions on a website. It checks if a user session is active, and redirects to the login page if not. It also contains code to delete an image file from the server and database when a delete URL parameter is passed, and displays a success message if the delete is successful. Finally it includes additional PHP pages for navigation, headers, searches, photo grids and footers on the page.

Uploaded by

ravikkota
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1 <!

---------PHP SESSION FUNCTION ------------->


2 <?php
3 session_start();
4 if(!isset($_SESSION["user_img"])){
5 header("location:login/login.php");
6 }else{
7 ?>
8 <!---------START HTML------------->
9 <!DOCTYPE html>
10 <html>
11 <title>Doc Mgmt</title>
12 <meta charset="UTF-8">
13 <meta name="viewport" content="width=device-width, initial-scale=1">
14 <link rel="stylesheet" href="css/w3.css">
15 <style>
16 body,h1,h2,h3,h4,h5,h6 {font-family: "Raleway", sans-serif}
17 </style>
18 <body class="w3-light-grey w3-content" style="max-width:1600px">
19 <!-- Sidebar/menu -->
20 <?php include('php/nav.php'); ?>
21 <!-- Overlay effect when opening sidebar on small screens -->
22 <div class="w3-overlay w3-hide-large w3-animate-opacity" onclick="w3_close()"
style="cursor:pointer" title="close side menu" id="myOverlay"></div>
23 <!-- !PAGE CONTENT! -->
24 <div class="w3-main" style="margin-left:250px">
25 <!-- Header -->
26 <?php include('php/header.php'); ?>
27
28 <!-- Php File delete functions and alert function -->
29 <div class="w3-row-padding">
30 <?php
31 $connect = mysqli_connect('localhost','root','','NSOC');
32 if(isset($_GET['deleteid']))
33 {
34 $selectSql = "select * from images where id =
".$_GET['deleteid'];
35 $rsSelect = mysqli_query($connect,$selectSql);
36 $getRow = mysqli_fetch_assoc($rsSelect);
37
38 $getIamgeName = $getRow['name'];
39
40 $createDeletePath = "upload/".$getIamgeName;
41
42 if(unlink($createDeletePath))
43 {
44 $deleteSql = "delete from images where id = ".$getRow['id'];
45 $rsDelete = mysqli_query($connect, $deleteSql);
46
47 if($rsDelete)
48 {
49 header('location:index.php?success=true');
50 exit();
51 }
52 }
53 else
54 {
55 $errorMsg = "Unable to delete Image";
56 }
57
58 }
59
60
61 if(isset($_GET['success']) && $_GET['success'] == 'true')
62 {
63 ?>
64 <div class="alert alert-success">
65 <?php
66 echo "Images has been deleted sucessfully";
67 ?>
68 </div>
69 <?php
70 }
71 ?>
72 <br/>
73 <!-- Including search page -->
74 <?php include('php/search.php'); ?>
75 </div>
76
77 <!-- Second Photo Grid-->
78 <?php include('php/design.php'); ?>
79
80 <!-- Footer -->
81 <?php include('php/footer.php'); ?>
82
83
84 <!-- End page content -->
85 </div>
86 </body>
87 </html>
88 <!-- PHP SEASON-->
89 <?php
90 }
91 ?>

You might also like