"; $end_highlight = ""; if ( $invertHighlight ) $start_highlight = ""; $return_value = TRUE; $outputPhrase = ""; $sentence = trim($inputPhrase); if ( $sentence == "" ) return !$return_value; $BadWordArray = array(); dbconnect(); $query = "SELECT BadWord FROM $badwordtable"; $query_result = @mysql_query( $query ); if( !$query_result ) error("ERROR in statement:
$query
prevented successful execution of query"); $lengthstr = strlen($sentence); $currlocinstr = 0; $outputPhrase = ""; while ($row = mysql_fetch_array($query_result, MYSQL_NUM)) { // go through the input phrase and locate every occurance of // this bad word $partstr = stristr($sentence,$row[0]); $lenpartstr = strlen($partstr); while ( $lenpartstr && $lengthstr = strlen($sentence) ) { // at least one bad word in phrase // get length of string starting at first bad word $lenpartstr = strlen($partstr); // is length of partstr = length remaining sentence? if ( $lenpartstr < $lengthstr ) { // bad word found at beginning? // no - bad word is inside of sentence // get first part of sentence and add it to // end of output phrase $outputPhrase .= substr($sentence,0,$lengthstr-$lenpartstr); // strip off part of sentence before bad word $sentence = substr($sentence,$lengthstr-$lenpartstr); } // add highlighted bad word to end of output phrase $outputPhrase .= $start_highlight . $row[0] . $end_highlight; // strip bad word from sentence $sentence = substr($sentence,strlen($row[0])); $return_value = FALSE; $partstr = stristr($sentence,$row[0]); $lenpartstr = strlen($partstr); } // add remainder of sentence to the output phrase $outputPhrase .= $sentence; $sentence = $outputPhrase; $outputPhrase = ""; } $outputPhrase = $sentence; return $return_value; } function displayFooter() { echo "

http://www.TheMuralsOfWinnipeg.com

\n"; echo "\n"; echo "\n"; exit; } function displayHeader( $title = "" ) { global $PAGE_BG_COLOR, $PAGE_BG_IMAGE; echo "\n\n"; echo "\n"; echo "$title\n"; echo "\n\n"; echo "\n\n"; } function error( $error ) { displayHeader( "Error Page" ); echo "

Error: $error\n"; echo "

Back

