PHP Script... what the... ?

  • PolishHurricane
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1585

Post 3+ Months Ago

I'm doing some work on a website for someone and they're wondering why a link won't redirect, so I'm looking in the PHP script and there's a MySQL query that does the following...

Code: [ Select ]
$SQL = "SELECT url FROM deeplink WHERE deeplink_id = ".base_convert($destination_uid, 36, 10)." AND column = ".intval($var)." AND column2 = ".intval($var2);


Is the call to base_convert() a primitive version of intval() or am I missing something? It made an ID of the table go from 198 to 1628? Why on earth would someone do that? Maybe I should re-phrase... Is this some type of programming trick that is over my head, or what?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

Maybe the following usage with a common base conversion will make it easier to understand. :D

PHP Code: [ Select ]
$_255 = base_convert('ff', 16, 10);
  • PolishHurricane
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1585

Post 3+ Months Ago

Yeah I know what the function does, but I'm puzzled why someone would actually use it in a MySQL query, the database is nothing special, just your regular old integer ID. I wonder if they were trying to make them bigger? Doesn't make any sense.
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

Maybe it's a bandwidth thing ?
  • PolishHurricane
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1585

Post 3+ Months Ago

nah, I think he just had a moron working for him or something.
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

It's easy to attribute to stupidity that which we do not understand, isn't it? :)

There's always a good reason for things to happen, sometimes those good reasons just get trumped by reasons to do other things.
  • PolishHurricane
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1585

Post 3+ Months Ago

I think the guy thought it was how you force something into an integer (intval), but he didn't know. The intvals in the current statement are newer. Either way, stupid as hell.

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 180 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.