What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » /?id=home

Pages: (3): « First [ 1 ] 2 3 » Last »
/?id=home
Author: Message:
stoshrocket
Senior Member
****

Avatar
formerly methos

Posts: 748
Reputation: 31
34 / Male / Flag
Joined: Aug 2005
O.P. /?id=home
ok, before someone posts the google sign, i have genuinely looked for help from many webistes including phpfreaks.com, phpbuilder.com etc etc
the problem is i want use the ?id= tag to link between pages instead of the ususal <a href="/index.html">
any suggestions on some good tutorials (i dont want just a code thanks, i want to know how it works) or maybe if someone could explain? thanks!
formerly methos
12-20-2005 10:54 PM
Profile PM Web Find Quote Report
ShawnZ
Veteran Member
*****

Avatar

Posts: 3146
Reputation: 43
32 / Male / Flag
Joined: Jan 2003
RE: /?id=home
you would use $_GET['whatever'] to get what they put after "?whatever=" in the url, then you can just use some IF statements to associate that name with a page and include it. (if whatever==page1 then include index2.html or such) You can also include every page in a single php file and store them in variables, then just 'echo' them if whatever is equal to "pageX"

Note: NEVER EVER EVER EVER EVER let users include any page by filename (e.g. include($_GET['whatever']) -- bad idea) or let users echo any variable they want (e.g. echo(eval('$' . $_GET['whatever'])) -- also a bad idea) because you'll get hacked in under a second.
Spoiler:
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
12-20-2005 10:58 PM
Profile PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: /?id=home
What Shawnz said is for PHP. If you don't know PHP or want to do this without PHP (and thus only basic HTML and javascript), look up "anchors". Those are the things which start with "#". eg: http://www.blah.com/mypage.htm#here

You can do exactly the same with them as you can with PHP, though you need to write some small javascript code to parse the anchors (and thus react on them) as this use of anchors is a bit different than the default usage (which is jumping to a particular place on the page).

Though PHP is much more secure since people can't view the original source of the page and find out some (hidden) "anchors". Of course, with only HTML and javascript, the source can easly be viewed. But if it is just for jumping thru pages and/or redirecting and/or making some choices and/or parsing some variables to a specific page, than anchors and javascript can do this perfectly also.

This post was edited on 12-20-2005 at 11:14 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
12-20-2005 11:12 PM
Profile PM Find Quote Report
ShawnZ
Veteran Member
*****

Avatar

Posts: 3146
Reputation: 43
32 / Male / Flag
Joined: Jan 2003
RE: /?id=home
quote:
Originally posted by CookieRevised
What Shawnz said is for PHP. If you don't know PHP or want to do this without PHP (and thus only basic HTML and javascript), look up "anchors". Those are the things which start with "#". eg: http://www.blah.com/mypage.htm#here

You can do exactly the same with them as you can with PHP, though you need to write some small javascript code to parse the anchors (and thus react on them) as this use of anchors is a bit different than the default usage (which is jumping to a particular place on the page).

Though PHP is much more secure since people can't view the original source of the page and find out some (hidden) "anchors". Of course, with only HTML and javascript, the source can easly be viewed. But if it is just for jumping thru pages and/or redirecting and/or making some choices and/or parsing some variables to a specific page, than anchors and javascript can do this perfectly also.

Isn't this completly unrelated? He said ?id= and even specifically said PHP.
Spoiler:
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
12-20-2005 11:59 PM
Profile PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: /?id=home
[OFF TOPIC]
Nope, it is very related and for all we know he maybe didn't even know you can do it with html and javascript and thus asked the question as he did. Maybe he doesn't know PHP and maybe rather don't wanna use or learn it just for that, but only asked it in the way he did because he assumed it was only possible with PHP
(you would be surprised in how many people ask stuff like this in this way as they don't know which alternatives exist; or asking something slithly differentl/or too specific than what they actually mean, unwillingly).

Also the post is very relevant for anyone else who is searching for the subject and/or have the same questions and/or thought-process as I just described. For this, the post isn't only for answering his question, but also for answering the questions of people who might come across this thread (and maybe even don't know about PHP and/or javascript and/or the difference, etc).
(is also part of anticipating questions)
[/OFF TOPIC]

This post was edited on 12-21-2005 at 12:22 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
12-21-2005 12:10 AM
Profile PM Find Quote Report
ShawnZ
Veteran Member
*****

