Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6686001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:07:21+00:00 2026-05-26T05:07:21+00:00

function intfix($i) { $i = preg_replace(‘/[^\d]/’, ”, $i); if (!strlen($i)) $i = 0; return

  • 0
function intfix($i)
{
   $i = preg_replace('/[^\d]/', '', $i);
   if (!strlen($i))
      $i = 0;
   return $i;
}


function textfix($text = ""){
if(!is_array($text)){ $text = htmlentities($text,ENT_QUOTES,"UTF-8");
}
return $text;
}

These two functions filter all the user submitted variables. Do you think it is secure enough?

I’m a little confused about character encoding. I want to allow my users to play around with ACII art and use any kind of symbols they want but at the moment it doesn’t seem to be possible. What should be done? It may have something to do with the table’s encoding as well as my functions.

EDIT:

The numbers actually are really big. Sometimes in trillions.

This is an example how I filter user input:

if($_GET['number']){ $number = intfix($_GET['number']);  }
if($_GET['text']){ $text = textfix($_GET['text']);  }'

Is that the mistake you are talking about?

Also, this is how I filter them before inserting to the db:

function filter($input,$s=1){

    $input = strip_tags($input, "");
    $input = str_replace("\n", "<br />", $input);
    if($s == 1){$input = bbcode($input); } // smileys and bbcode
    $input = textWrap($input); // wordwrap without breaking html
    return $input;
}

function unfilter($input){ // to unfilter in case I need to show the text in a textbox

    $input = html_entity_decode($input,ENT_QUOTES,"UTF-8");
    $input = str_replace("<br />", "\n", $input);

    return $input;

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:07:22+00:00Added an answer on May 26, 2026 at 5:07 am

    Replace intfix with intval() or floatval() – you are reinventing the wheel unless you are expecting very large numbers.

    I hope you are not using textfix() on input?? That would be a very big mistake. You must encode entities ONLY on output, not on input.

    For UTF-8 you probably need:

    ini_set('default_charset', 'UTF-8');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

function returnsAnArray () { return array ('test'); } echo returnsAnArray ()[0]; generates a syntax
function Submit_click() { if (!bValidateFields()) return; } function bValidateFields() { /// <summary>Validation rules</summary> ///
function json (url){ $.getJSON(url, function(data) { return data; }) } this function don't see
function twitterify($ret) { $ret = preg_replace(#(^|[\n ])([\w]+?://[\w]+[^ \\n\r\t< ]*)#, \\1<a href=\\\2\ target=\_blank\>\\2</a>, $ret); $ret
function drawLabel(labelsIndex) { // Check not deleted Label data:(DBID, text, styling, x, y, isDeleted)
function someFunc() { return 'Hello, world'; } function call(funcName) { eval(funcName + '()'); }
function selected() { var selObj = window.getSelection(); } This function returns selected text from
Function FillAdminAccount() As Boolean FillAdminAccount = True Try SQLconn.ConnectionString = connect timeout=9999999; & _
function main() { Hello(); } function Hello() { // How do you find out
function AddTheatres() { Services.AdminWebServices.AddTheatresSVC(oTheatres, OnSuccessTheatres, OnError, OnTimeOut); } function OnSuccessTheatres(result1) { Services.AdminWebServices.AddTicketPricesSVC(oTicketPrices, OnSuccessTicketPrices, OnError,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.