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
User Posts

Go to Profile

My own theme has struggled with this too, but its well responsive.. its more the side content I want positioned on say, an iPad - but over time its become fixed up and fluid. I use .mobile-only to hide content I don't want on mobile, but the other way around isn't so easy.

I should test the default theme on a local run, and see what comes up. The majority of the default theme is relying on tables, so that alone makes it a lot easier and reliable to make responsive than a cluster mess of <div> all over. Thats when you need to rule out child, parent and notate a lot of your classes in CSS (joining classes or IDs), but it generally comes down to the viewport and the CSS.
Throw me any JS or CS work and ill turn the cogs.
This can be achieved to be responsive in pure CSS, further complying across all modern browsers with some hand work. The only selector to focus on would be the viewport css max-width 100% and respective meta tag. There are table classes that can be assigned by adding a responsive class to a table tag, and it will take care of the responsiveness automatically, lesaving very little work for existing TT table markup (anywhere </table>, etc)

Where exactly is the menu causing you issues? Or is stock not mobile?
"spiritblue, post: 68515, member: 401":

no,  the beginning of your page with <? is written without php
for the file of the name of ajax_checkusername.php :)
[ATTACH=full]5499[/ATTACH]


just personal preference, the last mod I posted I’ve corrected all tags before post
You don’t need it, It just looks good. Completely optional. Just adjust your field input style, that should do it
"spiritblue, post: 68512, member: 401":

Question:
why your page entry is not in ?
Example(ajax_checkusername.php):  <? php


On live site?
"m-jay, post: 68509, member: 20288":

no errors in log which is a good sign but not displaying right, inputs are just empty pages
seems around this
<div id="shoutbox" class="response"></div>
[ATTACH type="full" alt="Untitled.png"]5494[/ATTACH]

thought it might be paths but i see you used absolute paths for js did you come across this in development


Sorry, my mistake. I use [color=rgb(226, 80, 65)]height: 4px[/color] due to a responsive form plugin that acts up.

In HTML find:
<input type="text" class="shoutbox-input" name="message" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" id="shout-label" placeholder="Type something here..." maxlength="150" style="height:4px;font-size:16px" />


Replace with:
<input type="text" class="shoutbox-input" name="message" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" id="shout-label" placeholder="Type something here..." maxlength="150" style="font-size:16px" />


So how it works, is the AJAX call retrieves [color=rgb(0, 168, 133)]item.[/color][color=rgb(226, 80, 65)]<value>[/color] as objects through JSON array, if you go to url directly you can see the array data, this makes it really easy to test what is coming in from the database or not, and you use them line by line as you have set in the php script, which attaches to the DIV response class, and so their objects that are wrapped in span tags, you can use any HTML in there as long as you use the right line formatting for items like

html_to_append +=
                       [color=rgb(226, 80, 65)]'[/color]<div>Maybe text here</div>[color=rgb(226, 80, 65)]' +[/color]
                       [color=rgb(41, 105, 176)]item[/color][color=rgb(226, 80, 65)].date[/color][color=rgb(41, 105, 176)] +[/color]
                      [color=rgb(226, 80, 65)]'[/color]<div>More HTML</div>[color=rgb(226, 80, 65)]' +[/color]
[color=rgb(41, 105, 176)]                       item[/color][color=rgb(226, 80, 65)].avatar[/color][color=rgb(41, 105, 176)] + [/color]


And whatever is going on in there will be output to
<div id="shoutbox" class="response"></div>


You can plug any object in as long as you've set it up in the PHP script (query & bindvalues)
Here I have today what I rewrote from ground up, no longer using any existing code, previously was shout.php but as AJAX took off in the quest to replace that old bugger, I've brought the script up to speed.
No SQL is changed or needed, it uses the existing tables as they are, so hold on to existing shout data so you get a better view of the mod first impression.

So I didn't know where to go for instructions for adding in the markup for stock V3, so I'll leave that up to you. You know your theme.

[color=rgb(226, 80, 65)]* Be sure to update database details in both AJAX scripts in [/color][color=rgb(226, 80, 65)]/ajax/[/color]

Open /themes/default/header.php and add:


<!-- jQuery.min 1.11.1 -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- jQuery.Timeago 1.6.7 -->
<script src="<?php echo $site_config["SITEURL"]; ?>/themes/js/jquery-timeago-1.6.7/jquery.timeago.js"></script>

