Hi there,

How can I ignore case sensitivity when people type in letters and get redirected through this script:

<?php 
if($_GET['username'] == "BBY"){
  header("Location: http://www.x.ca"); }
   elseif($_GET['username'] == "RS"){
  header("Location: http://www.x2.ca"); }  
   elseif($_GET['username'] == "WM"){
  header("Location: http://www.x3"); }  
   elseif($_GET['username'] == "RP"){
  header("Location: http://www.x4.ca"); }
   elseif($_GET['username'] == "SM"){
  header("Location: http://www.x5.ca"); } 
  else {
  header("Location: ../portal_failedattempt");
}

exit();
?>

Thank you! :)

strcasecmp('Hello', 'HELLO') == 0 - when strings are identical, regardless of case

Thank you very much for all your help!

Actually it doesn't work. Can you please show it to me using my code as an example? I'm not quite advanced with PHP I'm sorry :s

Member Avatar for diafol

Like this?

if(strtoupper($_GET['username']) == "BBY"){

Or

if(strcasecmp($_GET['username'], 'BBY') == 0) {
    // true
}

Thanks blocblue! Now it all works perfectly!!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.