Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
Encrypt Email [TTv3]
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Mods in Progress

2019-07-04 16:13:59
Based on this http://www.torrenttrader.xyz/index.php?threads/v2-08-mods-completed-encrypting-emails-in-bdd.26/  so credit to original author.
just a few more things to test but i have this installed on my live site, members do need to update emails but looking at adding staff to be able to see old un-encrypted emails and maybe a account-recovery1.php to allow members to recover account with old un-encrypted emails.

Upload encrypt_email.php to backend

[color=rgb(251, 160, 38)]backend/config.php add[/color]
// email encrypt
$site_config["clef"] = 'AHIJKLMNOPQRSTUVWXYZabcde,;:!ยง#)nopqrstuvwxyz0123456789+@='; // change your key as you wish


[color=rgb(251, 160, 38)]backend/functions.php find[/color]
require_once(BACKEND."/languages.php");


add below
require_once($_SERVER["DOCUMENT_ROOT"]."/backend/encrypt_email.php");


[color=rgb(251, 160, 38)]account-ce.php find[/color]
$email = $_GET["email"];


add below
// encrypt email
$crypt = new Cryptage();
$clef = $site_config["clef"];


find
if ($md5 != md5($sec . $email . $sec))
   show_error_msg(T_("ERROR"), T_("NOTHING_FOUND"), 1);


add below
// encrypt email
$email = $crypt->b64encode($email, $clef);


[color=rgb(251, 160, 38)]account-details.php find[/color]
$modcomment = htmlspecialchars($user["modcomment"]);


add after
// email encrypt
$crypt = new Cryptage();
$clef = $site_config["clef"];
$mail = $crypt->b64decode($user[email], $clef);


find
print("<tr><td>".T_("EMAIL")."</td><td align='left'><input type='text' size='67' name='email' value=\"$user[email]\" /></td></tr>\n");


replace with
print("<tr><td>".T_("EMAIL")."</td><td align='left'><input type='text' size='67' name='email' value=\"$mail\" /></td></tr>\n");


[color=rgb(251, 160, 38)]account-recover.php[/color]
dbconn();


add after
// email encrypt
$crypt = new Cryptage();
$clef = $site_config["clef"];


find
        $res = SQL_Query_exec("SELECT id, username, email FROM users WHERE email=" . sqlesc($email) . " LIMIT 1");


replace with
// email encrypt
       $mail = $crypt->b64encode($email, $clef);
 
$res = SQL_Query_exec("SELECT id, username, email FROM users WHERE email=" . sqlesc($mail) . " LIMIT 1");


find
              $res2 = SQL_Query_exec("UPDATE `users` SET `secret` = ".sqlesc($sec)." WHERE `email`= ". sqlesc($email) ." LIMIT 1");


replace with
              $res2 = SQL_Query_exec("UPDATE `users` SET `secret` = ".sqlesc($sec)." WHERE `email`= ". sqlesc($mail) ." LIMIT 1");


[color=rgb(251, 160, 38)]account.php find[/color]
loggedinonly();


after add
// encrypt email
$crypt = new Cryptage();
$clef = $site_config["clef"];
$mail = $crypt->b64decode($CURUSER["email"], $clef);


find
    print("<tr><td align='right' class='alt2'><b>" . T_("EMAIL") . ":</b> </td><td align='left' class='alt2'><input type=\"text\" name=\"email\" size=\"50\" value=\"" . htmlspecialchars($CURUSER["email"]) .
     "\" /><br />\n<i>".T_("REPLY_TO_CONFIRM_EMAIL")."</i><br /></td></tr>");


replace with
    print("<tr><td align='right' class='alt2'><b>" . T_("EMAIL") . ":</b> </td><td align='left' class='alt2'><input type=\"text\" name=\"email\" size=\"50\" value=\"" . $mail . "\" /><br />\n<i>".T_("REPLY_TO_CONFIRM_EMAIL")."</i><br /></td></tr>");


