Facebook  Twitter 

SMFHacks.com

+- +-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 12240
Latest: ptrcmres01
New This Month: 9
New This Week: 5
New Today: 1
Stats
Total Posts: 39383
Total Topics: 6933
Most Online Today: 41
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 37
Total: 37

Author Topic: Recording apostrophes into tables  (Read 218 times)

0 Members and 1 Guest are viewing this topic.

Offline shuban

  • Hero Member
  • *****
  • Posts: 646
    • View Profile
    • Biology Forums - For All Your Science Needs
Recording apostrophes into tables
« on: August 08, 2018, 04:27:44 pm »
Is it fine to record data containing apostrophe characters rather than their HTML codes?

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14715
    • View Profile
Re: Recording apostrophes into tables
« Reply #1 on: August 08, 2018, 04:39:45 pm »
As long as the database is escaped you can place it into the database.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline shuban

  • Hero Member
  • *****
  • Posts: 646
    • View Profile
    • Biology Forums - For All Your Science Needs
Re: Recording apostrophes into tables
« Reply #2 on: August 08, 2018, 05:20:50 pm »
That being said, I have a code that reads the URL with $_GET. Can you tell me if this is enough to protect from SQL injection?

$context['string'] = !empty($_GET['t']) ? trim(addslashes(stripslashes(un_htmlspecialchars($_GET['t'])))) : 0;

Code: [Select]
$dbresult = db_query("
SELECT column1
FROM {$db_prefix}TABLE_NAME
WHERE column1 LIKE '%".$context['string']."%'
LIMIT 1", __FILE__, __LINE__);

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14715
    • View Profile
Re: Recording apostrophes into tables
« Reply #3 on: August 08, 2018, 06:04:21 pm »
That should  be pretty good. since it escapes the ''s
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

 

Related Topics

  Subject / Started by Replies Last post
0 Replies
2237 Views
Last post February 13, 2008, 11:41:59 pm
by Rebecca
3 Replies
4179 Views
Last post August 06, 2012, 02:33:17 pm
by tank_fv101
6 Replies
2536 Views
Last post October 01, 2014, 11:54:27 am
by shuban

+- Recent Topics

condition de livraison by SMFHacks
December 14, 2018, 12:47:53 pm

Multiple Versions in SMF by Boomslanger
December 13, 2018, 06:13:31 pm

GDPR Helper free doubts by Rock Lee
December 08, 2018, 06:20:57 pm

Downloads Pro 5.0 Released by SMFHacks
December 05, 2018, 03:11:32 pm

SMF Hacks Black Friday Sale! by SMFHacks
November 30, 2018, 09:03:04 am

Rewrite rule for IPN by diegolyanky
November 26, 2018, 10:58:55 am

EDITOR PRO by SMFHacks
November 25, 2018, 03:12:19 pm

SMF Gallery Pro 8.0 / PHP 7.0 onwards by SMFHacks
November 25, 2018, 12:33:10 pm

5.0 beta log errors by tfs
November 24, 2018, 10:37:06 pm

Download button doesn't initiate a download the first time by SMFHacks
November 24, 2018, 09:08:55 pm

Powered by EzPortal