function blobFollowUser($toFollowUser) { $toFollow = blobGetUserID($toFollowUser); $follower = blobCurrentUser(); if (blobCanFollow($toFollowUser)) { $qry = "SELECT follow FROM `users` WHERE user='******';"; $result = @mysql_query($qry) or die('<pre>' . mysql_error() . '</pre>'); $row = mysql_fetch_assoc($result); $follow = $row["follow"] . "," . $toFollow; $qry = "UPDATE `users` SET follow='{$follow}' WHERE user='******';"; $result = @mysql_query($qry) or die('<pre>' . mysql_error() . '</pre>'); return "You are now following '{$toFollowUser}'!"; } else { if ($toFollowUser == $follower) { return "That's me!"; } else { return "You are already following '{$toFollowUser}'!"; } } }
$page['title'] .= $page['title_separator'] . 'View Profile'; $page['page_id'] = 'viewprofile'; blobDatabaseConnect(); $user = blobCurrentUser(); if (isset($_GET['user']) && $_GET['user'] != $user) { $user = $_GET['user']; //$user = mysql_real_escape_string($user); // Check if the user exists if (!blobExistUser($user)) { blobMessagePush("'" . $user . "' does not exist!"); blobRedirect('view.php'); } $fullName = blobGetUserFullName($user); $avatar = getAvatar($user); $followHTML = blobCanFollowHTML($user); if (blobCanFollow($user)) { $showStatusHTML = "<div id=\"comments_main\"><div id=\"comments\"><pre width=\"77\">You will be able to see his updates only if you follow the user!</pre> </div></div>"; } else { $showStatusHTML = blobShowUserStatus($user); } $page['body'] .= "\r\n<div class=\"body_padded\">\r\n\t<h2>User Profile: {$user}</h2>\r\n\r\n\t<div class=\"vulnerable_code_area\">\r\n\t\t<div style=\"float: left; padding-right: 10px; border-right: 2px solid #C0C0C0;\">\r\n\t\t\t<img src=\"{$avatar}\" width=\"100\" />\r\n\t\t</div>\r\n\t\t<div style=\"margin-left: 120px;\">\r\n\t\t\t{$fullName}\r\n\t\t\t<br /><br />\r\n\t\t\t{$followHTML}\r\n\t\t</div>\r\n\t</div>\r\n\r\n\t<div class=\"clear\"></div>\r\n\t<pre>User's status updates:</pre>\r\n\t{$showStatusHTML}\r\n\t<br /><br /><br />\r\n\r\n</div>\r\n"; } else { $user_id = blobGetUserID($user); $fullName = blobGetUserFullName($user); $avatar = getAvatar($user); $showStatusHTML = blobShowUserStatus($user); $profileUrl = BLOB_WEB_PAGE_TO_ROOT; $user = $user . " (that's me!)"; $page['body'] .= "\r\n<div class=\"body_padded\">\r\n\t<h2>User Profile: {$user}</h2>\r\n\r\n\t<div class=\"vulnerable_code_area\">\r\n\t\t<div style=\"float: left; padding-right: 10px; border-right: 2px solid #C0C0C0;\">\r\n\t\t\t<img src=\"{$avatar}\" width=\"100\" />\r\n\t\t</div>\r\n\t\t<div style=\"margin-left: 120px;\">\r\n\t\t\t{$fullName}\r\n\t\t\t<br /><br />\r\n\t\t\t<input class=\"button\" name=\"btnUpdate\" type=\"submit\" value=\"Update your status\" onclick=\"window.location='{$profileUrl}'\">\r\n\t\t</div>\r\n\t</div>\r\n\r\n\t<div class=\"clear\"></div>\r\n\t<pre>Your previous status updates:</pre>\r\n\t{$showStatusHTML}\r\n\t<br /><br /><br />\r\n\r\n</div>\r\n"; } blobHtmlEcho($page);