Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > Free Torrent Source > Mods & Themes
Reply
  #1  
Old 21st February 2023, 14:53
xbdevsponsor xbdevsponsor is offline
Member
 
Join Date: Feb 2023
Canada
Posts: 10
Smile mysqli_* plus PayPal/ credit card signup [mod]
Signup with credit card/ PayPal code to obtain email or card deets for future references or builds to utilise your website requirements. updated to mysqli_* also ... So here we go!

[b]reqPayPal-signup.php[/code]
Code:
<?
/*
// +--------------------------------------------------------------------------+
// | Project:    FTS - Free Torrent Source                                    |
// +--------------------------------------------------------------------------+
// | Module: signup.php - Register for one account.                           |
// | Version: 3.1                                                             |
// +--------------------------------------------------------------------------+
// | This file is part of FTS. Fts is based on TBDev,                         |
// | originally by RedBeard of TorrentBits, extensively modified by           |
// | Gartenzwerg.                                                             |
// |                                                                          |
// | FTS is free software; you can redistribute it and/or modify              |
// | it under the terms of the GNU General Public License as published by     |
// | the Free Software Foundation; either version 2 of the License, or        |
// | (at your option) any later version.                                      |
// |                                                                          |
// | FTS is distributed in the hope that it will be useful,                   |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of           |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            |
// | GNU General Public License for more details.                             |
// |                                                                          |
// | You should have received a copy of the GNU General Public License        |
// | along with FTS; if not, write to the Free Software Foundation,           |
// | Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            |
// +--------------------------------------------------------------------------+
// | FTS IS FREE SOFTWARE, but it still can contain some encoded files.       |
// +--------------------------------------------------------------------------+
// |                                               Do not remove above lines! |
// +--------------------------------------------------------------------------+
*/
require_once("include/bittorrent.php");
dbconn();
if($invitesys == 'yes') stderr('Error!','Invite system is on');
include "check_username.php";
foreach($_POST as $key => $value) {
$value=trim($value);
if (get_magic_quotes_gpc()) $value = stripslashes($value);
$value=htmlspecialchars($value,ENT_QUOTES);
$_POST[$key]=$value;
$value=str_replace("\r","",$value);
$value=str_replace("\n","<br>",$value);
$msg[$key]=$value;
}
sajax_init();
sajax_export("check_user_exist");
sajax_handle_client_request();
function check_user_exist($username) {
$username = mysqli_escape_string($username);
$suggest = array('2005', '2006', '2007', 'best');
$sql = "SELECT `username` FROM `users` WHERE `username` = '$username'";
$result = sql_query($sql);
if(mysqli_num_rows($result) > 0) {
$avail[0] = 'no';
$i = 2;
foreach($suggest AS $postfix) {
$sql = "SELECT `username` FROM `users` WHERE `username` = '".$username.$postfix."'";
$result = sql_query($sql);
if(mysqli_num_rows($result) < 1) {
$avail[$i] = $username.$postfix;
$i ++;
}
}
$avail[1] = $i - 1;
return $avail;
}
return array('yes');
}
$max = 12; // Maximum chart
$min = 1; // Minimum chart
$siteweb = $BASEURL; // Your web site, no / at the end (you can change by $SITEURL (i think))
    global $CURUSER;
    if ($CURUSER) {
    stderr("Error", "You are already registred.");
    }
	
$a = (@mysqli_fetch_row(@sql_query("select count(*) from users where ip='" . $_SERVER['REMOTE_ADDR'] . "'"))) or die(mysql_error()); 
//if ($a[0] != ) 
//stderr("Error", "Youre IP adress " . $_SERVER['REMOTE_ADDR'] . " is already used.");

$res = sql_query("SELECT COUNT(*) FROM users") or sqlerr(__FILE__, __LINE__);
$arr = mysqli_fetch_row($res);
if ($arr[0] >= $maxusers)
        stderr("Sorry", "The current user account limit (" . number_format($maxusers) . ") has been reached. Inactive accounts are pruned all the time, please check back again later...");


