-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
171 lines (114 loc) · 4.23 KB
/
Copy pathindex.php
File metadata and controls
171 lines (114 loc) · 4.23 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head
<link href='https://fonts.googleapis.com/css?family=Montserrat|Cardo' rel='stylesheet' type='text/css'>
<link href='style.css' rel='stylesheet' type='text/css'>
<link href='icomoon/style.css' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="main.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<header class="stickyNav">
<a href="#top" class="icon-circle-up"></span>
<div class="row">
<a class="logo" href="index.php">COPY-Paste</a>
<nav>
<ul>
<li><a href="about.php">About</a></li>
<li><a href="document.php">Documentation</a></li>
<li><a href="contact.php">Contact</a></li>
<li><a href="login.php" id="login">Login</a></li>
<li><a href="Register.php">Sign Up</a></li>
</ul>
</nav>
</div>
</header>
<div class="hero">
<h1><span>COPY-Paste</span><br>COPY it anywhere , paste it anywhere</h1>
</div>
<div class="content" id="top">
<h2>Instantly everywhere</h2>
<p>
Just copy anything and you can instantly paste, or view, on any of your devices. COPY-paste is seamless, fast and works everywhere.
</p>
<h2>All your data – big or small</h2>
<p>
COPY-paste can easily copy a snippet of text – like a useful phone number or entire folders of files with equal ease. COPY-paste is flexible enough to handle it all - just copy it!
</p>
<h2>Wherever you go</h2>
<p>Anything you COPY-paste is instantly accessible on all your devices. Wherever you are – in the office or on the go. All your stuff is stored forever ready for you to retrieve when you need it most.
</p>
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
require 'database.php';
global $pdo;
$pdo=db_connect();
session_start();
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true) {
echo "<h3>Welcome ,</h3><h3 id='getEmail'> " .$_SESSION['email']. "</h3>";
$copiedText='';
$queryCopy="SELECT * FROM members WHERE email='".$_SESSION['email']."' ";
$resultExist = $pdo->query($queryCopy);
$text = Array();
while($row = $resultExist->fetch()){
array_push($text,$row);
foreach($text as $copy){
$copiedText = $copy[3];
}
}
echo "<script> var x='' ; var x='".$copiedText."' ; setInterval(function() { document.getElementById('paste').innerHTML=x;}, 100);";
echo "</script>";
}
else {
echo "Please log in first to see this page.";
};
if($_SERVER["REQUEST_METHOD"] == "POST")
{
$copiedText=$_POST['textCopy'];
if ($_SESSION['loggedin'] == true){
$query="UPDATE `members` SET `copy` = '".$copiedText."' WHERE `email`= '".$_SESSION['email']."';" ;
echo"<br>";
$statement= $pdo->prepare($query);
if ($statement->execute()) {
echo "The Text that is Copied is--- ".$copiedText ;
}
else {
echo "Not worked";
}
}
}
//connect to database: PHP Data object representing Database connection
?>
<div id="form1">
<form name="form" method="post" action="index.php" >
<h4>Type the Text you want to paste</h4>
<textarea type="text" name="textCopy" rows="6" cols="40"></textarea>
<br>
<input type="submit" value="submit" name="submit" id="submitCopy" />
<h4>Type the text you pasted</h4>
<h5 id="paste" ></h4>
</form>
</div>
<a href=" Register.php">
<div class="signUp">
<!-- add aria -->
Sign Up
</div>
</a>
<a href=" login.php">
<div class="signUp">
<!-- add aria -->
Log In
</div>
</a>
</div>
</div>
<footer>
<p>Made by: Sidharth Nayyar</p>
<p>Contact information: <a href="mailto:sidharth15nayyar.com">sidharth15nayyar.com</a>.</p>
</footer>
</body>
</html>