find
if ($email != $CURUSER["email"]) {


replace with
if ($email != $mail) {


[color=rgb(251, 160, 38)]admin-modtask.php find[/color]
//continue updates


add after
// encrypt email
$crypt = new Cryptage();
   $clef = $site_config["clef"];
   $email = $crypt->b64encode($email, $clef);


[color=rgb(251, 160, 38)]account-signup.php find[/color]
dbconn();


add after
// email encrypt
$crypt = new Cryptage();
$clef = $site_config["clef"];


find
$maildomain = (substr($email, strpos($email, "@") + 1));

           $a = (@mysqli_fetch_row(@SQL_Query_exec("select count(*) from email_bans where mail_domain='$email'")));


replace with
// encrypt email
           $maildomain = (substr($email, strpos($email, "@") + 1));
$mail = $crypt->b64encode($email, $clef);
$maildomain = $crypt->b64encode($maildomain, $clef);
     
$a = (@mysqli_fetch_row(@SQL_Query_exec("select count(*) from email_bans where mail_domain='$mail'")));


find
$a = (@mysqli_fetch_row(@SQL_Query_exec("select count(*) from users where email='$email'")));


replace with
$a = (@mysqli_fetch_row(@SQL_Query_exec("select count(*) from users where email='$mail'")));


find
      implode(",", array_map("sqlesc", array($wantusername, $wantpassword, $secret, $email, $status, get_date_time(), get_date_time(), $age, $country, $gender, $client, $site_config["default_theme"], $site_config["default_language"], $signupclass, getip()))).")");


replace with
implode(",", array_map("sqlesc", array($wantusername, $wantpassword, $secret, $mail, $status, get_date_time(), get_date_time(), $age, $country, $gender, $client, $site_config["default_theme"], $site_config["default_language"], $signupclass, getip()))).")");


[color=rgb(251, 160, 38)]admincp.php & mass mail[/color]
still checking these
encrypt_email.zip
Download
2019-07-04 23:50:44
m-jay, there you make me happy the friend thank you very much and if I do not give you news, it will mean that it is # 1
2019-07-05 15:10:23
another edit for account-details
find
<b><?php echo T_("EMAIL"); ?>:</b> <?php echo $CURUSER["email"]; ?><br />


replace with
<b><?php echo T_("EMAIL"); ?>:</b> <?php echo $mail ; ?><br />


and for old sites we help the staff find
    print("<tr><td>".T_("EMAIL")."</td><td align='left'><input type='text' size='67' name='email' value=\"$mail\" /></td></tr>\n");


add after
    // old unencrypted email
   print("<tr><td><b><font size='3' color='#00cc00'>If you can not read email above please update with this</font></b></td></tr>\n");
   print("<tr><td> $user[email]</td></tr>\n"); // end


2019-07-05 20:22:45
"m-jay, post: 66771, member: 20288":

time(


it is in account this correction;) +
2019-07-06 03:20:17
ive noticed a few things recover is not working and invite is missing but we are close to complete

[color=rgb(251, 160, 38)]account-confirm.php (fix signup)[/color]
if ($md5 != md5($row["secret"]))


replace with
if ($md5 != $row["secret"])


[color=rgb(250, 197, 28)]edit[/color]
[color=rgb(251, 160, 38)]now fix account-recover find[/color]

@sendmail($arr["email"], T_("ACCOUNT_DETAILS"), $body, "", "-f".$site_config['SITEEMAIL']);


replace with
@sendmail($email, T_("ACCOUNT_DETAILS"), $body, "", "-f".$site_config['SITEEMAIL']);
2019-07-06 05:32:18
[color=rgb(251, 160, 38)]invite.php find[/color]
dbconn();


add below
// email encrypt
$crypt = new Cryptage();
$clef = $site_config["clef"];