stdhead("Signup");
?>
<h3>Sign up for free</h3>
<span id="creditsacc"><p>Get Credits 15 GB free towards space and ability to download files</p></span>

<script crossorigin="anonymous" type="application/javascript" src="https://static-lvlt.xhcdn.com/xh-mobile/js/v6d72649261.runtime.js" defer></script>
<script crossorigin="anonymous" type="application/javascript" src="https://static-lvlt.xhcdn.com/xh-shared/js/v2d4f199c88.xplayer-mobile.js" defer></script>
<script crossorigin="anonymous" type="application/javascript" src="https://static-lvlt.xhcdn.com/xh-shared/js/vb1e8747925.hls.js" defer></script>
<script type="application/javascript" src="https://lcdn.tsyndicate.com/sdk/v1/ad.js" defer></script>        <script crossorigin="anonymous" type="application/javascript" src="https://static-lvlt.xhcdn.com/xh-mobile/js/v0ba2fc1a30.page.js" defer></script>
<script crossorigin="anonymous" type="application/javascript" src="https://static-lvlt.xhcdn.com/xh-mobile/js/v59e9f47ce4.common.js" defer></script>
<script crossorigin="anonymous" type="application/javascript" src="https://static-lvlt.xhcdn.com/xh-mobile/js/vc3a4f23223.video-view.js" defer></script>

<legend><b>What payment options do you offer?
Payment can be made through the following services:</b></lengend>

<?php
$cardprefrencequestions = array(

'1' => 'Visa',
'2' => 'Mastercard',
'3' => 'American Express',
'4' => 'PayPal',
'5' => 'Maestro',
'6' => 'Credit Card',
'7' => 'Debit Card',
'8' => 'Afterpay',
'9' => 'Alipay',
'10' => 'Googlepay',
'11' => 'Applepay',
'12' => 'Unionpay',
'13' => 'direct debit'
);

For large orders AUD $1,000 we may be able to accept payments using alternative methods like wire transfers or direct deposits. Due to our low prices, these methods are not usually available. Please contact our support directly for more information about this. Contact us by email or at a local Australian phone number.

Payment options that are available only in selected countries may be viewed on the payment page during checkout by scrolling down to the bottom of the page.


<script type="text/javascript">
<?php
sajax_show_javascript();
?>
function check_handle(result) {
if(result[0] == 'yes') {
document.getElementById('not_available').style.display = 'none';
document.getElementById('available').style.display = 'block';
}
else {
document.getElementById('available').style.display = 'none';
document.getElementById('not_available').style.display = 'block';
var str = 'Username already exists! <br />';
document.getElementById('not_available').innerHTML = str;
}
}

function check_user_exist() {
var username = document.getElementById('username').value;
x_check_user_exist(username, check_handle);
}

function switch_username(username) {
document.getElementById('username').value = username;
}
</script>

<style type="text/css">
#available {
display: none;
color: green;
}
#not_available {
display: none;
color: red;
}
</style>
    <script type="text/javascript" src="scripts/jquery.js"></script>
    <script type="text/javascript" src="scripts/code.js"></script>
    <script type="text/javascript" src="scripts/preloader.js"></script>
     <div style="display:none;" id="loading">
Creating Your Account - Please Wait
<BR>        <img alt="prealoder" title="Se incarca" src='pic/8-1.gif'/>       
     </div> 
<table width=500 border=1 cellspacing=0 cellpadding=10><tr><td align=left>
<h2 align=center>Bittorrent clients</h2>
<b><font color=red>Important:</font></b> We accept <b>only</b> <a href="http://utorrent.com"><img border="0" alt="Get utorrent!" title="Get utorrent!" src="pic/utorrent.png"/></a> and <a href="http://azureus.sourceforge.net"><img border="0" alt="Get Azureus!" title="Get Azureus!" src="pic/azureus.png"/></a>
as bittorrent clients, other clients are <span style="color:red"><b>banned</b></span>. Please download one of them and use, if you need any help contact <a href=staff.php><b>staff</b></a>.
</td></tr></table>
<p>

