-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodify.php
More file actions
103 lines (103 loc) · 2.13 KB
/
Copy pathmodify.php
File metadata and controls
103 lines (103 loc) · 2.13 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
<?php
session_start();
$id=$_SESSION["id"];
$user=$_SESSION["uname"];
$textvalue="";
$servername="localhost";
$username="root";
$password="Weiss-2sfj";
$dbname="users";
$okay=0;
$ref="";
?>
<html>
<head>
<style>
.u1
{
list-style-type:none;
background-color:white;
}
ul
{
list-style-type:none;
background-color:#333333;
padding:0px;
overflow:hidden;
margin:0px;
}
li
{
float:left;
}
li a
{
color:white;
text-decoration:none;
display:block;
padding:20px;
}
li a:hover
{
text-decoration:underline;
background-color:#111111;
}
#d1
{
height:480px;
border:none;
width:340px;
}
input[type=submit]{
border-radius:4px;
background-color:lightgrey;
}
</style>
</head>
<body>
<ul>
<li>
<a href="welcome.php">My Bin
</a>
</li>
<li>
<a href="signout.php">Sign Out-
<?php echo $user ?>
</a>
</li>
</ul>
<?php
$textvalue="";
$dbc=mysqli_connect($servername,$username,$password,$dbname);
$sql="SELECT url,paste FROM userin";
$result=mysqli_query($dbc,$sql);
if(empty($_POST["text"])){
while($row=mysqli_fetch_assoc($result)){
if($row["url"]==$id){
$textvalue=$row["paste"];
$ref=$textvalue;
break;
}
}
}
if(!empty($_POST["text"])){
$okay=1;
$ref=$_POST["text"];
}
if($okay==1){
$query="UPDATE userin SET paste=? WHERE url=?";
$stmt=mysqli_prepare($dbc,$query);
mysqli_stmt_bind_param($stmt,"ss",$ref,$id);
mysqli_execute($stmt);
}
?>
<div id="d1">
<form method="post" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>">
<textarea name="text" rows="25" cols="40">
<?php echo $ref; ?>
</textarea>
<input type="submit" value="<?php if($okay==0)echo 'edit'; else if($okay==1)
echo 'edited'; ?>">
</div>
</body>
</html>