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
Change Language MOD
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / v2.08 / v2.08 Mod Requests

Unknown User
2020-03-22 13:16:58
Hello i wont a mod to traslate website

here is my code!
<?php
//ExtremlymTorrents LANG PAGE TEST
require_once ("backend/functions.php");
require_once ("backend/bbcode.php");
dbconn(false);

loggedinonly();

stdhead("Change Language");




$ides = $_COOKIE["uid"];
$ps = $_COOKIE["pass"];

if($ac=="")
   {
begin_frame("Select you language");
       $rez = mysql_query("SELECT * from languages") or die;
       $num = mysql_num_rows($rez);

       for ($i=0; $i<$num; $i++)
           {
               $eile = mysql_fetch_array($rez);
               echo '<a href="changelanguage.php?ac=keisti&ids='.$eile["id"].'" method="POST">'.$eile["name"].'</a><BR>';
           }
   }

if($ac=="keisti" && $ids=="")
   {
       begin_frame("ERROR!!!");
       echo '<center><h3><b>KLAIDA!!!</b></h3></center>';
   }


   
if($ac=="keisti" && $ids!=="")
   {
       
   
   @mysql_query("UPDATE users SET language='$ids' WHERE id='$ides'") or die(mysql_error());
   begin_frame("Language changed");  
       echo 'Language changed';
   
   }
   
   

end_frame();
stdfoot();

?>



SQL

CREATE TABLE IF NOT EXISTS `languages` (
 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `uri` varchar(255) NOT NULL DEFAULT '',
 `name` varchar(64) NOT NULL DEFAULT '',
 PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=15 ;

--
-- Salvarea datelor din tabel `languages`
--

INSERT INTO `languages` (`id`, `uri`, `name`) VALUES
(1, 'english.lang', 'English / EN'),
(2, 'french.lang', 'French / FR'),
(3, 'spanish.lang', 'Spanish');


is not working but WHY?
i have the langs in the lang FOLDER !
Unknown User
2020-03-22 14:43:42
@mysql_query is the reason why it's not working.
Unknown User
2020-03-22 17:30:18
"shadows, post: 68204, member: 20311":

@mysql_query is the reason why it's not working.

Nope ! is changed the nr in users SQL the lang pack is not is in english.php
Unknown User
2020-03-22 22:42:01
This whole mod is TERRIBLE.

1. You CAN NOT use <a href="link" method="POST">
2. You CAN NOT use for loop with fetch inside.
3. This mod will NOT WORK on PHP 7+

Here is a simple rewrite from me: (Still, you shouldn't use this old torrent trader)

<?php
if (isset($_COOKIE['uid']) && isset($_COOKIE['pass']))
{

   /* @var $_COOKIE ['uid'] = $userid;
    * Change language for a currently logged user.
    * basic mod by shadows @ torrenttrader.xyz
    */

   begin_frame("Select your language");
   $stmt = mysql_query("SELECT *, COUNT (id) as 'found_languages' FROM languages");
   $row = mysql_fetch_assoc($stmt);

   if ($row && $row['found_languages'] > 0)
   {
       echo '<form method="post">';
       foreach ($row as $item)
       {
           echo '<input type="radio" name="language" value="' . $item['id'] . '">' . $item['name'] .'<br>';
       }
       echo '<input type="hidden" name="change_language" value="1">';
       echo '</form>';
   }

   if ($_SERVER['REQUEST_METHOD'] === 'POST')
   {
       if ($_POST['change_language'] == 1)
       {
           mysql_query("UPDATE users SET language = ".$_POST['language']." WHERE id = ".$_COOKIE["uid"]."");
           begin_frame("Language changed");
           echo 'Language changed';
       }
   }
}
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: 2
  • Members: 0
  • Guests online: 2
  • Comments: 3
  • Messages: 1,728