Visualizzazione dei risultati da 1 a 3 su 3

Discussione: RateApic

  1. #1

    RateApic

    Qualcuno è riuscito a farlo funzionare?
    Non mi visualizza le thumb e non le carica nella directory
    Vedi qui

    Tre sono i file principali(che riporterò separati data la lunghezza)

    fileupload
    codice:
    <?
    # =================================================================== #
    #
    # iMarc PHP Library
    # Copyright 1999, 2002 David Fox, Angryrobot Productions 
    #                (See below for full license)
    # 
    # VERSION: 2.0
    # LAST UPDATE: 2002-04-02
    # CONTENT: PHP file upload class
    #
    # =================================================================== #
    # 
    # USAGE and SETUP instructions at the bottom of this page (README)
    # 
    # =================================================================== #
    /*
    	METHODS:
    		max_filesize() - set a max filesize in bytes
    		max_image_size() - set max pixel dimenstions for image uploads
    		upload() - checks if file is acceptable, uploads file to server's temp directory
    		save_file() - moves the uploaded file and renames it depending on the save_file($mode)
    
    	Error codes:
    		$errors[0] - "No file was uploaded"
    		$errors[1] - "Maximum file size exceeded"
    		$errors[2] - "Maximum image size exceeded"
    		$errors[3] - "Only specified file type may be uploaded"
    		$errors[4] - "File already exists" (save only)
    */
    # ------------------------------------------------------------------- #
    # UPLOADER CLASS
    # ------------------------------------------------------------------- #
    class uploader {
    
    	var $file;
    	var $errors;
    	var $accepted;
    	var $max_filesize;
    	var $max_image_width;
    	var $max_image_height;
    	var $uploaded_file;
    
    	# ----------------------------------- #
    	# FUNCTION: max_filesize 
    	# ARGS: $size
    	# DESCRIPTION: Set the maximum file size
    	# in bytes ($size), allowable by the object.
    	#
    	# NOTE: PHP's configuration file also can control
    	# the maximum upload size, which is set to 2 or 4 
    	# megs by default. To upload larger files, you'll 
    	# have to change the php.ini file first.
    	# ----------------------------------- #
    	function max_filesize($size){
    		$this->max_filesize = $size;
    	}
    
    	# ----------------------------------- #
    	# FUNCTION: max_image_size 
    	# ARGS: $width, $height
    	# DESCRIPTION: Sets the maximum pixel dimensions
    	# for image uploads
    	# ----------------------------------- #
    	function max_image_size($width, $height){
    		$this->max_image_width = $width;
    		$this->max_image_height = $height;
    	}
    
    	# ----------------------------------- #
    	# FUNCTION: upload 
    	# ARGS: $filename, $accept_type, $extension
    	# DESCRIPTION: Checks and sets the raw 
    	# file data, checks if the content type is 
    	# acceptable (if $accept_type) is set, and 
    	# adds a default extension ($extention) if
    	# there is no ".xxx" in the filename
    	# ----------------------------------- #
    	function upload($filename, $accept_type='', $extention='') {
    		// get all the properties of the file
    		$index = array("file", "name", "size", "type");
    		for($i = 0; $i < 4; $i++) {
    			$file_var = '$' . $filename . (($index[$i] != "file") ? "_" . $index[$i] : "");
    			eval('global ' . $file_var . ';');
    			eval('$this->file[$index[$i]] = ' . $file_var . ';');
    		}
    		
    		if($this->file["file"] && $this->file["file"] != "none") {
    			// test max size
    			if($this->max_filesize && $this->file["size"] > $this->max_filesize) {
    				$this->errors[1] = "Maximum file size exceeded. File may be no larger than " . $this->max_filesize/1000 . "KB (" . $this->max_filesize . " bytes).";
    				return FALSE;
    			}
    	 		if(ereg("image", $this->file["type"])) {
    	 			$image = getimagesize($this->file["file"]);
    	 			$this->file["width"]  = $image[0];
    	 			$this->file["height"] = $image[1];
    
    				// test max image size
    				if(($this->max_image_width || $this->max_image_height) && (($this->file["width"] > $this->max_image_width) || ($this->file["height"] > $this->max_image_height))) {
    					$this->errors[2] = "Maximum image size exceeded. Image may be no more than " . $this->max_image_width . " x " . $this->max_image_height . " pixels";
    					return FALSE;
    				}
    	 			switch($image[2]) {
    	 				case 1:
    	 					$this->file["extention"] = ".gif";
    	 					break;
    	 				case 2:
    	 					$this->file["extention"] = ".jpg";
    	 					break;
    	 				case 3:
    	 					$this->file["extention"] = ".png";
    	 					break;
    	 				default:
    						$this->file["extention"] = $extention;
    	 					break;
    	 			}
    			} elseif(!ereg("(\.)([a-z0-9]{3,5})$", $this->file["name"]) && !$extention) {
    				// add new mime types here
    				switch($this->file["type"]) {
    					case "text/plain":
    						$this->file["extention"] = ".txt";
    						break;
    					default:
    						break;
    				}
    	 		} else {
    				$this->file["extention"] = $extention;
    			}
    		
    			// check to see if the file is of type specified
    			if($accept_type) {
    				if(ereg($accept_type, $this->file["type"])) {
    					$this->accepted = TRUE;
    				} else { 
    					$this->accepted = FALSE;
    					$this->errors[3] = "Only " . ereg_replace("\|", " or ", $accept_type) . " files may be uploaded";
    				}
    			} else { 
    				$this->accepted = TRUE;
    			}
    		} else { 
    			$this->accepted  = FALSE;
    			$this->errors[0] = "No file was uploaded";
    		}
    		return $this->accepted;		
    	}
    
    	# ----------------------------------- #
    	# FUNCTION: save_file 
    	# ARGS: $path, $mode
    	# DESCRIPTION: Writes the file data to 
    	# $path, after renaming the file by stripping
    	# out non-alphanumeric characters. This function
    	# also checks the upload $mode:
    	#
    	#	$mode = 1 :: overwrite existing file
    	#	$mode = 2 :: rename new file if a file
    	#	             with the same name already 
    	#                exists: file.txt becomes file_copy0.txt
    	#	$mode = 3 :: do nothing if a file with the
    	#	             same name already exists
    	# ----------------------------------- #
    	function save_file($path, $mode="3"){
    		$this->path = $path;	
    		if($this->accepted) {
    			// very strict naming of file.. only lowercase letters, numbers and underscores
    			$this->file["name"] = ereg_replace("[^a-z0-9._]", "", ereg_replace(" ", "_", ereg_replace("%20", "_", strtolower($this->file["name"]))));
    						
    			// check for extention and remove - we want to get JUST the 
    			// filename (without the extenstion) into the variable $name
    			if(ereg("(\.)([a-z0-9]{2,5})$", $this->file["name"])) {
    				$pos = strrpos($this->file["name"], ".");
    				if(!$this->file["extention"]) { 
    					$this->file["extention"] = substr($this->file["name"], $pos, strlen($this->file["name"]));
    				}
    				$name = substr($this->file["name"], 0, $pos);
    			} else {
    				$name = $this->file["name"];
    				if ($this->file["extention"]) {
    					$this->file["name"] = $this->file["name"] . $this->file["extention"];
    				}
    			}
    			$this->uploaded_file = $this->path . $this->file["name"];
    			 
    			if(ereg("text", $this->file["type"])) {
    				// If it's a text file, we may need to convert MAC and/or PC
    				// line breaks to UNIX
    				// chr(13)  = CR (carridge return) = Macintosh
    				// chr(10)  = LF (line feed)       = Unix
    				// Win line break = CRLF
    				$new_file  = '';
    				$old_file  = '';
    				$fcontents = file($this->file["file"]);
    				while (list ($line_num, $line) = each($fcontents)) {
    					$old_file .= $line;
    					$new_file .= str_replace(chr(13), chr(10), $line);
    				}
    				if ($old_file != $new_file) {
    					// Open the uploaded file, and re-write it
    					// with the new changes
    					$fp = fopen($this->file["file"], "w");
    					fwrite($fp, $new_file);
    					fclose($fp);
    				}
    			}
    			
    			switch($mode) {
    				case 1: // overwrite mode
    					$aok = copy($this->file["file"], $this->uploaded_file);
    					break;
    				case 2: // create new with incremental extention
    					while(file_exists($this->path . $name . $copy . $this->file["extention"])) {
    						$copy = "_copy" . $n;
    						$n++;
    					}
    					$this->file["name"]  = $name . $copy . $this->file["extention"];
    					$this->uploaded_file = $this->path . $this->file["name"];
    					$aok = copy($this->file["file"], $this->uploaded_file);
    					break;
    				case 3: // do nothing if exists, highest protection
    					if(file_exists($this->uploaded_file)){
    						$this->errors[4] = "File &quot" . $this->uploaded_file . "&quot already exists";
    					} else {
    						$aok = copy($this->file["file"], $this->uploaded_file);
    					}
    					break;
    				default:
    					break;
    			}
    			
    			if(!$aok) { unset($this->uploaded_file); }
    			return $aok;
    		} else {
    			return FALSE;
    		}
    	}
    }
    
    
    
    
    /*
    <readme>
    
    	fileupload.class can be used to upload files of any type
    	to a web server using a web browser. The uploaded file's name will 
    	get cleaned up - special characters will be deleted, and spaces 
    	get replaced with underscores, and moved to a specified 
    	directory (on your server). fileupload.class also does its best to 
    	determine the file's type (text, GIF, JPEG, etc). If the user 
    	has named the file with the correct extension (.txt, .gif, etc), 
    	then the class will use that, but if the user tries to upload 
    	an extensionless file, PHP does can identify text, gif, jpeg, 
    	and png files for you. As a last resort, if there is no 
    	specified extension, and PHP can not determine the type, you 
    	can set a default extension to be added.
    	
    	SETUP:
    		Make sure that the directory that you plan on uploading 
    		files to has enough permissions for your web server to 
    		write/upload to it. (usually, this means making it world writable)
    			- cd /your/web/dir
    			- chmod 777 <fileupload_dir>
    		
    		The HTML FORM used to upload the file should look like this:
    		<form method="post" action="upload.php" enctype="multipart/form-data">
    			<input type="file" name="userfile"> 
    			<input type="submit" value="Submit">
    		</form>
    
    
    	USAGE:
    		// Create a new instance of the class
    		$my_uploader = new uploader;
    		
    		// OPTIONAL: set the max filesize of uploadable files in bytes
    		$my_uploader->max_filesize(90000);
    
    		// OPTIONAL: if you're uploading images, you can set the max pixel dimensions 
    		$my_uploader->max_image_size(150, 300); // max_image_size($width, $height)
    		
    		// UPLOAD the file
    		// $my_uploader->upload($upload_file_name, $acceptable_file_types, $default_extension)
    		$success = $my_uploader->upload("userfile", "", ".jpg");
    		
    		if ($success) {
    			// MOVE THE FILE to it's final destination
    			
    			//	$mode = 1 :: overwrite existing file
    			//	$mode = 2 :: rename new file if a file
    			//	             with the same name already 
    			//               exists: file.txt becomes file_copy0.txt
    			//	$mode = 3 :: do nothing if a file with the
    			//	             same name already exists
    			$success = $my_uploader->save_file("/your/web/dir/fileupload_dir", int $mode);
    		}
    		
    		if ($success) {
    			// Successful upload!
    			$file_name = $my_uploader->file['name'];
    			print($file_name . " was successfully uploaded!");
    		} else {
    			// ERROR uploading...
     			if($my_uploader->errors) {
    				while(list($key, $var) = each($my_uploader->errors)){
    				echo $var . "
    ";
    			}
     		}
    </readme>
    
    
    <license>
    
    	///// fileupload.class /////
    	Copyright (c) 1999, 2002 David Fox, Angryrobot Productions
    	(http://www.angryrobot.com) All rights reserved.
    	
    	Redistribution and use in source and binary forms, with or without 
    	modification, are permitted provided that the following conditions 
    	are met:
    	1. Redistributions of source code must retain the above copyright 
    	   notice, this list of conditions and the following disclaimer.
    	2. Redistributions in binary form must reproduce the above 
    	   copyright notice, this list of conditions and the following 
    	   disclaimer in the documentation and/or other materials provided 
    	   with the distribution.
    	3. Neither the name of author nor the names of its contributors 
    	   may be used to endorse or promote products derived from this 
    	   software without specific prior written permission.
    
    	DISCLAIMER:
    	THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" 
    	AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 
    	TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
    	PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR 
    	CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
    	SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
    	LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 
    	USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
    	AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
    	LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
    	IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
    	THE POSSIBILITY OF SUCH DAMAGE.
    
    </license>
    
    */
    ?>
    Giuseppe

    Mi lamentavo delle scarpe strette, poi vidi un uomo senza gambe......

  2. #2
    functions parte uno
    codice:
    <?php
    
    function getStats() {
     global $HTTP_SERVER_VARS;
     global $HTTP_COOKIE_VARS;
     $votesleft = $HTTP_COOKIE_VARS["votesleft"];
     
     include("settings.php");
     $online = getUsersOnline();
     $totpics = getTotpics();  
     $topStats = "<font color=\"#f5f5f5\">Users Online:</font><font color=\"yellow\">$online</font> | Total Photos: <font color=\"yellow\">$totpics</font> | ";
     if ($showvotes =="1") {
    	$vleft = $maxvotes -$votesleft;
    	if($votesleft < 1) { $tempv ="0";} else { $tempv = $votesleft;}
    	$topStats = $topStats ."Votes Remaining: <font color=\"yellow\">$vleft</font> | ";
    	$topStats =  $topStats ."Votes Today:<font color=\"yellow\">$tempv</font> | ";	
    	}
     return $topStats;
    exit;
    }
    function getCatnum($catid) {
    	require('settings.php');
    	$connection = mysql_connect("$sqlhost","$sqluser","$sqlpass"); 
    	if (!$connection) { 
    	echo "Couldn't make a connection!"; 
    	exit; 
    	} 
    	$db = mysql_select_db("$sqldb", $connection); 
    	if (!$db) { 
    	echo "Couldn't select database!"; 
    	exit; 
    	} 	
    	$sql = "select * from $r_picuploads where catagory='$catid'"; // Catagory list
    	$sql_result = mysql_query($sql,$connection); 	
    	while ($row = mysql_fetch_array($sql_result)) { 
    		 $catnum++;			 
    		}
    return $catnum;
    }
    
    
    function CheckBan($ip) {
    	require('settings.php');
    	$today = date("Y-m-d");		// check todays date
    	$connection = mysql_connect("$sqlhost","$sqluser","$sqlpass"); 
    	if (!$connection) { 
    	echo "Couldn't make a connection!"; 
    	exit; 
    	} 
    	$db = mysql_select_db("$sqldb", $connection); 
    	if (!$db) { 
    	echo "Couldn't select database in $r_banip!"; 
    	exit; 
    	} 
    	// check for existing record
    	$sql = "select * from $r_banip where ip ='$ip'";  
    	$sql_result = mysql_query($sql,$connection); 
    	while ($row = mysql_fetch_array($sql_result)) { 
    		$dbip = $row["ip"]; 
    		if ($dbip == "$ip"){ $status= "ban"; }
    		}
    		return $status;
    	}
    
    function BanIp($ip,$today) {
    	require('settings.php');
    	$connection = mysql_connect("$sqlhost","$sqluser","$sqlpass"); 
    	if (!$connection) { 
    	echo "Couldn't make a connection!"; 
    	exit; 
    	} 
    	$db = mysql_select_db("$sqldb", $connection); 
    	if (!$db) { 
    	echo "Couldn't select database in banip!"; 
    	exit; 
    	} 
    	// check for existing record
    	$isban = CheckBan($ip);
    		if ($isban == "ban") {
    			$sql = "update $r_banip set today='$today' where ip='$ip'";  
    			$sql_result = mysql_query($sql,$connection); 
    		} else {
    			$sql = "insert into $r_banip values('','$ip','$today')";  
    			$sql_result = mysql_query($sql,$connection); 
    		}
    }
    	
    
    function CheckIp($ip,$today) {
    	require('settings.php');
    	$connection = mysql_connect("$sqlhost","$sqluser","$sqlpass"); 
    	if (!$connection) { 
    	echo "Couldn't make a connection!"; 
    	exit; 
    	} 
    	$db = mysql_select_db("$sqldb", $connection); 
    	if (!$db) { 
    	echo "Couldn't select database in Checkip!"; 
    	exit; 
    	} 
    	$sql = "select * from $r_banip where ip ='$ip' AND today='$today'";  
    	$sql_result = mysql_query($sql,$connection); 
    	while ($row = mysql_fetch_array($sql_result)) { 
    		$dbip = $row["ip"]; 
    		$dbtoday = $row["today"]; 
    		if ($dbip == "$ip" && $dbtoday == "$today") { $status = "ban"; }
    	}	
    	return $status;
    }
    // GD Library
    function RatioResizeImgGD($src_file, $dest_file, $newWidth) {
    	global
    		$gallerypath
    	;
    	// find the image size & type
    	if(!function_exists('imagecreate')){return $src_file;}
    
    	$imginfo = @getimagesize($src_file);
    	switch($imginfo[2]) {
    		case 1: $type = IMG_GIF; break;
    		case 2: $type = IMG_JPG; break;
    		case 3: $type = IMG_PNG; break;
    		case 4: $type = IMG_WBMP; break;
    		default: return $src_file; break;
    	}
    	
    	switch($type) {
    		case IMG_GIF:
    			if(!function_exists('imagecreatefromgif')){return $src_file;}
    			$srcImage = @imagecreatefromgif("$src_file");
    			break;
    		case IMG_JPG:
    			if(!function_exists('imagecreatefromjpeg')){return $src_file;}
    			$srcImage = @ImageCreateFromJpeg($src_file);
    			break;
    		case IMG_PNG:
    			if(!function_exists('imagecreatefrompng')){return $src_file;}
    			$srcImage = @imagecreatefrompng("$src_file");
    			break;
    		case IMG_WBMP:
    			if(!function_exists('imagecreatefromwbmp')){return $src_file;}
    			$srcImage = @imagecreatefromwbmp("$src_file");
    			break;
    		default: return $src_file;
    	}
    	
    	if($srcImage){
    		// height/width
    		$srcWidth = $imginfo[0];
    		$srcHeight = $imginfo[1];
    		$ratioWidth = $srcWidth/$newWidth;
    		$destWidth = $newWidth;
    		$destHeight = $srcHeight / $ratioWidth;
    		// resize
    		$destImage = @imagecreate($destWidth, $destHeight);
    		imagecopyresized($destImage, $srcImage, 0, 0, 0, 0, $destWidth, $destHeight, $srcWidth, $srcHeight);
    		// create and save final picture
    		
    		switch($type){
    			case IMG_GIF: @imagegif($destImage, "$dest_file"); break;
    			case IMG_JPG: @imagejpeg($destImage, "$dest_file"); break;
    			case IMG_PNG: @imagepng($destImage, "$dest_file"); break;
    			case IMG_WBMP: @imagewbmp($destImage, "$dest_file"); break;
    		}
    
    		// free the memory
    		@imagedestroy($srcImage);
    		@imagedestroy($destImage);
    
    		return $dest_file;
    	}
    	else
    	{
    		return $src_file;
    	}
    }
    
    // ImageMagick
    function RatioResizeImgImageMagick($src_file, $dest_file, $newWidth){
    	global
    		$gallerypath
    	;
    	// find the image size
    	$imginfo = @getimagesize($src_file);
    	if ($imginfo == NULL)
    		return $src_file;
    	
    	// height/width
    	$srcWidth = $imginfo[0];
    	$srcHeight = $imginfo[1];
    
    	$ratioWidth = $srcWidth/$newWidth;
    	$ratioHeight = 0;
    	$destWidth = $newWidth;
    	$destHeight = $srcHeight / $ratioWidth;
    	
    	// resize
    	//echo "convert -quality 80 -antialias -sample \"".$destWidth."x".$destHeight."\" \"$src_file\" \"$dest_file\"";
    	exec("convert -quality 80 -antialias -sample \"".$destWidth."x".$destHeight."\" \"$src_file\" \"$dest_file\"");
    	return $dest_file;
    }
    
    
    function getUcomments($id){
    	require('settings.php');
    		$connection = mysql_connect("$sqlhost","$sqluser","$sqlpass"); 
    		if (!$connection) { 
    		echo "Couldn't make a connection!"; 
    		exit; 
    		} 
    		$db = mysql_select_db("$sqldb", $connection); 
    		if (!$db) { 
    		echo "Couldn't select database!"; 
    		exit; 
    		}
    	$ucomments= "
    	<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n
    	  <tbody>\n
    	    <tr valign=\"top\">
    		  <td width=\"100%\">\n
    	";
    	$sql = "select * from $r_ucomments where pid ='$id' ORDER BY id DESC LIMIT $maxcomments";  	
    	$sql_result = mysql_query($sql,$connection); 
    	while ($row = mysql_fetch_array($sql_result)) { 
    		$user = $row["userid"];
    		$text = $row["text"];		
    		if($bg == "#fff8dc") { $bg = "#fffaf0";} else { $bg ="#fff8dc";}
    		$ucomments = $ucomments ."		
    		$user\n
     		 <div class=\"hilite\">\n
    			$text<hr color=\"black\">\n
    		</div>\n";		
    	}		
    	
    	$query = ("select count(*) from $r_ucomments where pid ='$id'");
    	$num2 = mysql_query($query) or die("Select Failed!");
    	$num = mysql_fetch_array($num2);	
    	if($num[0] >0) {
    		if($num[0] >$maxcomments) {
    		$ucomments = $ucomments ."<a href=\"#\" onClick=\"MoreComments=window.open('$PHP_SELF?allcomments=on&id=$id','MoreComments','toolbar=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizeable=yes,width=400,height=400,left=20,top=20'); return false;\">more comments..</a></td>\n</tr></table>\n";
    		} else {
    				$ucomments = $ucomments ."</td>\n</tr></table>\n";
    		}		
    	} else { 
    	$ucomments = "No comments have been submitted.";
    	}
    	return $ucomments;
    }
    function getUsersOnline(){
    	include("dbinfo.php"); 
    	include("settings.php");
    	global $HTTP_SERVER_VARS; 
    	// Set length of session to twenty minutes 
    	define("SESSION_LENGTH", 5); 
    	$userIP = $HTTP_SERVER_VARS["REMOTE_ADDR"]; 
    	$sConn = @mysql_connect($dbServer, $dbUser, $dbPass) 
    	or die("Couldnt connect to database"); 
    	$dbConn = @mysql_select_db($dbName, $sConn) 
    	or die("Couldnt select database $dbName"); 
    	$timeMax = time() - (60 * SESSION_LENGTH); 
    	$result = mysql_query("select count(*) from $r_usersonline where unix_timestamp(dateAdded) >= '$timeMax' and userIP = '$userIP'"); 
    	$recordExists = mysql_result($result, 0, 0) > 0 ? true : false; 
    		if(!$recordExists) 
    		{ 
    			// Add a record for this user 
    			@mysql_query("insert into $r_usersonline(userIP) values('$userIP')"); 
    		} 
    	$query = ("select count(*) from $r_usersonline where unix_timestamp(dateAdded) >= '$timeMax'");
    	$numguests = mysql_query($query) or die("Select Failed!");
    	$numguest = mysql_fetch_array($numguests);
    	return $numguest[0];
    }
    
    function getTotpics(){
    		require('settings.php');
    		$connection = mysql_connect("$sqlhost","$sqluser","$sqlpass"); 
    		if (!$connection) { 
    		echo "Couldn't make a connection!"; 
    		exit; 
    		} 
    		$db = mysql_select_db("$sqldb", $connection); 
    		if (!$db) { 
    		echo "Couldn't select database!"; 
    		exit; 
    		}
    		$query = ("select count(*) from $r_picuploads");
    		$numpics1 = mysql_query($query) or die("Select Failed!");
    		$numpics = mysql_fetch_array($numpics1);
    		return $numpics[0];
    }
    
    
    function getProfilebox($userid){ //12
    
    		require('settings.php');
    		$connection = mysql_connect("$sqlhost","$sqluser","$sqlpass"); 
    		if (!$connection) { 
    		echo "Couldn't make a connection!"; 
    		exit; 
    		} 
    		$db = mysql_select_db("$sqldb", $connection); 
    		if (!$db) { 
    		echo "Couldn't select database!"; 
    		exit; 
    		}
    	   
    		// GET USERS LAST POSTINGS FIRST
    		if($preapprove == "0") { $prea = "AND approved = '1' "; } 
    		else {
    		$prea = "";}
    		
    		$sql = "select * from $r_picuploads where userid ='$userid' $prea ORDER BY id DESC LIMIT 5";// postings by user
    		$sql_result = mysql_query($sql,$connection); 
    		while ($row = mysql_fetch_array($sql_result)) { 
    		 $pid = $row["id"]; // id title userid
    		 $title = $row["title"];
    		 $tempString = $tempString ."<a href=\"$PHP_SELF?showpic=$pid\">$title</a>
    ";
    		}
    		$sql = "select * from $r_users where userid ='$userid'";//user info
    		$sql_result = mysql_query($sql,$connection); 
    		while ($row = mysql_fetch_array($sql_result)) { 
    		 $proemail = $row["email"];
     		 $prosex = $row["sex"];
    		 $prohobbies = $row["hobbies"]; 
    		 $promusic = $row["music"];
    		 $prochat = $row["chat"];		 
    		 $proupdated = $row["updated"];		 
    		 $proemailvisible = $row["emailvisible"];		 
    		}
    		if($proemailvisble == "0") { $proemail = "not shown";} // redundent?
    		 if($proemailvisible == "0") { 
    			 $proemail = "not shown";
    			} else {
    			 $proemail = "<a href=\"mailto:$proemail?subject=$title\">$proemail</a>";	 		 			
    			}
    
    		$profilebox = array("$proemail","$prosex","$prohobbies","$promusic","$prochat","$proupdated","$tempString");
    
    	return $profilebox;		 
    }
    
    function getMemberbox($loggedinName,$template){
    		require('settings.php');
    		$connection = mysql_connect("$sqlhost","$sqluser","$sqlpass"); 
    		if (!$connection) { 
    		echo "Couldn't make a connection!"; 
    		exit; 
    		} 
    		$db = mysql_select_db("$sqldb", $connection); 
    		if (!$db) { 
    		echo "Couldn't select database!"; 
    		exit; 
    		}
    		$sql = "select * from $r_messages where touserid ='$loggedinName' AND isread = '0'"; //check messages
    		$sql_result = mysql_query($sql,$connection); 
    		$totmsgs = 0;
    		while ($row = mysql_fetch_array($sql_result)) { 
    		 $isread = $row["isread"];
    		 $totmsgs++;
    		} 
    		$content_array = file("$theme/memberbox.html");
    		$memberbox = implode("", $content_array);				
    		if(isset($loggedinName)) { // IS VISITOR A MEMBER? 
    		 $template = str_replace('<:LOGIN:>', "$memberbox", $template);	 
    		 $template = str_replace('<:LOGOUT:>', "$PHP_SELF?logout=now", $template);	  
    		 $template = str_replace('<:URPROFILE:>', "$PHP_SELF?yourprofile=on", $template);	  
    		 $template = str_replace('<:UPLOAD:>', "$PHP_SELF?upload=on", $template);	  
    		 $template = str_replace('<:FEEDBACK:>', "$PHP_SELF?feedback=on", $template);	  
    		 $template = str_replace('<:UNREAD:>', "$totmsgs", $template);	   
    		 $template = str_replace('<:INBOX:>', "$PHP_SELF?inbox=on", $template);	   
    			} else {
    
    		$content_array = file("$theme/login.html");
    		$loginform= implode("", $content_array);		
    		 $template = str_replace('<:LOGIN:>', "$loginform\n", $template);	 
    		}
    		return $template;
    }
    
    function generate() {
            $length ="4";              // the length of the password required
            $possible = '23456789' . 
                    'abcdefghijkmnpqrstuvwxyz';
    //            'ABCDEFGHJKLMNPQRSTUVWXYZ';
            $str ="";
            while (strlen($str) < $length) {
            $str.=substr($possible, (rand() % strlen($possible)),1);
       }
             return($str);
    }
    Giuseppe

    Mi lamentavo delle scarpe strette, poi vidi un uomo senza gambe......

  3. #3
    settings
    codice:
    <? 
    
    /* DB VARIABLES*/
    $sqlhost = "localhost";
    $sqluser = "root";
    $sqlpass = "password";
    $sqldb = "mydb";
    
    /* TABLE NAMES */
    $r_ucomments = "r_ucomments"; // user comments
    $r_picuploads = "r_picuploads";
    $r_banip ="r_banip";
    $r_catagory = "r_catagory";
    $r_links = "r_links";
    $r_messages = "r_messages";
    $r_users = "r_users";
    $r_usersonline = "usersOnline";			
    $r_faq = "r_faq";					
    
    /* PATHS */
    $mainurl = "/rateapic/";
    $thumbType = "0";  // 0 = GD, 1 = ImagageMagic
    $thumbdir = "thumb";  // short path
    $imagedir = "uploads";  // short path
    $fullpathuploads = "/var/www/html/rateapic/uploads";
    $fullpaththumb = "/var/www/html/rateapic/thumb";
    $theme = "templates/default";			
    
    /*ADMINISTRATION OPTIONS*/
    $adminpassword = "password";
    $notifyAdmin ="1";		// 0 = off, 1 = on when new photo submitted
    $preapprove ="0";      // 0 = admin approves first  = everything approved
    $showvotes = "1";  // 0 = off, 1 = on vote tracking on and off.
    $maxupSize = "900000"; // maximum upload size in bytes
    $new_w = "320";					// thumbnail width after upload.
    $maxupWidth = "1024";  // maximum width of pic to accept
    $maxupHeight = "768";  // maximum height of pic to accept
    $maxvotes="30"; 	// if showvotes off, ignore.
    $maxcomments ="3"; // max comments to show before displaying more
    $maxlinks = "10";   // max links to show before displaying more
    $maxfaq = "4";		// maximum faq questions to display before the more.
    
    /* PAGE VARIABLES */
    $infoText="Simply rate each picture by clicking on the themometer and we'll advance you to the next available entry. If you would like to submit your own photo, click on the signup and we'll do the rest.";
    /*	Customize what <:INFOTEXT:> displays on each page.
    	By default, main page is default to what infoText is set for.
    	However, you can customize each one.  Just make sure what ever
    	you supply, make sure it's not blank, else the formatting may not
    	look correct.
    		 
    	Example:
    	$JoininfoText="After filling out the form below, we'll email you your user name and password.";
    */
    $FeedbackinfoText=$infoText;
    $InboxinfoText=$infoText;			
    $CommentinfoText=$infoText;
    $PrivateinfoText=$infoText;			
    $JoininfoText=$infoText;
    $AboutinfoText = $infoText;
    $FaqinfoText = $infoText;	
    $UploadinfoText = $infoText;				
    $aftervote ="";		   // not recommend to use.  Ignore this and keep it blank.
    
    /* SITE VARIABLES*/
    $mailadmin = "youremail";			
    $sitetitle = "RateApic";		// used when emailing users
    $sitename = "yoursite.com";		// used for page title in browswer.
    $siteurl ="http://yoursite.com/rateapic/";  //With trailing slash!!
    $mailname = "RateApic";
    $msgText = "<html><head><title>$sitename</title></head>
    					<body style=\"margin:8px 9px 9px 12px\" bgcolor=\"#ffffff\"> 
    					<font face=\"Verdana,Arial\" size=\"2\">
    					You're receiving this message because you recently signed up for a username and password on <a href=\"$siteurl\">$sitetitle</a>.  We want to personally thank you for taking the time for contributing to our site.   You're username and password is listed below.  After signing in, please make sure to change your password by clicking on the Your Profile option after logging in.  At anytime, you can change a number of options including your email address and things of that nature.
    					</font>
    					</body></html>";
    					
    $footer = "(c) 2002 phpRateApic iFuller.com";
    				
    
    ?>

    Qualche consiglio o valida alternativa?
    Giuseppe

    Mi lamentavo delle scarpe strette, poi vidi un uomo senza gambe......

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.