-
Posts
21 -
Joined
-
Last visited
Never
Everything posted by Splash
-
Hi, I've been struggling with this for a while now so hopefully someone can help me out. I need to use regex to replace all spaces inside an anchor tag for example. Hello this is a string, check this <a href="http://www.google.com">Google is cool</a> Oh and this <a href="http://www.google.com/blah blah">Google is cool</a> That is all Needs to become Hello this is a string, check this <a[sPACE]href="http://www.google.com">Google[sPACE]is[sPACE]cool</a> Oh and this <a[sPACE]href="http://www.google.com/blah[sPACE]blah">Google[sPACE]is[sPACE]cool</a> That is all Thank you
-
Hiya, I have a page that contains a number of 100% width tables. When I print the page the 4th table gets spit between two pages. How can I change this so that if the page ends half way through a table it pushes the whole table to the next page? Thank you for your help!
-
Figured this out. Needed to do it as a string. e.g. $url = 'http://foo.com/'; $params = 'name=test&age=24&preferences[]=1&preferences[]=2&preferences[]=3&preferences[]=4&preferences[]=5&preferences[]=6'; $user_agent = "Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)"; $ch = curl_init(); curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS,$params); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); if(curl_exec($ch) === false) { echo 0; } else { echo 1; } curl_close ($ch);
-
Hi all, I'm trying to send some data to a remote domain but am having an issue with one of the variables being an array. The problem is that the preferences array loses it's individual values at the other end. Any idea what I'm doing wrong here? $url = 'http://foo.com/'; $params = array( 'name' => ' Test', 'age' => 24, 'preferences' => array(1,2,3,4,5,6) ) $user_agent = "Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)"; $ch = curl_init(); curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS,$params); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); if(curl_exec($ch) === false) { echo 0; } else { echo 1; } curl_close ($ch);
-
Hiya, I'm trying to zip a directory using the following command: zip -r0 zipfile mydir However there's a file I get an error on whilst the zipping takes place. This causes the command to stop. Is there any way to tell the command to skip errors? I've tried 'man zip' but I can't find anything. thanks
-
Thanks Salathe, I've already had a look at that but can't find any practical examples to work from. Would you mind giving me an example with explanation?
-
Hiya, I've using mod_rewrite to run all URI requests through a PHP file (siteRun.php) However I need to stop this from happening in a particular sub directory. How can I achieve this? RewriteRule !\.(gif|jpg|php|png|css|js|swf|ico|flv|pdf)$ /siteRun.php RewriteRule ^(.*)subdir/(.*)$ /wordpress/$2
-
Looks good thanks.
-
Not sure if it's the cause of your problem but your constructor should start with 2 underscores.
-
The PHPMailer class is perfect for this: http://sourceforge.net/projects/phpmailer/
-
No problem
-
Also there are a number of security issues involved when mailing form data. The following link talks through these and tells you how to protect against them. http://www.velvetblues.com/web-development-blog/how-to-write-a-php-contact-form/
-
Hi Rockindano You'll need to add all your variables into the message parameter. i.e. $message = $name."\n"; $message .= $email."\n"; $message .= $phone."\n"; etc
-
Hiya, I'm having a problem that I hope someone can help me with. I've got a quicktime upload form which includes fields for the videos width and height. However it seems that most users don't understand this and are entering 0 and 0. What I need is to get the videos dimensions using PHP. Does anyone have experience with this or know how it could be done. Thank you.
-
Hi all I'm trying to set up a script that will generate thumbnails for an image gallery using GD Library. I'm using the following script, which resizes the image to 100px x 100px. It's working fine however I has hoping someone could help me edit it so that it shrinks the image by 50% then crops the thumbnail from the center. <?php //Input file $file = 'image.jpg'; //Output file $save = 'new.jpg'; //Get image dimensions list($width, $height) = getimagesize($file) ; //Set new Dimensions $modwidth = 100; $modheight = 100; $tn = imagecreatetruecolor($modwidth, $modheight) ; $image = imagecreatefromjpeg($file) ; imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; imagejpeg($tn, $save, 100); ?> Thanks a lot
-
Aha, Thanks so much, I was looking for so long I couldn't see it!
-
Hi All! I'm trying to implement a file upload script but am having a problem which I hope someone can help me with. Basically I can get the file to upload fine however it's not echo'ing the filename when prompted here echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; It just says "The file has been uploaded" I need the filename to work as I intend to insert it into a MySQL db. This is the full script I'm using; <?php if ($upload == 1) { $target = "GalleryImages/"; $target = $target . basename( $_FILES['uploaded']['name']) ; $ok=1; //This is our size condition if ($uploaded_size > 500000) {echo "Your file is too large.<br>"; $ok=0;} //This is our limit file type condition if (!($uploaded_type=="image/gif")) {echo "You may only upload GIF files.<br>"; $ok=0;} //Here we check that $ok was not set to 0 by an error if ($ok==0) {Echo "Sorry your file was not uploaded";} //If everything is ok we try to upload it else { if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)){ echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else {echo "Sorry, there was a problem uploading your file.";} } } else { ?> <form enctype="multipart/form-data" action="upload-photo.php" method="POST"> Please choose a file: <input name="uploaded" type="file" /> <input type="hidden" value="1" name="upload" /><br /> <input type="submit" value="Upload" /> </form> <?php } ?> Thankyou
-
[SOLVED] Adding a string to the end of a varibale name.
Splash replied to Splash's topic in PHP Coding Help
Btherl you're a legend! Works a treat! -
[SOLVED] Adding a string to the end of a varibale name.
Splash replied to Splash's topic in PHP Coding Help
Ah that looks good to me, I'll try it and let you know how I get on. -
Hello everyone. I'm working on a project at the moment and have hit a bit of a brick wall, and am hoping you guys can help me with it. Basicaly I'm trying to create a new variable by adding a string onto the end of the variable name. i.e. $Variable1 = 1; $Variable2."$Variable1" = "Value" $Variable1++; $Variable2."$Variable1" = "Value" Which would result in $Variable21 = "Value" $Variable22 = "Value" Does anyone know how this can be achieved? Thankyou Splash