Location: PHPKode > scripts > Particle Gallery > includes/functions.php
<?php
// include other stuff
include("bbcode.php");
include("breadcrumbs.php");
include("functions_admin.php");
include("functions_comments.php");
include("functions_fetch.php");
include("functions_get.php");
include("functions_images.php");
include("functions_maintenance.php");
include("functions_messages.php");
include("functions_moderate.php");
include("functions_other.php");
include("functions_skineditor.php");
include("functions_skins.php");
include("functions_url.php");

// mainstream functions
function dbSecure($code){
	
	if (get_magic_quotes_gpc()) {
	   $code = stripslashes($code);
	}
	
	if (function_exists("mysql_real_escape_string")){
		$code = mysql_real_escape_string($code);
	} elseif (function_exists("mysql_escape_string")){
		$code = mysql_escape_string($code);
	} else {
		$code = addslashes($code);
	}
	
	return $code;
}

// strip slashes for submitted forms
function un($code){
	if (get_magic_quotes_gpc()) {
	   $code = stripslashes($code);
	}
	return $code;
}

// allow encoding of messages
function Encode($code){
	$code = nl2br($code);
	return $code;
}

// 404 error function pretty much
function notfound(){
	//echo("404"); die();
	header("HTTP/1.0 404 Not Found");
	echo("<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">");
	echo("<HTML><HEAD>");
	echo("<TITLE>404 Not Found</TITLE>");
	echo("</HEAD><BODY>");
	echo("<H1>Not Found</H1>");
	echo("<P>The requested URL was not found on this server.<P>");
	echo("</BODY></HTML>");
	die();
}

// crazy crap to start a session
function StartSession(){
	ini_set('url_rewriter.tags', '');
	session_start();
}

// redirect or echo URL if not supported
function redirect($url){
	Header("Location: " . $url);
	echo($url);
	die();
}

// send an email
function communicate($to, $subject, $msg){
	global $config;
	
	// standard validation
	if ($to == ""){ return "No recipent supplied"; }
	if ($subject == ""){ return "No subject supplied"; }
	if ($msg == ""){ return "No message body supplied"; }
	
	// spam filters
	$fullstr1 = $name . $email . $subject . $message;
	$fullstr2 = $name . $email . $subject;
	
	if (eregi("MIME-Version: ", $fullstr1)){
		return "The message was rejected as spam";
	}
	
	if (eregi("\r", $fullstr2) || eregi("\n", $fullstr2)){
		 return "The message was rejected as spam";
	}
	
	// build headers
	$headers  = "MIME-Version: 1.0\r\n";
	$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
	$headers .= "From: \"" . $config["sitename"] . "\"\r\n\r\n";
	
	// send the mail
	$r = @mail($to, $subject, $msg, $headers);
	if ($r === FALSE){ return false; }
	
	// and return
	return "Email sent successfully";
}
?>
Return current item: Particle Gallery