-
Notifications
You must be signed in to change notification settings - Fork 0
/
testingprofile.php
96 lines (95 loc) · 3.99 KB
/
testingprofile.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
// Inialize session
session_start();
// Check, if user is already login, then jump to secured page
if (!isset($_SESSION['username'])) {
header('Location: studentlogin.php');
}
?>
<html>
<head>
<title>student profile</title>
<link rel="stylesheet" href="styles/formstyle.css" />
</head>
<body>
<?php
include_once("header.php");
?>
<br/>
<div id="topnav" align="center">
<hr><p style="margin:2px">
<a href="index.php"><button>Home</button></a>
<a href="studentprofile.php"><button>Profile</button></a>
<a href="payments.php"><button>Payments</button></a>
<a href="booking.php"><button>Book Room?</button></a>
<a href="qallery.php"><button>Gallery</button></a>
<a href="aboutus.php"><button>About Us</button></a>
<a href="contact.php"><button>Contact Us</button></a></p><hr>
</div><br />
<div align="right" >Welcome: <?php echo $_SESSION['username']; ?> | <a href="logout.php" ><font color='orange'>Logout</font></a></div>
<div class="sidebar1">
<ul class="nav"><br/>
<li><b><a href="index.php" id="homescript" title="Homepage">Home</a></b></li><br/>
<li><b><a href="aboutus.php" title="About Us">About Us</a></b></li><br/>
<li><b><a href="contact.php" title="Contact Us">Contact Us</a></b></li><br/>
<li><b><a href="studenthome.php" title="Login to View Profile, Hostel and Book Room." target="_parent">Student Module</a></b></li><br/>
<li class="nav_label"><b><a href="admin/index.php" title="Administer Hostels, Rooms and More."target="new">Admin Module</a></b></li><br/>
</ul> <p align="center"><em>Apartments</em><a href="apartments.php"><img src="images/Kilwa_0084(1).jpg" alt="Insert Logo Here"
name="Insert_logo" width="180px" height="150px" id="Insert_logo" style="background-color: #FF6666; display:block;" /></a>
</p></div><br/><br/>
<form action="testingprofile.php" method="post" id="form1" enctype="multipart/form-data">
<div id="profile">File:<input type="file" name="image"><input type="submit" value="Upload"></div> <br>
<?php
//connect to the database
mysql_connect("localhost","mutisya","kivaki") or die (mysql_error());
mysql_select_db("tumhostel")or die(mysql_error());
$username = $_SESSION['username'];
if (isset($username))
{
$check = mysql_query("SELECT username FROM profilepicture WHERE username = '$username'");
if($check==FALSE)
echo "problem selecting";
else {
$user = "SELECT image FROM profilepicture WHERE username = '$username'";
echo "<div style=margin-left:4%; border=1> Image Uploaded .<p>Your image:</p ><img src=savedpicture.php?username=$user width=20% height=15%></div>";
}
}
else {
//file properties
$file = $_FILES['image']['tmp_name'];
if (!isset($file))
echo "please select an image";
else {
$username = $_SESSION['username'];
$image = addslashes(file_get_contents($_FILES['image']['tmp_name']));
$image_name = addslashes($_FILES['image']['name']);
$image_size = getimagesize($_FILES['image']['tmp_name']);
if ($image_size==FALSE)
echo "That's Not an Image";
else{
if(!$insert = mysql_query("INSERT INTO profilepicture VALUES ('','$image_name','$image','$username')"))
echo "Problem Upoading Image";
else {
$lastid = mysql_insert_id();
echo "<div style=margin-left:4%; border=1><p>Your image:</p ><img src=savedimage.php?id=$lastid width=20% height=15%></div>";
}
}
}
}
?>
<br><br>
<table id="profile1">
<tr><td> FirstName:<input type="text" name="username" title="Enter your firstname"></td>
<td> LastName:<input type="text" name="username" title="Enter your lastname"></td></tr>
<tr><td>Email Address:<input type="text" name="username" title="Enter your Email"></td>
<td>Registration No:<input type="text" name="username" title="Enter your Reg no."></td></tr>
<tr><td> Mobile No:<input type="text" name="username" title="Enter your Mobile No"></td>
<td> Home County:<input type="text" name="username" title="Enter your Home County"></td></tr>
</table>
</form>
</div>
</body>
<?php
include_once("footer.php");
?>
</html>