Problème de compatibilité PHP4 / PHP5 !

Répondre


Cette question est un moyen d’empêcher des soumissions automatisées de formulaires par des robots.
Smileys
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: =D> #-o =P~ :^o :non: :priere: 8-|
Voir plus de smileys
  Revue du sujet
 

  Étendre la vue Revue du sujet : Problème de compatibilité PHP4 / PHP5 !

Re: Problème de compatibilité PHP4 / PHP5 !

par jrmy7 » 28 nov. 2011, 20:22

Je suis vraiment étourdie.... :oops:

Mais c'est vrai que je ne comprend comment ça fonctionné en PHP4 ???

En tout cas MERCI :D , ça marche très bien maintenant.

Re: Problème de compatibilité PHP4 / PHP5 !

par moogli » 28 nov. 2011, 17:38

J'ai quelque chose qui me saute aux yeux:

if (preg_match('#Android|BlackBerry|Cellphone|iPhone|iPod|hiptop|HTC|MIDP-2\.|MMEF20|MOT-V|NetFront|Newt|Nintendo Wii|Nintendo DS|Nitro|Nokia|Opera Mobi|Palm|PlayStation Portable|PSP|portalmmm|SonyEricsson|Symbian|UP.Browser|UP.Link|webOS|Windows CE|WinWAP|YahooSeeker/M1A1-R2D2|LGE VX|Maemo|phone )#', $_SERVER['HTTP_USER_AGENT']))
vi c'est ça la ) en trop :)

Re: Problème de compatibilité PHP4 / PHP5 !

par sam12 » 28 nov. 2011, 17:30

J'ai quelque chose qui me saute aux yeux:

if (preg_match('#Android|BlackBerry|Cellphone|iPhone|iPod|hiptop|HTC|MIDP-2\.|MMEF20|MOT-V|NetFront|Newt|Nintendo Wii|Nintendo DS|Nitro|Nokia|Opera Mobi|Palm|PlayStation Portable|PSP|portalmmm|SonyEricsson|Symbian|UP.Browser|UP.Link|webOS|Windows CE|WinWAP|YahooSeeker/M1A1-R2D2|LGE VX|Maemo|phone )#', $_SERVER['HTTP_USER_AGENT']))

Problème de compatibilité PHP4 / PHP5 !

par jrmy7 » 28 nov. 2011, 16:33

:D Bonjour à tous ! :D

Voilà j'ai était obligé de passer en PHP5 si pour mettre du xml à jour avec du php en utiisant le DOM.

Mais depuis j'ai un problème avec un script PHP servant à rediriger le visiteur selon s'il utilise un "Smartphone" ou un ordinateur (le script ne redirige plus lorsque l'on y va avec un ordi :cry:).

Voilà le script utilisé (qui fonctionne très bien en PHP4 !) :
<?php

if(checkmobile()) 
	 header('Location:http://www.eternal-graphic.com/mobile/m_detect_lang.php');

function checkmobile()
{
	if (isset($_SERVER['HTTP_X_WAP_PROFILE']) || isset($_SERVER['HTTP_PROFILE']))
		return true;

	if (isset ($_SERVER['HTTP_ACCEPT']))
	{
		$accept = strtolower($_SERVER['HTTP_ACCEPT']);
		if (strpos($accept, 'wap') !== false)
			return true;
	}

	if (isset ($_SERVER['HTTP_USER_AGENT']))
	{
		if (strpos ($_SERVER['HTTP_USER_AGENT'], 'Mobile') !== false)
			return true;

		if (strpos ($_SERVER['HTTP_USER_AGENT'], 'Opera Mini') !== false)
			return true;
			
		if (preg_match('#Android|BlackBerry|Cellphone|iPhone|iPod|hiptop|HTC|MIDP-2\.|MMEF20|MOT-V|NetFront|Newt|Nintendo Wii|Nintendo DS|Nitro|Nokia|Opera Mobi|Palm|PlayStation Portable|PSP|portalmmm|SonyEricsson|Symbian|UP.Browser|UP.Link|webOS|Windows CE|WinWAP|YahooSeeker/M1A1-R2D2|LGE VX|Maemo|phone)#', $_SERVER['HTTP_USER_AGENT']))
	  		return true;
	}

	header('Location: http://www.eternal-graphic.com/computer/c_detect_lang.php');
}
?>


Voilà le msg sur la page : :shock:


Warning: preg_match() [function.preg-match]: Compilation failed: unmatched parentheses at offset 280 in /homepages/39/d299682238/htdocs/eternal-graphic/index.php on line 26

Warning: Cannot modify header information - headers already sent by (output started at /homepages/39/d299682238/htdocs/eternal-graphic/index.php:26) in /homepages/39/d299682238/htdocs/eternal-graphic/index.php on line 30


...pour voir de vous même : http://www.eternal-graphic.com




Un grand merci
d'avance à ceux qui pourront m'aider ! :)

.