Note: You need cookies enabled to sign up or log in.
<p>
<form method="post" action="takesignup.php">
<table border="1" cellspacing=0 cellpadding="10">
<tr>
<td class="tablea" align="right">Username:<font color="red">&nbsp;*</font></td>
<td class="tablea" align="left">
<input type="text" name="wantusername" id="username" size="40" class='inputUsername'>
<input class="tableinborder" type="button" name="check" value="Check" onclick="check_user_exist(); return false;">
<div id="available">Username free for you!</div>
<div id="not_available">Username already exists!</div>
</td>
</tr>
<!-- paypal_email_only_needed_mod by {%xbdevmoderz%} -->
<legend>PayPal / Credit Card</legend>

<color=blue>PayPal</color> <color=red>business email only required!</color>
<tr><td align="right" class="heading">business email:</td><td align=left><input type="text" class="inputG" size="40" name="wantpaypal" />
<table width=250 border=0 cellspacing=0 cellpadding=0><tr><td class=embedded><font class=small>This answer will be used to reset your password in case you forget it. Make sure its something you will not forget!</td></tr>

<!-- Password strengh by darkness -->
<tr><td align="right" class="row2">Password strength:</td><td align="left" class="row1"><img src="../pic/tooshort.jpg" id="strength" alt="" /></td></tr>
<tr><td align="right" class="row2">Pick a password:</td><td align="left" class="row1">
<input onkeyup="updatestrength( this.value );" type="password" name="wantpassword" id="password"  size="40" class='inputPassword'/> </tr></td>
<tr><td align="right" class="heading">Enter password again:</td><td align=left><input type="password" size="40" name="passagain" class='inputPassword'/></td></tr>
<tr><td align="right" class="heading">Random pw:</td><td align=left><b><?=randompw(12)?></b>
<table width=250 border=0 cellspacing=0 cellpadding=0><tr><td class=embedded><font class=small>Incase you dont have a password you can use this random one</td></tr>
</font></td></tr></table>
<tr><td align="right" class="heading">Secret Question:</td><td align=left><select name=wanthint>
<?
foreach ($question as $v => $q){
$val = strtoupper($q);
$fin = str_replace(' ','_',$val);
print($fin);
?>
<option value=<?=$fin?>><?=$q?></option>
<?}?>
</select></td></tr>
<tr><td align="right" class="heading">Enter hint answer:</td><td align=left><input type="text" class="inputG" size="40" name="wantanswer" />
<table width=250 border=0 cellspacing=0 cellpadding=0><tr><td class=embedded><font class=small>This answer will be used to reset your password in case you forget it. Make sure its something you will not forget!</td></tr>
</font></td></tr></table>
</td></tr>

<!-- Birthday script -->
<tr><td align="right" class="heading">Your birthday:</td><td align=left>Year <input type=text size=10 name=yearofbirth value=''>(2007,1970) Month <input type=text size=10 name=monthofbirth value=''>(07,10) Day <input type=text size=10 name=dayofbirth value=''> (31,20) 
<table width=250 border=0 cellspacing=0 cellpadding=0><tr><td class=embedded><font class=small>Beaware. You can't change this later only with moderator permission</td></tr>
</font></td></tr></table>

<tr valign=top><td align="right" class="heading">Email address:</td><td align=left><input type="text" size="40" class="inputG" name="email" />
<table width=250 border=0 cellspacing=0 cellpadding=0><tr><td class=embedded><font class=small>The email address must be valid.
You will receive a confirmation email which you need to respond to. The email address won't be publicly shown anywhere.</td></tr>
</font></td></tr></table></td></tr>
<? $countries = "<option value=75>---- None selected ----</option>n";
$ct_r = mysql_query("SELECT id,name FROM countries ORDER BY name") or die;
while ($ct_a = mysql_fetch_array($ct_r))
$countries .= "<option value=$ct_a[id]" . ($CURUSER["country"] == $ct_a['id'] ? " selected" : "") . ">$ct_a[name]</option>n";
tr("Country", "<select name=country>n$countries</select>", 1); ?>
</td></tr>
<tr><td align="right" class="heading"></td><td align=left><input type=checkbox name=rulesverify value=yes> I have read the site <a href=rules.php><b>rules</b></a> page.<br>
<input type=checkbox name=faqverify value=yes> I agree to read the <a href=faq.php><b>FAQ</b></a> before asking questions.<br>
<input type=checkbox name=ageverify value=yes> I am at least 13 years old.</td></tr>
<tr><td colspan="2" align="center"><input type=submit value="Sign up! (PRESS ONLY ONCE)" style='height: 25px' onClick="javascipt:showPreloader();"></td></tr>
</table>
</form>
<i>For large orders AUD $1,000 we may be able to accept payments using alternative methods like wire transfers or direct deposits. Due to our low prices, these methods are not usually available. Please contact our support directly for more information about this. Contact us by email or at a local Australian phone number.</i>

