Undefined index: REQUEST_URI and HTTP_HOST - php

How can I get rid of this errors.
Line 8 : define('CURRENT_PAGE', basename($_SERVER['REQUEST_URI']));
Line 15: define('READ_PATH', $_SERVER['HTTP_HOST'].'/read.php?id=');
errors:
Undefined index: REQUEST_URI in ......... on line 8
Undefined index: HTTP_HOST in ....... on line 15

if you use CLI then u can check them for their existence but in the browser, HTTP_HOST will be available any time.
if (!empty($_SERVER['HTTP_HOST'])) {
define('CURRENT_PAGE', basename($_SERVER['HTTP_HOST']));
}
if (!empty($_SERVER['REQUEST_URI'])) {
define('CURRENT_PAGE', basename($_SERVER['REQUEST_URI']));
}

Related

I get "ErrorException in SteamAuth.php line 206: Undefined offset: 1"

I want to make SteamLogin on my website but try to login I get
"ErrorException in SteamAuth.php line 206:
Undefined offset: 1"
"array('matches' => array())) in SteamAuth.php line 206"
$this->steamId = is_numeric($matches[1]) ? $matches[1] : 0;

Opencart 1.5.6 error | Notice: Undefined index: option_value

Some of my product pages keep showing me this message:
“Notice: Undefined index: option_value in
/home/paper/osconvites/vqmod/vqcache/vq2-catalog_model_catalog_product.php
on line 411Notice: Undefined index: option_value in
/home/paper/osconvites/vqmod/vqcache/vq2-catalog_model_catalog_product.php
on line 411Notice: Undefined index: option_value in
/home/paper/osconvites/vqmod/vqcache/vq2-catalog_model_catalog_product.php
on line 411”
Add this code in line no 406
if (!isset($product_option['option_value']) || $product_option['option_value'] == '' ) {
$product_option['option_value'] = '';
}

Notice: Undefined variable: dbRead in C:\vhosts\phpcs5\lesson07\workfiles\scripts\user_registration.php on line 28

I'm getting this error and after checking for similar errors I verified the syntax is correct. The complete error is;
WRITE OK
READ OK
Notice: Undefined variable: dbRead in C:\vhosts\phpcs5\lesson07\workfiles\scripts\user_registration.php on line 28
Fatal error: Call to a member function quoteInto() on a non-object in C:\vhosts\phpcs5\lesson07\workfiles\scripts\user_registration.php on line 28
My connection is defined as:
$dbwrite = new Zend_Db_Adapter_Pdo_Mysql($write);
$dbread = new Zend_Db_Adapter_Pdo_Mysql($read);
I did a test first to make sure it can see the database which is what the Write OK and Read OK are as follows;
if ($dbwrite->getConnection()) {
echo 'WRITE OK<br/>';
}
if ($dbread->getConnection()) {
echo 'READ OK';
}
So I'm not sure why I'm getting this error.
dbRead is undefined. You've defined $dbread. Note the capitalization.
Look through your code base (particularly user_registration.php line 28) and switch all instances to one or the other.

How to change this complex function to a simple redirect

