Here's my situation. I have three script, which I'll post portions of in a moment. One is variables.php, one is functions.php and one is newcust.php. Both variables and functions are includes of newcust. The problemS come in:
[list=1][*]The browser detection, loosely take from Kevin Yank, designed for a PHP 4.2, register_globals environment. No matter what, all I am detecting is Mozilla, even when IE opens the page.[*]Here's where the sampling comes in. Look at www.barefooting.com/sales/newcust.php and go ahead and sign up for something. Notice that no matter what, it always goes with the $39.95 plan. The script involves two primary variables - $payment_code and $hosting_plan. For the sake of ease of coding and to just get it to work, I have hardcoded the value for $payment_code to equal 'monthly'.[/list=1]
Enough of my jibber jabbering. Heres my code:
Code://functions.php file function inAgent($agent){ $notAgent=strpos($_SERVER['HTTP_USER_AGENT'],$agent)===false; return(!$notAgent); } if(inAgent('MSIE 4')||inAgent('MSIE 5')){ if(inAgent('Mac')){ $browser=inAgent('MSIE 5')?'ie5mac':'ie4mac'; return($browser); } elseif(inAgent('Win')){ return("iewin"); } } elseif(!inAgent('MSIE')){ if(inAgent('Mozilla/5')||inAgent('Mozilla/6')){ return("ns6"); } elseif(inAgent('Mozilla/4')){ if(inAgent('Mac')){ return("nsmac"); } elseif(inAgent('Win')){ return("nswin"); } else{ return("nsunix"); } } } else{ return("unknown"); }The whole source code for newcust.php is here:newcust.phpsCode://variables.php $browser=inAgent($_SERVER['HTTP_USER_AGENT']); if($browser == 'ns6') { //Netscape 6-Mozilla variables $sitecss = "../includes/barefootingMOZILLA.css"; $admincss = "../includes/adminMOZILLA.css"; $inputfield = 25; } else { //IE 5+ Variables $sitecss = "../includes/barefootingIE.css"; $admincss = "../includes/adminIE.css"; $inputfield = 50; }
Thanks.
Sketch





which would make it go through all of the things and have $payment_code be whatever the last thing is. the $39.95 plan in this case.






Bookmarks