/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Need server side with php cookie help please

Hello, really need some help please. Put this in php area because think someone that knows more about php will know more about how this is done.

There is php cookie script in one page test page found here. [url]http://www.mooonbaby.com/no.php[/url]
its just a standard php cookie script that goes from one item to the next each time the page is refreshed that has a standard cookie variable in it as well like time()+60*60*24*365.

Then there is test page found here
[url]http://www.mooonbaby.com/testno.html[/url]
That there is a server side command in to call no.php that looks like this

<!–#include virtual=”no.php”– >

You’ll notice if you go to the first address it goes from one item to the next just fine. But if gone to the second address to call that page with a server side command instead it does not go to one item to the next anymore. Can anyone tell me why? Reason I’m trying to call it with a server side command instead is because I don’t want to name the page I want to use the script in with a .php extension want to keep it with an html extension instead. Please let me know, thank you very much for your help.

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@tfk11Sep 14.2008 — I've never used server side includes before... but looking at the headers returned by each of your pages it's clear that the cookie is never being set by the included script.

I expect server side includes simply replace the include with the output of the script and that is all. The script is unable to modify the headers returned by the page which is needed to set the cookie.

You can keep the html extension on php scripts a few ways. One is to tell the server to handle html files as php script. Depending on your server setup you may be able to place a line similar to the following in an .htaccess file.

[code=php]
AddHandler application/x-httpd-php .html
[/code]


You may also be able to use a rewrite rule to mask the script with a url of your choice. Again in .htaccess

[code=php]
<IfModule mod_rewrite.c>

Options +FollowSymLinks
RewriteEngine on

RewriteRule ^testno.html$ no.php

</IfModule>
[/code]
Copy linkTweet thisAlerts:
@vortexerauthorSep 14.2008 — Thanks a lot http://www.mooonbaby.com/no.php the cookie is working fine in the first one as shown by the changing items but just not in the html page calling it. But I added both of those to an .htaccess file and uploaded it to the same root as the rest for that account but didn't help. Can anyone help? Please let me know, thank you very much.
Copy linkTweet thisAlerts:
@tfk11Sep 14.2008 — I never intended my suggestions to be cut and paste solutions. Both depend on server configuration and probably need to be modified slightly to work.

Some servers are setup with content types of application/x-httpd-php5 or application/x-httpd-php4.

Some servers don't have mod_rewrite support (most do) and you always have to play with your regular expression to get the effect you want or at least I do...

RewriteRule (.*)/testno.html$ $1/no.php

Or maybe your server isn't running Apache at all...

In general you should expect suggestions from forums rather than drop in solutions.
Copy linkTweet thisAlerts:
@vortexerauthorSep 14.2008 — Thanks, its basic godaddy hosting account with apache and php. I'm dead in the water anyway then because I don't know how to write it myself because don't know enough about php. Can anyone help?
Copy linkTweet thisAlerts:
@tfk11Sep 14.2008 — Your only dead in the water because you think you are. I have learned everything I know about programming by reading documentation, tutorials, articles, and yes even forum posts all found online. Problems you can't find an exact solution for online you can deduce based on related information.

Take some initiative man, the info is out there for anyone to find.

http://www.google.ca/search?hl=en&q=godaddy mod_rewrite

http://www.workingwith.me.uk/articles/scripting/mod_rewrite

http://www.regular-expressions.info/tutorial.html
Copy linkTweet thisAlerts:
@vortexerauthorSep 15.2008 — Thanks, I really do take initiative, try hard, and write a lot but I get to a certain point and have a real hard time. Even after googling for weeks. But I'll check out those links.
×

Success!

Help @vortexer 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.9,
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,
)...