I have been making some changes to a wordpress ecommerce plugin and I've taken out a ton of functions to make it simpler for my needs. Now it won't redirect to the thankyou page after the purchase button is pressed because the function uses some variables that I got rid of like order_id, etc.
I've been working on this for a few hours now, and all I want it to do is redirect to thankyou.php on the click of the purchase button. (I know right now it uses ajax, and I wouldn't mind using it too) I don't need it to go to the processpayment function or anything like that. Really simple.
Here is the code and the functions that I'm working with:
Thanks so much!!!
Input element:
<div id="payment">
<div class="form-row">
<noscript><?php _e('Since your browser does not support JavaScript, or it is disabled, please ensure you click the <em>Update Totals</em> button before placing your order. You may be charged more than the amount stated above if you fail to do so.', 'jigoshop'); ?><br/><input type="submit" class="button-alt" name="update_totals" value="<?php _e('Update totals', 'jigoshop'); ?>" /></noscript>
<?php jigoshop::nonce_field('process_checkout')?>
<input type="submit" class="button-alt" name="place_order" id="place_order" value="<?php _e('Next Step', 'jigoshop'); ?>" />
<?php do_action( 'jigoshop_review_order_before_submit' ); ?>
<?php if (get_option('jigoshop_terms_page_id')>0) : ?>
<p class="form-row terms">
<label for="terms" class="checkbox"><?php _e('I accept the', 'jigoshop'); ?> <?php _e('terms & conditions', 'jigoshop'); ?></label>
<input type="checkbox" class="input-checkbox" name="terms" <?php if (isset($_POST['terms'])) echo 'checked="checked"'; ?> id="terms" />
</p>
<?php endif; ?>
<?php do_action( 'jigoshop_review_order_after_submit' ); ?>
</div>
</div>
checkout.class.php:
// Process Payment
$result = $available_gateways["cheque"]->process_payment( $order_id );
// Redirect to success/confirmation/payment page
if (is_ajax()) :
ob_clean();
echo json_encode($result);
exit;
else :
wp_safe_redirect( $result['redirect'] );
exit;
endif;
else :
// No payment was required for order
$order->payment_complete();
// Empty the Cart
jigoshop_cart::empty_cart();
// Redirect to success/confirmation/payment page
$checkout_redirect = apply_filters( 'jigoshop_get_checkout_redirect_page_id', get_option( 'jigoshop_thanks_page_id' ) );
if (is_ajax()) :
ob_clean();
echo json_encode( array( 'redirect' => get_permalink( $checkout_redirect ) ) );
exit;
else :
wp_safe_redirect( get_permalink( $checkout_redirect ) );
exit;
endif;
endif;
// Break out of loop
break;
process payment function:
function process_payment() {
// Remove cart
jigoshop_cart::empty_cart();
// Return thankyou redirect
$checkout_redirect = apply_filters( 'jigoshop_get_checkout_redirect_page_id', get_option( 'jigoshop_thanks_page_id' ) );
return array(
'result' => 'success',
'redirect' => add_query_arg('key', $order->order_key, add_query_arg('order', $order_id, get_permalink( $checkout_redirect )))
);
}
Here is the error details I'm getting from firebug:
After I turned debugging on, I got these errors:
Notice: Undefined index: aiosp_enabled in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/all-in-one-seo-pack/all_in_one_seo_pack.php
on line 710
Notice: Undefined index: aiosp_enabled in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/all-in-one-seo-pack/all_in_one_seo_pack.php
on line 710
Notice: Use of undefined constant PLUGIN_URL - assumed 'PLUGIN_URL' in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/wp-google-fonts/google-fonts.php
on line 81
Notice: Use of undefined constant PLUGIN_PATH - assumed 'PLUGIN_PATH'
in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/wp-google-fonts/google-fonts.php
on line 82
Notice: Undefined index: host in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jetpack/jetpack.php
on line 2306
Notice: Undefined index: shipping-first_name in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 198
Notice: Undefined index: shipping-last_name in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 199
Notice: Undefined index: shipping-company in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 200
Notice: Undefined index: shipping-address in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 201
Notice: Undefined index: shipping-address-2 in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 202
Notice: Undefined index: shipping-city in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 203
Notice: Undefined index: shipping-state in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 204
Notice: Undefined index: shipping-postcode in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 205
Notice: Undefined index: shipping-country in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 206
IMPORTANT:
Notice: Undefined variable: user_id in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 211
Notice: Undefined index: order_comments in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 256
Notice: Undefined index: billing-company in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 264
Notice: Undefined index: billing-address in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 265
Notice: Undefined index: billing-address-2 in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 266
Notice: Undefined index: billing-city in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 267
Notice: Undefined index: billing-postcode in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 268
Notice: Undefined index: billing-country in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 269
Notice: Undefined index: billing-state in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 270
Notice: Undefined index: billing-phone in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 272
Notice: Undefined index: shipping_method in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 282
Notice: Undefined index: payment_method in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 283
Notice: Undefined index: aiosp_edit in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/all-in-one-seo-pack/aioseop.class.php
on line 1105
Notice: Undefined index: nonce-aioseop-edit in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/all-in-one-seo-pack/aioseop.class.php
on line 1106
IMPORTANT:
Notice: Undefined variable: user_id in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 364
Notice: Undefined variable: available_gateways in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 379
IMPORTANT:
Fatal error: Call to a member function process_payment() on a
non-object in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 379
Notice: Undefined index: aiosp_enabled in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/all-in-one-seo-pack/all_in_one_seo_pack.php
on line 710
Notice: Undefined index: aiosp_enabled in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/all-in-one-seo-pack/all_in_one_seo_pack.php
on line 710
Notice: Use of undefined constant PLUGIN_URL - assumed 'PLUGIN_URL' in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/wp-google-fonts/google-fonts.php
on line 81
Notice: Use of undefined constant PLUGIN_PATH - assumed 'PLUGIN_PATH'
in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/wp-google-fonts/google-fonts.php
on line 82
Notice: Undefined index: host in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jetpack/jetpack.php
on line 2306
Notice: Undefined index: shipping-first_name in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 198
Notice: Undefined index: shipping-last_name in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 199
Notice: Undefined index: shipping-company in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 200
Notice: Undefined index: shipping-address in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 201
Notice: Undefined index: shipping-address-2 in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 202
Notice: Undefined index: shipping-city in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 203
Notice: Undefined index: shipping-state in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 204
Notice: Undefined index: shipping-postcode in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 205
Notice: Undefined index: shipping-country in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 206
Notice: Undefined variable: user_id in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 211
Notice: Undefined index: order_comments in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 256
Notice: Undefined index: billing-company in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 264
Notice: Undefined index: billing-address in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 265
Notice: Undefined index: billing-address-2 in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 266
Notice: Undefined index: billing-city in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 267
Notice: Undefined index: billing-postcode in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 268
Notice: Undefined index: billing-country in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 269
Notice: Undefined index: billing-state in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 270
Notice: Undefined index: billing-phone in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 272
Notice: Undefined index: shipping_method in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 282
Notice: Undefined index: payment_method in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 283
Notice: Undefined index: aiosp_edit in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/all-in-one-seo-pack/aioseop.class.php
on line 1105
Notice: Undefined index: nonce-aioseop-edit in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/all-in-one-seo-pack/aioseop.class.php
on line 1106
Notice: Undefined variable: user_id in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 364
Notice: Undefined variable: available_gateways in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 379
IMPORTANT!!!!:
Fatal error: Call to a member function process_payment() on a
non-object in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php
on line 379
Notice: Undefined index: aiosp_enabled in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/all-in-one-seo-pack/all_in_one_seo_pack.php
on line 710
Notice: Undefined index: aiosp_enabled in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/all-in-one-seo-pack/all_in_one_seo_pack.php
on line 710
Notice: Use of undefined constant PLUGIN_URL - assumed 'PLUGIN_URL' in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/wp-google-fonts/google-fonts.php
on line 81
Notice: Use of undefined constant PLUGIN_PATH - assumed 'PLUGIN_PATH'
in
/home2/findmyki/public_html/bolistylus/wp-content/plugins/wp-google-fonts/google-fonts.php
on line 82
There should be some text or json string in the response tab, but it's empty. This could be a result of php error that is hidden because of php settings in your server is set to hide all error messages, which is good.
Turn the debugging on see http://codex.wordpress.org/Editing_wp-config.php#Debug and try again. There should be some text in the response tab.
Update turn debugging on:
Something does not look right here. Do you get these errors when you send the Ajax request?
Looking at these errors I can see you have fatal error which must have stopped the code execution.
Fatal error: Call to a member function process_payment() on a non-object in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 379
You have modified the original file jigoshop_checkout.class.php so it is hard for me to find the exact lines for these errors. But "Notice: Undefined index: " means there is an array variable in that line does not have an index of...
The method 'process_payment' called once in this file
// Process Payment
$result = $available_gateways[$this->posted['payment_method']]->process_payment( $order_id );
$available_gateways is an array with objects of different payment methods. But there is no object for the payment method defined in $this->posted['payment_method']
Also, I can see there is another error message state that the variable $available_gateways does not exists/defined
Notice: Undefined variable: available_gateways in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 379
This variable can only be defined when jigoshop_cart::needs_payment() return true
if (jigoshop_cart::needs_payment()) :
// Payment Method
$available_gateways = jigoshop_payment_gateways::get_available_payment_gateways();
if (!isset($available_gateways[$this->posted['payment_method']])) :
jigoshop::add_error( __('Invalid payment method.','jigoshop') );
else :
// Payment Method Field Validation
$available_gateways[$this->posted['payment_method']]->validate_fields();
endif;
endif;
<input type="button" value="Submit" onClick="location.href='thankyou.php';">
If you don't need it to do anything else try that. You may need to edit the href to go where you want it to go. It worked for me on my site.
Also you can always have the action of the form redirect to another page then that page redirects to thank you page after processing.
Just use header('Location: '); to redirect.