<!-- CodyHouse Forms Plugin -->
<link rel="stylesheet" href="<?php echo $site_config["SITEURL"]; ?>/js/codyhouse-forms/js/css/reset.css"> <!-- CSS reset -->
<link rel="stylesheet" href="<?php echo $site_config["SITEURL"]; ?>/js/codyhouse-forms/css/style.css"> <!-- Resource style -->
<script src="<?php echo $site_config["SITEURL"]; ?>/js/codyhouse-forms/js/modernizr.js"></script> <!-- Modernizr -->

<script>
function fetchNewShouts() {
   $(document).ready(function () {
       $.ajax({
           url: "/ajax/ajax_shoutbox_get.php",
           method: "GET",
           dataType: 'JSON',
           success: function (data) {
               var html_to_append = '';
               $.each(data, function (i, item) {
                   html_to_append +=
                       '<div class="shoutbox-container"><span class="shoutDate">' +
                       jQuery.timeago(item.date) +
                       ' <span style="color:#b3b3b3">ago</span></span><span class="shoutUser"><img src="' +
                       item.avatar +
                       '" class="shout-avatar" /></span><span class="shoutText">' +
                       item.message +
                       '</span></div><br>';
               });
               $("#shoutbox").html(html_to_append);
               $(".shoutbox-container").filter(function () {
                   return $(this).children().length == 3;
               }).filter(':odd').addClass('shoutbox_alt');
               $(".shoutbox-container").each(function () {
                   $(this).parent().nextAll().slice(0, this.rowSpan - 1).addClass('shoutbox_alt');
               });

           }
       });
   });
}
fetchNewShouts();
setInterval(function () {
   fetchNewShouts()
}, 10000);

// AJAX Shoutbox - POST
$(document).ready(function (e) {
   $("#form-shoutbox").on('submit', (function (e) {
       e.preventDefault();
       $.ajax({
           url: "/ajax/ajax_shoutbox_post.php",
           type: "POST",
           data: new FormData(this),
           contentType: false,
           cache: false,
           processData: false,
           beforeSend: function () {
               $("#posting").html("Posting...").delay(3000).fadeIn().delay(4000).fadeOut();
               $("#posting").fadeIn();
               $("#err").fadeOut();
           },
           success: function (data) {
               if (data == 'invalid') {
                   // Invalid data
                   $("#err").html("Invalid data").fadeIn();
               } else {
                   // Update shoutbox posts after post
                   $("#refresh-posts").html(data).fadeIn(); // Update element
                   $("#posting").html("Posted!").delay(2000).fadeIn().delay(1000).fadeOut();
               }
           },
           error: function (e) {
               $("#err").html(e).fadeIn();
           }
       });
   }));
});
$('.shoutbox-input').keypress(function (e) {
   //e.preventDefault();
   if (e.which == 13) {
       $('#form-shoutbox').submit();
       $("#form-shoutbox")[0].reset();
       return false;
   }
});
</script>


Open /themes/default/theme.css and add:


.shoutbox-container:nth-child(odd) { /* CSS-way of row backgrounds, no plugin needed ;) */
   margin-top: -10px;
   padding-top:3px
}
.shoutbox-container:nth-child(odd) { /* CSS-way of row backgrounds, no plugin needed ;) */
   margin-bottom: -12px;
}
.shoutDate, .shoutEdit, .shoutUser, .shoutText {
   display: table-cell;
   padding-top: 3px;
   padding-left: 20px;
   text-align: left;
   vertical-align: middle
}
.shoutText {
   width: 533px /* layout fix */
}
.shoutAlt {
   background: #FFF;
   padding: 5px
}
.shoutbox_alt {
   background: #ECECEC
}
.shoutbox_noalt {
   background: #FFF;
}
.shout-avatar {
   width: 45px;
   height: 45px;
   border-radius: 50%
}
.shoutbox-form-container {
   padding: 7px;
   width: 70%;
   position: relative
}
.response {
   padding-top: 11px
}


Create /ajax/ajax_shoutbox_post.php


<?php
// AJAX Shoutbox - POST
$dbHost     = "localhost";
$dbUsername = "username";
$dbPassword = "password";
$dbName     = "database";
if (isset($_POST['message'], $_POST['id'])) {
   $username = $_POST['username'];
   $userid   = $_POST['id'];
   $message  = $_POST['message'];
   $sql      = 'INSERT INTO shoutbox (msgid, user, message, date, userid) ';
   $sql .= ' VALUES (NULL, :username, :message, NOW(), :userid)';
   try {
       $db = new PDO("mysql:host={$dbHost};dbname={$dbName};charset=utf8", $dbUsername, $dbPassword);
       $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); // Prevent advanced injection by disabling emulated prepared statements
       $query = $db->prepare($sql);
       $query->bindValue(':username', $username, PDO::PARAM_STR);
       $query->bindValue(':userid', $userid, PDO::PARAM_STR);
       $query->bindValue(':message', $message, PDO::PARAM_STR);
       if ($query->execute()) {
           //echo "test";
       }
       die();
   }
   catch (Exception $e) {
       echo $e->getMessage();
   }
}
?>


