[PHP] Clear file or write to file erasing all old content
I can't seem to figure out how to write to a file deleting the old content. Sorry I can't find which function/functions to RTFM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Clear file or write to file erasing all old content
Thanks, Its just one of those things I miss sometimes... Jason Perkins [EMAIL PROTECTED] wrote in message news:r01050400-1023-A17E17A81BC511D7B4D4000393D5F61C@[192.168.1.3]... on 12/30/02 at 6:02 PM, Noodle Snacks [EMAIL PROTECTED] wrote: I can't seem to figure out how to write to a file deleting the old content. Sorry I can't find which function/functions to RTFM It's specified with the mode parameter in the fopen function: http://www.php.net/manual/en/function.fopen.php -- Jason Perkins url - http://www.somebodydial911.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Timing mySQL query time.
Is there a built in php function for mysql that I can use to time the last query? or do I have to take the microtime before and after then substract the first from the last? I want to time how long my queries take -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Timing mySQL query time.
Can I do that on the fly? Rasmus Lerdorf [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Why not just get the query times from the mysql general query log? On Tue, 24 Dec 2002, Noodle Snacks wrote: Is there a built in php function for mysql that I can use to time the last query? or do I have to take the microtime before and after then substract the first from the last? I want to time how long my queries take -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Updating GD
Cool, Just thought it might be a config / code issue or something. Jason Wong [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Tuesday 17 December 2002 10:19, Noodle Snacks wrote: PHP is telling me that I need GD 2.0 or later. This is on a newly installed mandrake 9 distro. Could this be a configuration issue? or do I need to figure out how to update GD? If you want to use those functions, then yes, you need to figure out a way to update GD. I get these errors: Warning: imagecreatetruecolor(): requires GD 2.0 or later in /var/www/html/golgo13/includes/img.class.php on line 55 Warning: imagecopyresampled(): requires GD 2.0 or later in /var/www/html/golgo13/includes/img.class.php on line 56 -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* What you don't know can hurt you, only you won't know it. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Updating GD
PHP is telling me that I need GD 2.0 or later. This is on a newly installed mandrake 9 distro. Could this be a configuration issue? or do I need to figure out how to update GD? I get these errors: Warning: imagecreatetruecolor(): requires GD 2.0 or later in /var/www/html/golgo13/includes/img.class.php on line 55 Warning: imagecopyresampled(): requires GD 2.0 or later in /var/www/html/golgo13/includes/img.class.php on line 56 Warning: imagedestroy(): supplied argument is not a valid Image resource in /var/www/html/golgo13/includes/img.class.php on line 73 Warning: imagedestroy(): supplied argument is not a valid Image resource in /var/www/html/golgo13/includes/img.class.php on line 74 When I run this script: $image = new image; $image-max_size = 300; $image-upload($data, $data_type); Here are the relevent class functions: function load_gd() {// Checks to see if GD has been loaded. If not it loads the dll/so file if (!extension_loaded('gd')) { if (!dl('gd.so')) { if (!dl('gd.dll')) { exit; } } } } function resize() {// Resizes Image to be within maximum size, could be expanded to have seperate width and height values. $this-load_gd();// Check that gd is loaded and availible. $size = GetImageSize($this-temp_loc); $width = $size[0]; $height = $size[1]; if(($width $this-max_size) || ($height $this-max_size)) { switch ($pictype) { case image/gif; $this-src_img = ImageCreateFromGif($picdata); break; case image/jpeg; $this-src_img = ImageCreateFromJpeg($picdata); break; case image/png; $this-src_img = ImageCreateFromPng($picdata); break; default: $mimeName = Unknown image type, failed; } $orig_x = $width; $orig_y = $height; $new_y = $this-max_size; $new_x = $orig_x/($orig_y/$this-max_size); $dst_img = ImageCreateTrueColor($new_x,$new_y); ImageCopyResampled($dst_img, $this-temp_loc, 0, 0, 0, 0, $new_x, $new_y, $orig_x, $orig_y); switch ($pictype) { case image/gif; $this-src_img = imagepng ($dst_img); break; case image/jpeg; $this-src_img = imagejpeg($dst_img); break; case image/png; $this-src_img = imagepng ($dst_img); break; default: $mimeName = Unknown image type, failed; } $this-picdata = $dst_img; ImageDestroy($src_img); ImageDestroy($dst_img); } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Language codes to textual languages.
Via $_SERVER['HTTP_ACCEPT_LANGUAGE'] you can get the default language of a browser (usually). Does anyone know of a list that has the conversion from say: en-au to Australia or en-us to U.S.A? -- JJ Harrison [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Ip address as 32bit int?
Is it easy enough to change a formated IP addy (eg 192.168.0.1) to the 32bit unsigned int that computers use? the reason I ask is because it is alot more efficient space wise in a db to be storing a 32bit number rather that a char or varchar field. Or am I going to run into trouble because all ints are signed in PHP? -- JJ Harrison [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] FAQ a good idea?
I think this group should have a regularly posted faq that outlines common problems such as register globals. I would be glad to help write it etc if anyone else would like an input. I wrote this in response to the millions of register global questions and the message with the subject Be Nice to Newbies. Reply on list if you think it would be a good idea and we can use this thread to discuss it... -- JJ Harrison [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FAQ a good idea?
An about register globals post bi-weekly would eliminate tons of questions I reckon. But maxim is also right. People should find their own info and a faq could dominate the group... -- JJ Harrison [EMAIL PROTECTED] Clint Tredway [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I think this is a good idea. We have have for ColdFusion because we can point new people to it and it answers a lot of questions without generating extra traffic on the list. I for one am all for an FAQ. Clint -Original Message- From: Maxim Maletsky [mailto:[EMAIL PROTECTED]] Sent: Friday, November 22, 2002 6:53 AM To: Noodle Snacks Cc: [EMAIL PROTECTED] Subject: Re: [PHP] FAQ a good idea? there is a bunch of info everywhere on the web. One should have better means to find these, but at the end, that is what others do here - answer questions :) I don't think this will ever happen -- Maxim Maletsky [EMAIL PROTECTED] Noodle Snacks [EMAIL PROTECTED] wrote... : I think this group should have a regularly posted faq that outlines common problems such as register globals. I would be glad to help write it etc if anyone else would like an input. I wrote this in response to the millions of register global questions and the message with the subject Be Nice to Newbies. Reply on list if you think it would be a good idea and we can use this thread to discuss it... -- JJ Harrison [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: echoing date of first and last day of current week.
I ended up using this: $time = time(); $weekday = date('w',$time); $suntimestamp = $time - ($weekday * 86400); $sattimestamp = $suntimestamp + 604800; echo 'Words for the week from '.date('jS F Y',$suntimestamp).' to '.date('jS F Y',$sattimestamp).'.br'; -- JJ Harrison [EMAIL PROTECTED] Noodle Snacks [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I want to get the unix timestamps of the first and last days of this week... Currently I have this: echo 'Words for the week from '.date('jS F Y',strtotime(last sunday)).' to '.date('jS F Y',strtotime (next saturday)).'.br'; on saturday this showed the 10th to 23rd... Is there a good way to do this mathematically (for speed) or can someone think of a better string to parse? -- JJ Harrison [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: problems with PHP code (Please help!)
It it better that you use a subject that is related to the problem eg. Email Script not working after server upgrade -- JJ Harrison [EMAIL PROTECTED] `Yan Grossman [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Dear Friends, I run some PHP scripts to deal with sending forms data to my email adress. But, my nice Host provider upgraded the server to another version of PHP 4 and I notice that now the scripts are not working. I don't receive the emails anymore. They say I have to make sure all my code works for PHP 4.23 or later... My code is very simple and uses the command mail(). I don't know much about PHP, but I guess it should be simple to fix my problem. I attached one of my most simple scripts and hoping that you might be able to help me. Please help me. I really must fix this today. Thank you so much. Yan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] echoing date of first and last day of current week.
I want to get the unix timestamps of the first and last days of this week... Currently I have this: echo 'Words for the week from '.date('jS F Y',strtotime(last sunday)).' to '.date('jS F Y',strtotime (next saturday)).'.br'; on saturday this showed the 10th to 23rd... Is there a good way to do this mathematically (for speed) or can someone think of a better string to parse? -- JJ Harrison [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Trouble with switch statements
This appears to be a register globals problem replace switch($select) with switch($_GET['select']). For information on register globals and why it has been turned off in later releases see this pagee: http://www.php.net/manual/en/security.registerglobals.php There is nothing syntactically wrong with the switch statment you are just refering to an non-existant variable... I imaginge this came from an outdated book or tutorial. -- JJ Harrison [EMAIL PROTECTED] Edward Kehoe [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Ok...I just recently installed Apache1 and PHP 4.2.3 on my computer and I've configured everything. However, I can't seem to get my switch statements to accept variable values from the address bar. So if I type in: http://www.my-site.com/index.php?select=1 It displays the text in the default part of the switch statement. I also seem to get the following error message every time: Notice: Undefined variable: select in c:\apache\apache\htdocs\index.php on line 51 Here's the code for my switch statement as well: switch($select) { case 1: print About Stuff Goes Here.; break; case 2: print Music Goes Here.; break; default:print Testing...; break; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Get the string in between two other strings
Cameron Cooke [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... Hi, I need a function to get a string in between two other strings. So you would give the function the string to search and then you pass the first string and last string, and the function will return the string in between. Does anyone have this, or know how to do it. I tried but could not get it to work. will substr() - http://au.php.net/manual/en/function.substr.php suit your needs? if not check out: http://au.php.net/manual/en/ref.regex.php and http://au.php.net/manual/en/ref.pcre.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] E-Commerce interfacing...
What is a good service to process credit card numbers for an E-Commerce site? To be specific I mean an easy interface with a PHP based system (maybe even sample code) eg works well with curl... and second any personal recommendations... -- JJ Harrison [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] netscape http user agent pattern thing.
I am just finish off a site. An of course the css rendered really badly with netscape... Fixed that with the: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] netscape user agent name...
Accidently hit the send shortcut... I am just finish off a site. An of course the css rendered really badly with netscape... Fixed that with the: style type='text/css' @import url(style_sheets/?=$skin[0][0]?); /style trick. One or two of the images looks really bad with the simpler css. I am going to detect the browser on the server side and decide which image I am going to link to. my question is does Netscape 4.x send Netscape 4.x or mozilla something? -- JJ Harrison [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] regular expression
what would be a simple regular expression for a href=anythinghere? for future reference are there any good references for them? -- JJ Harrison [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regular expression
Thanks. Ns_andy [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... perl: preg_match '/a\s*href/s*=/s*[\']?[^\']+[\']?/i' or eregi 'a[ ]*href[ ]*=[ ]*[\']?[^\']+[\']?' -- Regards, Noodle Snacks [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... what would be a simple regular expression for a href=anythinghere? for future reference are there any good references for them? -- JJ Harrison [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Odd request
Shawn McKenzie [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Probably a question for the php dev team, but here it goes. I want to display an external page in an iframe and have the iframe auto sized to fit the content without having scroll bars. I've tried javascript to no avail. So here's my idea: 1. Instead of iframe: $string = file_get_contents(http://somwhere.com;); to load page into string and then echo $string; use javascript to detect onclick, get href of anchor, load page into string and echo again. Works O.K. unless there are relative paths in document. 2. What I want to do: $string = file_get_contents(http://somwhere.com;); and determine the height that this page ($string) would render in a browser. Render iframe at determined height with src = http://somwhere.com;. Any way in php to determine at what height html content will render??? If not, should there be? Probably Not. It depends on the UA completly. eg screen res, font size, browser incompatibilty etc... Why the iframe? couldn't you just include/fopen it? -- JJ Harrison [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to do Date Calculation
Jason Wong [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Thursday 10 October 2002 18:37, Jack wrote: Dear all I'm trying to make a script which will show the month before current month! Is there anyway i can do this? Example : CurrentPervious OctoberSeptember date(F, strtotime(last month)); To find more about PHP's date/time functions go here: http://www.php.net/manual/en/ref.datetime.php in particular look at: date() -- Format a local time/date mktime() -- Get UNIX timestamp for a date time() -- Return current UNIX timestamp strtotime() -- Parse about any English textual datetime description into a UNIX timestamp -- JJ Harrison [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Animation in PHP
Daniel Masson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED] ... No way man !! hai , I want to create an animated line in php from (x,y) to (x1,y1).will php support animation.if so how do i go about in doing this.how do i draw a char so that it keeps on changing colors till i close browser. thanks for help Arun You could use php to generate JS or Flash (via ming) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] shouldn't $_SERVER['PHP_SELF'] include the get info?
I was using a redirect using $_SERVER['PHP_SELF'] from the previous page (a login for a site) and it didn't include this from the url: ?aid=12. shouldn't it? It caused a SQL error. (which I have included a catch for so the error will be friendly) instead of the variable to be: /co2_busters_mk2/full_article.php I want it to be: /co2_busters_mk2/full_article.php?aid=12. (like it would appear in the address bar). is it sposed to be like that or is it a bug? Also what is the best way to include all get data in the url? Thanks, -- JJ Harrison [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: shouldn't $_SERVER['PHP_SELF'] include the get info?
Erwin [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Noodle Snacks wrote: [snipped] It is supposed to be like that...the PHP_SELF points to this file, and the filename has no arguments, thus the PHP_SELF variable don't have them either. You will have to use the $_GET array for the aid=12 part. yeh, I figured that. But is there some easy way to print *all* of the get data parsed? (In this case, the variable names, number of vars etc varies alot. And this has rissen from a bug in a 250kb+ source plus project. I am wondering if there is a smart way. or do I have to examine the $_GET array for all vars and pass them on manually? -- JJ Harrison [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: shouldn't $_SERVER['PHP_SELF'] include the get info?
Erwin [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Noodle Snacks wrote: Erwin [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Noodle Snacks wrote: [snipped] It is supposed to be like that...the PHP_SELF points to this file, and the filename has no arguments, thus the PHP_SELF variable don't have them either. You will have to use the $_GET array for the aid=12 part. yeh, I figured that. But is there some easy way to print *all* of the get data parsed? (In this case, the variable names, number of vars etc varies alot. And this has rissen from a bug in a 250kb+ source plus project. I am wondering if there is a smart way. or do I have to examine the $_GET array for all vars and pass them on manually? Ah, I didn't understand your question (my mistake). Answer to your question (I hope): there is a smart way: $_SERVER['QUERY_STRING'] thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php