Undefined or defined index ? Decide

I have strange problem.
Line 61: $this->_currentRoute = Default_Model_Routes::getInstance()->getCurrentRoute();
.......... other code ..........
Line 86: var_dump(isset($this->_currentRoute['url']));
Line 87: var_dump($this->_currentRoute['url']);
Line 88: if ($this->_currentRoute['url'] == $currentUrl)
Line 89: $navigation[$key]['active'] = true;
Line 90: var_dump($this->_currentRoute);
This is result:
bool(true)
string(62) "cs/Polozka-menu-1/Polozka-menu-1-1/Polozka-menu-1-1-1/Clanek-1"
array(17) {
["url"]=>
string(62) "cs/Polozka-menu-1/Polozka-menu-1-1/Polozka-menu-1-1-1/Clanek-1"
["type"]=>
string(7) "article"
............
}
And in the error log:
[09-Mar-2011 19:49:32] PHP Notice: Undefined index: url in ...file... on line 87
[09-Mar-2011 19:49:32] PHP Notice: Undefined index: url in ...file... on line 88
Please, if you have any ideas where could be problem or how to fix, tell me.
Thank you :)
I have tried another test:
$test = array();
echo $test['lol'];
With this result:
Notice: Undefined index: lol in ...file... on line 92
Somethink really interesting: THIS 'lol' error is displayed in output, BUT the 'url' error IS NOT ! It is only in the log ... why ????? It's same file, line under the 'url' var_dump() ... crazy
What happens if you assign $this->_currentRoute to a variable first?
$route = $this->_currentRoute;
var_dump(array_key_exists('url', $route));
var_dump(isset($route['url']));
print "PRINTING: ".$route['url'];
die("ENDING ON LINE [".__LINE__."] !!!");
Solved (see comments)
This was unfortunately an issue with Zend Server, or bleeding edge PHP 5.3.3.
Maybe this is not you errors?
Try to ini_set('display_errors', 1);
And also see method Default_Model_Routes::getInstance()->getCurrentRoute()::__get()
Read this

Categories