Create /ajax/ajax_shoutbox_get.php


<?php
// AJAX Shoutbox - GET
$dbHost     = "localhost";
$dbUsername = "username";
$dbPassword = "password";
$dbName     = "database";
try {
   $conn = new PDO("mysql:host={$dbHost};dbname={$dbName};charset=utf8", $dbUsername, $dbPassword);
   $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
   $conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); // Prevent advanced injection by disabling emulated prepared statements
}
catch (PDOException $e) {
   die('Unable to connect to database');
}
$limit = 6;
$stmt = $conn->prepare("SELECT shoutbox.msgid, shoutbox.userid, shoutbox.user, shoutbox.message, shoutbox.date, users.avatar FROM shoutbox LEFT JOIN users ON shoutbox.user = users.username ORDER BY msgid DESC LIMIT :datalimit");
$stmt->bindParam(":datalimit", $limit, PDO::PARAM_INT);
$stmt->execute();
$userData = array();
if ($stmt->rowCount() > 0) {
   $usersactive = $stmt->fetchAll(PDO::FETCH_ASSOC);
   foreach ($usersactive as $row => $data) {
       $data['id']            = $row['msgid'];
       $data['value']      = $row['message'];
       $data['avatar']    = $row['avatar'];
       $data['user']       = $row['user'];
       $data['userid']    = $row['userid'];
       $data['date']       = $row['date'];
       array_push($userData, $usersactive);
   }
}
echo json_encode($usersactive, JSON_UNESCAPED_SLASHES);
?>


Now upload jQuery.timeago.js from ZIP to /themes/default/js/

This is the HTML block. You can add this anywhere on your site.


<div id="shoutbox" class="response"></div>

<div class="shoutbox-form-container">

   <form class="cd-form floating-labels" name="shoutboxform" id="form-shoutbox" action="/ajax/ajax_shoutbox_post.php" method="post">
       <label class="cd-label" for="shout-label">
           <i class="material-icons" style="color:rgba(46,168,4,1);vertical-align:middle">textsms</i> @
           <span style="color:#252525;font-size:22px" id="posting"><? echo $site_config['SITENAME']; ?></span>
       </label>

       <input type="text" class="shoutbox-input" name="message" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" id="shout-label" placeholder="Type something..." maxlength="200" style="height:4px;font-size:16px" />
       <div style="position:absolute;bottom:25px;left:280px">
           <a href="javascript:PopMoreSmiles();"><img src="/images/smilies/grin.png" style="vertical-align:middle;margin-left:10px" /></a>
           <a href="javascript:PopMoreSmiles();"><img src="/images/smilies/razz.png" style="vertical-align:middle;margin-left:10px" /></a>
           <a href="javascript:PopMoreSmiles();"><img src="/images/smilies/confused.png" style="vertical-align:middle;margin-left:10px" /></a>
           <a href="javascript:PopMoreSmiles();"><img src="/images/smilies/cool.png" style="vertical-align:middle;margin-left:10px" /></a>
           <a href="javascript:PopMoreSmiles();"><img src="/images/smilies/grin.png" style="vertical-align:middle;margin-left:10px" /></a>
       </div>
       <input type="hidden" name="id" value="<? echo $CURUSER[" id "]; ?>" required />
       <input type="hidden" name="username" value="<? echo $CURUSER[" username "]; ?>" required />

   </form>

</div>


That's it, enjoy!

[ATTACH type="full" width="633px" alt="ST-AJAX-Shoutbox.png"]5493[/ATTACH]

It auto refreshes every 10 seconds dynamically. You won't even notice. Press ENTER to post.
"spiritblue, post: 68504, member: 401":

I wanted a picture of the result


/PM
"MicroMonkey, post: 68459, member: 311":

