Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
fixed and commented on some of the potential sql injection vectors
- Loading branch information
Chris Hines
committed
Sep 4, 2014
1 parent
d89b26f
commit f8e4ecf
Showing
7 changed files
with
43 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,30 +1,26 @@ | ||
| <?php | ||
| if (isset($_COOKIE['session_auth'])) { | ||
| include "/data/klattr.com/www/includes/open_db"; | ||
| include "/data/klattr.com/www/includes/evaluate_cookie"; | ||
| $ip = $_SERVER['HTTP_X_REAL_IP']; | ||
| if ($ip == "") { | ||
| $ip = $_SERVER['REMOTE_ADDR']; | ||
| include "/data/klattr.com/www/includes/auth"; | ||
| if ($auth == 1) { | ||
| $profileText = $_POST["profileText"]; | ||
| $profileURL = $_POST["webAddress"]; | ||
| $senduname = $_POST["senduname"]; | ||
| if(strpos($profileURL, 'http') !== 0) { | ||
| $profileURL = "http://" . $profileURL; | ||
| } | ||
| $cookie_key = $_COOKIE['session_auth']; | ||
| $UID = evaluate_cookie($cookie_key, $ip); | ||
| if ($UID !== 0) { | ||
| $profileText = $_POST["profileText"]; | ||
| $profileURL = $_POST["webAddress"]; | ||
| $senduname = $_POST["senduname"]; | ||
| $profileText = htmlspecialchars($profileText); | ||
| $profileText = addslashes($profileText); | ||
| if(strpos($profileURL, 'http') !== 0) { | ||
| $profileURL = "http://" . $profileURL; | ||
| } | ||
| if(!filter_var($profileURL, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED)) { | ||
| $profileURL = ""; | ||
| } | ||
| $sql = "UPDATE Users SET Website_Addr='$profileURL', Profile_Text='$profileText' WHERE ID='$UID'"; | ||
| mysqli_query($con,$sql); | ||
| header( "Location: https://klattr.com/$senduname" ); | ||
| if(!filter_var($profileURL, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED)) { | ||
| $profileURL = ""; | ||
| } | ||
| } else { | ||
| /*Sanitize the vars that are going into the database*/ | ||
| $profileText = htmlspecialchars($profileText); | ||
| $profileText = addslashes($profileText); | ||
| $profileURL = htmlspecialchars($profileURL); | ||
| $profileURL = addslashes($profileURL); | ||
|
|
||
|
|
||
| $sql = "UPDATE Users SET Website_Addr='$profileURL', Profile_Text='$profileText' WHERE ID='$UID'"; | ||
| mysqli_query($con,$sql); | ||
| header( "Location: https://klattr.com/$senduname" ); | ||
| } else { | ||
| header( 'Location: https://klattr.com' ); | ||
| } | ||
| ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters