$body = $_POST['body'];if (strlen($body) < 3) {
autolink($_SERVER['HTTP_REFERER'], 'Body too short');
} if ( ($MEMBERSONLY) && (($seeder == 'no' && $torrent['freeleech'] == 0)) ) {
SQL_Query_exec("INSERT INTO `snatched` (`uid`, `tid`, `stime`, `utime`) VALUES ('$userid', '$torrentid', '".gmtime()."', '".gmtime()."') ON DUPLICATE KEY UPDATE `utime` = '" . gmtime() . "'");
}&& $torrent['freeleech'] == 0 # View Pending Invited Users - Created by mjay
#======================================================================#
if ($action == "pendinginvitecode")
{
if ($do == "confirm")
{
if (!@count($_POST["users"])) show_error_msg(T_("ERROR"), "Rien de sélectionné.", 1);
$ids = array_map("intval", $_POST["users"]);
$ids = implode(", ", $ids);
// Add Email to sql
$res = SQL_Query_exec("SELECT u.id, u.invited_by, u.email, i.invitees FROM users u LEFT JOIN users i ON u.invited_by = i.id WHERE u.status = 'pending' AND u.invited_by != '0' AND u.id IN ($ids)");
while ($row = mysqli_fetch_assoc($res))
{
// confirm user
SQL_Query_exec("UPDATE `users` SET `status` = 'confirmed' WHERE `id` = '$row[id]'");
// Send mail
sendmail($row["email"], "Confirm", "Admin has confirmed", "", "-f".$site_config['SITEEMAIL']);
}
autolink("admincp.php?action=pendinginvitecode", "Entrées supprimées");
}
$count = get_row_count("users", "WHERE status = 'pending' AND invited_by != '0'");
list($pagertop, $pagerbottom, $limit) = pager(25, $count, 'admincp.php?action=pendinginvite&');
$res = SQL_Query_exec("SELECT u.id, u.username, u.email, u.added, u.invited_by, i.username as inviter FROM users u LEFT JOIN users i ON u.invited_by = i.id WHERE u.status = 'pending' AND u.invited_by != '0' ORDER BY u.added DESC $limit");
stdhead("Invited Pending Users");
#navmenu();
begin_frame("Utilisateurs en attente d'invitations");
?>
<center>
Cette page affiche tous les utilisateurs invités auxquels des invitations ont été envoyées mais qui n'ont pas encore été activées. En supprimant un utilisateur, l'invité recevra son invitation et toutes les données associées à l'invité seront supprimées. <hr class="barre"/><?php echo number_format($count); ?> les membres sont en attente.
</center>
<?php if ($count > 0): ?>
<br />
<form id="pendinginvite" method="post" action="admincp.php?action=pendinginvitecode">
<input type="hidden" name="do" value="confirm" />
<table border="0" cellpadding="3" cellspacing="0" width="100%" align="center" class="table_table">
<tr>
<th class="table_head">Pseudo</th>
<th class="table_head">E-mail</th>
<th class="table_head">Invité</th>
<th class="table_head">Invité Par..</th>
<th class="table_head"><input type="checkbox" name="checkall" onclick="checkAll(this.form.id);" /></th>
</tr>
<?php while ($row = mysqli_fetch_assoc($res)): ?>
<tr>
<td class="table_col1" align="center"><?php echo $row["username"]; ?></td>
<td class="table_col2" align="center"><?php echo $row["email"]; ?></td>
<td class="table_col1" align="center"><?php echo utc_to_tz($row["added"]); ?></td>
<td class="table_col2" align="center"><a href="account-details.php?id=<?php echo $row["invited_by"]; ?>"><?php echo $row["inviter"]; ?></a></td>
<td class="table_col1" align="center"><input type="checkbox" name="users[]" value="<?php echo $row["id"]; ?>" /></td>
</tr>
<?php endwhile; ?>
<tr>
<td colspan="5" align="right">
<input type="submit" value="confirm Les Cochés" />
</td>
</tr>
</table>
</form>
<?php
endif;
if ($count > 25) echo $pagerbottom;
end_frame();
navmenu();
stdfoot();
}
# View Pending Invited Users - Created by mjay
#======================================================================#
if ($action == "pendinginvitecode")
{
if ($do == "confirm")
{
if (!@count($_POST["users"])) show_error_msg(T_("ERROR"), "Rien de sélectionné.", 1);
$ids = array_map("intval", $_POST["users"]);
$ids = implode(", ", $ids);
$res = SQL_Query_exec("SELECT u.id, u.invited_by, i.invitees FROM users u LEFT JOIN users i ON u.invited_by = i.id WHERE u.status = 'pending' AND u.invited_by != '0' AND u.id IN ($ids)");
while ($row = mysqli_fetch_assoc($res))
{
SQL_Query_exec("UPDATE `users` SET `status` = 'confirmed' WHERE `id` = '$row[id]'");
}
autolink("admincp.php?action=pendinginvitecode", "Entrées supprimées");
}
$count = get_row_count("users", "WHERE status = 'pending' AND invited_by != '0'");
list($pagertop, $pagerbottom, $limit) = pager(25, $count, 'admincp.php?action=pendinginvite&');
$res = SQL_Query_exec("SELECT u.id, u.username, u.email, u.added, u.invited_by, i.username as inviter FROM users u LEFT JOIN users i ON u.invited_by = i.id WHERE u.status = 'pending' AND u.invited_by != '0' ORDER BY u.added DESC $limit");
stdhead("Invited Pending Users");
#navmenu();
begin_frame("Utilisateurs en attente d'invitations");
?>
<center>
Cette page affiche tous les utilisateurs invités auxquels des invitations ont été envoyées mais qui n'ont pas encore été activées. En supprimant un utilisateur, l'invité recevra son invitation et toutes les données associées à l'invité seront supprimées. <hr class="barre"/><?php echo number_format($count); ?> les membres sont en attente.
</center>
<?php if ($count > 0): ?>
<br />
<form id="pendinginvite" method="post" action="admincp.php?action=pendinginvitecode">
<input type="hidden" name="do" value="confirm" />
<table border="0" cellpadding="3" cellspacing="0" width="100%" align="center" class="table_table">
<tr>
<th class="table_head">Pseudo</th>
<th class="table_head">E-mail</th>
<th class="table_head">Invité</th>
<th class="table_head">Invité Par..</th>
<th class="table_head"><input type="checkbox" name="checkall" onclick="checkAll(this.form.id);" /></th>
</tr>
<?php while ($row = mysqli_fetch_assoc($res)): ?>
<tr>
<td class="table_col1" align="center"><?php echo $row["username"]; ?></td>
<td class="table_col2" align="center"><?php echo $row["email"]; ?></td>
<td class="table_col1" align="center"><?php echo utc_to_tz($row["added"]); ?></td>
<td class="table_col2" align="center"><a href="account-details.php?id=<?php echo $row["invited_by"]; ?>"><?php echo $row["inviter"]; ?></a></td>
<td class="table_col1" align="center"><input type="checkbox" name="users[]" value="<?php echo $row["id"]; ?>" /></td>
</tr>
<?php endwhile; ?>
<tr>
<td colspan="5" align="right">
<input type="submit" value="confirm Les Cochés" />
</td>
</tr>
</table>
</form>
<?php
endif;
if ($count > 25) echo $pagerbottom;
end_frame();
navmenu();
stdfoot();
}
CREATE TABLE `invites` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`inviter` int(10) unsigned NOT NULL DEFAULT '0',
`inviteid` int(10) NOT NULL DEFAULT '0',
`invite` varchar(32) COLLATE utf8_bin NOT NULL DEFAULT '',
`time_invited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`confirmed` char(3) COLLATE utf8_bin NOT NULL DEFAULT 'no',
PRIMARY KEY (`id`),
KEY `inviter` (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=182 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;<?php
// Get File
require_once "backend/functions.php";
require_once "backend/config.php";
// Get Functions
dbconn();
loggedinonly();
// Count Max Users
$users = get_row_count("users", "WHERE enabled = 'yes'");
if ($users >= $site_config["maxusers_invites"]) {
show_error_msg(T_("ERROR"), "Sorry, The current user account limit (" . number_format($site_config["maxusers_invites"]) . ") has been reached. Inactive accounts are pruned all the time, please check back again later...", 1);
}
// Form Submitted
$mail = $_POST['email'];
$code = $_POST['secretcode'];
$specailcode = $_POST['specialcode'];
$type = $_GET['type'];
// Delete Code
if ($type == 'del') {
SQL_Query_exec("DELETE FROM invites WHERE invite = '$_GET[invite]'");
SQL_Query_exec("UPDATE users SET invites = ($CURUSER[invites] +1 ) WHERE id = $CURUSER[id]");
autolink("invitecode.php", "deleted invite code");
die();
}
// Create Code
if (!empty($code)) {
// Get User ID
$id = 0 + $_GET["id"];
if ($id == 0) {
$id = $CURUSER["id"];
}
if (get_user_class() <= 6)
$id = $CURUSER["id"];
SQL_Query_exec("INSERT INTO invites (inviter, invite, time_invited) VALUES ('$id', '$code', '" . get_date_time() . "')");
SQL_Query_exec("UPDATE users SET invites = invites - 1 WHERE id = $id");
header("Refresh: 0; url=invitecode.php");
}
// Count Invites
$count = get_row_count("users", "WHERE invites > 0 AND id = $CURUSER[id]");
if ($count <= 0) {
show_error_msg(T_("ERROR"), "Vous avez aucune invitation!");
}
// create secret
$secret = mksecret();
$psecret = md5($secret);
// show page
stdhead("Invite");
begin_frame("Invites");
echo "<center>This is last code $psecret</center>";
print("<br /><center><a class=stylebouton href=invitetree.php>".T_("INVITE_TREE")."</a></center>"); //one small space here!
?>
<form method="post" action="invitecode.php">
<input type="hidden" name="secretcode" value="<?php echo $psecret ?>">
<input type="submit" value="Create Code">
</form>
<?php
$rul = get_row_count("invites", "WHERE inviter = $CURUSER[id]");
$rer = SQL_Query_exec("SELECT inviteid, invite, time_invited FROM invites WHERE inviter = $CURUSER[id] AND confirmed='no'");
$num1 = mysqli_num_rows($rer);
print("<table border=0 width=750 cellspacing=0 cellpadding=5>".
"<tr class=tabletitle><td class=table_head colspan=6><b>Statut actuel des codes créés</b> ($rul) <br/><font color=#B0FF30><b>NB</b></font>: <i>Signalez à vos invités que le code est valide pour 5 jours.</i></td></tr>");
if(!$num1){
print("<tr class=ttable_col1><td colspan=6><i><b>...Aucun code d'invitation créé pour le moment !</b></i></tr>");
} else {
print("<tr class=tableb><td class=table_head><b>".T_("CODE_INVITE_")."</b></td><td class=table_head><b>".T_("CREATED_DATE")."</b></td><td class=table_head><b>".T_("DELETE_INVITE")."</td></tr>");
for ($i = 0; $i < $num1; ++$i)
{
$arr1 = mysqli_fetch_assoc($rer);
print("<tr><td class=table_col1 align=center>$arr1[invite]</td><td class=table_col1 align=center>$arr1[time_invited]</td>");
//print("<td><input type=\"checkbox\" name=\"conusr[]\" value=\"" . $arr['id'] . "\" /></td></tr>");
print ("<td class=table_col2 align=center><a href=\"invitecode.php?invite=$arr1[invite]&type=del\"><img src='images/delete.png' alt='".T_("DELETE_INVITE")."' width='17' height='17' border='0' /></a></td></tr>");
}
}
print("</table><br/>");
end_frame();
stdfoot();<?php
require_once("backend/functions.php");
dbconn();
loggedinonly();
// FORM SUBMITTED
if ($_GET["take"]) {
$code = $_POST['secret'];
$secret = mksecret(20);
// Create User
$ret = SQL_Query_exec("INSERT INTO users (username, secret, email, status, invited_by, added, stylesheet, language) VALUES (".
implode(",", array_map("sqlesc", array($code, $code, $email, 'pending', $CURUSER["id"]))) . ",'" . get_date_time() . "', $site_config[default_theme], $site_config[default_language])");
// Update Inviter
$last_id = mysqli_insert_id($GLOBALS["DBconnector"]);
$invitees = "$id $CURUSER[invitees]";
SQL_Query_exec("UPDATE users SET invites = invites - 1, invitees='$invitees' WHERE id = $CURUSER[id]");
// Delete Invite
//SQL_Query_exec("DELETE FROM invites WHERE invite = $code");
autolink("account-signup.php?invite=$last_id&secret=$code", "Now Signup");
die;
}
// Show Page
stdhead(T_("activate"));
begin_frame(T_("activate"));
?>
<form method="post" action="activatecode.php?take=1">
<label for="secret">PLACE CODE:</label>
<input type="text" id="secret" name="secret">
<input type="submit">
</form>
<?php
end_frame();
stdfoot(); $res = SQL_Query_exec("SELECT id FROM users WHERE id = $_REQUEST[invite] AND MD5(secret) = ".sqlesc($_REQUEST["secret"])); $cutsecret = substr($_REQUEST["secret"], 0, 20);
$res = SQL_Query_exec("SELECT id FROM users WHERE id = $_REQUEST[invite] AND secret = ".sqlesc($cutsecret)); if (!$invite_row) {
show_error_msg(T_("ERROR"), T_("INVITE_ONLY_NOT_FOUND")." ".($site_config['signup_timeout']/86400)." days.", 1);
} $res = SQL_Query_exec("SELECT * FROM invites WHERE invite = ".sqlesc($_REQUEST["secret"]));
$invite_code = mysqli_fetch_assoc($res);
if (!$invite_code) {
show_error_msg(T_("ERROR"), T_("strange code are you sure"));
} else {
$invite_code = true;
}<?php if (!$invite_row) {?><?php if (!$invite_row || $invite_code) {?>$os = array(222, 333, 444, 555);<?php
require_once "backend/functions.php";
require_once "backend/config.php";
dbconn();
loggedinonly();
stdhead("Invite");
// submitted form
$mail = $_POST['email'];
$code = $_POST['secretcode'];
$specailcode = $_POST['specialcode'];
// create secret
$secret = mksecret();
$psecret = md5($secret);
// show page
begin_frame("Invites");
if (!empty($code)) {
echo "<center>This is old code $code</center>";
echo "<center>This is email $email</center>";
echo "<center>now we make user</center>";
// Maybe sell codes or give away
$os = array(222, 333, 444, 555);
if (in_array($specailcode, $os)) {
echo "<center>Great you used specail code $specailcode</center>";
}
}
echo "<center>This is last code $psecret</center>";
?>
<form method="post" action="invitecode.php">
email only - code automatic
<input type="hidden" name="secretcode" value="<?php echo $psecret ?>">
<label for="email">Email:</label>
<input type="email" id="email" name="email"><br><br>
code we buy try 222 or 333
<label for="specialcode">specialcode:</label>
<input type="number" id="specialcode" name="specialcode"><br><br>
<input type="submit" value="Submit">
</form>
<?php
end_frame();
stdfoot();$site_config[SITEURL]/account-signup.php?invite=$id&secret=$psecret$body = <<<EOD$site_config[SITEURL]/account-signup.php?invite=$id&code=$psecret//$site_config[SITEURL]/account-signup.php?invite=$id&secret=$psecret
//$site_config[SITEURL]/account-signup.php?invite=$id&secret=$psecret // need setting
$body = <<<EOD
You have been invited to $site_config[SITENAME] by $CURUSER[username]. They have specified this address ($email) as your email.
If you do not know this person, please ignore this email. Please do not reply.
Message:
-------------------------------------------------------------------------------
$mess
-------------------------------------------------------------------------------
This is a private site and you must agree to the rules before you can enter:
$site_config[SITEURL]/rules.php
$site_config[SITEURL]/faq.php
To confirm your invitation, you have to follow this link:
$site_config[SITEURL]/account-signup.php?invite=$id&code=$psecret$secret = mksecret();;$psecret = md5($secret);if ($_GET["take"]) {<form method="post" action="invite.php?take=1"><input type="hidden" name="code" value="$psecret" /><form method="post" action="invite.php?take=1">echo $psecret;if ($_GET["code"]) {
echo 'code is here we just need to do signup ';
die();
} autolink("admincp.php?action=confirmreg", "Entries Confirmed");
define('_OWNERS', array('M-jay')); // Example & with more define('_OWNERS', array('mjay', 'mjay', 'mjay'));