Jump to content

MikeDean89

Members
  • Posts

    22
  • Joined

  • Last visited

    Never

Everything posted by MikeDean89

  1. Your error is relating to the following line: $sql = mysql_query("INSERT INTO members (id, username, password, realname, phone, email, address, city, state, zip, country, accounttype, bio, resume, signupdate) VALUES('$username','$realname', '$address','$city','$state','$zip','$country','$accounttype','$email','$hashedPass', now())") or die (mysql_error()); When inserting into a table, your columns must match the values being inserted. It also needs to be in the same order, see example MySQL query below: INSERT INTO table (col1, col2, col3, col4) VALUES (val1, val2, val3, val4) To fix your query, you'd need to add the remaining values to your query and reorder them. $sql = mysql_query("INSERT INTO members (id, username, password, realname, phone, email, address, city, state, zip, country, accounttype, bio, resume, signupdate) VALUES(NULL, '$username', '$hashedPass','$realname', '$phone', '$email', '$address','$city','$state','$zip','$country','$accounttype', '$bio', '$resume', now())") or die (mysql_error()); Note the additional values and the new order of the values to match the column order. Basically what marcelobm said, d'oh!
  2. KevinM1 is correct, you're using a foreach loop but you're directly accessing the array elements, makes no sense to use a foreach loop if that's what you intend to do. If you're not, I'd go with the following method. <?php $pqPhrases = $terms = array(); $pqPhrases[]["terms"]="camaro"; $pqPhrases[]["terms"]="doberman"; $pqPhrases[]["terms"]="little green buddha with pink nose"; foreach($pqPhrases as $pqPhrase) { $terms[] = $pqPhrase["terms"]; } echo implode(' - ', $terms); ?> Perhaps you should explain what you're looking to do in a little more detail.
  3. <?php //$lines = file('database/profile.txt'); $db = array( // Pinched from xyph. 'Tom | Michael | Johnson', 'Joe | William | Adams', 'Doug | David | Saunders', 'Joe | Thomas | Adams' ); $data = array(); foreach($db as $row){ $columns = explode('|', $row); $data[$columns[2].", ".$columns[0]." ".$columns[1]][] = $columns; } ksort($data); // Rebuild the array. $res = array(); foreach($data as $row){ foreach($row as $line){ $res[] = $line; } } ?> Person <select name="person"> <option value=""></option> <?php foreach($res as $columns){ $value = $columns[2].", ".$columns[0]." ".$columns[1]; echo '<option value="'.$value.'">'.$value.'</option>'; } ?> </select> You have multiple solutions to choose from - each of them doing exactly what you've asked of them.
  4. Yes, it does - this is because of the following line: var_dump($res); You're then free to do what you wish with the $res variable. For example.. foreach($res as $thisline){ list($p_id,$p_status,$p_filestart,$p_filemodified,$p_first,$p_middle,$p_last,$p_nick) = explode('|',$thisline); echo $p_last.", ".$p_first." ".$p_middle."<br/>"; } The code I've provided shows how you how to sort your database, the rest is up to you. Also, you could use Pandemikk's method but it's basically what I've done but a bloated version of it.
  5. D'oh! Yeah or you could do what Pikachu mentioned before.. Just realised what I wrote was nonsense.. it's late. Pikachu's will work fine.
  6. while ($obj = mysql_fetch_array($rs, MYSQL_ASSOC)) { $arr[] = array( $obj['id'], $obj['title'], $obj['author'], $obj['date'], $obj['imageUrl'], $obj['text'] ); } Replace your while() code with the one above and the data will be added to the array as intended.
  7. I didn't spend much time on it because I believe that an actual database is not only safer but the better option in most circumstances. However, the code below works. <?php $lines = file('database/profile.txt'); $data = array(); foreach($lines as $thisline){ list($p_id,$p_status,$p_filestart,$p_filemodified,$p_first,$p_middle,$p_last,$p_nick) = explode('|',$thisline); $data[$p_last.", ".$p_first." ".$p_middle][] = trim($thisline); } sort($data); // Rebuild the array. $res = array(); foreach($data as $row){ foreach($row as $line){ $res[] = $line; } } var_dump($res); ?>
  8. If you're looking for a simple way of simply stopping users from refreshing to win a prize, IP address is the only suitable option. Flappy has already mentioned the obvious flaw with this solution but there's no solution (that I can think of, anyway) that's both simple and able to stop people abusing it. If you was to choose the IP address, you'd need a database to store the IP addresses of those that have already claimed/won their prize. Unfortunately, saving it in the session - as JKG suggests originally - would not work, not at all. He is right, however, when he says that a simple way will not stop people abusing it, you'll always get the select few that will find a way.
  9. Give this a go.. <?php $page_contents = file_get_contents("http://ffxiv.yg.com/items?f=c=6.2.7"); $pattern = '/\/item\/([a-z,-]+[^gil])\?id\=([0-9,]+)/'; preg_match_all($pattern, $page_contents, $matches); $arrRetList = array(); if(!empty($matches)){ foreach($matches as $item) { foreach($item as $pos => $row){ $arrRetList[$pos][] = $row; } //echo $item[0] . " - " . $item[1] . " - " . $item[2] . "<BR>"; } foreach($arrRetList as $row){ echo implode( " - ", $row ) . "<br />"; } } ?> Couldn't spend much time on it but I believe it does what you need it to.
  10. I've added the updated code below, you should be able to just copy and paste this into the file. <?php function resize_jpeg( $image_file_path, $new_image_file_path, $max_width=480, $max_height=1600 ) { global $Globals; $return_val = 1; $image_stats = getimagesize( $image_file_path ); $FullImage_width = $image_stats[0]; $FullImage_height = $image_stats[1]; $img_type = $image_stats[2]; switch( $img_type ) { case 1: $src_img = ImageCreateFromGif($image_file_path); break; case 2: $src_img = ImageCreateFromJpeg($image_file_path); break; case 3: $src_img = ImageCreateFromPng($image_file_path); break; default: diewell("Sorry, this image type ($img_type) is not supported yet."); exit; } if ( !$src_img ) { diewell("Unable to create image [$image_file_path].<br>Please contact system administrator."); exit; } $ratio = ( $FullImage_width > $max_width ) ? (real)($max_width / $FullImage_width) : 1 ; $new_width = ((int)($FullImage_width * $ratio)); //full-size width $new_height = ((int)($FullImage_height * $ratio)); //full-size height $ratio = ( $new_height > $max_height ) ? (real)($max_height / $new_height) : 1 ; $new_width = ((int)($new_width * $ratio)); //mid-size width $new_height = ((int)($new_height * $ratio)); //mid-size height if ( $new_width == $FullImage_width && $new_height == $FullImage_height ) copy ( $image_file_path, $new_image_file_path ); if ( $Globals{'usegd'} == 1 ) { $full_id = ImageCreate( $new_width , $new_height ); ImageCopyResized( $full_id, $src_img, 0,0, 0,0, $new_width, $new_height, $FullImage_width, $FullImage_height ); } else { $full_id = ImageCreateTrueColor( $new_width, $new_height ); ImageCopyResampled( $full_id, $src_img, 0,0, 0,0, $new_width, $new_height, $FullImage_width, $FullImage_height ); } switch( $img_type ) { case 1: $return_val = ImageGIF( $full_id, $new_image_file_path ); break; case 2: $return_val = ImageJPEG( $full_id, $new_image_file_path, 90 ); break; case 3: $return_val = ImagePNG( $full_id, $new_image_file_path ); break; default: diewell("Sorry, this image type is not supported yet."); exit; } ImageDestroy( $full_id ); return ($return_val) ? TRUE : FALSE ; } function gdwatermark($srcfilename, $watermark) { $imageInfo = getimagesize($srcfilename); $width = $imageInfo[0]; $height = $imageInfo[1]; $logoinfo = getimagesize($watermark); $logowidth = $logoinfo[0]; $logoheight = $logoinfo[1]; $horizextra =$width - $logowidth; $vertextra =$height - $logoheight; // middle //$horizmargin = round($horizextra / 2); //$vertmargin = round($vertextra / 2); // lower right corner $horizmargin = $horizextra; $vertmargin = $vertextra; $photoImage = ImageCreateFromJPEG($srcfilename); ImageAlphaBlending($photoImage, true); $logoImage = ImageCreateFromPNG($watermark); $logoW = ImageSX($logoImage); $logoH = ImageSY($logoImage); ImageCopy($photoImage, $logoImage, $horizmargin, $vertmargin, 0, 0, $logoW, $logoH); //ImageJPEG($photoImage); // output to browser ImageJPEG($photoImage, $srcfilename, 90); ImageDestroy($photoImage); ImageDestroy($logoImage); } function create_thumb( $realname, $filepath, $thecat, $thevideo="" ) { global $Globals, $userid, $imagewidth, $imageheight, $thumbnail, $resizeorig, $uganno; // // NEW RESIZE CODE // $basedir = $Globals{'datafull'}; $previewwidth = $Globals{'previewwidth'}; if ( $filepath == "default" ) { $filepath = $Globals{'idir'}."/video.jpg"; } $image_stats = getimagesize( $filepath ); $imagewidth = $image_stats[0]; $imageheight = $image_stats[1]; $img_type = $image_stats[2]; // Create thumbnails if ( $thevideo == "" ) { $filenoext = get_filename( $realname ); $theext = get_ext( $realname ); $thumbnail = "$userid".$filenoext."-thumb.$theext"; $outthumb = "$basedir$thecat/$thumbnail"; } elseif ( $thevideo == "rebuildthumbnail" ) { $filenoext = get_filename( $realname ); $theext = get_ext( $realname ); $thumbnail = $filenoext."-thumb.$theext"; $outthumb = "$basedir$thecat/$thumbnail"; } else { $filenoext = get_filename( $thevideo ); $theext = "jpg"; $thumbnail = "$userid".$filenoext."-thumb.jpg"; $outthumb = "$basedir$thecat/$thumbnail"; } $outthumb = strtolower( $outthumb ); $thumbnail = strtolower( $thumbnail ); if ( !file_exists( $outthumb ) ) { if ( $Globals{'usegd'} != 0 ) { if ( $imageheight < $imagewidth ) { $scaleFactor = $imagewidth / $previewwidth; $newheight = round( $imageheight / $scaleFactor ); $newwidth = $previewwidth; } else { $scaleFactor = $imageheight / $previewwidth; $newwidth = round( $imagewidth / $scaleFactor ); $newheight = $previewwidth; } $resize_worked = resize_jpeg($filepath, $outthumb, $newwidth, $newheight); } else { copy ( $filepath, $outthumb ); // watermark thumbnail before resizing // uncomment if you want your thumbnails to have watermarks //if ( $uganno{$thecat} != 1 && $Globals{'annotate'} == "yes") { // // stamp the image // watermark( $outthumb ); //} // if image is taller than wider, then portrait if ( $imageheight < $imagewidth ) { $scaleFactor = $imagewidth / $previewwidth; $newheight = round( $imageheight / $scaleFactor ); $newwidth = $previewwidth; //$previewwidth = $previewwidth } else { $scaleFactor = $imageheight / $previewwidth; $newwidth = round( $imagewidth / $scaleFactor ); $newheight = $previewwidth; //$previewheight = $previewwidth } $syscmd = $Globals{'mogrify_command'}." -format $theext -geometry ".$newwidth."x".$newheight." $outthumb"; // call ImageMagick mogrify to create the thumbnail system( $syscmd, $retval ); if ( $retval != 0 ) { dieWell("Error creating thumbnail! Error code: $retval<p>Command: $syscmd"); unlink( $outthumb ); unlink( $filepath ); exit; } } } $imagesize = filesize( $outthumb ); return( $imagesize ); } function watermark( $filepath, $isadmin=0 ) { global $Globals; $agravity = $Globals{'gravity'}; $water_image = $Globals{'watermark'}; // need to execute this command after images: // composite -compose over -gravity southeast eblogo.jpg jess.jpg jesslogo.jpg if ( $Globals{'usegd'} != 0 ) { $retval = gdwatermark( $filepath, $water_image ); } else { $composite_cmd = str_replace( "mogrify", "composite", $Globals{'mogrify_command'} ); $stampcmd = $composite_cmd." -compose over -gravity $agravity $water_image $filepath $filepath"; system( $stampcmd, $retval ); if ( $retval != 0 ) { if ( $isadmin == 0 ) { dieWell("Error creating watermarked original! Error code: $retval<br><br>Command: $stampcmd"); exit; } else { print "Error creating watermarked original on $filepath [$stampcmd]<br>"; } } } return; } function process_image( $realname, $filepath, $thecat ) { global $Globals, $userid, $link, $db_link, $uganno; global $username, $usergroup, $title, $desc, $keywords; global $adminexclude, $keywords, $notify, $resizeorig; list($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(); $mon = $mon + 1; if( strlen($year) == 3 ) { $year = substr($year, 1); } $julian = mktime($hour,$min,$sec,$mon,$mday,$year); $filenoext = get_filename( $realname ); $theext = get_ext( $realname ); $outfilename = "$userid$realname"; $basedir = $Globals{'datafull'}; $image_stats = getimagesize( $filepath ); $imagewidth = $image_stats[0]; $imageheight = $image_stats[1]; $imagesize = filesize( $filepath ); $resizeorig = 0; $maxwidth = $Globals{'maxwidth'}; $maxheight = $Globals{'maxheight'}; if ( $imagewidth > $maxwidth ) { if ( $Globals{'resizeorig'} == "yes" ) { $resizeorig = 1; } else { dieWell("Your graphic is too wide! Please upload a smaller one."); unlink($realname); exit; } } if ( $imageheight > $maxheight ) { if ( $Globals{'resizeorig'} == "yes") { $resizeorig = 1; } else { dieWell("Your graphic is too tall! Please upload a smaller one."); unlink($realname); exit; } } // Watermark $watermarked = "no"; if ( $Globals{'annotate'} == "yes") { // stamp the image watermark( $filepath ); $watermarked = "yes"; } // Resizing if ( $resizeorig == 1 ) { // if image is taller than wider, then portrait if ( $imagewidth > $maxwidth ) { $scaleFactor = $imagewidth / $maxwidth; $newheight = round( $imageheight / $scaleFactor ); $newwidth = $maxwidth; } else { $scaleFactor = $imageheight / $maxheight; $newwidth = round( $imagewidth / $scaleFactor ); $newheight = $maxwidth; } if ( $Globals{'usegd'} != 0 ) { $resize_worked = resize_jpeg($filepath, $filepath, $newwidth, $newheight); } else { $syscmd = $Globals{'mogrify_command'}." -format $theext -geometry ".$newwidth."x".$newheight." $filepath"; // call ImageMagick mogrify to resize the original down system( $syscmd, $retval ); if ( $retval != 0 ) { dieWell("Error creating resized original! Error code: $retval"); unlink( $outthumb ); unlink( $filepath ); exit; } } $image_stats = getimagesize( $filepath ); $imagewidth = $image_stats[0]; $imageheight = $image_stats[1]; clearstatcache(); $imagesize = filesize( $filepath ); } //##// end resize original and/or annotate original ### //##// create a medium sized graphic if the graphic is too big ### $createmed = 0; $biggraphic = $Globals{'biggraphic'}; if ( $biggraphic > 0 ) { if ( $imagewidth > $biggraphic || $imageheight > $biggraphic ) $createmed = 1; } if ( $createmed == 1 ) { $medium = $filenoext."-med.$theext"; $medfile="$basedir$thecat/$userid$medium"; if ( $imageheight > $imagewidth ) { $scaleFactor = $imagewidth / $biggraphic; $medwidth = round( $imagewidth / $scaleFactor ); $medheight = $biggraphic; } else { $scaleFactor = $imageheight / $biggraphic; $medheight = round( $imageheight / $scaleFactor ); $medwidth = $biggraphic; } if ( $Globals{'usegd'} != 0 ) { $resize_worked = resize_jpeg($filepath, $medfile, $medwidth, $medheight); } else { copy ( $filepath, $medfile ); $syscmd = $Globals{'mogrify_command'}." -format $theext -geometry ".$medwidth."x".$medheight." $medfile"; // call ImageMagick mogrify to create the medium image system( $syscmd, $retval ); if ( $retval != 0 ) { dieWell("Error creating resized medium image! Error code: $retval<br>Command attempted: $syscmd"); unlink( $outthumb ); unlink( $filepath ); unlink( $medium ); exit; } } // get the proper stats $image_stats = getimagesize( $medfile ); $medwidth = $image_stats[0]; $medheight = $image_stats[1]; $medsize = filesize( $medfile ); } else { $medwidth = 0; $medheight = 0; $medsize = 0; } //##// end medium sized ### $username = addslashes( $username ); if ( empty($title) ) $title = $filenoext; $ititle = urldecode( $title ); $ititle = addslashes( $title ); $idesc = urldecode( $desc ); $idesc = addslashes( $desc ); $ikeywords = addslashes( $keywords ); $query = "INSERT INTO photos values(NULL,'$username', $userid, $thecat, $julian, '$ititle', '$idesc', '$ikeywords', '$realname', $imagewidth, $imageheight, $imagesize, '0', $medwidth, $medheight, $medsize, '1', $julian, '0', '$watermarked', '', '', '', '', '')"; $resulta = ppmysql_query($query, $link); if ( !$resulta ) { dieWell( "Database error! Please report to System Administrator.<p>$query" ); exit; } // end write ## } ?>
  11. I've done some tests and if you replace the process_image function with the code below, it should now work. function process_image( $realname, $filepath, $thecat ) { global $Globals, $userid, $link, $db_link, $uganno; global $username, $usergroup, $title, $desc, $keywords; global $adminexclude, $keywords, $notify, $resizeorig; list($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(); $mon = $mon + 1; if( strlen($year) == 3 ) $year = substr($year, 1); $julian = mktime($hour,$min,$sec,$mon,$mday,$year); $filenoext = get_filename( $realname ); $theext = get_ext( $realname ); $outfilename = "$userid$realname"; $basedir = $Globals{'datafull'}; $image_stats = getimagesize( $filepath ); $imagewidth = $image_stats[0]; $imageheight = $image_stats[1]; $imagesize = filesize( $filepath ); $resizeorig = 0; $maxwidth = $Globals{'maxwidth'}; $maxheight = $Globals{'maxheight'}; if ( $imagewidth > $maxwidth ) { if ( $Globals{'resizeorig'} == "yes" ) { $resizeorig = 1; } else { dieWell("Your graphic is too wide! Please upload a smaller one."); unlink($realname); exit; } } if ( $imageheight > $maxheight ) { if ( $Globals{'resizeorig'} == "yes") { $resizeorig = 1; } else { dieWell("Your graphic is too tall! Please upload a smaller one."); unlink($realname); exit; } } // Watermark $watermarked = "no"; if ( $Globals{'annotate'} == "yes") { // stamp the image watermark( $filepath ); $watermarked = "yes"; } // Resizing if ( $resizeorig == 1 ) { // if image is taller than wider, then portrait if ( $imagewidth > $maxwidth ) { $scaleFactor = $imagewidth / $maxwidth; $newheight = round( $imageheight / $scaleFactor ); $newwidth = $maxwidth; } else { $scaleFactor = $imageheight / $maxheight; $newwidth = round( $imagewidth / $scaleFactor ); $newheight = $maxwidth; } if ( $Globals{'usegd'} != 0 ) { $resize_worked = resize_jpeg($filepath, $filepath, $newwidth, $newheight); } else { $syscmd = $Globals{'mogrify_command'}." -format $theext -geometry ".$newwidth."x".$newheight." $filepath"; // call ImageMagick mogrify to resize the original down system( $syscmd, $retval ); if ( $retval != 0 ) { dieWell("Error creating resized original! Error code: $retval"); unlink( $outthumb ); unlink( $filepath ); exit; } } $image_stats = getimagesize( $filepath ); $imagewidth = $image_stats[0]; $imageheight = $image_stats[1]; clearstatcache(); $imagesize = filesize( $filepath ); } //##// end resize original and/or annotate original ### //##// create a medium sized graphic if the graphic is too big ### $createmed = 0; $biggraphic = $Globals{'biggraphic'}; if ( $biggraphic > 0 ) { if ( $imagewidth > $biggraphic || $imageheight > $biggraphic ) $createmed = 1; } if ( $createmed == 1 ) { $medium = $filenoext."-med.$theext"; $medfile="$basedir$thecat/$userid$medium"; if ( $imageheight > $imagewidth ) { $scaleFactor = $imagewidth / $biggraphic; $medwidth = round( $imagewidth / $scaleFactor ); $medheight = $biggraphic; } else { $scaleFactor = $imageheight / $biggraphic; $medheight = round( $imageheight / $scaleFactor ); $medwidth = $biggraphic; } if ( $Globals{'usegd'} != 0 ) { $resize_worked = resize_jpeg($filepath, $medfile, $medwidth, $medheight); } else { copy ( $filepath, $medfile ); $syscmd = $Globals{'mogrify_command'}." -format $theext -geometry ".$medwidth."x".$medheight." $medfile"; // call ImageMagick mogrify to create the medium image system( $syscmd, $retval ); if ( $retval != 0 ) { dieWell("Error creating resized medium image! Error code: $retval<br>Command attempted: $syscmd"); unlink( $outthumb ); unlink( $filepath ); unlink( $medium ); exit; } } // get the proper stats $image_stats = getimagesize( $medfile ); $medwidth = $image_stats[0]; $medheight = $image_stats[1]; $medsize = filesize( $medfile ); } else { $medwidth = 0; $medheight = 0; $medsize = 0; } //##// end medium sized ### $username = addslashes( $username ); if ( empty($title) ) $title = $filenoext; $ititle = urldecode( $title ); $ititle = addslashes( $title ); $idesc = urldecode( $desc ); $idesc = addslashes( $desc ); $ikeywords = addslashes( $keywords ); $query = "INSERT INTO photos values(NULL,'$username', $userid, $thecat, $julian, '$ititle', '$idesc', '$ikeywords', '$realname', $imagewidth, $imageheight, $imagesize, '0', $medwidth, $medheight, $medsize, '1', $julian, '0', '$watermarked', '', '', '', '', '')"; $resulta = ppmysql_query($query, $link); if ( !$resulta ) { dieWell( "Database error! Please report to System Administrator.<p>$query" ); exit; } // end write ## } Mike.
  12. The query isn't included within the code you've posted. I imagine it'll be within the process_image function so if you could post that, I'll happily run my eye over it. Mike.
  13. Your latest code is missing a few things from your query. - You have no table selected, e.g. an insert query should start like - INSERT INTO table_name SET value_1=.. (there is a different way but this is how I do it ). - As you've got a WHERE clause, it seems that you really want to update. So you should change your query to - UPDATE table_name SET etc. - If you do really want to do an INSERT, remove the WHERE and add a comma before week_id and change AND to a comma. It should end up something like this: <?php header("Location: admin_main_entry.php"); include("opendatabase.php"); foreach ($_POST['spread'] as $weekID => $games) { foreach ($games as $gameID => $values) { $sql = 'INSERT INTO change_to_table_name SET A_pt_spread = ' . $values['A'] .', H_pt_spread = ' . $values['H'] .', week_id = ' . $weekID . ', game_id = ' . $gameID ; mysql_query($sql); } } mysql_close($con) ?> Hope this helps. Mike. Edit: Just seen that you want to update. Start your query off with UPDATE change_to_table_name SET and it should work fine. Mike.
  14. The error you're getting is related to the query values. I've marked the area that's the problem with the word HERE. INSERT INTO photos values(NULL,'corrobex', 1, 10, HERE, 'makinti', '', '', 'makinti.jpg', 571, 381, 42520, '0', 0, 0, 0, '1', , '0', 'no', '', '', '', '', '') If you just default the insert value for that column to '' or 0 (depending on the data type - like you've done with other fields). It should work fine. Mike.
  15. Ah, I think if you're looking to monitor guests too then I'd move this entirely into a new table (so even for users). You can still keep the general idea of what Paul and I (well, mostly Paul) have been discussing. Here's a few things I'd do for this type of feature. - Create an online table with the following fields -- id -- session_id. -- user_id (default this to 0 which will represent a guest, otherwise, it'll store the logged in users ID). -- IP -- current_location -- last_seen - Still update both current_location and last_seen but also look to run a query that deletes any users that are now logged off, i.e. been offline for more than 10 minutes. $lastSeen = time()-600; // Upto and including 10 minutes ago $myQuery = "DELETE FROM online WHERE last_seen<$lastSeen"; I haven't got a lot of time to go into more detail but that should give you a general idea of how this could work. Of course, there could be a better, more efficient way of doing this.
  16. If you could post the code you currently have (perhaps only the relevant parts), it should hopefully stop the second guessing that's going on. Mike.
  17. Because you've already uploaded the file, the temp file will no longer be available (as you've moved it) - use the code below: $targetFile = str_replace('//','/',$targetPath) . $filename; if (move_uploaded_file($tempFile,$targetFile)){ mail($to, 'Upload notification', "Dear Mr/Mrs $fixedname, the file entitled $filename has been successfully uploaded on our servers."); }else { mail($to, 'Upload notification', "Dear Mr/Mrs $fixedname, the file entitled $filename has been NOT successfully uploaded on our servers!"); }
  18. The error you're getting is probably directed to the second comma you have in your query, see an updated query below. $query = "UPDATE registration SET firstname = '".$firstname."' WHERE user_id = '" . $_SESSION['user_id'] . "'"; mysql_query($query) or die(mysql_error()); This should now work.
  19. You really shouldn't worry about the str_replace, it's not doing anything any more. Also, using the file_exists function is pretty pointless here. if (move_uploaded_file($tempFile,$targetFile)){ mail($to, 'Upload notification', "Dear Mr/Mrs $fixedname, the file entitled $filename has been successfully uploaded on our servers."); }else { mail($to, 'Upload notification', "Dear Mr/Mrs $fixedname, the file entitled $filename has been NOT successfully uploaded on our servers!"); } Give that a go and let us know your results.
  20. Paul is correct and you should look to use his method. I'd only change it if you wanted a 'history' type feature, where you can show the last 5 - for example - places the user has visited. The only thing I would add is a 'last_seen' field. This should store the last time the user visited any page on the website and should be updated when the current_location field is. This is so you're not stuck with a potentially huge list containing users who navigated away from your website when visiting a certain page. So to recap: - Use Paul's method unless you're looking for a "history" feature. - Add a last_seen field to the DB. - Update the field when current_location is updated. - Decide the 'timeout' time so you're not left with users who aren't online any more. Hope this helps. Michael.
  21. Hmm, I'm pretty sure you need to assign 'margin: 0; padding: 0' on the 'li' element too. #top-bar ul li { display: inline; margin: 0; padding: 0; } Been a while since I built menus though.
  22. I know this is solved, but you're able to do this using the trim() function. $keywords = trim( $tags['keywords'] ); That should work
×
×
  • 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.