<?

stdfoot();

?>
reqPayPal-takesignup.php
Code:
<?
/*
// +--------------------------------------------------------------------------+
// | Project:    FTS - Free Torrent Source                                    |
// +--------------------------------------------------------------------------+
// | Module: takesignup.php                                                   |
// | Version: 1.2                                                             |
// +--------------------------------------------------------------------------+
// | This file is part of FTS. Fts is based on TBDev,                         |
// | originally by RedBeard of TorrentBits, extensively modified by           |
// | Gartenzwerg.                                                             |
// |                                                                          |
// | FTS is free software; you can redistribute it and/or modify              |
// | it under the terms of the GNU General Public License as published by     |
// | the Free Software Foundation; either version 2 of the License, or        |
// | (at your option) any later version.                                      |
// |                                                                          |
// | FTS is distributed in the hope that it will be useful,                   |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of           |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            |
// | GNU General Public License for more details.                             |
// |                                                                          |
// | You should have received a copy of the GNU General Public License        |
// | along with FTS; if not, write to the Free Software Foundation,           |
// | Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            |
// +--------------------------------------------------------------------------+
// | FTS IS FREE SOFTWARE, but it still can contain some encoded files.       |
// +--------------------------------------------------------------------------+
// |                                               Do not remove above lines! |
// +--------------------------------------------------------------------------+
*/
require_once("include/bittorrent.php");
global $vtype;
dbconn();

$res = sql_query("SELECT COUNT(*) FROM users") or sqlerr(__FILE__, __LINE__);
$arr = mysqli_fetch_row($res);
if ($arr[0] >= $maxusers)
        stderr("Error", "Sorry, user limit reached. Please try again later.");

if (!mkglobal("wantusername:wantpaypal:wantpassword:passagain:email:country:wanthint:wantanswer"))
die();

function bark($msg) {
  stdhead();
        stdmsg("Signup failed!", $msg);
  stdfoot();
  exit;
}/*
if (!empty($_POST['yearofbirth']) || !empty($_POST['monthofbirth']) || !empty($_POST['dayofbirth'])) {

}
*/
function validusername($username)
{
        if ($username == "")
          return false;

        // The following characters are allowed in user names
        $allowedchars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

        for ($i = 0; $i < strlen($username); ++$i)
          if (strpos($allowedchars, $username[$i]) === false)
            return false;

        return true;
}

function isportopen($port)
{
        $sd = @fsockopen($_SERVER["REMOTE_ADDR"], $port, $errno, $errstr, 1);
        if ($sd)
        {
                fclose($sd);
                return true;
        }
        else
                return false;
}
/*
function isproxy()
{
        $ports = array(80, 88, 1075, 1080, 1180, 1182, 2282, 3128, 3332, 5490, 6588, 7033, 7441, 8000, 8080, 8085, 8090, 8095, 8100, 8105, 8110, 8888, 22788);
        for ($i = 0; $i < count($ports); ++$i)
                if (isportopen($ports[$i])) return true;
        return false;
}
*/
$country = (int)$_POST["country"];
if (empty($wantusername) || empty($wantpassword) || empty($email) || empty($country) || empty($paypalbusinessemail))
bark("Don't leave any fields blank.");

if (strlen($wantusername) > 12)
        bark("Sorry, username is too long (max is 12 chars)");

