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

You are in: Forum / Forum / Torrent Trader / v3 Support

2022-12-01 22:45:46
At home with v3 sqli, my world can add writings and even tags to their writing and as far as I know a signature is an image and not a title, so it would be good to add an error when the person does not put not an image in the bbcode [img]

Thank you very much for your help with this fix.
2022-12-02 18:52:16
Its best to accept local images and validate before and after as apposed to linking a image url and having it redirect to some other website.

This way, you can check the image headers, mimetype, this that etc without allowing a potential risk. I dont allow it for a similar reason.
2022-12-03 13:12:49
ok but there they can put a writing instead of url of the image, so shouldn't there be an error for who can not put a writing but a url of an image
2022-12-03 15:23:42
maybe the best way is to stop members submitting wrong type
example in account edit form use
placeholder='images url only'

then also in account find $signature = $_POST["signature"]

something like check is image url
if (filter_var($_POST["signature"], FILTER_VALIDATE_URL)) {
$signature = $_POST["signature"];
} else {
    die('not image');
}


not tested this but you just need to check that $_POST["signature"].
this way someone could put website link in signature
Last edited by M-jay warn on 2022-12-03 15:25:01
2022-12-03 19:14:45
thanks  M-jay

it gives me the error but does not take into account my url which is good

		  //Erreur URL signature My M-jay [2022]
 if (filter_var($_POST["signature"], FILTER_VALIDATE_URL)) {
           $signature = $_POST["signature"];
         } else {
           die('Votre Url de votre image de signature est pas valide.');
         }



2022-12-03 22:14:28
I think I understand now. I use something similar to verify mimetypes using finfo() class (SPL stack).

But in your case, you want to validate url extension (https://blahblah.com/pic.jpg) and allow embedding, or else show "invalid file type" error.


$signature = '';
$parts = parse_url($row['signature']);
$extension = pathinfo($parts['path'], PATHINFO_EXTENSION);
if (in_array($extension, array('jpg', 'png', 'jpeg'))) {
  $signature = trim($row['signature']);
} else {
  // throw a error message
}
2022-12-04 11:54:02
don't forget that there is the [img] tag and who doesn't care about it, so it just gives the error and nothing is modified

		  //Erreur URL signature My M-jay [2022]
         $signature = '';
         $parts = parse_url($row['signature']);
         $extension = pathinfo($parts['path'], PATHINFO_EXTENSION);
         if (in_array($extension, array('jpg', 'png', 'jpeg'))) {
         $signature = trim($row['signature']);
         } else {
 die('Votre Url de votre image de signature est pas valide.');
         }



account.php

Last edited by spiritblue on 2022-12-04 11:54:44
2022-12-04 14:05:02
This is where it can be complicated.

You would need to check link/image then also bbcode - substr or preg but then it gets a little messy

I will try code later but I would block bbcode, make default signature then add html directly where ever signature is shown

2022-12-04 14:19:43
for the moment I have another selection system of 4 choices of banners, but having this default signature mode of TT should be an error for anyone draws this allow to put other in the <textarea> tag than url and tag [img]

for the moment as on my image I warned the world of pene has what their account will be deactivated.

I remain open to do tests if necessary and I thank you both for your support which is always much appreciated.

friendly ! ;)
Last edited by spiritblue on 2022-12-04 14:20:26
2022-12-04 19:23:48
try this for image link, then we can add image type https://torrenttrader.uk/test
should accept img tag

make test.php
<?php
require_once("backend/functions.php");
dbconn();
loggedinonly();

       if ($_POST) {
           if (filter_var($_POST['link'], FILTER_VALIDATE_URL)) {
               $signature = $_POST['link'];
               echo("$_POST[link] link is a success");
           } else {
               $has_bbcode = substr($_POST['link'], 5);
               $has_bbcode = substr($has_bbcode, 0, -6);
               if (filter_var($has_bbcode, FILTER_VALIDATE_URL)) {
                   $signature = $has_bbcode;
                   echo("$has_bbcode bbcode is a success");
               } else {
                   $signature = 'error';
                   echo("$_POST[link] is not a valid URL");
               }
           }
       }
       ?><br>
       <form id="submit" method="post" action="test.php">
           Result = <?= $signature ?><br>
           <input type='text' name='link' placeholder="image link only"><br>
           <button type="submit">submit</button>
       </form>
Last edited by M-jay warn on 2022-12-05 08:01:44
2022-12-05 23:56:46
thank you it works in part but it remains to integrate me into the acount.php file

Last edited by spiritblue on 2022-12-06 00:02:27
2022-12-06 05:18:51
this will force img bbcode
find
$signature = $_POST["signature"];


below add
        if ($_POST["signature"] != '') {
           $has_bbcode = substr($_POST['signature'], 5);
           $has_bbcode = substr($has_bbcode, 0, -6);
           if (filter_var($has_bbcode, FILTER_VALIDATE_URL)) {
               $signature = $_POST["signature"];
               //echo("$_POST[signature] is a success");
           } else {
               die("Votre Url de votre image de signature est pas valide.");
           }
       }
2022-12-06 21:35:27
I find nothing of what you suggest to search in the bbcode file on my side I want to integrate it into the account.php file

    // Valide signature to tag IMG My M-jay 2022
   if ($_POST["signature"] != '') {
       $has_bbcode = substr($_POST['signature'], 5);
       $has_bbcode = substr($has_bbcode, 0, -6);
           if (filter_var($has_bbcode, FILTER_VALIDATE_URL)) {
              $signature = $_POST["signature"];
              //echo("$_POST[signature] is a success");
           } else {
              die("Votre Url de votre image de signature est pas valide.");
          }
       }
   // End Valide signature



	   print('<font size=5 color=red>ne pas utilisé, en construction !!</font><br/>
      <form id="submit" method="post" action="account.php">
          Result = '.$signature.'<br/>
          <input type="text" name="link" placeholder="image link only"><br>
          <button type="submit">submit</button>
      </form><br/>');



2022-12-08 03:52:14
Then you should run a query that pulls that field out, and work with the variable.

Writing a query is fairly easy. And even easier with no parameters to prepare.


$test = SQL_Query_exec(“SELECT signature FROM users WHERE id = $CURUSER[id]”);
if ($user = mysqli_fetch_assoc($test)) {
  echo $user[‘signature’];
}
Last edited by STorrents2020 on 2022-12-08 03:53:05
2022-12-08 16:44:55
Post your account.php
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