-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile.php
More file actions
107 lines (79 loc) · 2.98 KB
/
profile.php
File metadata and controls
107 lines (79 loc) · 2.98 KB
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
97
98
99
100
101
102
103
104
105
106
107
<?php
include("config.php");
session_start();
if (!isset($_SESSION['username'])){
header("location:home.php"); ;
}
$flag="";
$username = $_SESSION['username'];
connect();
$result = mysql_query("select * from users where username='$username' ") or die(mysql_error());
$first_name = mysql_result($result,0,3) or die(mysql_error());
$last_name = mysql_result($result,0,4) or die(mysql_error());
$email = mysql_result($result,0,2) or die(mysql_error());
if(isset($_POST['submit']) && isset($_POST['name']) && isset($_POST['year']) && isset($_POST['writer'])){
$username = $_SESSION['username'];
$name = $_POST['name'];
$Writer=$_POST['writer'] ;
$year = $_POST['year'] ;
mysql_query("INSERT INTO book VALUES ('$name','$Writer','$year') ") or die(mysql_error());
mysql_query("INSERT INTO userbook VALUES ('$username','$name',10) ") or die(mysql_error());
if (mysql_affected_rows()){
$flag="your post Successful save ." ;
}
else{
$flag="your post not Successful save .";
}
}
?>
<html>
<head>
<title>Hello!</title>
</head>
<body>
<img src ="profile-150x150.png" height="100" width="80" />
<div style=" border-style: solid; border-color:black; border-width:2px; height:500px; width:200px;">
latest books you introduced
<ol>
<?php
$result=mysql_query("select BookName from userbook where username='$username'") or die(mysql_error());
for ($i=0;$i!=mysql_num_rows($result);$i++){
$book=mysql_result($result,$i);
print("<li>$book</li>");
}
?>
</ol>
</div>
<form action="" style="right:0; margin-top:-600px; position: absolute; ">
<input type="text" placeholder="search" />
<input type="submit" value="search" />
</form>
<?php
$result=mysql_query("select count(BookName) from userbook where username='$username'") or die(mysql_error());
$num=mysql_result($result,0) ;
print ("<div style=' border-style: solid; border-color:black; border-width:2px; height:500px; width:200px; float:right; margin-top:-500px;'>
about you <br>
Name : $first_name <br>
Username : $username <br>
number of books you introdused : $num <br> </div>");
?>
<div>
<form action="" method="post"style="margin-left:500px; margin-top:-150px; position: absolute; ">
<<<<<<< HEAD
<legend> introducing new book ... </legend> <br>
=======
introducing new book ... <br>
>>>>>>> origin/master
<input type="text" name="name" placeholder="Book name" /> <br>
<input type="text" name="writer" placeholder="writer name" /> <br>
<input type="text" name="year" placeholder="publish year" /> <br>
<textarea placeholder="your opinion ...">
</textarea>
<input name="submit" type="submit" value="post" />
</form>
<?php
print("<h3>$flag</h3>") ;
?>
</div>
</body>
</html>