PHP script not working
-
I’m still having problems that if I use:
&& (!isset($_SERVER['REDIRECT_STATUS']) || $_SERVER['REDIRECT_STATUS']=='200')
instead of
&& !isset($_SERVER['REDIRECT_STATUS'])
in qtranslate_utils.php a button on my website is not saving/prepulating the right values – can you find any problems in the below code why it’s not working with the default (first) redirect?
(the problem is that the values chosen by the user on the $pay_options are not registered/used – Do I have to replace “SERVER[REQUEST_URI]” with another command maybe?).global $pay_options; // /payment-button/?value=1&country=AT $params = explode('&', str_replace(array('?', '='), '&', $_SERVER[REQUEST_URI])); $value = $params[2]; $value = array_key_exists($value, $pay_options) ? $value : "1"; $country = $params[4]; $country = array_key_exists($country, $countries) ? $country : "AT"; $country_from_ip = $params[6]; $telephone = $params[8]; $ip = $_SERVER['REMOTE_ADDR']; if (true) { // Debug and test $pay_options[$value]["price"] = $pay_options[$value]["price"] / 1; $pay_options[$value]["price_1st_year"] = $pay_options[$value]["price_1st_year"] / 1; } $result = "[s2Member-PayPal-Button level='1' ccaps='' desc='" . $pay_options[$value]["desc"] . "' ps='paypal' lc='' cc='EUR' dg='0' ns='1' custom='openmtbmap.org|$ip|$country_from_ip|$country|$telephone' ta='" . $pay_options[$value]["price_1st_year"] . "' tp='" . (($pay_options[$value]["price_1st_year"] > 0) ? '1' : '0') . "' tt='Y' ra='" . $pay_options[$value]["price"] . "' rp='" . $pay_options[$value]["duration"] . "' rt='" . $pay_options[$value]["lifetime"] . "' rr='" . (($pay_options[$value]["price_1st_year"] > 0) ? '1' : 'BN') . "' rrt='' rra='1' image='default' output='button' /]"; echo do_shortcode($result); $result = str_replace("'", "", $result); $result = str_replace("\n", " ", $result); $actual_link = "$_SERVER[REQUEST_URI]"; echo " <script> console.log ('1: $actual_link'); console.log ('2: $ip'); console.log ('3: $value'); console.log ('4: $country'); console.log ('5: $result'); console.log ('6: $country_from_ip'); console.log ('7: $telephone'); </script>"; ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘PHP script not working’ is closed to new replies.