mezloh Posted April 26, 2008 Share Posted April 26, 2008 I can't seem to locate the error in my code and maybe its because of being a novice or its just there and i cant see it. I have had my blog going for about a year and yesterday this errors popped up along with another. I am pretty sure they are connected to each other in some way but i can't find the mistake in the code. This has kept me out of my site for a little over 24 hours now because i can't find these particular errors anywhere and no solution so far either. Here are the errors i am receiving and the chunks of code from the problem areas. Lines wrapped in bold tags are the error lines. If you need any more info please let me know. Warning: stristr() [function.stristr]: Empty delimiter. in /homepages/37/d193440522/htdocs/knockout/wp-content/plugins/wp-shopping-cart/wp-shopping-cart.php on line 2094 Parse error: syntax error, unexpected ',' in /homepages/37/d193440522/htdocs/knockout/wp-includes/pluggable.php on line 506 Pluggable.php if ( '' == $password ) { $error = __('<strong>ERROR</strong>: The password field is empty.'); return false; } $login = get_userdatabylogin($username); //$login = $wpdb->get_row("SELECT ID [b]user_login, user_pass FROM $wpdb->users WHERE user_login = '$username'");[/b] WP-Shopping-Cart php // pe.{ if(get_option('wpsc_share_this') == 1) { [b]if(stristr(("http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']), get_option('product_list_url'))){[/b] include_once(dirname(__FILE__)."/share-this.php"); } } include_once(dirname(__FILE__)."/show_cats_brands.php"); // if(get_option('cat_brand_loc') != 0) // { // //add_action('wp_list_pages', 'show_cats_brands'); // } // }.pe add_action('plugins_loaded', 'widget_wp_shopping_cart_init'); switch(get_option('cart_location')) Thank you in advance Link to comment https://forums.phpfreaks.com/topic/102980-looking-for-help-parse-error-syntax-error-unexpected/ Share on other sites More sharing options...
phpSensei Posted April 26, 2008 Share Posted April 26, 2008 For pluggable try <?php if ( $password == '') { $error = '<strong>ERROR</strong>: The password field is empty.'; return false; } $login = get_userdatabylogin($username); $login = $wpdb->get_row("SELECT ID user_login, user_pass FROM $wpdb->users WHERE user_login = '$username'"); ?> Link to comment https://forums.phpfreaks.com/topic/102980-looking-for-help-parse-error-syntax-error-unexpected/#findComment-527549 Share on other sites More sharing options...
mezloh Posted April 26, 2008 Author Share Posted April 26, 2008 That took care of the parse error and not it moved down a few lines to 515 giving me this error. Parse error: syntax error, unexpected T_STRING in /homepages/37/d193440522/htdocs/knockout/wp-includes/pluggable.php on line 515 I will see what i can find to fix this while i wait for an answer. Thank you for your help so far. if (!$login) { $error = __('<strong>ERROR</strong>: Invalid username.'); return false; } else { // If the password is already_md5, it has been double hashed. <---------515 // Otherwise, it is plain text. if ( ($already_md5 && md5($login->user_pass) == $password) || ($login->user_login == $username && $login->user_pass == md5($password)) ) { return true; } else { $error = __('<strong>ERROR</strong>: Incorrect password.'); $pwd = ''; return false; } } } endif; Link to comment https://forums.phpfreaks.com/topic/102980-looking-for-help-parse-error-syntax-error-unexpected/#findComment-527559 Share on other sites More sharing options...
phpSensei Posted April 26, 2008 Share Posted April 26, 2008 lol, what the hell is the __('dksfjdlskfjsdf': invalid'); for? try <?php if (!$login) { $error = '<strong>ERROR</strong>: Invalid username.'; return false; } else { // If the password is already_md5, it has been double hashed. <---------515 // Otherwise, it is plain text. if (($already_md5 && md5($login->user_pass) == $password) || ($login->user_login == $username && $login->user_pass == md5($password)) ) { return true; } else { $error = '<strong>ERROR</strong>: Incorrect password.'; $pwd = ''; return false; } } } ?> Link to comment https://forums.phpfreaks.com/topic/102980-looking-for-help-parse-error-syntax-error-unexpected/#findComment-527561 Share on other sites More sharing options...
mezloh Posted April 26, 2008 Author Share Posted April 26, 2008 Thank you that worked and the problem again is working its way down my code and finding errors. Didn't know a wordpress file would be so jacked up. I didn't do a thing to it and its been running fine for a year with no problems and through upgrades etc etc. Anyway its now in line 739 I think i might have an idea what is throwing this one but i'd like confirmation. Here it is: Parse error: syntax error, unexpected T_VARIABLE in /homepages/37/d193440522/htdocs/knockout/wp-includes/pluggable.php on line 739 Again thanks for the help. I'm getting closer. Any ideas on my first warning error up in my post in my shopping cart code that i posted. if ( !function_exists('wp_safe_redirect') ) : /** * performs a safe (local) redirect, using wp_redirect() * @return void **/ function wp_safe_redirect($location, $status = 302) { // Need to look at the URL the way it will end up in wp_redirect() $location = wp_sanitize_redirect($location); // browsers will assume 'http' is your protocol, and will obey a redirect to a URL starting with '//' if ( substr($location, 0, 2) == '//' ) $location = 'http:' . $location; $lp = parse_url($location); $wpp = parse_url(get_option('home')); $allowed_hosts = (array) Link to comment https://forums.phpfreaks.com/topic/102980-looking-for-help-parse-error-syntax-error-unexpected/#findComment-527575 Share on other sites More sharing options...
haku Posted April 26, 2008 Share Posted April 26, 2008 No offense, but you should probably learn to find these errors yourself. You say you think you've found it but want confirmation, well make the change and see if it works, that will confirm whether you are right or not. Here is something to help though. When you get an error like this one that you posted above Parse error: syntax error, unexpected T_VARIABLE The key is in the T_VARIABLE. Ignore the T_. Its telling you that it has found an unexpected VARIABLE. This means that somewhere before the place it found that variable, there was a mistake. It continued on as if it wasn't a mistake until it came to this variable. At this point the script knew that a variable couldn't exist there, so you get the error. So go to the line, look for a variable, then work backwards and find your error. Maybe you forgot a semi colon, or maybe a quotation mark or maybe something else. But if you are posting every error on the internet, its going to take you forever to make ANY script. Link to comment https://forums.phpfreaks.com/topic/102980-looking-for-help-parse-error-syntax-error-unexpected/#findComment-527576 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.