
chocopi
Members-
Posts
551 -
Joined
-
Last visited
Never
Everything posted by chocopi
-
Need help for creating URL using PHP Reg Exp
chocopi replied to kks_krishna's topic in PHP Coding Help
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; ?> -
yea
-
yea it does not matter how many times you call a session
-
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
-
do you mean something like this <a href="javascript:history.back()">Back</a> This has just been googled so it might be wrong ~ Chocopi
-
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
-
I don't know the clever way of doing it but you could always put it into a textarea ~ Chocopi
-
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
-
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
-
EDIT: Nevermind, its been sorted
-
yea, well as long you are just displaying normal images etc then you should be fine
-
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
-
Cheers, Huggie
-
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
-
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
-
try putting the image stuff along with the header inside another file and then include it
-
can you post your whole code please
-
I was gonna suggest something similar, but that will only work if there is one "." ~ Chocopi
-
so what is the actual error message ?
-
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
-
kool thanks, its not really a problem, so i will leave it
-
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
-
it could also be if you are using nl2br() to display it ~ Chocopi
-
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
-
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