This is pretty cool. I didnt create this, just found it and tried it. Try this. Functions.php
add this function
///ELAPSED TIME SINCE TORRENT WAS UPLOADED
function get_time_elapsed($datetime, $full = false)
{
   $now = new DateTime;
   $ago = new DateTime($datetime);
   $diff = $now->diff($ago);
   $diff->w = floor($diff->d / 7);
   $diff->d -= $diff->w * 7;
   $string = array(
       'y' => 'year',
       'm' => 'month',
       'w' => 'week',
       'd' => 'day',
       'h' => 'hour',
       'i' => 'minute',
       's' => 'second',
   );
   foreach ($string as $k => &$v)
   {
       if ($diff->$k)
       {
           $v = $diff->$k . ' ' . $v . ($diff->$k > 1 ? 's' : '');
       }
       else
       {
           unset($string[$k]);
    }
   }
   if (!$full) $string = array_slice($string, 0, 1);
   return $string ? implode(', ', $string) . ' ago' : 'just now';
}
///END ELAPSE TIME

find
            case 'added':
               print("<td class='ttable_col$x' align='center'>".date("n-d-Y g:i a", utc_to_tz_time($row['added']))."</td>");
           break;

change to (I keep old code commented out in case there is a need to revert back)
            case 'added':
           //    print("<td class='ttable_col$x' align='center'>".date("n-d-Y g:i a", utc_to_tz_time($row['added']))."</td>");
               print("<td class='ttable_col$x' align='center'>".get_time_elapsed($row['added'])."</td>");
           break;

[ATTACH type="full" alt="Capture.PNG"]5476[/ATTACH]


You can add DOM events that allow a click on that IMBD image and present a small dynamic box or "theatre mode" to preview the trailer
I added this post a little while ago, its time_ago() - is this not stock in functions.php? It binds all those functions together. I use it across the board, its a big saver!


function time_ago($addtime) {
  $addtime = get_elapsed_time(sql_timestamp_to_unix_timestamp($addtime));
  return $addtime;
}


Usage:
echo time_ago($row["date"]);
What's happening in the first post is PHP 7 is installed, which no longer caries the old mysql module since PHP 7.0. It was on its way out when PHP 5 was released - So /backend/functions.php ~ line 57

function_exists("mysql_connect") or die("MySQL support not available.");


mysql_connect => removed in PHP 7. Replace with mysqli_connect to retain connection compatibility (assuming code is updated).

Looks to me like you set up a wildcard % in place of a IP for your user. That typically, allows all connections locally (or remotely with bind-networking disabled), but due to different policies between database releases/versions, its best to use the servers IP, dynamic IP at home or Static if available. In this case, lets try..

Grant user privileges on localhost (PHP, client, CLI, etc):
GRANT ALL PRIVILEGES ON *.* TO ‘velvetunderground_bett'@'localhost’ IDENTIFIED BY 'YOUR-PASSWORD' WITH GRANT OPTION;


Now, set password to user:
SET PASSWORD FOR ‘velvetunderground_bett’@‘localhost’ = PASSWORD('YOUR-PASSWORD');


We are granting user and connection privileges for tovelvetunderground_bett on localhost.

If you want to use a IP, you perform the same two queries, replacing localhost with your IP. You can make a range if running from home, for example 192.168.0.%
That means, grant access to ALL users on that modem VPN, or whatever since their IP covers what is covered in that wildcard. In this case you want to comment out #bind-networking in my.cnf
"spiritblue, post: 68499, member: 401":

hi STorrents2020

first a big thank you for this hack and you can see the result on an image?

Thanks you!


No worries! It was a quick put together and did the job well. You can update it to retrieve the matched row data for which user exists already in db, is that what you need? :alien:
Thats funny, shadows.. I literally just realized that too and went to work at it, working! The work is now in /controllers/Accountlogin.php

We were not far off! lol


