On my site when you create a post or you write a comment, the script redirects to a purely server-side script that creates the HTML then redirects to the main page. The HTML-creating script sends nothing to the client so the user isn't even aware it's being called.
When something is posted, it redirects specifically to "index.php?View=##" where ## is the post ID number. This command shows that post (they're invisible initially).
But the problem of using the get method ("?View" in the URL) is that people can see it, and the problem with that is that they assume they can link to their post by copying that URL, which is incorrect. I want to hide View by using the Post method but don't know if I can do that, or how, using just a server-side script and no client-side stuff.
I know how to do it using the client; I can have an HTML form and use JavaScript to "submit" that form the instant the page loads. But I don't want any page to load. Am I making sense?
Passing something through POST without involving the client
Moderator: General Moderators
-
CGameProgrammer
- Forum Newbie
- Posts: 11
- Joined: Sun Mar 09, 2003 11:26 pm
So, if i understeand it correct.
You want, when a user post something, to give this user a url. So they can view there post anytime?
If this is the case, you can generate a random string. And parse this into the link, no id's. This same string will be saved into the database.
So the users can view there post, and they cannot gus what the link of a other user is.
You want, when a user post something, to give this user a url. So they can view there post anytime?
If this is the case, you can generate a random string. And parse this into the link, no id's. This same string will be saved into the database.
So the users can view there post, and they cannot gus what the link of a other user is.
-
CGameProgrammer
- Forum Newbie
- Posts: 11
- Joined: Sun Mar 09, 2003 11:26 pm
patrikG: Session variables are a good idea. Each user can have a variable saying which post they should view when the page loads... yeah, that'll work. Thanks!
inter: No. Say you go to the site devimg.net/index.php. That page will load the five most recent posts. Now you upload screenshots of your landscape engine, or whatever. You are redirected back to index.php?View=136 which will again load the five most recent posts (yours and four others) and the View command will scroll or show your post. This is a convenience measure so you don't have to click to open it yourself.
You might assume the URL devimg.net/index.php?View=136 can always be used to view your post. This is wrong. It will only show your post IF it's one of the five most recent posts; otherwise it won't be shown. So View is not a permanent link. But if View is hidden then since obviously copying the url "index.php" won't link specifically to your post, you'll look around and hopefully spot the "link" button (I'll try to make it more noticeable too).
That is what I was talking about.
inter: No. Say you go to the site devimg.net/index.php. That page will load the five most recent posts. Now you upload screenshots of your landscape engine, or whatever. You are redirected back to index.php?View=136 which will again load the five most recent posts (yours and four others) and the View command will scroll or show your post. This is a convenience measure so you don't have to click to open it yourself.
You might assume the URL devimg.net/index.php?View=136 can always be used to view your post. This is wrong. It will only show your post IF it's one of the five most recent posts; otherwise it won't be shown. So View is not a permanent link. But if View is hidden then since obviously copying the url "index.php" won't link specifically to your post, you'll look around and hopefully spot the "link" button (I'll try to make it more noticeable too).
That is what I was talking about.
If you still want to 'POST' the data. Look at this link, My code at the bottom allows php to simulate a form post.
viewtopic.php?t=7063
viewtopic.php?t=7063
-
CGameProgrammer
- Forum Newbie
- Posts: 11
- Joined: Sun Mar 09, 2003 11:26 pm
i recommend using sessions
here is an example page
you have to included the session_start on every page you want this value referenced, it might also be usefull to check that the viewid exists on each page
here is an example page
Code: Select all
<?php
session_start();
$_SESSION['ViewId'] = $id;//// some value from database
?>