I run a dynamic PHP/MySQL membership website, and a competitor site has been constantly hacking us. I have a few backups, so thank fully I can restore the site to its normal state. But after I restore it they can still hack it very easily. I have checked through all my code and I cannot find any vulnerabilities. I suspected that they were using XSS, so I installed a script called html purifier. Still they were able to hack into the system. After they had hacked the system they were using the private message facility to send lots of abusive messages out using my username.
Here is some of the session coding:
I think they might be some how modifying the user sessions to impersonate our website staff. Some how they had managed to post over 300 messages onto the forums in under a minute, and I could not trace the ip address of the poster.
Any guidance/help would be really appreciated
Thank you.
Here is some of the session coding:
PHP Code:
<?php
session_start(); // Must start session first thing
// See if they are a logged in member by checking Session data
$toplinks = "";
if (isset($_SESSION['id'])) {
// Put stored session variables into local php variable
$userid = $_SESSION['id'];
$username = $_SESSION['username'];
$toplinks = '<a href="member_profile.php?id=' . $userid . '">' . $username . '</a> <BR/>
<a href="member_account.php">Account</a><BR/>
<a href="logout.php">Log Out</a>';
$image = $_SESSION['username'];
}
else {
echo"login please!";
/* Make sure that code below does not get executed when we redirect. */
exit;
}
?>
<?php
//Connect to the database through our include
include_once "connect_to_mysql.php";
// Query member data from the database and ready it for display
$sql = mysql_query("SELECT * FROM members WHERE id='$userid'");
while($row = mysql_fetch_array($sql)){
$country = $row["country"];
$state = $row["state"];
$city = $row["city"];
$team = $row["team"];
$avatarid = $row["avatarid"];
$accounttype = $row["accounttype"];
$bio = $row["bio"];
$level = $row["level"];
$wages = $row["wages"];
}
?>
Any guidance/help would be really appreciated

Thank you.
Comment