\n"; displayFooter(); mysql_close(); exit; } function verifyLogin($user,$passwd) { global $primaryusertable; $uname = trim( $user ); $pass = trim( $passwd ); $query = "SELECT ClientID,EmailAddress FROM $primaryusertable WHERE UserName='$uname' AND Password='$pass'"; $result = @mysql_query( $query ); if( mysql_num_rows( $result ) == 1 ) { // $row = mysql_fetch_array($result, MYSQL_ASSOC); $row = mysql_fetch_row($result); /* if($row["ClientID"]==0 || $row["EmailAddress"]=="") error( "Error in database information, UserName=$username, EmailAddress=$row["EmailAddress"] please contact adminstrator" ); */ if($row[1]=="") echo("Error in database information, UserName=$uname");// error( "Error in database information, UserName=$username, EmailAddress=$row[\"EmailAddress\"] please contact adminstrator" ); // if($row["EmailAddress"]=="") echo("Error in database information, UserName=$username");// error( "Error in database information, UserName=$username, EmailAddress=$row[\"EmailAddress\"] please contact adminstrator" ); else { // got user info from database, create session and return session_start(); $Email = $row[1]; // $EmailAddress = $row["EmailAddress"]; // $ClientID = $row["ClientID"]; $Client = $row[0]; session_register("Client"); session_register("uname"); session_register("pass"); session_register("Email"); } return true; } else return false; } function ImageCopyResampleBicubic (&$dst_img, &$src_img, $dst_x,$dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) /* port to PHP by John Jensen July 10 2001 (updated June 13, 2002 by tim@smoothdeity.com) -- original code (in C, for the PHP GD Module) by jernberg@fairytale.se */ { $palsize = ImageColorsTotal ($src_img); for ($i = 0; $i < $palsize; $i++) { // get palette. $colors = ImageColorsForIndex ($src_img, $i); ImageColorAllocate ($dst_img, $colors['red'], $colors['green'],$colors['blue']); } $scaleX = ($src_w - 1) / $dst_w; $scaleY = ($src_h - 1) / $dst_h; $scaleX2 = (int) ($scaleX / 2); $scaleY2 = (int) ($scaleY / 2); $dstSizeX = imagesx( $dst_img ); $dstSizeY = imagesy( $dst_img ); $srcSizeX = imagesx( $src_img ); $srcSizeY = imagesy( $src_img ); for ($j = 0; $j < ($dst_h - $dst_y); $j++) { $sY = (int) ($j * $scaleY) + $src_y; $y13 = $sY + $scaleY2; $dY = $j + $dst_y; if (($sY > $srcSizeY) or ($dY > $dstSizeY)) break 1; for ($i = 0; $i < ($dst_w - $dst_x); $i++) { $sX = (int) ($i * $scaleX) + $src_x; $x34 = $sX + $scaleX2; $dX = $i + $dst_x; if (($sX > $srcSizeX) or ($dX > $dstSizeX)) break 1; $color1 = ImageColorsForIndex ($src_img, ImageColorAt ($src_img, $sX,$y13)); $color2 = ImageColorsForIndex ($src_img, ImageColorAt ($src_img, $sX,$sY)); $color3 = ImageColorsForIndex ($src_img, ImageColorAt ($src_img, $x34,$y13)); $color4 = ImageColorsForIndex ($src_img, ImageColorAt ($src_img, $x34,$sY)); $red = ($color1['red'] + $color2['red'] + $color3['red'] + $color4['red']) / 4; $green = ($color1['green'] + $color2['green'] + $color3['green'] + $color4['green']) / 4; $blue = ($color1['blue'] + $color2['blue'] + $color3['blue'] + $color4['blue']) / 4; ImageSetPixel ($dst_img, $dX, $dY, ImageColorClosest ($dst_img, $red, $green, $blue)); } } } /*function verifyUser($username,$passwd) { session_start(); if( session_is_registered( "email" ) && session_is_registered( "passwd" ) ) { $result = mysql_query( "SELECT email, passwd FROM user WHERE email='$email' AND BINARY passwd='$passwd'" ) or error( "Login failed, please contact adminstrator" ); if( mysql_num_rows( $result ) == 1 ) return true; } return false; } function verifyAdmin() { session_start(); global $ADMIN_NAME, $ADMIN_PASS, $adminPasswd, $adminName; if( session_is_registered( "adminName" ) && session_is_registered( "adminPasswd" ) ) { if( $adminName == $ADMIN_NAME && $adminPasswd == $ADMIN_PASS ) return true; } return false; } function sentMail( $from, $to, $subject, $body ) { $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=ios-8859-1\r\n"; $headers .= "From: {$from}\r\n"; $result = @mail( $to, $subject, $body, $headers ); if( $result ) return true; else return false; } function currentLocation( $id ) { $result = mysql_query( "SELECT cat_name, root_id, papa_id FROM category WHERE root_id=$id" ) or error( mysql_error() ); $row = mysql_fetch_array( $result ); if( $row['papa_id'] == 0 ) $location = "Home :: {$row['cat_name']}"; else { $location = " > {$row['cat_name']}"; currentLocation( $row['papa_id'] ); } echo " $location\n"; } */ function makeThumb( $thumbFileName, $srcImage, $srcImageType, $thumbSizeX, $thumbSizeY ) { $im = ""; if ( $srcImageType == "image/pjpeg") { if ( !function_exists('imagecreatefromjpeg') ) error("Can't make thumbnail " . "because function: \"imagecreatefromjpeg\" doesn't " . "exist on this system"); $im = imagecreatefromjpeg($srcImage); } else if ( $srcImageType == "image/x-png") { if ( !function_exists('imagecreatefrompng') ) error("Can't make thumbnail " . "because function: \"imagecreatefrompng\" doesn't" . " exist on this system"); $im = imagecreatefrompng($srcImage); } if ( $im ) { $dimensions = GetImageSize($srcImage); $w=$dimensions[0]; $h=$dimensions[1]; $thumb=ImageCreate($thumbSizeX,$thumbSizeY); $wm = $w/$thumbSizeX; $hm = $h/$thumbSizeY; $h_height = $thumbSizeY/2; $w_height = $thumbSizeX/2; if($w > $h){ $adjusted_width = $w / $hm; $half_width = $adjusted_width / 2; $int_width = $half_width - $w_height; ImageCopyResampleBicubic($thumb,$im,-$int_width,0,0,0, $adjusted_width,$thumbSizeY,$w,$h); ImageJPEG($thumb,$thumbFileName,100); }elseif(($w < $h) || ($w == $h)){ $adjusted_height = $h / $wm; $half_height = $adjusted_height / 2; $int_height = $half_height - $h_height; ImageCopyResampleBicubic($thumb,$im,0,-$int_height,0,0, $thumbSizeX,$adjusted_height,$w,$h); ImageJPEG($thumb,$thumbFileName,100); }else{ ImageCopyResampleBicubic($thumb,$im,0,0,0,0,$thumbSizeX, $thumbSizeY,$w,$h); ImageJPEG($thumb,$thumbFileName,100); } imagedestroy($im); } } ?>