Jump to content

sid0972

Members
  • Posts

    50
  • Joined

  • Last visited

sid0972's Achievements

Member

Member (2/5)

0

Reputation

  1. i get the same error, but the problem is that i dont have the bracket problem as iamz3r0 faced, i really have to use break. and if i cant use break, what can i use?
  2. This is the error PHP Notice: Undefined index: valid_user in /var/www/work/fns/display_images.php on line 3 <img src="./uploads/" /> PHP Notice: Undefined offset: 1 in /var/www/work/fns/display_images.php on line 7 <img src="" /> i think its not accepting the session variable. and i'll try hardcoding the username this time.
  3. i have a script to allow each member to store images in a folder named after him, so that they are exclusive to that particular member only. Now when i try to retrieve it, i get error. any ideas what might be wrong here?? <?php session_start(); $pictures = glob("./uploads/".$_SESSION['valid_user']."/"); $no_pictures = count($pictures); for( $i = 0; $i <= $no_pictures; $i++) { echo "<img src=\"".$pictures[$i]."\" />\n"; } ?> thanks
  4. i solved it i used this script and applied the same modification and everything works fine now
  5. here is the script i am using <?php session_start(); define ("MAX_SIZE","10000"); function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } $errors=0; if(isset($_POST['Submit'])) { for($i=0; $i<count($_files['image']['name']);$i++) { $image=$_FILES['image']['name']; if ($image) { $filename = stripslashes($_FILES['image']['name']); $extension = getExtension($filename); $extension = strtolower($extension); if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) { echo '<h1>Unknown extension!</h1>'; $errors=1; } else { $size=filesize($_FILES['image']['tmp_name']); if ($size > MAX_SIZE*1024) { echo '<h1>You have exceeded the size limit!</h1>'; $errors=1; } $directoryPath = "images/".$_SESSION['valid_user']; if (is_dir($directoryPath)) { echo "exists<br>"; $image_name=time().'.'.$extension; $newname="/images/".$_SESSION['valid_user']."/".$image_name; } else { echo "not exists"; $directorypaths = "images/".$_SESSION['valid_user']; mkdir($directorypaths, 0755); $newname="/images/".$_SESSION['valid_user']."/".$image_name; } $copied = copy($_FILES['image']['tmp_name'], $newname); if (!$copied) { echo '<h1>Copy uunsuccessfull!</h1>'; echo "<a href=\"member.php\">Click</a>"; $errors=1; }}}}} if(isset($_POST['Submit']) && !$errors) { echo "<h1>File Uploaded Successfully! Try again!</h1>"; echo "<a href=\"member.php\">Click</a>"; } ?> <form name="newad" method="post" enctype="multipart/form-data" action="image_upload.php"> <table> <tr><td><input type="file" name="image"></td></tr> <tr><td><input name="Submit" type="submit" value="Upload image"></td></tr> </table> </form> i copied this from somewhere and modified it a bit. I want it to check if a directory of the name of current user is already in the /images folder, and if not, it should create a directory by the name of current user and save images in there. So i added this part here $directoryPath = "images/".$_SESSION['valid_user']; if (is_dir($directoryPath)) { echo "exists<br>"; $image_name=time().'.'.$extension; $newname="/images/".$_SESSION['valid_user']."/".$image_name; } else { echo "not exists"; $directorypaths = "images/".$_SESSION['valid_user']; mkdir($directorypaths, 0755); $newname="/images/".$_SESSION['valid_user']."/".$image_name; } and i would take a guess that this part is not working. Any help is appreciated.
  6. i thought it was a function of php but kicken cleared it well and good.
  7. till now my guess was this /^\d+\.?\d{1,2,3}$/ It should accept a whole number, like 123456 or a decimal, like 123.456, but should allow MAX 3 decimal places. but this isn't seem to be working. what's wrong with it??
  8. silly me varchar() works fine. thanks for looking though
  9. i already have the particular column as float, and input is of the form 9999.999 i dont think if number_format's going to be of much help here. What should i use??
  10. so this is a path http://www.google.com and everything after google.com is a param https://www.google.c...iw=1855&bih=968 right?
  11. oh ok is there any way i can tell if there's a problem with a regex, or i just have to look at it?
  12. @christian f can you tell me the difference between URL path and URL param?? does URL parameters include GET values??
×
×
  • 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.