File: /home/httpd/html/freecams1.com/public_html/includes/inc.add_friend.php
<?php
include('../mb.php');
if (!is_numeric($_GET[id])) {
exit();
}
?>
<html>
<head>
<style>
*,*::after,*::before {box-sizing:border-box;}
#cboxContent {display:block;font-size:14px;font-family:"Roboto",Arial;}
.notification {padding:10px;margin-bottom:20px;border:1px solid transparent;border-radius:4px;clear:both;font-size:15px;width:100%;}
.notification.info {background-color:#d9edf7;border-color:#bce8f1;color:#31708f;}
.notification.alert {background-color:#fcf8e3;border-color:#faebcc;color:#8a6d3b;}
.notification.success {background-color:#dff0d8;border-color:#d6e9c6;color:#3c763d;}
.notification p {margin-bottom:0;}
.form-item {display:flex;align-items:center;margin-bottom:10px;}
.form-item.-actions {justify-content:center;margin-top:20px;}
.form-item label {display:block;flex:0 0 120px;}
.form-item input[type="text"],.form-item input[type="email"],textarea,select{display:block;flex:1 0 0;height:34px;line-height:32px;padding:0 10px;border:1px solid gray;}
.form-item textarea {min-height:80px;resize:vertical;padding:10px;line-height:1.4;}
.form-item input[type="submit"] {display:block;padding:0 20px;height:34px;line-height:34px;background-color:#ff2024;color:#ffffff;border:0 none;cursor:pointer;}
.form-item input[type="submit"]:hover {background-color:#b90003;}
.captcha-wrapper {flex:1 0 0;display:flex;flex-flow:row nowrap;}
.captcha-wrapper img {height:34px;flex:0 0 auto;margin-right:10px;}
.captcha-wrapper input[type="text"] {flex:1 0 0;}
</style>
</head>
<body>
<div id="cboxContent">
<div class="layer" style="text-align:center;">
<?php
if (!$_SESSION[userid]) {
echo setMessage(_t('You must be logged in to send friend request to user.'), 'alert', true);
exit();
}
if ($_GET[id] == $_SESSION[userid]) {
echo setMessage(_t('You can not be friend with yourself.'), 'alert', true);
exit();
}
if ($_POST) {
dbQuery("INSERT INTO friends VALUES('{$_SESSION['userid']}','{$_GET['id']}','0','" . date('Y-m-d H:i:s', time()) . "','" . mysqli_real_escape_string($dbconn, htmlentities($_POST[message])) . "',NULL)");
echo setMessage(_t('Your friend request was sent correctly.'), 'success', true);
sendEmail('friend-request', $_GET['id']);
exit();
}
$friendship = dbQuery("SELECT approved FROM friends WHERE user = $_SESSION[userid] AND friend = $_GET[id]", false);
if (is_array($friendship)) {
if ($friendship[0]['approved'] == 0) {
echo setMessage(_t('You already sent friend request to this user.'), 'info', true);
exit();
} else {
echo setMessage(_t('You already are friends with this user.'), 'info', true);
exit();
}
} else {
?>
<form action="" method="post">
<div class="form-item">
<textarea class="form-control" name="message"><?php echo _t("Hello, it's"); ?> <?php echo $_SESSION['username']; ?>. <?php echo _t("I want to add you as my friend at"); ?> <?php echo $sitename; ?>.</textarea><br />
</div>
<div class="form-item -actions">
<input type="submit" name="send" value="<?php echo _t("Send Friend Request"); ?>" class="btn btn-default"/>
</div>
</form>
<?php } ?>
</div>
</div>
</body>
</html>