Redir not going to proper site

Posted on 2003-02-26
Medium Priority
Last Modified: 2009-12-16
Good morning,

I have the following on

} else{
$num = array(
1 => "http://www.auctionupperhand.com/",
2 => "http://www.auctionupperhand.com/recruiting/index.html"
Header( "Location: $num[$ca]");

I would assume that if $ca is not defined, it would
default to the first option (ie, auctionupperhand).
But it goes to the site on which its hosted
(barbaraling.com).  Might someone point out
where I've been clueless?

Thank you in advance,

Barbara Ling
Question by:lingstar
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

_Niko_ earned 200 total points
ID: 8024521
Hi Barbara,

when your script hits the if-clause without having $ca being initialized, you set $ca to 1 but the array $num remains uninitialized.

Therefore your redirect is something invalid as $num does not exist in this case.


     $num = array(
                    1 => "http://www.auctionupperhand.com/",
                    2 => "http://www.auctionupperhand.com/recruiting/index.html"
     Header( "Location: $num[$ca]");


PS: Watch out for your php configuration of register_globals when you are passing $ca through a link or form. ($_GET['ca'] or $_POST['ca']).


Author Comment

ID: 8024883
Thank you thank you thank you!!!!!!!!!!!!

I greatly appreciate your insights, they
were most helpful.

Best wishes,

Barbara Ling

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question