Jump to content

VoodooJai

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

VoodooJai's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have had this problem as well in Firefox, but out of curiosity I tried it in IE and the error does not show. Im not sure if the extras work yet or how to check if they do so could someone give me some more info of how to see if all is good. I changed the server value to 0 like the other post said but this didnt work. Hope I helped someone. VoodooJai
  2. Many thanks for your patience I know it must be annoying for you all. I have been researching further with the info you supplied and I think I now have it working the way I wanted. I really only as for help when Im stuck and need a little nudge in the right direction. Thanks again I really appreciate the help. VoodooJai
  3. Hi again I am stil struggling with the query, if I display "race_results.position_fav_2" it just gives me the row ID of table2 and not the value assigned to that ID. I need to show 6 of these values from table2. These bits of the code "alias6.fav" etc are the ones causing me problems. Hope you can help thanks VoodooJai
  4. All values applicable in the results table have values in the favourites table. So how would I actually do this query then, I just cannt see the wood for the trees. Do I define an "AS" for each of the position_fav_# columns in the results table and display it for each of the horses. Something like: results.position_fav_1 = favourite.fav_id AS DisplayFav. Thanks again VoodooJai
  5. I have tried the solution but dont understand why it does not work and gives this result from this code mysql> SELECT results_id, alias1.fav, alias2.fav, alias3.fav, alias4.fav, alias5.fav, alias6.fav -> FROM race_results -> LEFT JOIN favourites AS alias1 ON race_results. position_fav_1 = alias1.fav -> LEFT JOIN favourites AS alias2 ON race_results. position_fav_2 = alias2.fav -> LEFT JOIN favourites AS alias3 ON race_results. position_fav_3 = alias3.fav -> LEFT JOIN favourites AS alias4 ON race_results. position_fav_4 = alias4.fav -> LEFT JOIN favourites AS alias5 ON race_results. position_fav_5 = alias5.fav -> LEFT JOIN favourites AS alias6 ON race_results. position_fav_6 = alias6.fav; +-------------+----------+ ----------+--------+--------+--------+---------+ | results_id | fav | fav | fav | fav | fav | fav | +-------------+----------+ ----------+--------+--------+--------+---------+ | 1 | 2nd-fav | 3rd-fav | NULL | NULL | NULL | NULL | | 2 | 2nd-fav | NULL | NULL | NULL | NULL | NULL | | 3 | 2nd-fav | NULL | NULL | NULL | NULL | NULL | | 4 | 2nd-fav | 3rd-fav | NULL | NULL | NULL | NULL | +-------------+----------+ ----------+--------+--------+--------+---------+ The NULL cells are supposed to show the type of favourite the horse is. Can anyone enlighten or show me whats wrong with the query. VoodooJai
  6. Thanks i will try this I was nearly on the right track, thanks. VoodooJai
  7. Hi all I am creating a db that holds info about horse racing table 1 contains the details abaout the horses and their finish positions and if they were a favourite in the race. Table 2 describes the favourite ie "Not a fav" "fav" "Join fav" "2nd fav" "Joint 2nd Fav". How could I display two different types of fav detail in the same row of a table. tbl 1 ID int Horse 1 varchar horse1_odds varchar horse1_fav int (Foreign key to fav table) Horse 2 varchar horse2_odds varchar horse2_fav int (Foreign key to fav table) Horse 3 varchar horse3_odds varchar horse3_fav int (Foreign key to fav table) table 2 ID int Fav varchar (fav description) Is it possible to reference table2 three times with different values in row 1 of table 1. A little help would be appreciated. VoodooJai
  8. I thought that to, but when I change the values from /** The name of the database for WordPress */ define('DB_NAME', 'Databasename'); /** MySQL database username */ define('DB_USER', 'Username'); /** MySQL database password */ define('DB_PASSWORD', 'passwordhere'); /** MySQL hostname */ define('DB_HOST', 'Dtabasehost'); to this the code changes to yellow.
  9. I would like to know how to use an underscore in a define function like this example below. /** The name of the database for WordPress */ define('DB_NAME', 'Database_name'); /** MySQL database username */ define('DB_USER', 'User_name'); /** MySQL database password */ define('DB_PASSWORD', 'password_here'); /** MySQL hostname */ define('DB_HOST', 'Dtabase_host'); Any help appreciated and thanks in advance.
  10. I have a little script that send an email using the mail function which includes some header information and after sending the email I wan to redirect to another page using the header function but it says the usual is the prooblem caused by the mail function headers and if so how do I get around it. VoodooJai
  11. Having changed the extension to a valid one and found a few errors that were corrected the code now looks like this <?php $secret = "asdflyu345iu2y35ui345"; //choose your own $fileName = "stock.jpg"; $hash = md5($fileName . "|" . $secret); $url = "$hash"; echo "Filename: ".$fileName."<br/>"; echo "The FileName hash: ".$hash."<br/><br/>"; echo "The URL: ".$url."<br/>"; echo "Hashed image shown here! <img src=\"Stockists/".$url." \" width=\"99\" height=\"64\">"; echo " and image should be this! <img src=\"Stockists/stock.jpg\" width=\"99\" height=\"64\">"; ?> the hidden filenames image does not still display. VoodooJai
  12. I am trying to hide a files name so that the source cannot be identified by others. So far I have this which disguises the filename but wont show the image. <?php $secret = "asdflyu345iu2y35ui345"; $fileName = "picture.png"; $hash = md5($fileName . "|" . $secret); $url = "images/adverts/$hash"; echo "Filename: ".$fileName."<br/>"; echo "The FileName hash: ".$hash."<br/><br/>"; echo "The URL: ".$url."<br/>"; echo "Hashed image shown here! <img src=".$url." width=\"99\" height=\"64\" \/>"; echo " and image should be this! <img src=\"images\/adverts\/picture.png\" width=\"99\" height=\"64\">"; ?> There is some debug code in there as well. Many thanks in advance VoodooJai
  13. I have a web site that allows users to upload files to my site and I want to know how to make the uploads server safe. I have registered users doing this. I have been tols to upload the files outside of the web sites root files, is this done by uploading to a sub domain of the site. VoodooJai
  14. Hi all again I have an upload form and script that adds multiple files to a db and all works ok, but the description part of the form just duplicates the first entry multiple times. I have been studying the code but are stuck. which part of the code do I need to edit to have it work as I want it to. <?php $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } foreach($_FILES as $files => $_file){ $_POST['File_Name']=basename($_file['name']); if($_POST['File_Name']!=""){ // ******************************************************************************** if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO uploads (file_name, user_ID, fileNR, `description`) VALUES (%s, %s, %s, %s)", GetSQLValueString($dbPrefix.$_POST['File_Name'], "text"), GetSQLValueString($_POST['UID'], "int"), GetSQLValueString($_POST['FileNR'], "text"), GetSQLValueString($_POST['Desc'], "text")); mysql_select_db($database_tattoocv, $tattoocv); $Result1 = mysql_query($insertSQL, $tattoocv) or die(mysql_error()); } }} if (isset($_POST['MM_insert'])) { $upload_error_codes=array("", "The uploaded file exceeds the upload_max_filesize directive in php.ini.","", "The uploaded file was only partially uploaded.", "No file was uploaded.","Missing a temporary folder.", "Failed to write file to disk.","File upload stopped by extension."); $allowed_ext_string="jpg,jpeg"; $allowed_extensions=explode(",",$allowed_ext_string); $upload_status = ""; $allowed_size = 2+0; $success_page = ""; $thumbs_dir = "uploads/photo/thumbnail/"; $resize_image = "yes"; $resize_width = 400+0; $resize_height = +0; $thumb_width = 150+0; $thumb_height = +0; $make_thumbs = "yes"; // ******************************************************************** // Var to prefix the filname with a userID and microtime // ******************************************************************** // $FilePrefix = "ID_".$UserNameID."_"; // $MyPrefix = generatePassword($length,$strength); // Create the prefixes for the 2 uploading files $FilePrefix = "ID_".$UserNameID."_".$My."_"; $thumb_prefix = "thumb_".$FilePrefix; $haulted = false; $upload_folder="uploads/photos/"; //Check for restrictions //Check if upload folder exists if(!file_exists($upload_folder)){die("Upload folder doesn't exist");} if(!is_writable($upload_folder)){die("Upload folder is not writable");} if($make_thumbs == "yes" && !file_exists($thumbs_dir)){die("Thumbnails folder doesn't exist");} if($make_thumbs == "yes" && !is_writable($thumbs_dir)){die("Thumbnails folder is not writable");} foreach($_FILES as $files => $_file){ //Check if it's not empty if($_file['name']!=""){ $pathinfo = pathinfo($_file['name']); //If allowed extension or no extension restriction if(!in_array(strtolower($pathinfo['extension']),$allowed_extensions) && $allowed_ext_string!=""){ die(strtoupper($pathinfo['extension'])." files are not allowed. <br>No files have been uploaded."); } if($_file['size']>$allowed_size*1048576 && $allowed_size!=0){ die("The file size of ".basename($_file['name'])." is ".round($_file['size']/1048576,2)."MB, which is larger than allowed ".$allowed_size."MB.<br>No files have been uploaded."); } } } //All checks passed, attempt to upload foreach($_FILES as $files => $_file){ //Check if it's not empty if($_file['name']!=""){ // **************************************************************** // adds a prefix to the "files name" but not the db entry $pathinfo = pathinfo($FilePrefix.$_file['name']); $target = $upload_folder; $file_uploaded = false; // **************************************************************** // adds a prefix to the "files name" but not the db entry $target = $target."/".$FilePrefix.basename($_file['name']); //if image if(strtolower($pathinfo['extension'])=="jpeg" || strtolower($pathinfo['extension'])=="jpg"){ //if needs resizing or a thumbnail if(($resize_image == "yes" && ($resize_width!="" || $resize_height!="")) || ($make_thumbs == "yes" && ($thumb_width!="" || $thumb_height!=""))){ $src = imagecreatefromjpeg($_file['tmp_name']); list($width,$height)=getimagesize($_file['tmp_name']); //if needs thumbnail if ($make_thumbs == "yes" && ($thumb_width!="" || $thumb_height!="")){ $thumb_newwidth=($thumb_width!=0)?$thumb_width:(($width/$height)*$thumb_height); $thumb_newheight=($thumb_height!=0)?$thumb_height:(($height/$width)*$thumb_width); $tmp=imagecreatetruecolor($thumb_newwidth,$thumb_newheight); imagecopyresampled($tmp,$src,0,0,0,0,$thumb_newwidth,$thumb_newheight,$width,$height); if(imagejpeg($tmp,$thumbs_dir."/".$thumb_prefix.basename($_file['name'],100))){ $upload_status=$upload_status."Thumbnail for ".basename($_file['name'])." was created successfully.<br>"; }else{ die($upload_status."There was a problem creating a thumbnail for ". basename($_file['name']).". Upload was interrupted.<br>"); } } //if needs resizing if($resize_image == "yes" && ($resize_width!="" || $resize_height!="")){ $newwidth=($resize_width!=0)?$resize_width:(($width/$height)*$resize_height); $newheight=($resize_height!=0)?$resize_height:(($height/$width)*$resize_width); $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height); if(imagejpeg($tmp,$target,100)){ $upload_status=$upload_status.basename($_file['name'])." was successfully resized.<br>"; $file_uploaded=true; }else{ die($upload_status.basename($_file['name'])." could not be resized. Upload was interrupted.<br>"); } } } } if(!$file_uploaded){ if(move_uploaded_file($_file['tmp_name'], $target)){ // This section uploads the file(s) $upload_status=$upload_status.basename($_file['name'])." was uploaded successfully.<br>"; }else{ $haulted=true; } } //Cleanup if(isset($src)){imagedestroy($src);unset($src);} if(isset($tmp)){imagedestroy($tmp);unset($tmp);} if($haulted){die($upload_status."There was a problem uploading ". basename($_file['name']).". Error: ".$upload_error_codes[basename($_file['error'])].". Upload was interrupted.<br>");} } } if($success_page!="" && $upload_status!=""){ header("Location: ".$success_page); } } ?> *************** THIS IS THE FORM USED FOR UPLOADS ************************** <form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="form1" id="form1"> Browse for file(s) <input name="File_Name" type="file" size="50" /> <input name="FileNR" type="hidden" value="<?php echo $pwd; ?>" /> Add a description <textarea name="Desc" cols="25" rows="2">Add a description</textarea> <input name="File_Name2" type="file" size="50" /> <input name="FileNR2" type="hidden" value="<?php echo $pwd; ?>" /> <textarea name="Desc_2" cols="25" rows="2" id="Desc_2"></textarea></td> <input name="File_Name3" type="file" size="50" /> <input name="FileNR3" type="hidden" value="<?php echo $pwd; ?>" /> <textarea name="Desc_3" cols="25" rows="2" id="Desc_3"></textarea></td> <input name="File_Name4" type="file" size="50" /> <input name="FileNR4" type="hidden" value="<?php echo $pwd; ?>" /> <textarea name="Desc_4" cols="25" rows="2" id="Desc_4"></textarea></td> <input name="Submit" type="submit" value="Upload file(s) and description(s)" /></td> <!-- Passes the random prefix for the upload file names --> <input name="MyPrefix" type="hidden" value="<?php echo $pwd ?>" /> <input type="hidden" name="UID" value="<?php echo $UserNameID; ?>"> <input type="hidden" name="MM_insert" value="form1"> </form> Hope this helps VoodooJai
  15. this is the code for the nav bar a DW8 extract is this enough details <table border="0" width="50%" align="center"> <tr> <td width="23%" align="center"><?php if ($pageNum_Display400pxPhoto > 0) { // Show if not first page ?> <a href="<?php printf("%s?pageNum_Display400pxPhoto=%d%s", $currentPage, 0, $queryString_Display400pxPhoto); ?>">First</a> <?php } // Show if not first page ?> </td> <td width="31%" align="center"><?php if ($pageNum_Display400pxPhoto > 0) { // Show if not first page ?> <a href="<?php printf("%s?pageNum_Display400pxPhoto=%d%s", $currentPage, max(0, $pageNum_Display400pxPhoto - 1), $queryString_Display400pxPhoto); ?>">Previous</a> <?php } // Show if not first page ?> </td> <td width="23%" align="center"><?php if ($pageNum_Display400pxPhoto < $totalPages_Display400pxPhoto) { // Show if not last page ?> <a href="<?php printf("%s?pageNum_Display400pxPhoto=%d%s", $currentPage, min($totalPages_Display400pxPhoto, $pageNum_Display400pxPhoto + 1), $queryString_Display400pxPhoto); ?>" onclick="window.location.hash = 'gallery-id';">Next</a> <?php } // Show if not last page ?> </td> <td width="23%" align="center"><?php if ($pageNum_Display400pxPhoto < $totalPages_Display400pxPhoto) { // Show if not last page ?> <a href="<?php printf("%s?pageNum_Display400pxPhoto=%d%s", $currentPage, $totalPages_Display400pxPhoto, $queryString_Display400pxPhoto); ?>">Last</a> <?php } // Show if not last page ?> </td> </tr> </table> Jai
×
×
  • 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.