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
Bug Tracker
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / M-BiTsy / M-BiTsy Support

2021-05-22 05:27:52
fixed for next update and torrent import  :D
2021-05-22 09:25:13
it's good or not for Rtorrent?
2021-05-23 11:25:22
i dont know i can not test rtorrent
2021-05-28 17:03:41
When trying to import a user from the old database, there are many fields matching, but there are 2 that at this moment give me an error:

"title" field > which also gives me an error when editing from the front end, my title - If It Ain't Dutch, It Ain't Much - is for example not accepted.

>>  data to long for titles

The other error, has to do with the notification subscription for the torrent categories mod, which gives currently the following error

>> data to long for notifs which is the torrent cat notification thingy

Seedbonus Management >>

This page displays all available options trade which users can exchange for seedbonus 5
< a href="adminseedbonus/change&id=null">Add a new option?
If It Ain't Dutch, It Ain't Much!!
2021-05-28 17:17:51
Another option missing at this moment, but maybe you posted before is how to ask an imported member to change his or her password after the new site starts up with their account imported.

The password for our 47K accounts all use the old style password format.


If It Ain't Dutch, It Ain't Much!!
2021-05-28 18:20:13
Got 9 days off now so hoping to go through everything - if I do 6 sections a day won't be far off finished.

I'll sort password rehash out I have code posted somewhere
for db table you can send a export  of structure only (no data) and I'll have a look

Keep a note of any edits except theme, the login, blocks etc

fine tuning the staff panel so moving some things around

2021-05-28 18:23:58
Group Colour: for new groups...have the popup for color select ;-)

Ooooh, gonna LOAD YOU with IDEAS!!

The code at bootstrapdev is the one now at github.

Hope you will be able to implement the mods as well, for where you find them useful of course!

Ok...let me do an export of structure only this weekend.

If It Ain't Dutch, It Ain't Much!!
Last edited by Propaganda on 2021-05-28 18:26:12
2021-05-29 05:25:20
yes ill go through your structure and edits, like removing the <br> from blocks and adjust the main one so updating is easier  :thum
2021-06-06 10:43:30
Using latest code >>

- Typing in the staff shoutbox, shows up in the frontpage shoutbox
- How to create custom "card-header" and "card-body" for your login/recover/signup pages?
If It Ain't Dutch, It Ain't Much!!
2021-06-08 23:28:41
I solved this long ago. The login page in this MVC release, contains BCRYPT password hashing, but does not include the next step: Rehashing.

If this is a hot topic, I'll add solution code to login script from the GIT. I added support for this in our account class last year. Thousands of passwords have been rehashed, we forgot its even happening.

Ours looks like this ($row is your user table)


