Jump to content

chocopi

Members
  • Posts

    551
  • Joined

  • Last visited

    Never

Everything posted by chocopi

  1. well to convert the spaces you would so something like <?php $str = "What is new in Site?"; $new_str = str_replace(" ","-",$str); echo $str; echo $new_str; ?>
  2. yea it does not matter how many times you call a session
  3. your sessions will only be deleted if you use unset() or session_destroy() or $_SESSION['blah'] = array(); // I think So if you use session_start() multiple times it will not delete your previous sessions. Hope that helps ~ Chocopi
  4. do you mean something like this <a href="javascript:history.back()">Back</a> This has just been googled so it might be wrong ~ Chocopi
  5. Yes the code is secure and you should be fine Just out of intrest what is the :digit: part in this if (eregi("^[[:digit:]]$", $newsid )) You could just use this if (eregi("^([0-9])+$",$newsid)) //doesnt really need eregi, but ohwell I hope that helps ~ Chocopi
  6. I don't know the clever way of doing it but you could always put it into a textarea ~ Chocopi
  7. No, neither is better to have, its just what you prefer, and as long as they both work then you should be fine no matter which script you decided to use. The script that I gave you is just one that one of the mods gave me when I asked a similar question to you. Hope that helps ~ Chocopi
  8. If you know it is just going to be a interger then you could use something like this: $newsid = sprintf("%d",$_GET['newsid']); Hope it helps ~ Chocopi
  9. EDIT: Nevermind, its been sorted
  10. yea, well as long you are just displaying normal images etc then you should be fine
  11. I think it would be difficult to use a WYSIWYG with php as there are so many different functions, whereas with html you have your bold,underline,italics,links,mail,images,align,table,list etc and thats it (and yes i know there are more, but they are the basic ones). Also, as Dragen said you should probably learn the code itself as it will help you later on in the long run. ~ Chocopi
  12. Cheers, Huggie
  13. How do you actually get the dimensions of an image using getimagesize(). I do not know which variable I should be using. Here is my code <html> <body> <br /> <center> <form name="upload" action="<?php $_SERVER['PHP_SELF'] ?>" method="post" enctype="multipart/form-data"> <input type="file" name="avatar" id="avatar" maxlength="60" /> <br /> <input type="submit" name="submit" id="submit" value="Upload" /> <br /> </form> <?php if($_POST) { // set variables $errors = 0; $directory = 'files/'; $max_file_size = '10000'; $allowed_files = array('image/gif'); $file_location = 'avatar/'; $file_upload_name = ''.$page_id.''; // get avatar information $file_name = $_FILES['avatar']['name']; $file_size = $_FILES['avatar']['size']; $file_type = $_FILES['avatar']['type']; $file_dim = getimagesize(???); // what goes here ? echo "name = ".$file_name."<br />"; echo "size = ".$file_size."<br />"; echo "type = ".$file_type."<br />"; echo "dim = ".$file_dim."<br />"; if(empty($file_size) or empty($file_name) or empty($file_type)) { } else { list($blank,$file_extension) = explode('image/',$file_type); if($file_size > $max_file_size) { echo "Your file is larger than 10kb.<br />"; $errors++; } if(!in_array($file_type, $allowed_files)) { echo "You are not allowed to upload that file type.<br />You are only allowed: .gif<br />"; $errors++; } if($errors == 0) { copy($_FILES['avatar']['tmp_name'], "files/".$_FILES['avatar']['name']) or die ("Could not copy"); echo "Your image has been uploaded"; } else if($errors > 0) { $errors = 0; die(""); } } } ?> </body> </html> Cheers ~ Chocopi
  14. if you have something like captcha in your page, the cacheing can make the same image appear again and again, making the captcha worthless ~ Chocopi
  15. try putting the image stuff along with the header inside another file and then include it
  16. can you post your whole code please
  17. I was gonna suggest something similar, but that will only work if there is one "." ~ Chocopi
  18. so what is the actual error message ?
  19. i dont know, but you could try removing the first slash include("../includes/conf.php"); or you could try using ' instead of " EDIT = by the way, what is the error ? ~ Chocopi
  20. kool thanks, its not really a problem, so i will leave it
  21. yea but strip tags wont stop < > on there own which could be used for evil things. Anway i use it to change ' and " and whatever others there are ~ Chocopi
  22. it could also be if you are using nl2br() to display it ~ Chocopi
  23. you just need to put them around your $_POST's and $_GET's eg // this for like usernames and stuff going in to database $username = mysql_real_escape_string($_POST['username']); // i use this for stuff to be in message boards $original = $_POST['message']; $original = strip_tags($original); $original = htmlentities($original, ENT_QUOTES); etc There is also html-special-chars ~ Chocopi EDIT: Beaten to it, twice
  24. well there is quite a few, here is just some Strip-Tags mysql_real_escape_string htmlentities Add-Slashes Thats all I can think of, off the top of my head ~ Chocopi
×
×
  • 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.