Jump to content

Include file error


emediastudios

Recommended Posts

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)));
    }
}




?>

Link to comment
https://forums.phpfreaks.com/topic/107554-include-file-error/
Share on other sites

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)));
}

Link to comment
https://forums.phpfreaks.com/topic/107554-include-file-error/#findComment-551786
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.