Avatar

Posts: 3146
Reputation: 43
32 / Male / Flag
Joined: Jan 2003
RE: /?id=home
quote:
Originally posted by CookieRevised
[OFF TOPIC]
No, it is very related and for all we know he maybe didn't even know you can do it with html and javascript and thus asked the question as he did. Maybe he doesn't know PHP and maybe rather don't wanna use or learn it just for that, but only asked it in the way he did because he assumed it was only possible with PHP (You would be surprised in how many people ask stuff like this in this way as they don't know which alternatives exist).

Also the post is very relevant for anyone else who is searching for the subject and/or have the same questions and/or thought-process as I just described. For this, the post isn't only for answering his question, but also for answering the questions of people who might come across this thread (and maybe even don't know about PHP and/or javascript and/or the difference, etc).
[/OFF TOPIC]

But come on? Using the location.hash for that kind of thing is laughable coding. In fact, I highly suggest Methos2 avoids the suggestion.
Spoiler:
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
12-21-2005 12:22 AM
Profile PM Web Find Quote Report
surfichris
Former Admin
*****

Avatar

Posts: 2365
Reputation: 81
Joined: Mar 2002
RE: /?id=home
[
quote:
Originally posted by CookieRevised
Nope, it is very related and for all we know he maybe didn't even know you can do it with html and javascript and thus asked the question as he did.
I'm sorry to say it, but whoever does that with Javascript is a moron.

Firstly, what happens when users have Javascript disabled?

Secondly, you'd be redirecting people AGAIN to a new page.
12-21-2005 12:23 AM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: RE: /?id=home
quote:
Originally posted by Chris Boulton
[
quote:
Originally posted by CookieRevised
Nope, it is very related and for all we know he maybe didn't even know you can do it with html and javascript and thus asked the question as he did.
I'm sorry to say it, but whoever does that with Javascript is a moron.
lol, well, I didn't say it was a perfectly sane way. I just said it is possible in case somebody wants it (or if PHP isn't available)...

(PS: and in some specific small cases, it is indeed sane to do though)

quote:
Originally posted by Chris Boulton
Firstly, what happens when users have Javascript disabled?
It wouldn't work... What happens if the creator hasn't access to a PHP enabled host?

quote:
Originally posted by Chris Boulton
Secondly, you'd be redirecting people AGAIN to a new page.
Highly depends on what you want to do. If it is only for redirecting, then yes (but isn't PHP doing this also in way?). But, just as in PHP, it can be used for far more things than only that.
.-= A 'frrrrrrrituurrr' for Wacky =-.
12-21-2005 12:35 AM
Profile PM Find Quote Report
ShawnZ
Veteran Member
*****

Avatar

Posts: 3146
Reputation: 43
32 / Male / Flag
Joined: Jan 2003
RE: /?id=home
quote:
Originally posted by CookieRevised
It wouldn't work... What happens if the creator hasn't access to a PHP enabled host?

Well, at least there isn't a RISK involved in that.

quote:
Originally posted by CookieRevised
(but isn't PHP doing this also in way?)

Uh no?

Spoiler:
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
12-21-2005 12:36 AM
Profile PM Web Find Quote Report
surfichris
Former Admin
*****

Avatar

Posts: 2365
Reputation: 81
Joined: Mar 2002
RE: /?id=home
quote:
Originally posted by CookieRevised
What happens if the creator hasn't access to a PHP enabled host?
Well, obviously if the user is creating it then he'd know he has PHP. You can't just say "bah, everyone without JS don't matter" :P You can't make predications on your visitors like that :P
quote:
Originally posted by CookieRevised
If it is only for redirecting, then yes (but isn't PHP doing this also in way?). But, just as in PHP, it can be used for far more things than only that.
In PHP, I wouldn't make it redirect, i'd make it seem totally transparent to the user and use an include() function.

So something like:
code:
<?php
$action = ($_GET['action'] ? $_GET['action']; : $_POST['action']); // Assign $action based on if we're getting or posting.

switch($_GET['action'])
{
    case "test":
        include "test.php";
        break;
    default:
        include "home.php";
        break;
}
?>

(However, you have to expand on it - it only supports pages you've added to the switch..)
12-21-2005 12:40 AM
Profile PM Find Quote Report
Pages: (3): « First [ 1 ] 2 3 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On