if (is_array($row)) {
           
           if (password_verify($passwd, $row['password'])) {
       
           /* Check if password needs rehashing, if so then continue  */
           if (password_needs_rehash(sha1($row['password']), PASSWORD_DEFAULT)) {
               
               /* Rehash existing password algorithm to BCRYPT and update */
               $newhash = password_hash($passwd, PASSWORD_BCRYPT);
               
try {
$stmt    = $pdo->prepare("UPDATE users SET password = ?, last_access = NOW(), last_login = NOW() WHERE user_id = ?");
$stmt->execute([$newhash, $row['user_id']]);
}
catch (PDOException $e) {

/* If there is a PDO exception, throw a STAccountsException exception. */
$STe = new STAccountsException($e);
$STe->setVarData(['query' => 'UPDATE users SET password = ?, last_access = NOW(), last_login = NOW() WHERE user_id = ?', 'values' => [$newhash, $row['user_id']]]);
throw $STe;
}
           }
           
}
2021-06-09 17:54:59
cheers Storrents ill play around with that.

Quote:
- How to create custom "card-header" and "card-body" for your login/recover/signup pages?


we will use app/controller/login for example find this
$this->view('user/login', $data, 'user');


that line sets up user page, if you change user to admin thats admin page setup
$this->view('user/login', $data, 'admin');


today we want this for custom style pages remove the last var to create blank page
$this->view('user/login', $data);



here is the template for login in app/views/user/login you will see no header or frame
        <div class="row justify-content-center">
       <form method="post" action="<?php echo URLROOT; ?>/login/submit" autocomplete="off">
       <input type="hidden" name="token" value="<?php echo Token::generate(); ?>" />
       <div class="form-group">
           <label for="username"><?php echo Lang::T("USERNAME"); ?></label>
           <input id="username" type="text" class="form-control" name="username" minlength="3" maxlength="25" required autofocus>
       </div>
       <div class="form-group">
       <label for="password"><?php echo Lang::T("PASSWORD"); ?></label>
       <input id="password" type="password" class="form-control" name="password" minlength="6" maxlength="16" required data-eye>
   </div>
       <div class="form-group">
           <?php (new Captcha)->html(); ?>
           <button type="submit" class="btn btn-warning btn-block"><?php echo Lang::T("LOGIN"); ?></button>
           <center><i><?php echo Lang::T("COOKIES"); ?></i></center>
</div>
       <div class="margin-top20 text-center">
           <a href="<?php echo URLROOT; ?>/signup"><?php echo Lang::T("SIGNUP"); ?></a> |
           <a href="<?php echo URLROOT; ?>/recover"><?php echo Lang::T("RECOVER_ACCOUNT"); ?></a>
</div>
       </form>
       </div>


so now we know how to call the template and where it is lets add some style look at top and bottom 2 lines we will call the style class

               Style::header($data['title']);
               Style::begin($data['title']);
       <div class="row justify-content-center">
       <form method="post" action="<?php echo URLROOT; ?>/login/submit" autocomplete="off">
       <input type="hidden" name="token" value="<?php echo Token::generate(); ?>" />
       <div class="form-group">
           <label for="username"><?php echo Lang::T("USERNAME"); ?></label>
           <input id="username" type="text" class="form-control" name="username" minlength="3" maxlength="25" required autofocus>
       </div>
       <div class="form-group">
       <label for="password"><?php echo Lang::T("PASSWORD"); ?></label>
       <input id="password" type="password" class="form-control" name="password" minlength="6" maxlength="16" required data-eye>
   </div>
       <div class="form-group">
           <?php (new Captcha)->html(); ?>
           <button type="submit" class="btn btn-warning btn-block"><?php echo Lang::T("LOGIN"); ?></button>
           <center><i><?php echo Lang::T("COOKIES"); ?></i></center>
</div>
       <div class="margin-top20 text-center">
           <a href="<?php echo URLROOT; ?>/signup"><?php echo Lang::T("SIGNUP"); ?></a> |
           <a href="<?php echo URLROOT; ?>/recover"><?php echo Lang::T("RECOVER_ACCOUNT"); ?></a>
</div>
       </form>
       </div>
               Style::end();
               Style::footer();


but that is standard style lets look at personal style - lets say you want login, signup, recover all the same lets make a U2 controller - create file U2.php and place in libraries

<?php
class U2
{
   public static function begin($caption = "-", $align = "justify")
   {
       $blockId = 'f-' . sha1($caption);
       ?>
       <div class="card">
           <div class="card-header">
               <?php echo $caption ?>
               <a data-toggle="collapse" href="#" class="showHide" id="<?php echo $blockId; ?>" style="float: right;"></a>
           </div>
           <div class="card-body slidingDiv<?php echo $blockId; ?>">
       <?php
   }
   
   public static function end()
   {
       ?>
           </div>
       </div>
       <?php
   }


now in templates just add this instead of Style::begin($data['title']); & Style::end();
                Style::header($data['title']);
               U2::begin($data['title']);
               // login template code
               U2::end();
               Style::footer();


github  has been updated again i made a few sql changes so i could run with strict mode make two backups one for safety and one to edit
for test site its best to export the database and make these changes

the agents table needs renaming to clients also the insert agents line although there should be no line if no clients are banned

and in reports table types request is now req  - changes to sql are here https://github.com/M-jay84/Torrent-Trader-MVC-PDO/commit/778ee695036e35c63bfb310561cb701e16e337c1

find datetime NOT NULL DEFAULT '0000-00-00 00:00:00'  
notice no  ;  at the end

replace all in file with
datetime DEFAULT NULL

search
'0000-00-00 00:00:00'  
notice no , at the end

replace all in file with
NULL
Last edited by M-jay warn on 2021-06-09 17:57:38
2021-06-09 20:14:56
Sounds like template inheritance by using traits. Very different from my system, themes are the only "TT old world" feature still at the core for some reason, I didn't let everything go.. lol
:unsure
2021-06-09 21:39:27
here is the controller with the view and model methods https://github.com/M-jay84/Torrent-Trader-MVC-PDO/blob/master/TorrentTraderMVC/app/libraries/Controller.php

this autoloads sql and templates, autoload for libraries then each page (class) extends this controller slimmed the code down by loads. Spent so much time moving stuff, changing my mind but finally everything's set just fine tuning.

The only big outstanding thing is the sql data i pass data to template like
        $data = [
           'title' => Lang::T("LOGIN")
       ];
       $this->view('user/login', $data, 'user');


i need to pass data as a big sql result array at the minute i still have some php code in the templates - forums is a good example you can see top line where i foreach the data query but then theres another, then another lol that should be in the model

The controller should call the model
Returning a big array
Then pass the big array to the template

Then instead of all that logic been in template  it would be a case of the template checking/counting array keys - if you have any thoughts on how to do that mate, this is one of the more complex ones

I was thinking of moving the full block of code to the model and typing out a array like this but maybe theres a better way
$bigdata[
    'lppostid' => $arr["id"],
    'topic_userid' = $topicarr["userid"],
    etc.............
]


    foreach ($data['topicsres'] as $topicarr) {
       $topicid = $topicarr["id"];
       $topic_userid = $topicarr["userid"];
       $locked = $topicarr["locked"] == "yes";
       $moved = $topicarr["moved"] == "yes";
       $sticky = $topicarr["sticky"] == "yes";
       //---- Get reply count
       $res = DB::run("SELECT COUNT(*) FROM forum_posts WHERE topicid=$topicid");
       $arr = $res->fetch(PDO::FETCH_LAZY);
       $posts = $arr[0];
       $replies = max(0, $posts - 1);
       //---- Get userID and date of last post
       $res = DB::run("SELECT * FROM forum_posts WHERE topicid=$topicid ORDER BY id DESC LIMIT 1");
       $arr = $res->fetch(PDO::FETCH_ASSOC);
       $lppostid = $arr["id"];
       $lpuserid = (int) $arr["userid"];
       $lpadded = TimeDate::utc_to_tz($arr["added"]);
       //------ Get name of last poster
       if ($lpuserid > 0) {
           $res = DB::run("SELECT * FROM users WHERE id=$lpuserid");
           if ($res->rowCount() == 1) {
               $arr = $res->fetch(PDO::FETCH_ASSOC);
               $lpusername = "<a href='" . URLROOT . "/profile?id=$lpuserid'>" . Users::coloredname($arr['username']) . "</a>";
           } else {
               $lpusername = "Deluser";
           }
       } else {
           $lpusername = "Deluser";
       }
       //------ Get author
       if ($topic_userid > 0) {
           $res = DB::run("SELECT username FROM users WHERE id=$topic_userid");
           if ($res->rowCount() == 1) {
               $arr = $res->fetch(PDO::FETCH_ASSOC);
               $lpauthor = "<a href='" . URLROOT . "/profile?id=$topic_userid'>" . Users::coloredname($arr['username']) . "</a>";
           } else {
               $lpauthor = "Deluser";
           }
       } else {
           $lpauthor = "Deluser";
       }
       // Topic Views
       $viewsq = DB::run("SELECT views FROM forum_topics WHERE id=$topicid");
       $viewsa = $viewsq->fetch(PDO::FETCH_LAZY);
       $views = $viewsa[0];
       // End
       //---- Print row
       if ($_SESSION) {
           $r = DB::run("SELECT lastpostread FROM forum_readposts WHERE userid=$_SESSION[id] AND topicid=$topicid");
           $a = $r->fetch(PDO::FETCH_LAZY);
       }
       $new = !$a || $lppostid > $a[0];
       $topicpic = ($locked ? ($new ? "folder_locked_new" : "folder_locked") : ($new ? "folder_new" : "folder"));
       $subject = ($sticky ? "<b>" . Lang::T("FORUMS_STICKY") . ": </b>" : "") . "<a href='" . URLROOT . "/topic?topicid=$topicid'><b>" .
       encodehtml(stripslashes($topicarr["subject"])) . "</b></a>$topicpages";
       ?>
2021-06-09 22:05:52
I've become really good with arrays, carrying skills I've learned from official hired freelancers. I can help here. Let me review the code and see if I can recommend a better way.
2021-06-09 22:14:02
I'll give you a solution for the LAZY params, you dont need to declare that every time.. let PHP decide. I'll share that shortly.

Now, for the iteration block. Im reviewing now.

Can you provide me the output of
print_r($data['topicsres'])


And to clarify, you want to push each query result set into the primary array that is pushed to a variable and called from the first block of code correct?

If so, we expect to adopt this code:


<?
$myarray1 = [];
foreach ($data['topicsres'] as $topicarr) {
   $data['topicid']      = $topicarr["id"];
   $data['topic_userid'] = $topicarr["userid"];
   $data['locked']       = $topicarr["locked"] == "yes";
   array_push($myarray1, $data);
}

print_r($myarray1);


Again, we need to get that print_r output.
Last edited by STorrents2020 on 2021-06-10 00:43:59
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: 1
  • Members: 0
  • Guests online: 1
  • Comments: 3
  • Messages: 1,728