How many security holes do you see in this script (including variations), Count them up
Spoiler:
- Code: Select all
<?php
$ip = $_SERVER['REMOTE_ADDR'];
if(!empty($_SESSION['loggedin']) && !empty($_SESSION['username'])) // START THE IF LOGGED IN
{ // START THE IF LOGGED IN
$user_sess = $_SESSION['username'];
$user_4_forum = mysql_query("SELECT * FROM users WHERE username='".$user_sess."'") or die ("Error in query".mysql_error());
if (mysql_num_rows($user_4_forum) > 0)
{
while($row = mysql_fetch_array($user_4_forum))
{
$steamid = $row["steamid"];
$rank = $row["rank"];
$password = $row["password"];
$username = $row["username"];
}
}
// START RANK RECOGNIZATION QUERYS
if ($rank == 6)
{
$query = "(58, 0, 12, '', 0, '".$ip."', 1248375799, '".$username."', '".$username."', '".$password."', 1248375799, 0, 'you@yourdomain.com', 34944741818, '', 0, 1248375799, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'en', 0.00, 0, 'D M d, Y g:i a', 1, 0, 'FF0000', 0, 0, 0, 0, -3, 0, 0, 't', 'd', 0, 't', 'a', 0, 1, 0, 1, 1, 1, 1, 895, '', 0, 0, 0, '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'a00683416e0a8d25');";
}
if ($rank == 5)
{
$query = "(57, 0, 11, '', 0, '".$ip."', 1248375776, '".$username."', '".$username."', '".$password."', 1248375776, 0, 'you@yourdomain.com', 34944741818, '', 0, 1248375776, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'en', 0.00, 0, 'D M d, Y g:i a', 1, 0, '0000FF', 0, 0, 0, 0, -3, 0, 0, 't', 'd', 0, 't', 'a', 0, 1, 0, 1, 1, 1, 1, 895, '', 0, 0, 0, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '6e100d66ba0779ce'),";
}
if ($rank == 4)
{
$query = "(56, 0, 9, '', 0, '".$ip."', 1248375758, '".$username."', '".$username."', '".$password."', 1248375758, 0, 'you@yourdomain.com', 34944741818, '', 0, 1248375758, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'en', 0.00, 0, 'D M d, Y g:i a', 1, 0, '00CC00', 0, 0, 0, 0, -3, 0, 0, 't', 'd', 0, 't', 'a', 0, 1, 0, 1, 1, 1, 1, 895, '', 0, 0, 0, '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'e0e84cf08572428f'),";
}
if ($rank == 3)
{
$query = "(55, 0, 10, '', 0, '".$ip."', 1248375739, '".$username."', '".$username."', '".$password."', 1248375739, 0, 'you@yourdomain.com', 34944741818, '', 0, 1248375739, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'en', 0.00, 0, 'D M d, Y g:i a', 1, 0, '#60C', 0, 0, 0, 0, -3, 0, 0, 't', 'd', 0, 't', 'a', 0, 1, 0, 1, 1, 1, 1, 895, '', 0, 0, 0, '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'bd432b76a414888f'),";
}
if ($rank == 2)
{
$query = "(54, 0, 8, '', 0, '".$ip."', 1248375720, '".$username."', '".$username."', '".$password."', 1248375720, 0, 'you@yourdomain.com', 34944741818, '', 0, 1248375720, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'en', 0.00, 0, 'D M d, Y g:i a', 1, 0, '#F60', 0, 0, 0, 0, -3, 0, 0, 't', 'd', 0, 't', 'a', 0, 1, 0, 1, 1, 1, 1, 895, '', 0, 0, 0, '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'ea4c9f7344cd20fc'),";
}
if ($rank == 1)
{
$query = "(53, 0, 7, '', 0, '".$ip."', 1248375700, '".$username."', '".$username."', '".$password."', 1248375700, 0, 'you@yourdomain.com', 34944741818, '', 0, 1248375700, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'en', 0.00, 0, 'D M d, Y g:i a', 1, 0, '', 0, 0, 0, 0, -3, 0, 0, 't', 'd', 0, 't', 'a', 0, 1, 0, 1, 1, 1, 1, 895, '', 0, 0, 0, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '18418bd053f0a783')";
}
// END RANK RECOGNIZATION QUERYS
$checkusername = mysql_query("SELECT * FROM phpbb_users WHERE username = '".$user_sess."'");
if(mysql_num_rows($checkusername) == 1)
{
echo "You already exist on the forum";
}
else
{ // START IF USER DOESNT EXIST ON FORUM
//echo '<a href="'.$_SERVER['PHP_SELF'].'">Click here to activate your account on the forum</a>';
if(isset($_POST['submit']))
{ // START IF POST FOR FORUM ACTIVATION
$query_insert = "INSERT INTO `phpbb_users` (`user_id`, `user_type`, `group_id`, `user_permissions`, `user_perm_from`, `user_ip`, `user_regdate`, `username`, `username_clean`, `user_password`, `user_passchg`, `user_pass_convert`, `user_email`, `user_email_hash`, `user_birthday`, `user_lastvisit`, `user_lastmark`, `user_lastpost_time`, `user_lastpage`, `user_last_confirm_key`, `user_last_search`, `user_warnings`, `user_last_warning`, `user_login_attempts`, `user_inactive_reason`, `user_inactive_time`, `user_posts`, `user_lang`, `user_timezone`, `user_dst`, `user_dateformat`, `user_style`, `user_rank`, `user_colour`, `user_new_privmsg`, `user_unread_privmsg`, `user_last_privmsg`, `user_message_rules`, `user_full_folder`, `user_emailtime`, `user_topic_show_days`, `user_topic_sortby_type`, `user_topic_sortby_dir`, `user_post_show_days`, `user_post_sortby_type`, `user_post_sortby_dir`, `user_notify`, `user_notify_pm`, `user_notify_type`, `user_allow_pm`, `user_allow_viewonline`, `user_allow_viewemail`, `user_allow_massemail`, `user_options`, `user_avatar`, `user_avatar_type`, `user_avatar_width`, `user_avatar_height`, `user_sig`, `user_sig_bbcode_uid`, `user_sig_bbcode_bitfield`, `user_from`, `user_icq`, `user_aim`, `user_yim`, `user_msnm`, `user_jabber`, `user_website`, `user_occ`, `user_interests`, `user_actkey`, `user_newpasswd`, `user_form_salt`) VALUES";
mysql_query("".$query_insert." ".$query."") or die(mysql_error());
echo "Account Activated!";
} // END IF POST FOR FORUM ACTIVATION
else
{ // START IF NO SUBMIT
?>
<form action="<?php echo $PHP_SELF;?>" method="post" enctype="multipart/form-data" name="activate">
<input name="submit" type="submit" value="Click to activate your forum account">
</form>
<?php
} // END IF NO SUBMIT
} // END IF USER DOESNT EXIST ON FORUM
} // END IF IS LOGGED IN
else // START IF IS NOT LOGGED IN
{ // START IF IS NOT LOGGED IN
echo "You have to login to activate an account!";
} // END IF IS NOT LOGGED IN
?>








Proud member of the phpBB support team
STG Support team member
STG Moderator team member










I dont see anything wrong with it. 