find
    $maildomain = (substr($email, strpos($email, "@") + 1));            /*$maildomain = (substr($email, strpos($email, "@") + 1));
   $a = (@mysqli_fetch_row(@SQL_Query_exec("select count(*) from email_bans where mail_domain='$email'")));


replace with
    // encrypt email
   $maildomain = (substr($email, strpos($email, "@") + 1));
   $mail = $crypt->b64encode($email, $clef);
   $maildomain = $crypt->b64encode($maildomain, $clef);
   $a = (@mysqli_fetch_row(@SQL_Query_exec("select count(*) from email_bans where mail_domain='$mail'")));


find x 2
implode(",", array_map("sqlesc", array($username, $secret, $email,


replace with
implode(",", array_map("sqlesc", array($username, $secret, $mail,
Unknown User
2019-07-06 07:32:03
So it only encrypts mails inside account details and stuff, not into sql?
2019-07-06 08:01:29
yes its into database just need to finish admincp think ive got most of it


Unknown User
2019-07-06 08:29:53
"m-jay, post: 66848, member: 20288":

yes its into database just need to finish admincp think ive got most of it




I have changed login method email + password, would encryption disallow login?
2019-07-06 09:36:27
I think it would effect it, because you could login with old password but once you change it - to encrypt it when you try login again it would not recognise it, the only time emails effect members really is when there use account-recovery so for updating emails theres no big rush
So like the password hash I've added a back door (account-recovery1)  on my site which I'll close in time  but it might be possible to have two options on login page based on string lenght
2019-07-06 12:15:02
error in registration
Database Error in account-signup.php on line 145: Column count doesn't match value count at row 1. Query was: INSERT INTO users (username, password, secret, email, status, added, last_access, age, country, gender, client, stylesheet, uploaded, downloaded, language, invites, class, ip) VALUES ('test','20eabe5d64b0e216796e834f52d61fd0b70332fc','JVJWtwBWsW7w83qba9lR','uryytrrBvY63v8W/tL3BhLrHxg==','confirmed','2019-07-06 12:11:04','2019-07-06 12:11:04',50,5,'Homme','Utorrent',1,1,1,'9x.xxx.xxx.xxx').


Thanks ;)
2019-07-06 17:45:10
your query is little different try this line see if this works
        SQL_Query_exec("INSERT INTO users (username, password, secret, email, status, added, last_access, age, country, gender, client, stylesheet, language, class, ip) VALUES (" .       
    implode(",", array_map("sqlesc", array($wantusername, $wantpassword, $secret, $mail, $status, get_date_time(), get_date_time(), $age, $country, $gender, $client, $site_config["default_theme"], $site_config["default_language"], $signupclass, getip()))).")");


also this line should of been replaced so you can remove
$a = (@mysqli_fetch_row(@SQL_Query_exec("select count(*) from email_bans where mail_domain='$email'")));
2019-07-06 19:39:18
"m-jay, post: 66853, member: 20288":

your query is little different try this line see if this works
        SQL_Query_exec("INSERT INTO users (username, password, secret, email, status, added, last_access, age, country, gender, client, stylesheet, language, class, ip) VALUES (" .      
    implode(",", array_map("sqlesc", array($wantusername, $wantpassword, $secret, $mail, $status, get_date_time(), get_date_time(), $age, $country, $gender, $client, $site_config["default_theme"], $site_config["default_language"], $signupclass, getip()))).")");


also this line should of been replaced so you can remove
$a = (@mysqli_fetch_row(@SQL_Query_exec("select count(*) from email_bans where mail_domain='$email'")));


a big thank you, works # 1 (y)
2019-07-07 10:57:36
Error in torrents-details.php

I can no longer validate a change to a member account

My error:
Warning:  Use of undefined constant email - assumed 'email' (this will throw an Error in a future version of PHP) in /home/crazy/public_html/account-details.php on line 278 


thanks !
Unknown User
2019-07-07 12:36:20
lol you've posted torrents-details not account-details anyway
go to 278 and find

$mail = $crypt->b64decode($user[email], $clef);


change to


$mail = $crypt->b64decode($user['email'], $clef);


if thats not there on line 278 as i havent installed this mod
just put ' ' around
[email]
 like
 ['email'] 

that will sort out the error you posted on line 278
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 9
  • Members: 0
  • Guests online: 9
  • Comments: 3
  • Messages: 1,728