Jump to content

stevesimo

Members
  • Posts

    96
  • Joined

  • Last visited

    Never

Everything posted by stevesimo

  1. Hi, I have a PHP script used on an intranet which displays a list of employees whose birthday occurs during the current month. i.e. all birthdays in the month of July. NOTE: I only want to show the day, not the full date of birth. The date of birth field is currently stored as a date yyyy-mm-dd. My problem is this: I want to display the list of birthdays in order of day order and not date order. Therefore simply saying order by dob will order the list in order of age. Does anyone know how to achieve this? Just to clarify what I am trying to achieve, the sample output would be something like: There are 3 birthdays in July 4th Employee 1 13th Employee 2 21st Employee 3
  2. Hi, we have an intranet web server which has a computer name of server-01. When we enter http://server-01 into the browser address bar on our network it automatically points to the webroot folder on the network. Does anyone know how this works? I am trying to set up a new server which I am going to call server-02 and I want the same functionality so that when we enter http://server-02 in the browser, the webroot for that server is displayed. Any help appreciated. Steve
  3. Hi, does anyone know how I can set the name of my http server to say server1 for example so instead of http://localhost I can use http://server1 ? Thanks Steve
  4. Hi, my client has asked me to generate a CSV file or Excel file which is straight forward enough to do. The complication is that they have asked if the file can be password protected. Does anyone know how I could achieve this. Is it actually possible to do this with PHP? Any advice on this subject would be appreciated. Steve
  5. Hi, I have a textfile which I need to upload to a remote server but am getting no joy. Can anyone spot what might be causing the problem from my code. I have substituted ip address and username and password: $localfile = 'test.txt'; $ch = curl_init(); $fp = fopen ($localfile, "r") or die('Cannot open textfile'); curl_setopt($ch, CURLOPT_URL,"sftp://123.123.123.123:10022/username/test.txt"); curl_setopt($ch, CURLOPT_USERPWD, "username:password"); curl_setopt($ch, CURLOPT_UPLOAD, 1); curl_setopt($ch, CURLOPT_INFILE, $fp); if(curl_exec($ch)){ echo 'File was successfully transferred using SFTP'; }else{ echo 'File was unable to be transferred using SFTP'; } curl_close ($ch); any advice would be greatly appreciated. Steve
  6. Hi, I am working on an application which stores details of customer orders. The payment date has been stored as a varchar in dd/mm/yyyy UK format ie. 28/10/2008. My problem is that when I run a query on orders and try to index on payment date the results are not properly ordered. I would normally store dates as a timestamp value but this system was written a couple of years ago and there are a lot of records already in the database. Can anyone offer any advice on how I can get around this problem for the purposes of indexing the results in order of payment date using the existing dd/mm/yyyy varchar format. Thanks Steve
  7. Still made no progress with this problem, can anyone point me in the right direction regarding how to use ftp_ssl_connect for file transfer via PHP. Thanks Steve
  8. Hi, I have been asked to code an application which for its last job needs to transfer a data textfile using SFTP. I have been given an IP address and a port to connect to but cant get it to work. Before posting here I have had a good luck on the internet and was struggling to find any complete examples. I found the example below but cant get this to work. Here is my code: $ftphost = '123.123.123.123'; $ftpuser = 'username'; $ftppwd = 'password'; $ftpport = 10022; $timelimit = 30; //UTF8 Encode Data $data = utf8_encode($data); // set up ssl connection $ftpconn = ftp_ssl_connect($ftphost, $ftpport, $timelimit) or die("Could not connect to FTP server..."); echo 'Connected to FTP server...<br>'; // login with username and password $login_result = ftp_login($ftpconn, $ftpuser, $ftppwd) or die("Could not login to FTP server...<br>"); echo ftp_pwd($ftpconn); ftp_close($ftpconn); // close the ssl connection This code doesnt even try to tranfer any files, just tries to connect to server and login but I cannot get it to work. Can anyone point me in the right direction. Many thanks Steve
  9. Hi, I am attempting to write a script which downloads a copy of specified auction listings from a well know auction site. It downloads a copy of the html page and associated images using the item number of the listing. Although the code which I am using works, it is slow as it has to recreate the images once they are downloaded. Also I have noticed that the images once recreated appear to be slightly larger than the original ones on the auction site. I tried to use CURL but I think that the auction site have disabled this functionality on their server as all I kept getting was a message saying that the file had moved to another location although the underlying link I was using was correct. Here is my code: $im = @imagecreatefromjpeg($imageurl); imagejpeg($im,$filename); Any suggestions would be much appreciated. thanks, Steve (Blackpool, UK)
  10. Hi, I am having trouble with a relatively simple script. There are 3 steps, 1) create a folder 2) chmod folder 3) copy file to new folder Here is my code mkdir('newfolder',0777); //create folder chmod('newfolder', 0777); //chmod folder copy('file.php','/newfolder/file.php') or die('failed to copy file'); Can anyone see what I am doing wrong? thanks, Steve
  11. Have you set the chmod of your upload folder to 777 as I had this problem once when uploading images.
  12. Hi, I have a script which creates a new folder on the server which I then want to save a textfile into. The folder is being created and is CHMOD to 777 but the textfile is not being saved into the folder. Can anyone see what I am doing wrong? Not sure if my file path is incorrect. //create folder using id mkdir("./".$id, 0777); //now chmod to 0777 chmod("./".$id."/", 0777); $output = 'Some text to save in file goes here...'; //now save textfile using id as name $textpage = fopen("/".$id."/".$id.".txt","w"); fwrite($textpage,$output); fclose($textpage); Thanks, Steve
  13. Thanks for that, I sent Digimarc an email earlier today but thought I would ask on the off chance that someone might have already developed a script to do this. As yet I havent found anything out there to do this but will keep looking. Cheers, Steve
  14. Hi, does anyone know how to read an image file to detect a digimarc id using PHP? Thanks, Steve
  15. here is the php code ya will need to save the code to a file on your server $output = 'User input will be in this value'; //save webpage to server $webpage = fopen('filename.htm',"w"); fwrite($webpage,$output); fclose($webpage); hope this helps
  16. Hi, I am trying to use Curl to download the html content of a webpage of a specified URL and save to server. However when I check the source code of the saved page it is simply a page containing a redirect link to the same URL. The return code is 301 which is a redirect - moved permenantly code. Does anyone know how I can get around this problem? Here is my code: //make sure slash is included initially $url = 'myurl.com/'; // create a new curl resource $ch = curl_init(); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // grab URL, and return output $output = curl_exec($ch); // Get response code $response_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo 'Response Code: '.$response_code; // Not found? if ($response_code == '404') { echo 'Page doesn\'t exist'; } // close curl resource, and free up system resources curl_close($ch); //save webpage to server $webpage = fopen('exchangerates.htm',"w"); fwrite($webpage,$output); fclose($webpage);
  17. Thanks for that, your code worked a treat!
  18. Hi, I have a php function which downloads an image in PNG format from a remote server and returns the result as a value called $content. Using the following code I can output the downloaded PNG image to the screen. header("Content-type: image"); print($content); My question is how can I store this PNG file on the server as an image file? Many thanks, Steve (Blackpool, UK)
  19. I removed the 75 of the imagepng command and now the image displays but simply as a black rectangle. Could this be because my image coords are incorrect?
  20. hi, thanks for your code, i have uploaded it and it seems to run ok, however when I try and access the small image which has been created, my browser simply displays the path of the image, not the image itself. Do you have any ideas as to what this might be? Thanks Steve
  21. Hi, I am having difficuly using the imagecopy command. I have a large image and I am trying to copy a small area of this image and save this to a file. However I cant get it to work and am not sure where I am going wrong. Here is my code $imagefile = 'largeimage.png'; $src = imagecreatefrompng($imagefile); $dest = imagecreatetruecolor(83, 24); // Copy small image from large image imagecopy($dest, $imagefile, 358, 70, 0, 0, 83, 24); $image = 'smallimage.png'; $newimage = @imagecreatefrompng($dest); imagepng($newimage, $image, 75); imagedestroy($newimage); The main part of what I am trying to do is not just to copy the image but actually saving it to a file. Can anyone point me in the right direction. Thanks, Steve (Blackpool, UK)
  22. Thanks for the help Matt, that has helped a lot Cheers, Steve
  23. Hi, I have a script which sends and email to a given email address. This works fine however I want to also embed an image into the email. Does anyone know if this is possible and if so how do I achieve it. Here is my email code: $to = $useremail; $subject = "Email Subject"; $body = "My email content"; mail($to, $subject, $body); Many thanks,Steve
  24. Thanks for your help, I have got it working now. Steve
×
×
  • 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.