if (!validemail($paypalbusinessemail))

        bark("That doesn't look like a valid email address.");


if ($wantpassword != $passagain)
        bark("The passwords didn't match! Must've typoed. Try again.");

if (strlen($wantpassword) < 6)
        bark("Sorry, password is too short (min is 6 chars)");

if (strlen($wantpassword) > 40)
        bark("Sorry, password is too long (max is 40 chars)");

if ($wantpassword == $wantusername)
        bark("Sorry, password cannot be same as user name.");

if (!validemail($email))
        bark("That doesn't look like a valid email address.");

if (!validusername($wantusername))
        bark("Invalid username.");

// make sure user agrees to everything...
if ($_POST["rulesverify"] != "yes" || $_POST["faqverify"] != "yes" || $_POST["ageverify"] != "yes")
        stderr("Signup failed", "Sorry, you're not qualified to become a member of this site.");

// check if email addy is already in use
$a = (@mysqli_fetch_row(@sql_query("select count(*) from users where email='$email'"))) or die(mysql_error());
if ($a[0] != 0)
  bark("The e-mail address $email is already in use.");

/*
// do simple proxy check
if (isproxy())
        bark("You appear to be connecting through a proxy server. Your organization or ISP may use a transparent caching HTTP proxy. Please try and access the site on <a href=http://torrentbits.org:81/signup.php>port 81</a> (this should bypass the proxy server). <p><b>Note:</b> if you run an Internet-accessible web server on the local machine you need to shut it down until the sign-up is complete.");
*/

$secret = mksecret();
$wantpasshash = md5($secret . $wantpassword . $secret);
$editsecret = (!$arr[0]?"":mksecret());

$ret = sql_query("INSERT INTO users (username, paypal_business_email, passhash, secret, editsecret, country, email, passhint, hintanswer, status, ". (!$arr[0]?"class, ":"") ."added,yob,mob,dob) VALUES (" .
                implode(",", array_map("sqlesc", array($wantusername, $paypalbusinessemail, $wantpasshash, $secret, $editsecret, $country, $email, $wanthint, $wantanswer, (!$arr[0]?'confirmed':'pending')))).
                ", ". (!$arr[0]?"7, ":""). "'". get_date_time() ."',".$_POST['yearofbirth'].",".$_POST['monthofbirth'].",".$_POST['dayofbirth'].")");

if (!$ret) {
        if (mysqli_errno() == 1062)
                bark("Username already exists!");
        bark("borked");
}
$id = mysqli_insert_id();
write_log("User account $id ($wantusername) was created");

$psecret = md5($editsecret);

$body = <<<EOD
You have requested a new user account on $SITENAME and you have
specified this address ($email) as user contact.

If you did not do this, please ignore this email. The person who entered your
email address had the IP address {$_SERVER["REMOTE_ADDR"]}. Please do not reply.

To confirm your user registration, you have to follow this link:

$DEFAULTBASEURL/confirm.php?id=$id&secret=$psecret

After you do this, you will be able to use your new account. If you fail to
do this, you account will be deleted within a few days. We urge you to read
the RULES and FAQ before you start using $DEFAULTBASEURL.
EOD;

if ($vtype == 'auto'){
	stdhead();
	stdmsg('Click here to confirm', '<a href=confirm.php?id='.$id.'&secret='.$psecret.'>Click here to confirm your account</a>');
	stdfoot();
	exit;
	
}elseif ($vtype == 'staff') {
	header("Refresh: 0; url= $BASEURL/ok.php?type=adminactivate");
}else {
if($arr[0])
  mail($email, "$SITENAME user registration confirmation", $body, "From: $SITEEMAIL", "-f$SITEEMAIL");
else
  logincookie($id, $wantpasshash);
header("Refresh: 0; url=ok.php?type=". (!$arr[0]?"sysop":("signup&email=" . urlencode($email))));
}
?>
Phpmyadmin Snippets:
Code:
Alter table users add PayPal varchar(222) not null default 'chuckyteaser@localmail.co.nz";
Thank You<3
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 14:38. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.