$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
Especially the ?.. what does this do
It's just a trinary conditional statement. It's shorthand for the following:
if (!get_magic_quotes_gpc()) addslashes($theValue); else $theValue;
What the actual statement does, I have no idea.
it checks to see if magic quotes is turned on. If it is not, then it adds slashes to the string to avoid SQL Injection.