public function index()
   {
       dbconn();
       // add globals
       global $site_config, $CURUSER;

       $username = $_POST['username'] ?? false;
       $user_password = $_POST['password'] ?? false;
       $message = '';

       if ($username && $user_password) { // form not empty, continue

           $password = $user_password;
           // called model method/function
           $row = $this->userModel->getUserByUsername($username);
         
   if (password_needs_rehash($row["password"], PASSWORD_BCRYPT, array(
       "cost" => 7
   ))) {
       $hash = password_hash($row["page"], PASSWORD_BCRYPT, array(
           "cost" => 7
       ));

       // Update new hash
       $stmt = DB::run("UPDATE users SET page=? WHERE id=?", [$hash, $row['id']]);
   }
Bit of a chat with m-jay, I got this far last night in handling SHA1 => BCrypt rehashing however, as silly as it is.. I can not get the user ID or cookie UID? Over 10K members locked out until this is working. Once we turn back on the SQL fetch, it refuses to execute and complains all about the query with little to go off of.

What it does: Checks if user password needs to be rehashed, if so it inserts to "page", to not effect real user data. I'm quite stuck.


function userlogin() {
   $ip = getip();
   // If there's no IP a script is being ran from CLI. Any checks here will fail, skip all.
   if ($ip == '') return;

   GLOBAL $CURUSER;
   unset($GLOBALS["CURUSER"]);

   /* DISABLED FOR TESTING THIS VERSION - APRIL 16
   //Check IP bans
   if (is_ipv6($ip))
       $nip = ip2long6($ip);
   else
       $nip = ip2long($ip);
   */
 
   $res = DB::run('SELECT * FROM bans WHERE true');
   while ($row = $res->fetch(PDO::FETCH_ASSOC)){
       $banned = false;
       if (is_ipv6($row["first"]) && is_ipv6($row["last"]) && is_ipv6($ip)) {
           $row["first"] = ip2long6($row["first"]);
           $row["last"] = ip2long6($row["last"]);
           $banned = bccomp($row["first"], $nip) != -1 && bccomp($row["last"], $nip) != -1;
       } else {
           $row["first"] = ip2long($row["first"]);
           $row["last"] = ip2long($row["last"]);
           $banned = $nip >= $row["first"] && $nip <= $row["last"];
       }
       if ($banned) {
           header("HTTP/1.0 403 Forbidden");
// todo        echo "<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Forbidden</title></head><body><h1>Forbidden</h1>Unauthorized IP address.<br />";
       //    "Reason for banning: $row[comment]</body></html>";
       //    die;
       }
   }
 
   /*
   //Check The Cookie and get CURUSER details  
   if (strlen($_COOKIE["pass"]) != 60 || !is_numeric($_COOKIE["uid"])) {  
       //logoutcookie();  
       return;  
   }  
   //Get User Details And Permissions
   $res = DB::run("SELECT * FROM users INNER JOIN groups ON users.class=groups.group_id WHERE id=$_COOKIE[uid] AND users.enabled='yes' AND users.status = 'confirmed'");
   $row = $res->fetch(PDO::FETCH_ASSOC);
   $hash = $row["id"].$row["secret"].$row["password"].$ip.$row["secret"];
   if (!$row || !password_verify($hash,$_COOKIE["pass"])){
       logoutcookie();
       return;
   }
   */
 
   $id = (int) 6; // we need our user ID!! Not 6 (dummy account for testing)

   // Get User Details And Permissions & Check if password is BCRYPT => Update
   if (strlen($_COOKIE["pass"]) != 60 || !is_numeric($_COOKIE["uid"])) {
   //logoutcookie();
   $hash = $row["id"] . $row["secret"] . $row["password"] . $ip . $row["secret"];
   if (password_needs_rehash($hash, PASSWORD_BCRYPT, array(
       "cost" => 7
   ))) {
       $hash = password_hash($password, PASSWORD_BCRYPT, array(
           "cost" => 7
       ));
       //echo $hash;
       //$id = $row['id'];

       // Save new hash (update Page column for safety/live site)
       $stmt = DB::run("UPDATE users SET page=? WHERE id=?", [$hash, $id]);
   }
       return;
   }

   $where = where ($_SERVER["SCRIPT_FILENAME"], $row["id"], 0);
 
   $id = $row['id'];
   $stmt = DB::run("UPDATE users SET last_access=?,ip=?,page=? WHERE id=?", [get_date_time(),$ip,$where,$id]);
   $GLOBALS["CURUSER"] = $row;
   unset($row);
}


It could be highly insecure, and while the goal was to generate new hash and insert to password, set cookies and login, works but ID not retrieved by login. Please advice!

This is userlogin() in /helpers/functions.php
MVC Update (PDO) — 2020-04-18 20:27:32 in M-BiTsy Support
"m-jay, post: 68408, member: 20288":

Too early to add this to github but its what ive added to assist with breaking controllers down
This doesn't effect anything its just a starter template and a unit tester
to view go to SITEURL/atest & SITEURL/atest/one

I'll keep adding examples to it as I go


Thanks!!
MVC Update (PDO) — 2020-04-18 00:34:35 in M-BiTsy Support
"m-jay, post: 68403, member: 20288":

Thank you I've enjoyed playing with the script.
Got another theme for it somewhere got too many folders on my pc lol
There will be odd update over next few days
Going make most of this free time


Excellent. Yes much free time too, must keep myself busy
Easy, its just adding the rows into the array in the ajax file. I'll see about today.
Flags on profile/account coming soon, will update post.

[ATTACH type="full" width="570px"]5442[/ATTACH]
[ATTACH type="full" width="448px"]5441[/ATTACH]

Flags on profile/account coming soon, will update post
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