PHP Blundering

He has: 1,380 posts

Joined: Feb 2002

how do you redirect using php inside a php script...redirect("http://myurl.com")?
thanks

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

http://www.php.net/manual/en/function.header.php

<?php
header
(\"Location: <a href=\"http://www.example.com/\" class=\"bb-url\">http://www.example.com/</a>\");
exit;
?>

Laughing out loud

He has: 1,380 posts

Joined: Feb 2002

ok...thanks...and for checking a cookie?

<?php
if ($HTTP_COOKIE_VARS[NameCookie]) {

//page

} else {
header("Location: <a href="http://www.myurl.com/" class="bb-url">http://www.myurl.com/</a>");
   
exit;

}
?>
'
will that work, insert my page where "page" is...

He has: 1,016 posts

Joined: May 2002

Looks like vBulletin is parsing the URL inside the PHP tags. Here's how it should be...

<?php
header
(\"Location: http://www.yourwebsite.com/\");
?>

He has: 1,380 posts

Joined: Feb 2002

ok cool...i figured that much...and to check cookies...when i use an HTTP_COOKIE_VARS, does that go in the header or right after the tag? thanks so much for guiding me thru this blundering

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

Put the cookie checker wherever you want to mark off the stuff that can't be seen without a cookie...
You have it set so if they have a cookie they can get in... kind of insecure... are you checking against a DB or anything???

On another note:
How do I get around Vbulletin parsing URLs in my posts? I checked twice on preview to see if it did that and it wouldn't remove the [url] either time

Laughing out loud

He has: 1,380 posts

Joined: Feb 2002

yes i do...and its not really supposed to be "secure"...i have a DB of peeps that are registered, but its a free site. just to count my users and track 'em a wee bit. and i know if i needed/wanted it to be "secure" i could use sessions...but, #1- i dont think i can do it now at my skill level and #2- why overdo it? most people on this site barely understand html, let alone edit a cookie.

They have: 447 posts

Joined: Oct 1999

Quote: Originally posted by nike_guy_man
On another note:
How do I get around Vbulletin parsing URLs in my posts? I checked twice on preview to see if it did that and it wouldn't remove the [url] either time

if you click the [post reply] button rather than using the form at the bottom of the thread, you can uncheck the "Automatically parse URLs" option. or, i think you can edit your post and uncheck it.

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

Unchecking the auto-parse won't remove any url tags, it simply wont add anymore. You'll have to uncheck the box, then remove any url tags that are already in there.

Mark Hensler
If there is no answer on Google, then there is no question.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.