Jump to content

EchoFool

Members
  • Posts

    1,074
  • Joined

  • Last visited

Everything posted by EchoFool

  1. The folder the files go to is 0775 and the script.php is 0775 aswell but i get permission denied.
  2. Okay your talking beyond my level here i just made the script above it worked on 0777 - beyond that ive never really touched permissions ... all my other folders/files are 0755. Which is fine. So were talking about alien stuff to me here If i change mod to 0755 it won't work when i did it manually.
  3. When you say apply it to the folder do you mean make the script in the folder and execute it or something else ?
  4. Hi I have an image uploading script that won't upload images... It worked at one point when i had folder permission at 0777 but i was told that is risky so i changed it to 0775 Now it won't work and i can't use 0777. Any one know what i need to do to get it to work? This is my script: <?php $salt = 35322232414; $name = $salt.$safe; $name = md5($name); if(isset($_POST['submit'])){ if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/png") || ($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 1000000)) { if ($_FILES["file"]["error"] > 0) { echo $_FILES["file"]["error"]; } else { $filename = md5(serverdate()) . $_FILES["file"]["name"]; if (file_exists("userimages/".$name."/".$filename)) { echo "Image already uploaded!"; } else { if (is_dir("userimages/".$name) == FALSE){ mkdir("userimages/".$name, 0775); //permissions } move_uploaded_file($_FILES["file"]["tmp_name"], "userimages/".$name."/" . $filename); echo "Image has been uploaded!"; } Error i get:
  5. Hey, I am trying to make a BBCode which quotes a post. But if a user quotes a post where the post they are quoting... contains a quote already from a previous post (still with me?) then the CSS messes up and im not sure why. In short if you quote a post which is already quoting a post then the problem arises. My function is: <?php function bbcode ($string) { // All the default bbcode arrays. $bbcode = array( //Text Apperence '#\[b\](.*?)\[/b\]#si' => '<b>\\1</b>', //Other '#\[url=http://(.*?)\](.*?)\[/url]#si' => '<a href="\\1" target="_blank">\\2</a>', '#\[quote\](.*?)\[/quote\]#si' => '<div class="quote_body">\\1<>', '#\[img\](.*?)\[/img\]#si' => '<img src="\\1">', ); $output = preg_replace(array_keys($bbcode), array_values($bbcode), $string); return $output; } echo nl2br(bbcode($message)); ?> The HTML came out like this: <div class="quote_body"> Posted By <b>Username</b> <br/> [quote] Posted By <b>Username</b> <br/> Content of post <br /><br/> Content of post [/quote] <br/><br/> Content of Post As you can see above some times it didn't change "quote" it left it and didn't convert it to my CSS. Any idea why?
  6. Oh i see, thanks for the advice
  7. The one you provided me is a little confusing. ((date_format(now(),'%Y') - date_format(ma.DOB,'%Y')) - (date_format(now(),'00-%m-%d') < date_format(ma.DOB,'00-%m-%d'))) AS age How come it does 3 subtractions then compares if its less than something when calculating the age?
  8. I shall take a look at that thanks! p.s is there a way to not take into account leap years? I originally got the DATE_ADD() from here http://www.phpfreaks.com/forums/index.php?topic=345577
  9. Oops my bad, it was meant to be 18 and 99 not 60 =/ Do you mean i have to convert "age" from date to years old first.. how can i do that in MySQL =/
  10. Hey I have a WHERE clause which has this: <?php $hi = 99; $low = 18; //WHERE clause age BETWEEN (DATE_ADD(CURDATE(), INTERVAL $low YEAR) AND DATE_ADD(CURDATE(), INTERVAL $hi YEAR)) ?> The field age is in the structure of YYYY-MM-DD Now i have in the database 1 user with this: But my query returns 0 results. The WHERE clause is suppose to find all users whose age is between the two values. Can any one see the mistake i am making here?
  11. If you explode via domain like that won't it get it wrong at this part: Because it will come out like:
  12. Hi thank you for the reply, quick question, if i want to then edit the $new1 2 and 3 and then re-import it back to the original string how would i do that? My intentions is to extract the domain links..check if they are valid then add a <img src="tick.jpg"> in font of the link and put each link on its own line. Thus resulting in : <?php $newlinks = '[quote] <img src="tick.jpg"/> http://www.domain.com/?d=03WO6WPC random text, <img src="tick.jpg"/> http://www.domain.com/?d=0334fWPC <img src="tick.jpg"/> http://www.domain.com/?d=03WV4SPC [/quote]'; ?> What would you suggest ?
  13. Hey, I have a script that is meant to grab links of a specific type. <?php //need to some how extract all links from this text $link = '[quote]http://www.domain.com/?d=03WO6WPC random text, http://www.domain.com/?d=0334fWPChttp://www.domain.com/?d=03WV4SPC[/quote]'; ?> The urls are always the same character length, but there is no telling how the user types them out so im looking for a way to extract the 3 urls based on domain.com. The end result should be to create an array of 3 urls which belong to domain.com . I tried explode but some one may type it without spaces so explode fails.. any ideas?
  14. Well i was always told to avoid derived tables due to performance issues?
  15. The left join is to see if the user has images uploaded to their profile. Because the query is only to load users who have images of 1 or more. But some users can decide to load users without images, so i used a left join and just echo'd how many images the user has uploaded to their profile adjacent to their name like: User 1 : 0 images. User 2: 5 images. etc. But if it finds no users it comes up with a empty row showing 0 images. I tried to merge it into one query for efficiency which i do as much as possible.
  16. I thought you could bump after 12 hours guess the rules changed since i last visited, and if i use a second query will that be efficient enough =/ Always thought making it in to one query is most efficient method when possible.
  17. Hey, I have a query which returns a row with no values in the fields, technically it should not find a row based on my current example data, but it still finds one. I have no idea how to solve this.... please can you help. Here is my query: <?php SELECT *,count(t3.userid) as Total FROM user_settings t1 INNER JOIN users t2 ON t1.userid=t2.UserID LEFT JOIN users_pictures t3 ON t1.userid=t3.userID WHERE TIMESTAMPDIFF(DAY,LastAction,NOW()) < 34 AND NOT EXISTS ( SELECT id FROM users_blocked WHERE (user1='$myid' AND user2=t2.UserID) OR (user1=t2.UserID AND user2='$myid') ) LIMIT 50 ?> I am wondering if my count() is causing it ? IF so how can i solve it ? Thanks
  18. Hey, I have a table which stores userid and birthday. The birthday is in the format of YYYY-MM-DD And im trying to do a query to search for all userid's that are between the ages of two ages, lets say 18 and 30. How would i do this ? Do i have to use a php function in the query?
  19. Oh so i just add [$position] after it ? Argh thats simpler than i was expecting! Thanks
  20. Hey, I have a script which processes an image when it is uploaded, but now i have a new form that allows users to upload four images at a time. I store them in an array in the form like so: name="file[]" So now i am wondering how do i process each image with a forloop because using $_FILES doesn't say which image to check in the array? Hope some one can help me! Heres my code: <?php if(isset($_POST['submit'])){ echo '<p align="center">'; if ($_FILES["file"]["size"] < 1000000) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { $filename = $_FILES["file"]["name"]; if (file_exists("images/".$name."/".$filename)) { echo "Image already uploaded!"; } else { if (is_dir("userimages/".$name) == FALSE){ mkdir("images/".$name, 0777); } move_uploaded_file($_FILES["file"]["tmp_name"], "userimages/".$name."/" . $filename); echo "Image has been uploaded!"; } } } else { echo "Invalid file"; } } ?> Thanks
  21. I have size solved the problem there was a nice tutorial on w3school that helped me out! Thanks for the feedback guys!
  22. Doesn't seem like that option is available to me:
  23. That resize script seems a bit long just to resize an image in a directory, im sure theres a built in function for it that keeps the ratio of the image intact.
×
×
  • 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.