![]() |
Using $_GET
I want to know how to make those PHP links like:
index.php?page=hello index.php?page=player&id=747 etc.. Someone please tell me how, and if there is another way other than $_GET, then please tell me. I'm not a beginner, but teach me as a beginner please. |
do you want to know how read it into the php file or how to make a link to a php file?
also you made a contradiction, you are beginner or you aren't. you can't be both, sry:( |
I wrote this I hope it helps.
|
Quote:
Quote:
You got it, OK now teach me the HARD WAY! And can you also tell me how can I use the CASE and ARRAY |
Quote:
|
Thanks Marco, but can anyone also tell me how can I do the sub sub pages, like index.php?act=mods&do=download&modid=45
__________________ One extra thing, what is "global $anything, $anothervar" I read about it and it's: An associative array containing references to all variables which are currently defined in the global scope of the script. The variable names are the keys of the array. So I wanted to know what's the use of it? |
Just create if branches in your script:
|
Quote:
|
if($_REQUEST['modid'] == 46)
{ do something; } if($_REQUEST['page'] == "home) { do something else; } please though run your data through the vbulletin GPC if your using vbulletin or sanatize incoming data. |
PHP Code:
|
Quote:
Quote:
|
$_REQUEST can be used as both $_POST and $_GET
|
Thanks for the reply :)
|
Perhaps you should start by reading about php, these are pretty basic questions covered by any php online manual or book.
|
Quote:
I just have one more question: :) If I had a MySQL table called players: Code:
ID - Player For example, if someone opened index.php like: index.php?id=1, then I want the $playername to be set to John, and if ?id=2 then to be set to Paul, then if ?id=3 then to be set as Puyol. According to what's on the database. |
Quote:
start reading about php and mysql or look into the tutorials https://vborg.vbsupport.ru/forumdisplay.php?f=184 |
Quote:
|
You would use something like
Code:
SELECT * Quote:
|
I'm pretty sure you would want to clean the variables before doing something like that.
|
Quote:
https://vborg.vbsupport.ru/showthread.php?t=119372 |
That's what I just said. :confused:
Is there any reason to use the input cleaner instead of just performing the checks yourself as I suggested? The advantage that way is that you don't have to change the way you access the variable and you can also assign extra or different checks instead of being limited to the few GPCs and can assign if/else to deal with the data as well. That's a terrific tutorial but the one thing it doesn't do is explain why you should use it instead of your own way. |
Thanks :)
If I did this: $playername = SELECT name FROM players WHERE id='" . $_REQUEST['id'] . '' Will it work? |
Quote:
|
The only case where I would consider not using vB's sanitizing functions would be if you're only dealing with one single int variable in a plugin, then it would probably be more readable/simpler to just use intval to force it to be an int. If I remember right, that's what vB does anyway to sanitize an int variable.
$i = intval ($_GET['i']); In all other cases (and maybe even in this one), follow Danny's advice. |
What should I put in the red text if I'm going to using REDTYGER's advice?
Code:
if($_GET['id'] == "here) |
All times are GMT. The time now is 02:47 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|