Skip to content

Commit 1c57534

Browse files
committed
Fixed an SQL injection vulnerability in loggedin.php
1 parent 6f7b745 commit 1c57534

File tree

5 files changed

+22
-10
lines changed

5 files changed

+22
-10
lines changed

Diff for: images/theteknet.png

3.69 KB
Loading

Diff for: index.php

+9-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<html lang="en" class="no-js">
1111
<head>
12-
<title>TekNet Beta Registration</title>
12+
<title>Beta Registration</title>
1313
<meta name="description" content="TekNet Beta registration" />
1414
<link rel="shortcut icon" href="../favicon.ico">
1515
<link rel="stylesheet" type="text/css" href="css/default.css" />
@@ -25,7 +25,9 @@
2525
<a href="#"><hr></a>
2626
<header>
2727
<div class="inner relative">
28+
<img src="images/theteknet.png">
2829
<div style=height:20px; padding-top:50px;"></div>
30+
2931
<a id="menu-toggle" class="button dark" href="#""></i></a>
3032
<nav id="navigation">
3133
<ul id="main-menu">
@@ -40,12 +42,12 @@
4042
</nav>
4143
<div class="clear"></div>
4244
</div>
43-
<h1>TekNet Beta Registration <span> Register to be one of the first beta users on our site</h1>
45+
<h1>Beta Registration <span> Register to be one of the first beta users on our site</h1>
4446
</header>
45-
<section class="color-1">
4647
<p class="text note-touch">Sign-ups are currrently closed. You may try using the demo version of the site by clicking "Sign in" at the top right corner, and using the provided demo account. Please enter your email and name to pre-register and receive updates on TekNet's progress.</p>
4748
<p>
48-
Please make sure you are over the age of 13, as it would be illegal for us to knowingly collect information from people under the age of 13. Registration is open to PAUSD students only. Scroll down for all of the FAQ's.
49+
<br>
50+
Please make sure you are over the age of 13, as it would be illegal for us to knowingly collect information from people under the age of 13. Registration is open to PAUSD students only. Scroll down for all of the FAQ's.
4951
<p>
5052
<form method="get">
5153

@@ -57,7 +59,6 @@
5759
</form >
5860

5961
<?php
60-
6162
$email = $_GET["email"];
6263
$name = $_GET["name"];
6364
$position = strpos($email,"@palo-alto.edu");
@@ -67,7 +68,6 @@
6768
elseif($email==null){
6869
echo "Enter your @palo-alto.edu email and your name.";
6970
}
70-
7171
else{
7272
echo "Gotcha, we will be contacting you at $email shortly. To unsubscribe, just send an email to support@theteknet.org with the word \"Unsubscribe\" in the subject line, and we will be more then happy to remove your email from recieving updates";
7373

@@ -79,7 +79,10 @@
7979
<section class="color-2">
8080
<h1>What is TekNet?</h1>
8181
TekNet is a social network created by a group of Gunn studends designed for ALL PAUSD students ages 13+. TekNet will help PAUSD students connect, make friends (especially new students), find common classes, and get help with homework.
82+
<br>
83+
8284
</section>
85+
8386
<section class="color-3">
8487
<h1>When is TekNet going to be released?</h1>
8588
TekNet has no public release schedule at this time. TekNet's release depends on the demand of users that have pre-registered. If we receive at least 45 pre-registration requests, we will be released around late December to early January.

Diff for: login.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
<!-- Top Navigation -->
1616

1717
<header>
18-
18+
<a href="index.php"><img src="images/theteknet.png"></a>
1919
<div class="clear"></div>
20-
<h1>TekNet Login <span>Welcome back, please login</h1>
20+
<h1>Login <span>Welcome back, please login</h1>
2121
</header>
2222
<section class="color-1">
2323
<p class="text note-touch">Please enter your email and password. <br>To try out this site as a demo user, please login as email: jsmith@palo-alto.edu, password: demouser</p>

Diff for: pages/loggedin.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@
44
<title>TekNet - Home</title>
55

66
</head>
7+
78
<?php
89
include '../includeme.php';
910
include '../getelement.php';
1011
include '../backendstuff/phplogin.php';
1112

1213
?>
14+
1315
<header>
16+
<center><img src="../images/theteknet.png"></center>
1417
<?php
1518
echo "<h1>TekNet - Home </h1> <span>Welcome back, $email </span>";
1619
?>
@@ -34,9 +37,14 @@
3437

3538
$namestatus=$con->query("SELECT name,message,postnum FROM status ORDER BY postnum");
3639
$statusentery = $_POST[status];
40+
$position = strpos($statusentery,"<");
41+
if ($position === 0){
42+
echo "Sorry, for security purposes we do not allow characters such as <";
43+
exit;
44+
}
3745
if ($statusentery != null){
3846
if ($con->query("INSERT INTO status(message, name, date, postnum) VALUES('$statusentery', '$name[0]', now(), 2)") === TRUE) {
39-
echo "Buzz posted";
47+
echo "<script>document.location.href='http://www.theteknet.com'</script>";
4048
}
4149
else {
4250
echo "Error: " . $sql . "<br>" . $con->error;
@@ -73,4 +81,5 @@
7381

7482

7583
?>
84+
<br>
7685
</body>

Diff for: version.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<html>
2-
TheTekNet Version 0.05 Alpha
2+
TheTekNet Version 0.09 Alpha -- Codename: Mentos
33
</html>

0 commit comments

Comments
 (0)