php-general Digest 4 Aug 2007 12:11:02 -0000 Issue 4942
php-general Digest 4 Aug 2007 12:11:02 - Issue 4942 Topics (messages 260156 through 260172): Re: OT- why is network solutions more than godaddy? 260156 by: Micky Hulse 260157 by: Daniel Brown 260158 by: Robert Cummings 260159 by: Robert Cummings 260160 by: Daniel Brown 260161 by: Daniel Brown 260163 by: Robert Cummings 260164 by: tedd 260165 by: tedd 260167 by: Robert Cummings Re: UTF-8 support 260162 by: adel 260171 by: Naz Gassiep Output Buffering and zlib Compression Issue 260166 by: Chris 260168 by: Jan Reiter 260169 by: Chris 260170 by: Jan Reiter Problem with getting time in EST 260172 by: Crab Hunt Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- I use and love http://www.namecheap.com/ 8.88$, plus whois guard. The control panel is great. Fast customer service. Also, I personally would avoid mixing host and registrar. Cheers, M -- Wishlists: http://snipurl.com/1gqpj Switch: http://browsehappy.com/ BCC?: http://snipurl.com/w6f8 My: http://del.icio.us/mhulse ---End Message--- ---BeginMessage--- On 8/3/07, Micky Hulse [EMAIL PROTECTED] wrote: I use and love http://www.namecheap.com/ 8.88$, plus whois guard. The control panel is great. Fast customer service. Also, I personally would avoid mixing host and registrar. Cheers, M -- Wishlists: http://snipurl.com/1gqpj Switch: http://browsehappy.com/ BCC?: http://snipurl.com/w6f8 My: http://del.icio.us/mhulse -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Yes, but at the core, Namecheap (http://www.namecheap.com/) is just like me (http://domains.pilotpig.net/) - a domain reseller. A bigger, richer, more well-known reseller, but still just a reseller. Their site looks fancy, mine well, I'm no designer, I'm a geek. I'll stick to what I know. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Hey, PHP-General list to give something back to everyone, you guys can have 50% off every month on hosting plans of $10/mo. or more (list price) at http://www.pilotpig.net/. Use the coupon code phpgeneralaug07 ---End Message--- ---BeginMessage--- On Fri, 2007-08-03 at 17:05 -0400, Daniel Brown wrote: Yes, but at the core, Namecheap (http://www.namecheap.com/) is just like me (http://domains.pilotpig.net/) - a domain reseller. A bigger, richer, more well-known reseller, but still just a reseller. Their site looks fancy, mine well, I'm no designer, I'm a geek. I'll stick to what I know. Hmmm, I think yours looks nicer. But again, I'm a geek also and not a designer :) Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... ---End Message--- ---BeginMessage--- On Fri, 2007-08-03 at 17:05 -0400, Daniel Brown wrote: Yes, but at the core, Namecheap (http://www.namecheap.com/) is just like me (http://domains.pilotpig.net/) - a domain reseller. A bigger, richer, more well-known reseller, but still just a reseller. Their site looks fancy, mine well, I'm no designer, I'm a geek. I'll stick to what I know. Your site is broken btw, it doesn't support Canadian Dollars you insensitive clod. Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... ---End Message--- ---BeginMessage--- On 8/3/07, Robert Cummings [EMAIL PROTECTED] wrote: On Fri, 2007-08-03 at 17:05 -0400, Daniel Brown wrote: Yes, but at the core, Namecheap (http://www.namecheap.com/) is just like me (http://domains.pilotpig.net/) - a domain reseller. A bigger, richer, more well-known reseller, but still just a reseller. Their site looks fancy, mine well, I'm no designer, I'm a geek. I'll stick to what I know. Hmmm, I think yours looks nicer. But again, I'm a geek also and not a designer :) Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... Mine looks cheaper! Heh. I actually lose a penny for each domain I sell at that price, I think, but it's an attempt to gain attention for my newest hosting company. And by the way plug shame=no Check out the blurb in my signature! /plug -- Daniel P. Brown
php-general Digest 5 Aug 2007 04:15:39 -0000 Issue 4943
php-general Digest 5 Aug 2007 04:15:39 - Issue 4943 Topics (messages 260173 through 260196): Re: Problem with getting time in EST 260173 by: Leonard Burton 260174 by: Jan Reiter 260175 by: Michael Preslar 260176 by: tedd 260183 by: Jan Reiter Authentication script working in firefox but strange results in ie7 260177 by: Brian Seymour 260188 by: Sancar Saran Re: UTF-8 support 260178 by: Daniel Macedo 260181 by: Naz Gassiep 260184 by: Daniel Macedo Creating watermarks 260179 by: Tom Ray [Lists] 260180 by: Greg Donald 260185 by: Jan Reiter 260186 by: GP INTERACTIVE 260187 by: tedd 260189 by: Tom Ray [Lists] 260192 by: zerof Re: About PHP/MYSQL Pagination 260182 by: Sanjeev N 260190 by: Richard Heyes Which Chat system to use 260191 by: robert mena 260193 by: zerof XHTML/CSS templates for developers 260194 by: Steve Finkelstein 260195 by: Instruct ICC Problem with php mail 260196 by: Jason Sia Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- HI, Are you looking for EDT or EST? EST = EDT -1. EDT = EST +1 Take care, Leonard On 8/4/07, Crab Hunt [EMAIL PROTECTED] wrote: Hi, I need to get the current time in EST timezone while my current timezone is CEST. I use the function : date_default_timezone_set('EST') But now the time that I get is 1 hour less than the time in EST ( http://wwp.greenwichmeantime.com/time-zone/usa/eastern-time/), probably without taking care of the daylight savings time (DST)... Can anyone help me out how to solve it, its an urgent issue for me. Thanks a lot in advance, regards, Rakesh -- Leonard Burton, N9URK http://www.jiffyslides.com [EMAIL PROTECTED] [EMAIL PROTECTED] The prolonged evacuation would have dramatically affected the survivability of the occupants. ---End Message--- ---BeginMessage--- Hi! Try setting the timezone to one of the cities inside it from this list: http://www.php.net/manual/en/timezones.america.php DST will be taken into account automatically. Hope that helps. Jan ---End Message--- ---BeginMessage--- if time() is always 1 hour behind what you want, why not time() + 3600 // 60 seconds * 60 minutes On 8/4/07, Crab Hunt [EMAIL PROTECTED] wrote: Hi, I need to get the current time in EST timezone while my current timezone is CEST. I use the function : date_default_timezone_set('EST') But now the time that I get is 1 hour less than the time in EST ( http://wwp.greenwichmeantime.com/time-zone/usa/eastern-time/), probably without taking care of the daylight savings time (DST)... Can anyone help me out how to solve it, its an urgent issue for me. Thanks a lot in advance, regards, Rakesh ---End Message--- ---BeginMessage--- At 3:57 PM +0200 8/4/07, Jan Reiter wrote: Hi! Try setting the timezone to one of the cities inside it from this list: http://www.php.net/manual/en/timezones.america.php DST will be taken into account automatically. Hope that helps. Jan Jan: That's the problem, it doesn't work. I have mine set for Detroit and it's an hour off Detroit time. It kind of bugged me that when I upgraded to php5 that I had to define the default time zone in my code, but then to find out that it's off by an hour really ticks me off. What's the point of defining a time zone if php5 isn't going to get it right? All this time I thought that I was doing something wrong, but it appears that this is a problem for others as well -- are we doing something wrong? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com ---End Message--- ---BeginMessage--- Tedd: you can set your default php timezone in the php.ini with the date.timezone value. What Server do you use? What OS? I'm using apache2.x on win32, debian and fedora core. The time of Detroit looks ok to compared to times stated on world time pages on the internet. After upgrading to PHP5, did you check for the latest version of PECL's timezonedb. I don't know if its included with the PHP package! May be a bad question, but are the time and timezone settings of your HW clock correct?? Just as the very last option to check, if everything else fails ... ;-) Jan -Original Message- From: tedd [mailto:[EMAIL PROTECTED] Sent: Saturday, August 04, 2007 5:02 PM To: Jan Reiter; 'Crab Hunt'; [EMAIL PROTECTED] Subject: RE: [PHP] Problem with getting time in EST Jan: That's the problem, it doesn't work. I have mine set for Detroit and it's an hour off Detroit time. It kind of bugged me that when I upgraded to php5 that I had to define the default time zone in my code,
Re: [PHP] UTF-8 support
I've seen that, there is no mb_trim() that I can see. - Naz. adel wrote: http://www.php.net/manual/en/ref.mbstring.php On 8/3/07, Naz Gassiep [EMAIL PROTECTED] wrote: The functions trim() and explode() appear to be munging multibyte UTF-8 strings. I can't find multibyte safe versions of them in the manual, do they exist, or do I have to make my own? - Naz. -- 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] Problem with getting time in EST
Hi, I need to get the current time in EST timezone while my current timezone is CEST. I use the function : date_default_timezone_set('EST') But now the time that I get is 1 hour less than the time in EST ( http://wwp.greenwichmeantime.com/time-zone/usa/eastern-time/), probably without taking care of the daylight savings time (DST)... Can anyone help me out how to solve it, its an urgent issue for me. Thanks a lot in advance, regards, Rakesh
Re: [PHP] Problem with getting time in EST
HI, Are you looking for EDT or EST? EST = EDT -1. EDT = EST +1 Take care, Leonard On 8/4/07, Crab Hunt [EMAIL PROTECTED] wrote: Hi, I need to get the current time in EST timezone while my current timezone is CEST. I use the function : date_default_timezone_set('EST') But now the time that I get is 1 hour less than the time in EST ( http://wwp.greenwichmeantime.com/time-zone/usa/eastern-time/), probably without taking care of the daylight savings time (DST)... Can anyone help me out how to solve it, its an urgent issue for me. Thanks a lot in advance, regards, Rakesh -- Leonard Burton, N9URK http://www.jiffyslides.com [EMAIL PROTECTED] [EMAIL PROTECTED] The prolonged evacuation would have dramatically affected the survivability of the occupants. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with getting time in EST
Hi! Try setting the timezone to one of the cities inside it from this list: http://www.php.net/manual/en/timezones.america.php DST will be taken into account automatically. Hope that helps. Jan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with getting time in EST
if time() is always 1 hour behind what you want, why not time() + 3600 // 60 seconds * 60 minutes On 8/4/07, Crab Hunt [EMAIL PROTECTED] wrote: Hi, I need to get the current time in EST timezone while my current timezone is CEST. I use the function : date_default_timezone_set('EST') But now the time that I get is 1 hour less than the time in EST ( http://wwp.greenwichmeantime.com/time-zone/usa/eastern-time/), probably without taking care of the daylight savings time (DST)... Can anyone help me out how to solve it, its an urgent issue for me. Thanks a lot in advance, regards, Rakesh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with getting time in EST
At 3:57 PM +0200 8/4/07, Jan Reiter wrote: Hi! Try setting the timezone to one of the cities inside it from this list: http://www.php.net/manual/en/timezones.america.php DST will be taken into account automatically. Hope that helps. Jan Jan: That's the problem, it doesn't work. I have mine set for Detroit and it's an hour off Detroit time. It kind of bugged me that when I upgraded to php5 that I had to define the default time zone in my code, but then to find out that it's off by an hour really ticks me off. What's the point of defining a time zone if php5 isn't going to get it right? All this time I thought that I was doing something wrong, but it appears that this is a problem for others as well -- are we doing something wrong? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Authentication script working in firefox but strange results in ie7
I mostly use Firefox but still I check to make sure everything works in IE7 and other browsers equally as well. I had strange results here. I have a simple login form(user/pass field and submit button). I have the actual login request script in a common php file. I have an Authentication class that handles my auth stuff. With the code the way it is, it works perfectly in firefox. However, in IE7 when you log in it shows the restricted stuff but as soon as you navigate anywhere else you no longer have access. If you login again then it works fine just like the first time you logged in using firefox. Now if you change $_SESSION['uid']== to !isset($_SESSION['uid']) then it works perfectly on both browsers. Anyhow, rifle through the code -- just something to think about. Anybody else have a similar issue before? Web Code: Restricted stuff: ?php if ($_SESSION['uid']==){ $ops-postLogin($e); }else{ ? Logged in stuff(Restricted stuff) ?php } ? Common snippet: if ($_POST[action]==login){ $auth = new Authentication($host,$user,$pass,dbname,http://aerocore.net/;); if ($auth-verifyCreds($_POST['username'],$_POST['password'],base_contributors ,id)) { $_SESSION['uid'] = $auth-retId; $auth-failSafe(); break; } } Authentication: class Authentication extends SQL { public $errorMsg; public $retId; public $clean = array(); public $fail; public function __construct($host,$user,$pass,$dbname = null,$fail) { parent::__construct($host,$user,$pass,$dbname = null); $this-fail=$fail; } public function failSafe() { header(Location: {$this-fail}); } final public function sanitizeLoginCreds($user, $pass) { $this-clean['username']=strip_tags($user); $this-clean['password']=strip_tags($pass); if (!ctype_alnum($this-clean['username'])){ $this-clean['username']=; } if (!ctype_alnum($this-clean['password'])){ $this-clean['password']=; } } final public function verifyCreds($user, $pass, $table, $retVal = null) { $this-sanitizeLoginCreds($user,$pass); //$this-result = $this-query(SELECT * FROM $table where username='{$this-clean[username]}' and password='{$this-clean[password]}'); if ($this-fetchNumRows(SELECT * FROM $table where username='{$this-clean[username]}' and password='{$this-clean[password]}') == 0) { $this-errorMsg = Incorrect Username/Password Combo; $this-failSafe(); return false; } else { if (isset($retVal)) { $this-retId = $this-fetchArray(SELECT * FROM $table where username='{$this-clean[username]}' and password='{$this-clean[password]}'); $this-retId = $this-retId[$retVal]; } return true; } } final public function secureLogout() { $_SESSION = array(); session_destroy(); $this-failSafe(); } public function __destruct(){} } Brian Seymour Zend Certified Engineer AeroCoreProductions http://www.aerocore.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UTF-8 support
Hi Naz, Any byte function is NOT safe for UTF-8. trim() works properly with UTF-8 IF you don't specify the charlist (second argument). This is because all whitespace characters are in the ASCII range, and therefore it won't corrupt the UTF-8 string. The explode() function will handle UTF-8 as long as it's well formed. This means that if you properly specify UTF-8 delimiters, it doesn't corrupt the UTF-8 input string. ~ DM adel escreveu: http://www.php.net/manual/en/ref.mbstring.php On 8/3/07, Naz Gassiep [EMAIL PROTECTED] wrote: The functions trim() and explode() appear to be munging multibyte UTF-8 strings. I can't find multibyte safe versions of them in the manual, do they exist, or do I have to make my own? - Naz. -- 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] Creating watermarks
I've been learning how to use PHP with the GD Library and I've managed to learn quite a bit. I can upload, resize, create thumbnails and I'm even able to create security code images for forms. My question is how do I create a Watermark on the image? I want something transparent but still visible enough to see the copyright and the website. I want to put it in the center of the image. I would use a non-water marked image and when it's called on (depending on viewing size) I want the water mark to be added. How would one go about doing that? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating watermarks
On 8/4/07, Tom Ray [Lists] [EMAIL PROTECTED] wrote: I've been learning how to use PHP with the GD Library and I've managed to learn quite a bit. I can upload, resize, create thumbnails and I'm even able to create security code images for forms. My question is how This is usually referred to as a captcha. do I create a Watermark on the image? I want something transparent but still visible enough to see the copyright and the website. I want to put it in the center of the image. I would use a non-water marked image and when it's called on (depending on viewing size) I want the water mark to be added. How would one go about doing that? You can write words on images using imagettftext(). -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UTF-8 support
Great! Thanks for the answer, that's very helpful. Will trim() work if I specify charlists in the ASCII range? Not that I ever do, but just curious. - Naz Daniel Macedo wrote: Hi Naz, Any byte function is NOT safe for UTF-8. trim() works properly with UTF-8 IF you don't specify the charlist (second argument). This is because all whitespace characters are in the ASCII range, and therefore it won't corrupt the UTF-8 string. The explode() function will handle UTF-8 as long as it's well formed. This means that if you properly specify UTF-8 delimiters, it doesn't corrupt the UTF-8 input string. ~ DM adel escreveu: http://www.php.net/manual/en/ref.mbstring.php On 8/3/07, Naz Gassiep [EMAIL PROTECTED] wrote: The functions trim() and explode() appear to be munging multibyte UTF-8 strings. I can't find multibyte safe versions of them in the manual, do they exist, or do I have to make my own? - Naz. -- 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] About PHP/MYSQL Pagination
Hi, 1. first you know current page number 2. you know how many pages Next consider total how many page number you want to display Assume 5 I.e. first previous | 1 2 3 4 5 | next last Now when you come to page 4 then starting page is around 4-1 or 4-2 (however you want) and start the for loop till 4+2 or 4+3(depends on you). I.e. first previous | (4-2) (4-1) 4 (4+1) (4+2) (4+3) | next last For loop will be For(i=-2; i=2; i++) Echo a href=$pagenumber+$i/a; I think you got some idea Warm Regards, Sanjeev http://www.sanchanworld.com/ http://webdirectory.sanchanworld.com -Original Message- From: Kelvin Park [mailto:[EMAIL PROTECTED] Sent: Friday, August 03, 2007 6:43 AM To: php-general@lists.php.net Subject: [PHP] About PHP/MYSQL Pagination I just couldn't find it anywhere, google or yahoo. I know how to make first, previous, last, and next links for php/mysql pagination. How do you list page numbers in the middle, between previous and next? (ex. first previous | 1 2 3 4 5 | next last ) I know how to display them from 1 to whatever by using for loop, but the problem comes in when I click next from page 5, it does not get re-listed starting from page 6. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with getting time in EST
Tedd: you can set your default php timezone in the php.ini with the date.timezone value. What Server do you use? What OS? I'm using apache2.x on win32, debian and fedora core. The time of Detroit looks ok to compared to times stated on world time pages on the internet. After upgrading to PHP5, did you check for the latest version of PECL's timezonedb. I don't know if its included with the PHP package! May be a bad question, but are the time and timezone settings of your HW clock correct?? Just as the very last option to check, if everything else fails ... ;-) Jan -Original Message- From: tedd [mailto:[EMAIL PROTECTED] Sent: Saturday, August 04, 2007 5:02 PM To: Jan Reiter; 'Crab Hunt'; php-general@lists.php.net Subject: RE: [PHP] Problem with getting time in EST Jan: That's the problem, it doesn't work. I have mine set for Detroit and it's an hour off Detroit time. It kind of bugged me that when I upgraded to php5 that I had to define the default time zone in my code, but then to find out that it's off by an hour really ticks me off. What's the point of defining a time zone if php5 isn't going to get it right? All this time I thought that I was doing something wrong, but it appears that this is a problem for others as well -- are we doing something wrong? Cheers, tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UTF-8 support
Yes it will, trim() was given the option to specify other characters in PHP 4.1.0. Rember that it's a byte function, so single byte characters can be handled, you just can't use it for multi-byte characters. ~ DM Naz Gassiep escreveu: Great! Thanks for the answer, that's very helpful. Will trim() work if I specify charlists in the ASCII range? Not that I ever do, but just curious. - Naz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Creating watermarks
Hi! Try using imagealphablending() to blend your logo onto the original image. This function should not require the user browser to be capable of blending functions as would using the alpha channel of a png inmage or such ... Jan -Original Message- From: Tom Ray [Lists] [mailto:[EMAIL PROTECTED] Sent: Saturday, August 04, 2007 5:32 PM To: php-general@lists.php.net Subject: [PHP] Creating watermarks I've been learning how to use PHP with the GD Library and I've managed to learn quite a bit. I can upload, resize, create thumbnails and I'm even able to create security code images for forms. My question is how do I create a Watermark on the image? I want something transparent but still visible enough to see the copyright and the website. I want to put it in the center of the image. I would use a non-water marked image and when it's called on (depending on viewing size) I want the water mark to be added. How would one go about doing that? -- 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] Creating watermarks
you can use also the following function : ?php // --- image play path $watermarkfile = 'images/play_small.png'; // as an example function getPictureMarked($sourcefile, $watermarkfile) { # # $sourcefile = Filename of the picture to be watermarked. # $watermarkfile = Filename of the 24-bit PNG watermark file. # //Get the resource ids of the pictures $watermarkfile_id = imagecreatefrompng($watermarkfile); imageAlphaBlending($watermarkfile_id, false); imageSaveAlpha($watermarkfile_id, true); $fileType = strtolower(substr($sourcefile, strlen($sourcefile)-3)); switch($fileType) { case('gif'): $sourcefile_id = imagecreatefromgif($sourcefile); break; case('png'): $sourcefile_id = imagecreatefrompng($sourcefile); break; default: $sourcefile_id = imagecreatefromjpeg($sourcefile); } //Get the sizes of both pix $sourcefile_width=imageSX($sourcefile_id); $sourcefile_height=imageSY($sourcefile_id); $watermarkfile_width=imageSX($watermarkfile_id); $watermarkfile_height=imageSY($watermarkfile_id); $dest_x = ( $sourcefile_width / 2 ) - ( $watermarkfile_width / 2 ); $dest_y = ( $sourcefile_height / 2 ) - ( $watermarkfile_height / 2 ); // if a gif, we have to upsample it to a truecolor image if($fileType == 'gif') { // create an empty truecolor container $tempimage = imagecreatetruecolor($sourcefile_width, $sourcefile_height); // copy the 8-bit gif into the truecolor image imagecopy($tempimage, $sourcefile_id, 0, 0, 0, 0, $sourcefile_width, $sourcefile_height); // copy the source_id int $sourcefile_id = $tempimage; } imagecopy($sourcefile_id, $watermarkfile_id, $dest_x, $dest_y, 0, 0, $watermarkfile_width, $watermarkfile_height); //Create a jpeg out of the modified picture switch($fileType) { // remember we don't need gif any more, so we use only png or jpeg. // See the upsaple code immediately above to see how we handle gifs case('png'): header(Content-type: image/png); imagepng ($sourcefile_id); break; default: header(Content-type: image/jpg); imagejpeg ($sourcefile_id); } imagedestroy($sourcefile_id); imagedestroy($watermarkfile_id); } ? Regards, Greg http://www.psmdev.com On 8/4/07, Tom Ray [Lists] [EMAIL PROTECTED] wrote: I've been learning how to use PHP with the GD Library and I've managed to learn quite a bit. I can upload, resize, create thumbnails and I'm even able to create security code images for forms. My question is how do I create a Watermark on the image? I want something transparent but still visible enough to see the copyright and the website. I want to put it in the center of the image. I would use a non-water marked image and when it's called on (depending on viewing size) I want the water mark to be added. How would one go about doing that? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating watermarks
At 11:32 AM -0400 8/4/07, Tom Ray [Lists] wrote: I've been learning how to use PHP with the GD Library and I've managed to learn quite a bit. I can upload, resize, create thumbnails and I'm even able to create security code images for forms. My question is how do I create a Watermark on the image? I want something transparent but still visible enough to see the copyright and the website. I want to put it in the center of the image. I would use a non-water marked image and when it's called on (depending on viewing size) I want the water mark to be added. How would one go about doing that? Tom: I just combine images -- it's simple. Here's an example: http://www.webbytedd.com/b/watermark/ Refresh and the watermark position will move. Here's the code (refreshing will shift the watermark around): ?php $place = c; $original=imagecreatefromjpeg(mydog.jpg); $watermark=imagecreatefrompng(copyright.png); $osx=imagesx($original); $osy=imagesy($original); $wsx=imagesx($watermark); $wsy=imagesy($watermark); $place = rand(1,5); switch ($place) { case 1: //c: imagecopy($original, $watermark, ($osx-$wsx)/2, ($osy-$wsy)/2, 0, 0, $wsx, $wsy); //center works break; case 2: //nw: imagecopy($original, $watermark,0, 0, 0, 0, $wsx, $wsy); // upper left works break; case 3: //sw: imagecopy($original, $watermark, 0, ($osy-$wsy), 0, 0, $wsx, $wsy); // lower right works break; case 4: //ne: imagecopy($original, $watermark, ($osx-$wsx), 0, 0, 0, $wsx, $wsy); // upper left works break; case 5: //se: imagecopy($original, $watermark, ($osx-$wsx), ($osy-$wsy), 0, 0, $wsx, $wsy); // lower right works break; } imagepng($original, trans.png); ? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Authentication script working in firefox but strange results in ie7
Hello , Those code doesn't mean anything to client browser, you may session cookie problem. Please check php.net online manual about it. Regards Sancar On Saturday 04 August 2007 18:20:49 Brian Seymour wrote: I mostly use Firefox but still I check to make sure everything works in IE7 and other browsers equally as well. I had strange results here. I have a simple login form(user/pass field and submit button). I have the actual login request script in a common php file. I have an Authentication class that handles my auth stuff. With the code the way it is, it works perfectly in firefox. However, in IE7 when you log in it shows the restricted stuff but as soon as you navigate anywhere else you no longer have access. If you login again then it works fine just like the first time you logged in using firefox. Now if you change $_SESSION['uid']== to !isset($_SESSION['uid']) then it works perfectly on both browsers. Anyhow, rifle through the code -- just something to think about. Anybody else have a similar issue before? Web Code: Restricted stuff: ?php if ($_SESSION['uid']==){ $ops-postLogin($e); }else{ ? Logged in stuff(Restricted stuff) ?php } ? Common snippet: if ($_POST[action]==login){ $auth = new Authentication($host,$user,$pass,dbname,http://aerocore.net/;); if ($auth-verifyCreds($_POST['username'],$_POST['password'],base_contributor s ,id)) { $_SESSION['uid'] = $auth-retId; $auth-failSafe(); break; } } Authentication: class Authentication extends SQL { public $errorMsg; public $retId; public $clean = array(); public $fail; public function __construct($host,$user,$pass,$dbname = null,$fail) { parent::__construct($host,$user,$pass,$dbname = null); $this-fail=$fail; } public function failSafe() { header(Location: {$this-fail}); } final public function sanitizeLoginCreds($user, $pass) { $this-clean['username']=strip_tags($user); $this-clean['password']=strip_tags($pass); if (!ctype_alnum($this-clean['username'])){ $this-clean['username']=; } if (!ctype_alnum($this-clean['password'])){ $this-clean['password']=; } } final public function verifyCreds($user, $pass, $table, $retVal = null) { $this-sanitizeLoginCreds($user,$pass); //$this-result = $this-query(SELECT * FROM $table where username='{$this-clean[username]}' and password='{$this-clean[password]}'); if ($this-fetchNumRows(SELECT * FROM $table where username='{$this-clean[username]}' and password='{$this-clean[password]}') == 0) { $this-errorMsg = Incorrect Username/Password Combo; $this-failSafe(); return false; } else { if (isset($retVal)) { $this-retId = $this-fetchArray(SELECT * FROM $table where username='{$this-clean[username]}' and password='{$this-clean[password]}'); $this-retId = $this-retId[$retVal]; } return true; } } final public function secureLogout() { $_SESSION = array(); session_destroy(); $this-failSafe(); } public function __destruct(){} } Brian Seymour Zend Certified Engineer AeroCoreProductions http://www.aerocore.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating watermarks
GP INTERACTIVE wrote: you can use also the following function : ?php // --- image play path $watermarkfile = 'images/play_small.png'; // as an example function getPictureMarked($sourcefile, $watermarkfile) { # # $sourcefile = Filename of the picture to be watermarked. # $watermarkfile = Filename of the 24-bit PNG watermark file. # //Get the resource ids of the pictures $watermarkfile_id = imagecreatefrompng($watermarkfi le); imageAlphaBlending($watermarkfile_id, false); imageSaveAlpha($watermarkfile_id, true); $fileType = strtolower(substr($sourcefile, strlen($sourcefile)-3)); switch($fileType) { case('gif'): $sourcefile_id = imagecreatefromgif($sourcefile); break; case('png'): $sourcefile_id = imagecreatefrompng($sourcefile); break; default: $sourcefile_id = imagecreatefromjpeg($sourcefile); } //Get the sizes of both pix $sourcefile_width=imageSX($sourcefile_id); $sourcefile_height=imageSY($sourcefile_id); $watermarkfile_width=imageSX($watermarkfile_id); $watermarkfile_height=imageSY($watermarkfile_id); $dest_x = ( $sourcefile_width / 2 ) - ( $watermarkfile_width / 2 ); $dest_y = ( $sourcefile_height / 2 ) - ( $watermarkfile_height / 2 ); // if a gif, we have to upsample it to a truecolor image if($fileType == 'gif') { // create an empty truecolor container $tempimage = imagecreatetruecolor($sourcefile_width, $sourcefile_height); // copy the 8-bit gif into the truecolor image imagecopy($tempimage, $sourcefile_id, 0, 0, 0, 0, $sourcefile_width, $sourcefile_height); // copy the source_id int $sourcefile_id = $tempimage; } imagecopy($sourcefile_id, $watermarkfile_id, $dest_x, $dest_y, 0, 0, $watermarkfile_width, $watermarkfile_height); //Create a jpeg out of the modified picture switch($fileType) { // remember we don't need gif any more, so we use only png or jpeg. // See the upsaple code immediately above to see how we handle gifs case('png'): header(Content-type: image/png); imagepng ($sourcefile_id); break; default: header(Content-type: image/jpg); imagejpeg ($sourcefile_id); } imagedestroy($sourcefile_id); imagedestroy($watermarkfile_id); } ? Regards, Greg http://www.psmdev.com http://www.psmdev.com/ On 8/4/07, *Tom Ray [Lists]* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: I've been learning how to use PHP with the GD Library and I've managed to learn quite a bit. I can upload, resize, create thumbnails and I'm even able to create security code images for forms. My question is how do I create a Watermark on the image? I want something transparent but still visible enough to see the copyright and the website. I want to put it in the center of the image. I would use a non-water marked image and when it's called on (depending on viewing size) I want the water mark to be added. How would one go about doing that? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php http://www.php.net/unsub.php I'll test this tonight...thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] About PHP/MYSQL Pagination
I just couldn't find it anywhere, google or yahoo. I know how to make first, previous, last, and next links for php/mysql pagination. How do you list page numbers in the middle, between previous and next? (ex. first previous | 1 2 3 4 5 | next last ) I know how to display them from 1 to whatever by using for loop, but the problem comes in when I click next from page 5, it does not get re-listed starting from page 6. The PEAR Pager package might be able to help you. -- Richard Heyes +44 (0)844 801 1072 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Which Chat system to use
Hi, I need to add a simple chat system to my site and I am trying to find out good solutions, free or paid. Some of the requirements : - php :) - uses some sort of template system (smarty better) - support for private chats - source code available - one chat room (except for private chats everybody sees everything) So far the chat systems I've found are too complex (need to register the nick before entering the chat, confusing interface), not stable enough ( http://www.phpfreechat.net/) or integrated with other systems. There is no need for : - multiple chat rooms - operator/ban - registration of the nickname - archive of previous chats thanks.
[PHP] Re: Creating watermarks
Tom Ray [Lists] escreveu: I've been learning how to use PHP with the GD Library and I've managed to learn quite a bit. I can upload, resize, create thumbnails and I'm even able to create security code images for forms. My question is how do I create a Watermark on the image? I want something transparent but still visible enough to see the copyright and the website. I want to put it in the center of the image. I would use a non-water marked image and when it's called on (depending on viewing size) I want the water mark to be added. How would one go about doing that? --- http://www.educar.pro.br/en/a/gdlib/index.php?pn=76tr=97 http://www.educar.pro.br/en/a/gdlib/index.php?pn=23tr=97 http://www.educar.pro.br/en/a/gdlib/index.php?pn=81tr=97 -- zerof http://www.educar.pro.br/ Apache - PHP - MySQL - Boolean Logics - Project Management -- You must hear, always, one second opinion! In all cases. -- Let the people know if this info was useful for you! -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Which Chat system to use
robert mena escreveu: Hi, I need to add a simple chat system to my site and I am trying to find out good solutions, free or paid. Some of the requirements : - php :) - uses some sort of template system (smarty better) - support for private chats - source code available - one chat room (except for private chats everybody sees everything) So far the chat systems I've found are too complex (need to register the nick before entering the chat, confusing interface), not stable enough ( http://www.phpfreechat.net/) or integrated with other systems. There is no need for : - multiple chat rooms - operator/ban - registration of the nickname - archive of previous chats thanks. -- http://socket7.net/lace/ -- zerof http://www.educar.pro.br/ Apache - PHP - MySQL - Boolean Logics - Project Management -- You must hear, always, one second opinion! In all cases. -- Let the people know if this info was useful for you! -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] XHTML/CSS templates for developers
Hi all, I was curious if anyone could provide some insight on tools which allow developers who strictly focus on server-side programming and not UI, to quickly implement XHTML/HTML templates with proper div placement. Drag and drop would be preferable. I'm currently working on a project which no design was thrown at me. I have since hired a designer who's going to take everything I hand to him and CSS it and add the right touches to it to make it a deliverable project. Other than that, I'd like to spend the least amount of time designing, but have the layout prepared for my designer so he can integrate his work with ease. Thank you kindly for any insight. - sf
RE: [PHP] XHTML/CSS templates for developers
I have since hired a designer who's going to take everything I hand to him and CSS it and add the right touches to it to make it a deliverable project. You mean you will hand him your PHP code? I wouldn't expect a designer to take it from there. Perhaps you mean hand him the rendered HTML? Thank you kindly for any insight. - sf To the person who started this post and everyone answering it... I would appreciate your thoughts on this post as well: From : Instruct ICC [EMAIL PROTECTED] Sent : Thursday, August 2, 2007 1:46 PM To :php-general@lists.php.net Subject : [PHP] Separation of Roles; with Salaries _ Learn.Laugh.Share. Reallivemoms is right place! http://www.reallivemoms.com?ocid=TXT_TAGHMloc=us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with php mail
Hi Everyone, I'm having problem with php mail. When I try to create an html message with only a href='mydomain.com'mydomain/a, gmail is registering it as a spam while yahoo is not. Can you suggest solutions to my problem. Thanks, Jason Send instant messages to your online friends http://uk.messenger.yahoo.com
[PHP] Rejecting File Upload
Hi All, How do I prior check file's size in server side before the upload process begin ? Regards, Feris
Re: [PHP] Rejecting File Upload
Check http://www.php.net/file_upload .. In specific, the MAX_FILE_SIZE form field .. And then check http://us3.php.net/manual/en/ini.core.php#ini.upload-max-filesize On 8/4/07, php mail [EMAIL PROTECTED] wrote: Hi All, How do I prior check file's size in server side before the upload process begin ? Regards, Feris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Rejecting File Upload
At 11:48 AM +0700 8/5/07, php mail wrote: Hi All, How do I prior check file's size in server side before the upload process begin ? Regards, Feris If you want file information for a file on the *server*, see http://www.php.net/manual/en/ref.filesystem.php If you want file size information *before the upload begins*, that would be on the client side. There's no foolproof or general way to check file information on the client. I don't think you can do it with JavaScript; you might be able to do it on a Windows PC with VBScript, and Java could do it. PHP can refuse to accept files larger than a specified size, which isn't exactly what you're asking: http://us.php.net/manual/en/features.file-upload.php For more information, documentation sets in multiple languages are available here: http://www.php.net/docs.php -steve -- +--- my people are the people of the dessert, ---+ | Steve Edberghttp://pgfsun.ucdavis.edu/ | | UC Davis Genome Center[EMAIL PROTECTED] | | Bioinformatics programming/database/sysadmin (530)754-9127 | + said t e lawrence, picking up his fork + -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php