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-09 15:12:02
Hello, bonjour


tu peut teste avec se code
you can test with this code
chercher / search
$signature = $_POST["signature"];


remplace par / replaced by

if ($_POST["signature"] != '') {
$extensions_valides = array( 'jpg' , 'jpeg' , 'gif' , 'png' );
$Extension = strtolower(pathinfo($_POST['signature'],PATHINFO_EXTENSION));
if (in_array($Extension, $extensions_valides)){
$signatures = $_POST["signature"];
} else {
       $signatures = '';
   }
}

$signature = $signatures;
Last edited by Gollum on 2022-12-09 15:27:38
2022-12-09 17:33:37
Is any global being checked for initialized state? - isset()

Use strlen($var) > 0

Instead of

!= ‘’

And that also lets you control input length. Also, using the != operator is slowing down your code. It checks the variable if a type conversion is needed internally. You know exactly what type (int, string, etc) you’re expecting from POST so use strict comparison !== instead. This is why you should use != on objects (type conversion).

C# is religious about this as well as C/C++ so PHP being compiled in C, the same rules apply just very loosely. PHP is a hybrid language.
2022-12-09 22:08:17
Je commence a mis perde!  / I'm starting to lose!  😊

Ligne #750 /#760
account.zip
Download

2022-12-10 19:12:42
salut , hello
J'espere que j'ai bien comprie la demande et que je vous met pas en erreur avec mon code
je vient de tester de mon coter pour une function
1) vérifie extention URL -> 'jpg','jpeg','gif','png'
2) Supprime les BBcode si il en a
chez moi sa fonctionne
-----------------------------------------------------------------------------------------------
I hope I have understood the request correctly and that I am not misleading you with my code
I just tested on my side for a function
1) check extension URL -> 'jpg','jpeg','gif','png'
2) Remove BBcodes if there are any
it works for me


function UrlImage($s){
// verifie extention url sans bbcode
$Extension = pathinfo($s,PATHINFO_EXTENSION);
if (in_array($Extension, array('jpg','jpeg','gif','png'))){
       // BON AJOUTE BBCODE + URL
$s = "[img]".$s."[/img]";
   } else {
//SUPPRIME LES BBCODE
       $s = substr($s, 5, -6);
       
if (pathinfo($s, PATHINFO_EXTENSION)) {
// BON AJOUTE BBCODE + URL
           $s = "[img]".$s."[/img]";
       } else {
// MAUVAISE EXTENSION MESSAGE ERREUR
           $s = "ERREUR , n'est pas une URL valide";
       }
   }
  return $s;
}


exemple : $signature = urlImage($_POST["signature"]);

sorry for the english translation but i am french
Last edited by Gollum on 2022-12-10 19:13:38
2022-12-10 22:18:13

function validate_image_url($string) {
 // Use a regular expression to search for [img] and [/img] tags in the string
 $pattern = '/\[img\](.+?)\[\/img\]/';

 // Check if the string contains the [img] and [/img] tags
 if (preg_match($pattern, $string, $matches)) {
   // Get the URL from the matches array
   $url = $matches[1];

   // Validate the URL using PHP's filter_var function
   if (filter_var($url, FILTER_VALIDATE_URL)) {
     // If the URL is valid, return the original string
     return $string;
   }
 }

 // If the URL is not valid or the [img] and [/img] tags were not found, return an empty string
 return '';
}


Here's how you could use this function:


// Check and validate the image URL
$result = validate_image_url(“[img] $row[signature] [/img]”);

// Print the result
echo $result;

Last edited by STorrents2020 on 2022-12-11 00:39:00
2022-12-11 15:14:11
Rien n'a fonctionné / Nothing worked
2022-12-13 05:18:03
try this
account.zip
Download
2022-12-13 22:46:43
Good!

it works, I tested writing in text and it gave the error, I tested without the IMG tag and only URL and it gave me the error.

It has to be the letag and the url for it to work.

A big thank you to all of you!

RÉSOLU / SOLVED

2024-09-23 21:06:32
Add account-details.php :
		<? if ($user["signature"]) { ?>  
<td align="center" colspan="2"><hr/><b><?php echo T_("SIGNATURE"); ?> ↴</b><div id='img5-Signature'><?php echo format_comment($user["signature"]); ?></div></td>
<? }else { ?>
<td align="center" colspan="2"><hr/><b><?php echo T_("SIGNATURE_DEFAUT");?> ↴</b><div id='img5-Signature'><img src="images/signature/signature_default.png" alt="Signature" /></div></td>
<? } ?>


Add themes.css :
/* Signature */ 
#img5-Signature {
  display: block;
  overflow: hidden;
  max-width: 100%;
  height: 150px;
  padding: -12px;
  margin: 0 1px;
}


Last edited by spiritblue on 2024-09-23 21:08:24
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