Jump to content

nbarone

Members
  • Posts

    90
  • Joined

  • Last visited

    Never

About nbarone

  • Birthday 01/01/1990

Contact Methods

  • ICQ
    244192128

Profile Information

  • Gender
    Male
  • Location
    NY

nbarone's Achievements

Member

Member (2/5)

0

Reputation

  1. I am trying to merge two images... the background image will have an overlay that is basically a border around the image... Here is my code, but it's only outputting the background image and not the overlay. <?php // define base image, this is the custom image $background = "../images/frontpage/fpgtest.png"; $overlay = "../images/assets/fpgraphic_overlay.png"; // create image $background = imagecreatefrompng($background); $overlay = imagecreatefrompng($overlay); // define colors $white = imagecolorallocate($background, 255, 255, 255); // transparent // apply trans color //imagealphablending($background, true); //imagesavealpha($background, true); //imagecolortransparent($background, $white); // define header header ("Content-type: image/png"); // Merge Image imagecopymerge($background,$overlay,0,0,0,0,0,0,100); // display image imagepng($background); imagedestroy($background); ?>
  2. fixed - source file needed a ".." in front of it. Found error as a PHP Warning in error log. To Chris92... the extra parenthesis are not required, although good practice.
  3. I am trying to load in a PNG image, and place a number on top of it. This code is not outputting anything (not even an error): <?php // define base image $base = ($_GET['hover']=='true')?"/images/assets/sel_hover.png":"/images/assets/sel.png"; // create image $image = imagecreatefrompng($base); // define colors $black = imagecolorallocate($image, 0, 0, 0); // text // define font file $font = "helvetica.ttf"; // define incremental number $num = $_GET['inc']; // define header header ("Content-type: image/png"); // write text to image imagettftext($image,10,0,3,3,$black,$font,$num); // display image imagepng($image); imagedestroy($image); ?>
  4. Thanks, that worked great. Sorry for the confusion, at first I thought it would be easiest to sort by length, but I figured I'd check and see if it's possible to sort by directory.
  5. if(!isset($_GET['x'])){ // x is not valid } else { // x is valid }
  6. Hi, I have a multidimensional array and I would like to sort it by the length of the first key. The first key is a file path, the second key is a file id, and then several parameters under that. $filelist['\\fileserver\share\path\to\file']['1234']['name'] = "video.avi"; If possible, I would like to sort the first key in a tree-like format example: $filelist['\\fileserver\share\'] = $filelist[0] $filelist['\\fileserver\share\folder1'] = $filelist[1] $filelist['\\fileserver\share\folder1\anotherfolder\'] = $filelist[2] $filelist['\\fileserver\share\folder1\anotherfolder2\'] = $filelist[3] $filelist['\\fileserver\share\folder2\'] = $filelist[4] Also, I would like to story the filenames alphabetically $filelist['\\fileserver\share\path\to\file']['1234']['name'] = "video.avi"; I don't know how I would do this all with such a complex array.
  7. Thanks, that was the issue.
  8. They are all datetime fields.
  9. I'm hoping someone here will have a better eye at catching this error than I have. Thanks in advance. Actual code: $sql = "INSERT INTO mfl_files (file_name, file_share, file_path, file_created, file_modified, file_lastVerified, file_active) VALUES ('$file', '$shr_id', '$dir', '$dateCreated', '$dateModified', '$newDateVer', '1')"; $sql output: INSERT INTO mfl_files (file_name, file_share, file_path, file_created, file_modified, file_lastVerified, file_active) VALUES ('09-6-2009-dvd.mov', '1', '\\fileserver01\SHARE01\VIDEO\DVD Files\2009\', '2009-11-24 09:33:11', '2010-02-03 16:37:34', '2010-02-25 10:37:28', '1') Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2009-11-24 09:33:11', '2010-02-03 16:37:34', '2010-02-25 10:37:28', '1')' at line 2
  10. You can't, sorry! Best bet would be to make a small picture with the link to the page, then ask your users to "drag" the picture to the home icon in firefox/chrome.
  11. \n is a "newline" characters, as in a line break or return. that line replaces "\n" with "" (nothing), removing your issue.
  12. well, I am a retard (most of my posts here end this way) - I removed the include('db.php') in the second page, which would explain all the issues. now it is running fine. I will keep this here as a lesson learned
  13. Well I have an include file that pulls a num_rows variable from the database. I have this page included in a few different pages throughout the site - however, on just one page, it runs very slow. here's the script: <?php $foxridge[8] = 3; $foxridge[6] = 6; $alpine[8] = 10; $alpine[6] = 10; $valley[8] = 5; $valley[6] = 1; $inn[2] = 10; $inn[4] = 89; $wildflower[2] = 23; $wildflower[4] = 32; $wildflower[6] = 20; $snowpine[2] = 4; $snowpine[4] = 18; $snowpine[6] = 30; $snowpine[8] = 15; foreach($foxridge as $k=>$v){ $sql = "SELECT b_id FROM breakaway WHERE b_location='foxridge' AND b_numRoommates='".$k."'"; if(mysql_num_rows(mysql_query($sql)) >= $v) $foxridge[$k] = false; //echo "<br>Foxridge: ".$k." - ".$v." - ".mysql_num_rows(mysql_query($sql)); echo date("H:i:s"); echo "<br>"; } foreach($alpine as $k=>$v){ $sql = "SELECT b_id FROM breakaway WHERE b_location='alpinemeadow' AND b_numRoommates='".$k."'"; if(mysql_num_rows(mysql_query($sql)) >= $v) $alpine[$k] = false; //echo "<br>Alpine: ".$k." - ".$v." - ".mysql_num_rows(mysql_query($sql)); echo date("H:i:s"); echo "<br>"; } foreach($valley as $k=>$v){ $sql = "SELECT b_id FROM breakaway WHERE b_location='valleyvillage' AND b_numRoommates='".$k."'"; if(mysql_num_rows(mysql_query($sql)) >= $v) $valley[$k] = false; //echo "<br>Valley: ".$k." - ".$v." - ".mysql_num_rows(mysql_query($sql)); echo date("H:i:s"); echo "<br>"; } foreach($inn as $k=>$v){ $sql = "SELECT b_id FROM breakaway WHERE b_location='inn' AND b_numRoommates='".$k."'"; if(mysql_num_rows(mysql_query($sql)) >= $v) $inn[$k] = false; //echo "<br>The Inn: ".$k." - ".$v." - ".mysql_num_rows(mysql_query($sql)); echo date("H:i:s"); echo "<br>"; } foreach($wildflower as $k=>$v){ $sql = "SELECT b_id FROM breakaway WHERE b_location='wildflower' AND b_numRoommates='".$k."'"; if(mysql_num_rows(mysql_query($sql)) >= $v) $wildflower[$k] = false; //echo "<br>Wildflower: ".$k." - ".$v." - ".mysql_num_rows(mysql_query($sql)); echo date("H:i:s"); echo "<br>"; } foreach($snowpine as $k=>$v){ $sql = "SELECT b_id FROM breakaway WHERE b_location='snowpine' AND b_numRoommates='".$k."'"; if(mysql_num_rows(mysql_query($sql)) >= $v) $snowpine[$k] = false; //echo "<br>Snowpine: ".$k." - ".$v." - ".mysql_num_rows(mysql_query($sql)); echo date("H:i:s"); echo "<br>"; } $twos = true; $fours = true; $sixs = true; $eights = true; if(($snowpine[2]==false)&&($wildflower[2]==false)&&($inn[2]==false)){ $twos = false; } if(($snowpine[4]==false)&&($wildflower[4]==false)&&($inn[4]==false)){ $fours = false; } if(($snowpine[6]==false)&&($wildflower[6]==false)&&($valley[6]==false)&&($foxridge[6]==false)&&($alpine[6]==false)){ $sixs = false; } if(($snowpine[8]==false)&&($valley[8]==false)&&($foxridge[8]==false)&&($alpine[8]==false)){ $eights = false; } ?> now it will output the timestamp of each query, so I can debug. on one page it looked like this: on the page in question, it took about 1 second per query: as you can see this dramitically increases page load time (this is for older women, they will think the world ended if it doesn't load in 5 seconds and keep clicking ) The first page, which loads the include very fast start out like this (checkRooms.php is the include in question) <?php session_start(); session_destroy(); session_start(); include('db.php'); require('checkRooms.php'); ?> the second page is VERY simalir: <?php session_start(); include('checkRooms.php'); ?> why would this code load sooooooooo slow on only this page? this makes no sense to me. the worst part is everything loaded nice and fast until this morning
  14. It's best to use a switch, because of security issues. <?php switch($_REQUEST['page']){ case "home": include('homepage.html'); break; case "products": include('products.html'); break; default: include('homepage.html'); break; } ?>
  15. I am setting up a registration form for a trip. The variable name is the location name the key is the number of people who can fit in a room at that location the value is the number of rooms available that will fit that many people. I want to scan the DB for the number of people registered for that location, with there number of roommates, and see if any rooms are still available. Here is my script, but I feel like it can be done in a better way. Any input is appreciated. <?php // NUMBERS $foxridge[8] = 3; $foxridge[6] = 6; $alpine[8] = 10; $alpine[6] = 10; $valley[8] = 5; $valley[6] = 1; $wildflower[2] = 23; $wildflower[4] = 32; $wildflower[6] = 20; $snowpine[2] = 4; $snowpine[4] = 18; $snowpine[6] = 30; $snowpine[8] = 15; foreach($foxridge as $k=>$v){ $sql = "SELECT * FROM breakaway WHERE b_location='foxridge' AND b_numRoommates='".$k."'"; if(mysql_num_rows(mysql_query($sql)) >= $v) $foxridge[$k] = false; } foreach($alpine as $k=>$v){ $sql = "SELECT * FROM breakaway WHERE b_location='alpinemeadow' AND b_numRoommates='".$k."'"; if(mysql_num_rows(mysql_query($sql)) >= $v) $alpine[$k] = false; } foreach($valley as $k=>$v){ $sql = "SELECT * FROM breakaway WHERE b_location='valleyvillage' AND b_numRoommates='".$k."'"; if(mysql_num_rows(mysql_query($sql)) >= $v) $valley[$k] = false; } foreach($wildflower as $k=>$v){ $sql = "SELECT * FROM breakaway WHERE b_location='wildflower' AND b_numRoommates='".$k."'"; if(mysql_num_rows(mysql_query($sql)) >= $v) $wildflower[$k] = false; } foreach($snowpine as $k=>$v){ $sql = "SELECT * FROM breakaway WHERE b_location='snowpine' AND b_numRoommates='".$k."'"; if(mysql_num_rows(mysql_query($sql)) >= $v) $snowpine[$k] = false; } ?>
×
×
  • 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.