emediastudios Posted May 28, 2008 Share Posted May 28, 2008 My script work fine on localhost but get this error on my server online. Fatal error: Cannot redeclare htmlspecialchars_decode() in /home/emediast/public_html/salondigitalentertainment/includes/include.php on line 88 Code <?php /* ** Database functions */ function dbConnect() { $dbhost = "localhost"; //ex: LocalHost $dbuser = "emediast"; //ex: User $dbpass = "7833pjer"; //ex: iamapassword $db = "emediast_sde"; //ex: Resume $dbcnx = @mysql_connect($dbhost, $dbuser, $dbpass) or die("The site database appears to be down."); if ($db!="" and !@mysql_select_db($db)) die("The site database is unavailable."); return $dbcnx; } /* ** Universal Cleaning and Checking Functions */ function clean($var) { /* * Use preg_replace to replace things such as javascript: and any other nasties you can think of. This is the bloated bit. * Done because things like javascript: aren't caught by strip_tags. I also remove certain javascript functions for good measure */ //Now add in our own slashes $var = mysql_real_escape_string($var); //Strip any html tags $var = strip_tags($var); //Convert any special chars $var = htmlspecialchars($var); //turn it into html $var = htmlentities($var); $var = str_replace('\r\n','<br>',$var); //Take out any slashes, in case php is set to add them $var = stripslashes($var); return $var; } function EmailChk($email){ $regex = '&^(?: ("\s*(?:[^"\f\n\r\t\v\b\s]+\s*)+")| ([-\w!\#\$%\&\'*+~/^`|{}]+(?:\.[-\w!\#\$%\&\'*+~/^`|{}]+)*)) @(((\[)? (??:(??:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9]))\.){3} (??:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9]))))(?(5)\])| ((?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])?\.)*[a-z0-9](?:[-a-z0-9]*[a-z0-9])?) \.((?[^- ])[-a-z]*[-a-z]))) $&xi'; if( 0 < preg_match($regex, $email)) return true; else return false; } function EmailCheck($email){ $r = mysql_query("SELECT * FROM resume WHERE email='".$email."'") or die(mysql_error()); $num = mysql_num_rows($r); if(!$num) return true; else return false; } function cleanInputs(){ foreach($_GET as $key => $stuff){ $_GET[$key] = clean($stuff); } foreach($_POST as $key => $stuff){ if($key != "message" || $key != "choices") $_POST[$key] = clean($stuff); } } /* ** Call On-Run Functions */ session_start(); dbConnect(); //cleanInputs(); if (!function_exists("htmlspecialc hars_decode")) { function htmlspecialchars_decode($string, $quote_style = ENT_COMPAT) { return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style))); } } ?> Quote Link to comment Share on other sites More sharing options...
nloding Posted May 28, 2008 Share Posted May 28, 2008 I'm unsure. Does the hard-return in the middle of the function name in function_exists have anything to do with it? Quote Link to comment Share on other sites More sharing options...
emediastudios Posted May 28, 2008 Author Share Posted May 28, 2008 No idea. I payed a guy to build this script and he had to make an alteration to fix this error before, but i cant find the ammended file. I,m reusing it on another site. Quote Link to comment Share on other sites More sharing options...
nloding Posted May 28, 2008 Share Posted May 28, 2008 Remove the hard return in the name ... your script is failing that if check, then trying to define the function when it already exists. So the issue is most likely with that if statement. I'd also recommend removing usernames and passwords from script when you post them Quote Link to comment Share on other sites More sharing options...
ILYAS415 Posted May 28, 2008 Share Posted May 28, 2008 Hmm i would say... Replace this bit of code... if (!function_exists("htmlspecialc hars_decode")) { function htmlspecialchars_decode($string, $quote_style = ENT_COMPAT) { return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style))); } } with... function htmlspecialchars_decode($string, $quote_style = ENT_COMPAT) { return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style))); } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.