Jump to content
Larry Ullman's Book Forums

Ex1 - Site Live -- Error Page Google Or Robot


Recommended Posts

Hello Larry

 

Maybe my question is about the limit of this forum

but can nevertheless interested when the live website send forth errors

 

with the exemple 1, i realized a site

recettesoriginales.fr

 

For a better url, i transform 

 

http://recettesoriginales.fr/category.php?cat_id=1

 

as 

 

http://recettesoriginales.fr/category.php?category=apéritifs

 

so it's ok But

 


 I did a few days after launching the site on the web.

Now I regularly get errors caused by robots
like this:
LIVE -- Une erreur, An error occurred in script '/home/recettesih/www/category.php' on line 6:
Undefined index: category
<pre>Array
(
   [0] => Array
       (
           [file] => /home/recettesih/www/category.php
           [line] => 6
           [function] => my_error_handler_lv
           [args] => Array
               (
                   [0] => 8
                   [1] => Undefined index: category
                   [2] => /home/recettesih/www/category.php
                   [3] => 6
                   [4] => Array
                       (
                           [_GET] => Array
                               (
                                   [cat_id] => 3
                               )

                           [_POST] => Array
                               (
                               )

                           [_COOKIE] => Array
                               (
                                   [xxlplan] => R908481581
                               )

                           [_FILES] => Array
                               (
                               )

                           [_SERVER] => Array
                               (
                                   [USER] => recettesih
                                   [FCGI_ROLE] => RESPONDER
                                   [APP_ENGINE_VERSION] => 5.5
                                   [APP_ENGINE] => php
                                   [ENVIRONMENT] => production
                                   [UNIQUE_ID] => VItXuAoAPZIAAEpi6pMAAAGp
                                   [GEOIP_COUNTRY_CODE] => FR
                                   [GEOIP_COUNTRY_NAME] => France
                                   [GEOIP_DMA_CODE] => 0
                                   [GEOIP_AREA_CODE] => 0
                                   [GEOIP_LATITUDE] => 48.860001
                                   [GEOIP_LONGITUDE] => 2.350000
                                   [SCRIPT_URL] => /category.php
                                   [SCRIPT_URI] => http://recettesoriginales.fr/category.php
                                   [CFG_CLUSTER] => cluster007
                                   [PHP_VER] => 5_5
                                   [HTTP_REMOTE_IP] => 188.165.15.198
                                   [HTTP_HOST] => recettesoriginales.fr
                                   [HTTP_COOKIE] => xxlplan=R908481581
                                   [HTTP_X_PREDICTOR] => 1
                                   [HTTP_CONNECTION] => close
                                   [HTTP_USER_AGENT] => Mozilla/5.0 (compatible; AhrefsBot/5.0; +http://ahrefs.com/robot/)
                                   [HTTP_ACCEPT] => */*
                                   [HTTP_X_GEO] => varn36.rbx5
                                   [HTTP_X_GEO_PORT] => 1007
                                   [SERVER_SIGNATURE] => 
                                   [SERVER_SOFTWARE] => Apache
                                   [SERVER_NAME] => recettesoriginales.fr
                                   [SERVER_ADDR] => 10.0.97.146
                                   [SERVER_PORT] => 80
                                   [REMOTE_ADDR] => 188.165.15.198
                                   [DOCUMENT_ROOT] => /home/recettesih/www
                                   [SERVER_ADMIN] => postmaster@recettesoriginales.fr
                                   [SCRIPT_FILENAME] => /home/recettesih/www/category.php
                                   [REMOTE_PORT] => 51220
                                   [GATEWAY_INTERFACE] => CGI/1.1
                                   [SERVER_PROTOCOL] => HTTP/1.1
                                   [REQUEST_METHOD] => GET
                                   [QUERY_STRING] => cat_id=3
                                   [REQUEST_URI] => /category.php?cat_id=3
                                   [SCRIPT_NAME] => /category.php
                                   [PHP_SELF] => /category.php
                                   [REQUEST_TIME_FLOAT] => 1418418104.4165
                                   [REQUEST_TIME] => 1418418104
                                   [argv] => Array
                                       (
                                           [0] => cat_id=3
                                       )

                                   [argc] => 1
                               ) 

an extract of the code

/*line 6*/  if( filter_var($_GET['category'], FILTER_SANITIZE_STRING ) ){

 $category = $_GET['category'];

	$q ="SELECT category FROM categorie WHERE category =?";
	$stmt = mysqli_prepare($dbc,$q);
	mysqli_stmt_bind_param($stmt, 's', $category);
	mysqli_stmt_execute($stmt);
	mysqli_stmt_store_result($stmt);
	
	
	if(mysqli_stmt_num_rows($stmt) !== 1 ){
		$page_title = 'Error!';
		include('./is/error-page.php');
		/*
		include('./is/header.inc.html');
		echo'<div class="alert alert-danger">Vous avez accéder à cette page par erreur. </div>';
		include('./is/footer.inc.html');
		*/
		exit();
	}

mysqli_stmt_bind_result($stmt, $category);
 
mysqli_stmt_fetch($stmt);
mysqli_stmt_close($stmt);
$page_title = $category;
include('./is/header.inc.html');
?>

../..

 

 

 

 

and if i test in live

http://recettesoriginales.fr/category.php?cat_id=4

 

i have my response error message

"Vous avez accéder à cette page par erreur. Désolé."

so it's the true and ok

 

so i you are an advice

 

cordialy

Link to comment
Share on other sites

Thanks Larry for the advice.

 

cordialy

 

this night(5h28), I received this error. I hope this will be over thanks to your advice.

                                   [APP_ENGINE_VERSION] => 5.5
                                   [APP_ENGINE] => php
                                   [ENVIRONMENT] => production
                                   [UNIQUE_ID] => VJEGeAoAPZgAAAoeccoAAAAu
                                   [GEOIP_COUNTRY_CODE] => US
                                   [GEOIP_COUNTRY_NAME] => United States
                                   [GEOIP_REGION] => VA
                                   [GEOIP_CITY] => Chantilly
                                   [GEOIP_DMA_CODE] => 511
                                   [GEOIP_AREA_CODE] => 703
                                   [GEOIP_LATITUDE] => 38.894299
                                   [GEOIP_LONGITUDE] => -77.431099
                                   [SCRIPT_URL] => /category.php
                                   [SCRIPT_URI] => http://recettesoriginales.fr/category.php
                                   [CFG_CLUSTER] => cluster007
                                   [PHP_VER] => 5_5
                                   [HTTP_REMOTE_IP] => 208.43.251.182
                                   [HTTP_HOST] => recettesoriginales.fr
                                   [HTTP_COOKIE] => xxlplan=R908513162
                                   [HTTP_X_PREDICTOR] => 1
                                   [HTTP_CONNECTION] => close
                                   [HTTP_USER_AGENT] => Mozilla/5.0 (compatible; SiteExplorer/1.0b; +http://siteexplorer.info/)
Link to comment
Share on other sites

Yes Larry, sorry this part it's ok.

 

it was an extract only to locate the place.

 

You could see the top of the message

LIVE -- Une erreur, An error occurred in script '/home/recettesih/www/category.php' on line 6:
Undefined index: category
<pre>Array
(
   [0] => Array
       (
           [file] => /home/recettesih/www/category.php
           [line] => 6
           [function] => my_error_handler_lv
           [args] => Array
               (
                   [0] => 8
                   [1] => Undefined index: category
                   [2] => /home/recettesih/www/category.php
                   [3] => 6
                   [4] => Array
                       (
                           [_GET] => Array

Since your advice, i don't get more errors. C'est formidable…

 

Thanks a lot

 

cordialy

Link to comment
Share on other sites

 Share

×
×
  • Create New...