/    Sign up×
Community /Pin to ProfileBookmark

Hiding variables passes in with URL?

I’ve been learning PHP for 3 hours, so please fogive me for asking this question if it’s really basic.

I’m trying to make a hi-score table which will appear in a PHP page, but using a score from a Flash game.

So far I’ve managed to set up my PHP pag so that it will display the hi-scores based on a variable called $score. I can pass the value of the player’s score into this page by calling the URL like this from Flash

[QUOTE]

getURL(“http://www.hostname.com/hiscore.php?score=”+myScore);

[/QUOTE]

But what this does is show the URL in the browser like this

.

[QUOTE]

http://www.hostname.com./hiscore.php?score=1440

[/QUOTE]

This means anyone could easily just type in the URL with any score they want.. so how can I call the PHP page WITHOUT showing the variable being passed into it?

Thanks a lot for your help on this

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@JonaJul 04.2003 — [font=arial][color=maroon]Rather than using the GET method, make a hidden form in your Flash file, that will submit a form to the PHP file via the [b]POST[/b] method.[/color][/font]

[b][J]ona[/b]
Copy linkTweet thisAlerts:
@tobyw_1969authorJul 04.2003 — Thanks - I will try that.

Is there a way to show a URL link in an e-mail that will also hide the variables?

I am thinking of the example of an e-greetings card, where you would want to send the recipient an e-mail something like


You have received a new card from .... Please click on this link to view your card

http://www.myhost.com/greetings.php?card=card1&message=happy birthday

[/QUOTE]



Is there a better way to do that? Should I use POST there too? And how would it work?

I'm a bit confused about how to pass variables into the actual php page!

Thanks
Copy linkTweet thisAlerts:
@JonaJul 04.2003 — [font=arial][color=maroon]Okay, to retrieve the POST variables, you'll use the following code:[/color][/font]

[code=php]
echo $_POST['score'];
[/code]


[font=arial][color=maroon]As for your e-card thing, I don't know if you [i]could[/i] use the POST method there, since it's cross-server... Your link in the email would look something like this (assuming you're going to have different [i]types[/i] of emails):[/color][/font]

[font=monospaced]

http://www.yourserver.com/greetings.php?greeting=Happy,%20Birthday&type=birthday

[/font]


[font=arial][color=maroon]I don't know if you're going to dynamically generate a Flash file, or just edit it via PHP; but the easiest way would be to create a text file and edit it via PHP, then read from it in the Flash file--you can have multiple types based on which Flash file is displayed--in the above it'd be "birthday.swf," for example.



Let me know if you need any help on the PHP coding.[/color]
[/font]

[b][J]ona[/b]
Copy linkTweet thisAlerts:
@tobyw_1969authorJul 05.2003 — Thanks for your help Jonah.

I've got the e-card thing up and running now, you can see it here


[URL=http://www.netcartoon.net/greetings/greetings-choose.htm]My card site[/URL]

The way I am doing it at the moment is not very good though, because the e-mail which goes to the recipient will have to contain a URL which includes all the variables, including the message etc.. which doesn't look too good.

I think your idea re: text file will be the best bet, but I am guessing a database will be better?

I've only been learning PHP for a day and a half, so my next objective will be to learn how to tie in with MySQL - but it looks quite frightening!

Anyway, thanks for your help - I expect I will be back with more questions soon... ?
Copy linkTweet thisAlerts:
@JonaJul 05.2003 — [font=arial][color=maroon]Connecting to a database is quite simple really--setting up one, on the other hand, is the real challenge (it was on my first time, anyway). But you should use a database rather than a plain text file, because it is more secure and, in some cases, easier to manipulate the data.[/color][/font]

[b][J]ona[/b]
×

Success!

Help @tobyw_1969 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...