Otis17 Posted May 7, 2014 Share Posted May 7, 2014 (edited) So I seem to know very little about php and coding in general. I'm trying to use html anchors for a table of contents, but everytime I insert them into a php function, the page won't load. <?php include("./includes/egl_inc.php"); $secure = new secure(); $secure->secureGlobals(); page_protect(); $out[body]=" <strong><a href="#1">text here</a></strong><br> "; include("$config "); ?> Is this something even possible, is someone able explain to me the error I'm getting? Edited May 7, 2014 by Otis17 Quote Link to comment Share on other sites More sharing options...
ginerjm Posted May 7, 2014 Share Posted May 7, 2014 Look at your quotes. You need to learn to use single and double quotes or else learn how to escape them. And - if you're a newbie where did you learn how to write this OOP code already? You can't write a clean string but you are using classes/objects? Quote Link to comment Share on other sites More sharing options...
trq Posted May 7, 2014 Share Posted May 7, 2014 You have double quotes within a double quoted string, breaking that string. You are missing quotes around the strings 'body' and 'html'. You have quotes and braces places you don't need them. You need to escape the inner quotes: <?php include "./includes/egl_inc.php"; $secure = new secure(); $secure->secureGlobals(); page_protect(); $out['body'] = "<strong><a href=\"#1\">text here</a></strong><br>"; include $config['html']; Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted May 7, 2014 Share Posted May 7, 2014 Hi, please get rid of this garbage class and stop stealing random bullshit from the internet. I'm sorry for being so harsh, but this really is the cancer of PHP. Why don't you write you own code? Start with a blank file and write down your own ideas while you search the PHP manual for the right functions. Yes, this takes time, and your first scripts won't be very good. But they will be your scripts, and you'll learn from them. There's nothing you could learn from that class you've copypasted. Whoever wrote it doesn't know anything whatsoever about PHP or security or good code. It's just an incredibly naïve attempt of implementing “Magic Quotes on steroids” or something like that. You should actually look at the code, it's pretty funny: private function secureSuperGlobalGET(&$value, $key) { $_GET[$key] = htmlspecialchars(stripslashes($_GET[$key])); $_GET[$key] = str_ireplace("<script", "<blocked", $_GET[$key]); $_GET[$key] = mysql_escape_string($_GET[$key]); $_GET[$key] = preg_replace('/DROP TABLE | TRUNCATE TABLE |EXECUTE /i', '', $_GET[$key]); return $_GET[$key]; } What kind of drugs does it take to think this is a good idea? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.