Jump to content


Photo

redirect code


  • Please log in to reply
5 replies to this topic

#1 ifyrlucky

ifyrlucky
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 11 April 2006 - 07:02 AM

when a customer goes to a specific page I want them redirected to their own page. I have set up the redirect code and created a database that has a URL address for each client. What I'm having a problem with is pulling the specific client URL from within the php redirect code. I keep on getting an error message on the page. The Code I'm using is below. How can I pull up the clients URL address under location without getting an error message?

if($HTTP_HOST=="www.napoleonp.org/ikaika/redirect.php" or $HTTP_HOST == "napoleonp.org/ikaika/redirect.php"){
header("Location: <?php echo($row_rsCWGetCustomerData["cst_weburl"]); ?>");
}?>

#2 shortj75

shortj75
  • Members
  • PipPipPip
  • Advanced Member
  • 118 posts
  • LocationPort Huron,mi

Posted 11 April 2006 - 07:32 AM

this is php code already you some <? ?> you dont need that may be you problem try this

<?
if($HTTP_HOST=="www.napoleonp.org/ikaika/redirect.php" or $HTTP_HOST == "napoleonp.org/ikaika/redirect.php"){
header("Location:  echo($row_rsCWGetCustomerData[cst_weburl]); ");
}?>
that should work
The Short One

hopfully this helps if it doesn't sorry
i won't write the code for you!!! you don't learn that way

#3 ifyrlucky

ifyrlucky
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 11 April 2006 - 08:30 AM

I tried the new code without the <? ?>. I now get a Parse error: parse error, unexpected $ in /htdocs/www/ikaika/redirect.php on line 7
using

<?php require_once("application.php");?>
<?php include("CWIncLoginForm.php");?>
<?php if (isset($_SESSION["customerID"]) && $_SESSION["customerID"] != "0") { ?>
<?php
if($HTTP_HOST=="www.napoleonp.org/ikaika/redirect.php" or $HTTP_HOST == "napoleonp.org/ikaika/redirect.php"){
header("Location: echo($row_rsCWGetCustomerData[cst_weburl]); ");
}?>

Any Ideas why I'm getting this error?


[!--quoteo(post=363560:date=Apr 11 2006, 12:32 AM:name=shortj75)--][div class=\'quotetop\']QUOTE(shortj75 @ Apr 11 2006, 12:32 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
this is php code already you some <? ?> you dont need that may be you problem try this

<?
if($HTTP_HOST=="www.napoleonp.org/ikaika/redirect.php" or $HTTP_HOST == "napoleonp.org/ikaika/redirect.php"){
header("Location:  echo($row_rsCWGetCustomerData[cst_weburl]); ");
}?>
that should work
[/quote]


#4 shortj75

shortj75
  • Members
  • PipPipPip
  • Advanced Member
  • 118 posts
  • LocationPort Huron,mi

Posted 11 April 2006 - 08:35 AM

try this
header("Location: echo($row_rsCWGetCustomerData[cst_weburl])");
i see i forgot the ") at the end
The Short One

hopfully this helps if it doesn't sorry
i won't write the code for you!!! you don't learn that way

#5 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 11 April 2006 - 08:43 AM

Umm, you dont need to use echo when getting value from variable to be used in a funtion. The following should work:
header("Location: $row_rsCWGetCustomerData['cst_weburl']");


#6 ifyrlucky

ifyrlucky
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 12 April 2006 - 07:17 AM

I tried the new code and got the following error.

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /htdocs/www/ikaika/redirect.php on line 6

again the code used was:

<?php require_once("application.php");?>
<?php include("CWIncLoginForm.php");?>
<?php if (isset($_SESSION["customerID"]) && $_SESSION["customerID"] != "0") { ?>
<?
if($HTTP_HOST=="www.napoleonp.org/ikaika/redirect.php" or $HTTP_HOST == "napoleonp.org/ikaika/redirect.php"){
header("Location: $row_rsCWGetCustomerData['cst_weburl']");
}?>

sorry for all the problems.

quote name='wildteen88' date='Apr 11 2006, 01:43 AM' post='363577']
Umm, you dont need to use echo when getting value from variable to be used in a funtion. The following should work:
header("Location: $row_rsCWGetCustomerData['cst_weburl']");
[/quote]





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users