Re: [PHP] Reversing the Colour.

2002-10-09 Thread ::[ Julien Bonastre ]::

Assumptions:
- background colour is stored in $bgcol (ie 4592FF)
- chosen link colour is stored in $lncol (ie *same as above*)
- Finds half-way colour between $bgcol and $lncol (returns a RRGGBB in hex
as above)

Notes:
This is actually fairly simple Alexis.. Simply convert your hex vals to
something you can work with (ie dec) using hexdec() and then do some basic
maths to find the half way between each of the R G B vals and then finally
spitting out a hex value for the midway mark..


Implementation:

?php
/** Func: getMidColour **/
// Returns the midway value in HEX between the two DEC values $dec1, $dec2
function getMidColour($dec1,$dec2) {
  return
dechex(abs(hexdec($dec1)-hexdec($dec2))/2+(hexdec($dec1)hexdec($dec2)?hexde
c($dec2):hexdec($dec1)));
}

// Parses 6char hex colour (RRGGBB) into 3 part RGB string and feeds into an
array
$bgcol_arr=split(,,preg_replace(([\d]{2})([\d]{2})([\d]{2}),$1,$2,$3,$
bgcol));
$lncol_arr=split(,,preg_replace(([\d]{2})([\d]{2})([\d]{2}),$1,$2,$3,$
lncol));

// We now can access the hex RGB values through the [0],[1],[2] elements of
these arrays..
// Using our custom function we can throw into our final array the actual 3
hex values
// desired which is the midpoint between $bgcol and $lncol
$midcol_arr=Array(getMidColour($bgcol_arr[0],$lncol_arr[0]),getMidColour($bg
col_arr[1],$lncol_arr[1]),getMidColour($bgcol_arr[2],$lncol_arr[2]));




---

HIH.. Not tested.. Please tell me how it goes (if it goes :-p)



Bye


- Original Message -
From: Alexis Antonakis [EMAIL PROTECTED]
To: Php-General@Lists. Php. Net [EMAIL PROTECTED]
Sent: Wednesday, October 09, 2002 10:48 PM
Subject: [PHP] Reversing the Colour.


 Hi,

 I have a site whereby the user can select the colour of links for their
 individual sections.

 What I would like to do is to get the exact opposite colour of the one
that
 they choose and use that in the 'hover over' option of the a tag.

 The value for the colour is stored in hex.

 To add to this, the user can also choose the background colour. I have
made
 sure that they cannot have the same background colour as colour of the
link,
 but obviously if the background colour is the exact opposite of the link
 colour, then when they hover over the link, it would 'disappear'. In this
 case I would like to choose HALFWAY between the two sets of colours. I
know
 that this might not always produce the best colour combinations, but I'm
 trying to get it so that the links always 'stand out'. I cannot let them
 choose the colour of the 'Hover Over' option unfortunately.

 Any suggestions as to how to achieve this, especially the calculations, or
 for that matter improve upon it, would be most appreciated.

 Regards
 Alexis



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php






Re: [PHP] Reversing the Colour.

2002-10-09 Thread ::[ Julien Bonastre ]::

Ok below is the fully tested and working code:

NOTE: . I have attached it too so wordwrapping email clients don't stuff the
lines up .. ;-)

This script will take in two 6character HTML hex colours (ie 44F0DD) and
return the midway colour between them (in Hex also)..


--
?php
//Example values..
$bgcol=39DFD9;
$lncol=F02816;

/** Func: getMidColour **/
// Returns the midway value in HEX between the two DEC values $dec1, $dec2
function getMidColour($dec1,$dec2) {
  return
dechex(abs(hexdec($dec1)-hexdec($dec2))/2+(hexdec($dec1)hexdec($dec2)?hexde
c($dec2):hexdec($dec1)));
}

// Parses 6char hex colour (RRGGBB) into 3 part RGB string and feeds into an
array
$bgcol_arr=split(,,preg_replace(/(.{2})(.{2})(.{2})/,$1,$2,$3,$bgcol))
;
$lncol_arr=split(,,preg_replace(/(.{2})(.{2})(.{2})/,$1,$2,$3,$lncol))
;

// We now can access the hex RGB values through the [0],[1],[2] elements of
these arrays..
// Using our custom function we can throw into our final array the actual 3
hex values
// desired which is the midpoint between $bgcol and $lncol
$midcol_arr=Array(getMidColour($bgcol_arr[0],$lncol_arr[0]),getMidColour($bg
col_arr[1],$lncol_arr[1]),getMidColour($bgcol_arr[2],$lncol_arr[2]));

// Formats the array into a string and Upper cases it..
$midcol=strtoupper(join(,$midcol_arr));

?
-

You then have the $midcol var which holds a uppercase HTML hex colour string
which represents the midway colour between $bgcol and $lncol..



Finally.. :-p


Ok HIH

- Original Message -
From: ::[ Julien Bonastre ]:: [EMAIL PROTECTED]
To: ::[ Julien Bonastre ]:: [EMAIL PROTECTED]
Sent: Thursday, October 10, 2002 12:19 AM
Subject: Re: [PHP] Reversing the Colour.


 Hang on..

 Yep I just tested it.

 Make sure you incldue the forward slash REGEX seperators in those preg
 functions..

 Ie.. my lines in previous email have:

$bgcol_arr=split(,,preg_replace(([\d]{2})([\d]{2})([\d]{2}),$1,$2,$3,$
 bgcol));

 Which should be:

$bgcol_arr=split(,,preg_replace(/([\d]{2})([\d]{2})([\d]{2})/,$1,$2,$3
 ,$bgcol));



 Anyway...
 - Original Message -
 From: ::[ Julien Bonastre ]:: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, October 09, 2002 11:59 PM
 Subject: Re: [PHP] Reversing the Colour.


 Assumptions:
 - background colour is stored in $bgcol (ie 4592FF)
 - chosen link colour is stored in $lncol (ie *same as above*)
 - Finds half-way colour between $bgcol and $lncol (returns a RRGGBB in
hex
 as above)

 Notes:
 This is actually fairly simple Alexis.. Simply convert your hex vals to
 something you can work with (ie dec) using hexdec() and then do some basic
 maths to find the half way between each of the R G B vals and then finally
 spitting out a hex value for the midway mark..


 Implementation:

 ?php
 /** Func: getMidColour **/
 // Returns the midway value in HEX between the two DEC values $dec1, $dec2
 function getMidColour($dec1,$dec2) {
   return

dechex(abs(hexdec($dec1)-hexdec($dec2))/2+(hexdec($dec1)hexdec($dec2)?hexde
 c($dec2):hexdec($dec1)));
 }

 // Parses 6char hex colour (RRGGBB) into 3 part RGB string and feeds into
an
 array

$bgcol_arr=split(,,preg_replace(([\d]{2})([\d]{2})([\d]{2}),$1,$2,$3,$
 bgcol));

$lncol_arr=split(,,preg_replace(([\d]{2})([\d]{2})([\d]{2}),$1,$2,$3,$
 lncol));

 // We now can access the hex RGB values through the [0],[1],[2] elements
of
 these arrays..
 // Using our custom function we can throw into our final array the actual
3
 hex values
 // desired which is the midpoint between $bgcol and $lncol

$midcol_arr=Array(getMidColour($bgcol_arr[0],$lncol_arr[0]),getMidColour($bg
 col_arr[1],$lncol_arr[1]),getMidColour($bgcol_arr[2],$lncol_arr[2]));




 ---

 HIH.. Not tested.. Please tell me how it goes (if it goes :-p)



 Bye


 - Original Message -
 From: Alexis Antonakis [EMAIL PROTECTED]
 To: Php-General@Lists. Php. Net [EMAIL PROTECTED]
 Sent: Wednesday, October 09, 2002 10:48 PM
 Subject: [PHP] Reversing the Colour.


  Hi,
 
  I have a site whereby the user can select the colour of links for their
  individual sections.
 
  What I would like to do is to get the exact opposite colour of the one
 that
  they choose and use that in the 'hover over' option of the a tag.
 
  The value for the colour is stored in hex.
 
  To add to this, the user can also choose the background colour. I have
 made
  sure that they cannot have the same background colour as colour of the
 link,
  but obviously if the background colour is the exact opposite of the link
  colour, then when they hover over the link, it would 'disappear'. In
this
  case I would like to choose HALFWAY between the two sets of colours. I
 know
  that this might not always produce the best colour combinations, but I'm
  trying to get it so that the links always 'stand out'. I cannot let them
  choose the colour of the 'Hover Over' option unfortunately.
 
  Any suggestions as to how to achieve this, especially the calculations

Re: [PHP] Reversing the Colour

2002-10-09 Thread ::[ Julien Bonastre ]::

Hang on..

Yep I just tested it.

Make sure you incldue the forward slash REGEX seperators in those preg
functions..

Ie.. my lines in previous email have:
$bgcol_arr=split(,,preg_replace(([\d]{2})([\d]{2})([\d]{2}),$1,$2,$3,$
bgcol));

Which should be:
$bgcol_arr=split(,,preg_replace(/([\d]{2})([\d]{2})([\d]{2})/,$1,$2,$3
,$bgcol));



Anyway...
- Original Message -
From: ::[ Julien Bonastre ]:: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, October 09, 2002 11:59 PM
Subject: Re: [PHP] Reversing the Colour.


Assumptions:
- background colour is stored in $bgcol (ie 4592FF)
- chosen link colour is stored in $lncol (ie *same as above*)
- Finds half-way colour between $bgcol and $lncol (returns a RRGGBB in hex
as above)

Notes:
This is actually fairly simple Alexis.. Simply convert your hex vals to
something you can work with (ie dec) using hexdec() and then do some basic
maths to find the half way between each of the R G B vals and then finally
spitting out a hex value for the midway mark..


Implementation:

?php
/** Func: getMidColour **/
// Returns the midway value in HEX between the two DEC values $dec1, $dec2
function getMidColour($dec1,$dec2) {
  return
dechex(abs(hexdec($dec1)-hexdec($dec2))/2+(hexdec($dec1)hexdec($dec2)?hexde
c($dec2):hexdec($dec1)));
}

// Parses 6char hex colour (RRGGBB) into 3 part RGB string and feeds into an
array
$bgcol_arr=split(,,preg_replace(([\d]{2})([\d]{2})([\d]{2}),$1,$2,$3,$
bgcol));
$lncol_arr=split(,,preg_replace(([\d]{2})([\d]{2})([\d]{2}),$1,$2,$3,$
lncol));

// We now can access the hex RGB values through the [0],[1],[2] elements of
these arrays..
// Using our custom function we can throw into our final array the actual 3
hex values
// desired which is the midpoint between $bgcol and $lncol
$midcol_arr=Array(getMidColour($bgcol_arr[0],$lncol_arr[0]),getMidColour($bg
col_arr[1],$lncol_arr[1]),getMidColour($bgcol_arr[2],$lncol_arr[2]));




---

HIH.. Not tested.. Please tell me how it goes (if it goes :-p)



Bye


- Original Message -
From: Alexis Antonakis [EMAIL PROTECTED]
To: Php-General@Lists. Php. Net [EMAIL PROTECTED]
Sent: Wednesday, October 09, 2002 10:48 PM
Subject: [PHP] Reversing the Colour.


 Hi,

 I have a site whereby the user can select the colour of links for their
 individual sections.

 What I would like to do is to get the exact opposite colour of the one
that
 they choose and use that in the 'hover over' option of the a tag.

 The value for the colour is stored in hex.

 To add to this, the user can also choose the background colour. I have
made
 sure that they cannot have the same background colour as colour of the
link,
 but obviously if the background colour is the exact opposite of the link
 colour, then when they hover over the link, it would 'disappear'. In this
 case I would like to choose HALFWAY between the two sets of colours. I
know
 that this might not always produce the best colour combinations, but I'm
 trying to get it so that the links always 'stand out'. I cannot let them
 choose the colour of the 'Hover Over' option unfortunately.

 Any suggestions as to how to achieve this, especially the calculations, or
 for that matter improve upon it, would be most appreciated.

 Regards
 Alexis



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php








Re: [PHP] Multiple Domains in cookie?

2002-09-28 Thread Julien Bonastre

GREAT Q!

I have been trying to play with my cookies for a while now for this same
reason..

And to no avail..

It seems due to the structure of them and as long as the client (browser)
sticks to the specifications you can only access a cookie belonging to that
same host..

For example, I am starting up a large network site base but I wanted all
the sites even though they have their own unique domain to be able to have a
global member login system.. Catch is.. The only way for them to be able to
login to one site and then be able to freely go to another completely diff.
site also on our network they would still be logged in and hence they have
this main ONE account that allows them access  to all our network sites..

So I studied the workings behind Terra Lycos and found their trick quite
easily.. Since they have basically this same concept they too had to find a
solution..


And their's is very close to mine :) I had thought.. since it's HOST
specific. Not the full domain.. that means that cookies only differentiate
between: aaa.com and bbb.com..

But not: one.aaa.com or two.aaa.com

Therefore to create ONE cookie you set it's host for aaa.com and that way
all your other site domains can be redirectors to the subdomain..

Ie.. if you have aaa.com as your main site and bbb.com and ccc.com just make
those other two point to: bbb.aaa.com and ccc.aaa.com  respectively..

Don't think it's unpro because that's exactly what Terra Lycos does..

For eg.. Checkout www.webmonkey.com (I'm sure many of you already know it)
you soon see you'll be transported to: www.hotwired.lycos.com/webmonkey

This is because not only is webmonkey part of Terra lycos.. It's also under
HotWired..

Then I thought.. No way.. that can't be their trick surely??

Yep.. Checkout all their other sites..

More examples: www.angelfire.com goes to angelfire.lycos.com and tripod.com
goes to tripod.lycos.com

it seems this is the idea.. that way.. if they login.. just set some details
(perhaps the SESSID so you can easily jsut reload the session on the other
sites) on for example lycos.com as the domain and then all the subdomains
can also use this freely..

Use your domains as redirectors and you get a sweet system.. :)


HIH
--oOo---oOo--

 Julien Bonastre [The_RadiX]
 The-Spectrum Network CEO
 [EMAIL PROTECTED]
 www.the-spectrum.org

--oOo---oOo--
- Original Message -
From: Tony Harrison [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, September 28, 2002 7:25 PM
Subject: [PHP] Multiple Domains in cookie?


 Is it possible to specify more than 1 domain in a cookie?
 -
 [EMAIL PROTECTED]
 http://www.cool-palace.com


 --
 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] Create Thumbnails from image

2002-09-26 Thread Julien Bonastre

Yeah sorry about that.. It happens where I just hit reply and forget to add
the mail list address :-(

Oops.. hehe
--oOo---oOo--

 Julien Bonastre [The_RadiX]
 The-Spectrum Network CEO
 [EMAIL PROTECTED]
 www.the-spectrum.org

--oOo---oOo--
- Original Message -
From: Kjell Hansen [EMAIL PROTECTED]
To: -=| Julien Bonastre |=- [EMAIL PROTECTED]
Sent: Tuesday, September 24, 2002 1:55 AM
Subject: Re: [PHP] Create Thumbnails from image


Hey Julien!
Thanx for the code! Your posting from yesterday helped me out. Actually I
was on the right path all along but hadn't activated the GD-extension in my
php.ini and so I just got errors and grew _pretty_ annoyed by it. Then after
I got your message from yesterday giving med the same errors I realized that
there were somethin' cookin'. After activating the GD-extension and
restarted Apache your snippet worked fine and eventually mine too.

Thanx again for your effort, it would have been better though if we all had
sent this to the newsgroup. More people would have had a chance to see it
there...

Have fun
Regards
Kjell

- Original Message -
From: -=| Julien Bonastre |=- [EMAIL PROTECTED]
To: Kjell Hansen [EMAIL PROTECTED]
Sent: Monday, September 23, 2002 4:20 PM
Subject: Re: [PHP] Create Thumbnails from image


 OMG..

 This is the second question tonight I answer that I was just working on
 today :-p

 hah..


 Ok.. simple.. here's my code I used today for
www.operation-scifi.com/lobby


 Thing is.. It's about as understandable to other's as hieroglyphics..

 Therefore.. a simple solution..

 do this:

 ?
 header(Content-type: image/jpeg);
 $img=imagecreatefromxxx(../dir/img.ext); //where xxx = jpeg | png | gif
 etc..
 $img2=imagecreate(150,100);
 $imgsize=getimagesize(../dir/img.ext);
 imagecopyresized($img2,$img,0,0,0,0,150,100,$size[0],$size[1]);
 imagexxx($img2);
 ?

 Substitute the filepath etc.. and also the 150/100 dimension sizes..

 xxx denotes the image type which depending on your GD version .. jpeg has
 always been supported.. GIF has been removed as of 1.6 I think due to the
 LZW compression patent by Unisys.. and now they have PNG which my site
uses
 due to it's much better file format and flexibility..

 Also BTW.. this script is designed to be a seperate file.. ie image.php

 perhaps even do what I did and make the filename actually a $_GET param..

 As in.. you call: ./image.php?im=whatever.jpg

 and it generates a thumbnailed version..

 if your using JPEG format you can also use this param in the
 imagejpeg($img2); function:

 imagejpeg($img2,,80); whereby the output quality is no 80%.. that means
 lower qual thumbnail..

 There is a lot of fun things that can be done just with the core graphics
 module of PHP without GD.

 but GD is soo great it can do much more exciting things..

 Like for instance today I wanted to resize these big pics.. That's all
 good.. But they are somewhat pixellised from the large downshrink. Now..
the
 function imagecopyresample() would be great..

 but's a GD2+ thing.. I don't use GD plus yet.. [downloading the bin as I
 write this] but that's just one great func. taht allows for resize and
 interpolation of near pixels (ie smoothing)..

 w00tage eh??


 Anyways.. enough said. rambling on now.. HIH



 /* IMAGE HANDLING ROUTINE */

   $errmsg=Array();
   if(strlen($_GET[d])1) {
 $errmsg[]=Invalid GET params sent:;
 $errmsg[]=Must send valid data_id to script!;


$fwidth=(strlen($errmsg[count($errmsg)-1])$fwidth?strlen($errmsg[count($err
 msg)-1]):$fwidth);
   } else {
 $sql=mysql_query(SELECT * FROM opscifi_news_data WHERE data_id =
 .$_GET[d],$DB);
 if(mysql_num_rows($sql)0 AND $ditem=@mysql_fetch_array($sql)) {


if(!file_exists(./news/n.$ditem[news_id].d.$ditem[data_id]...subst

r($ditem[filename],strpos($ditem[filename],.,0)+1,strlen($ditem[filen
 ame])-(strpos(fname,.,0)+1 {
 $errmsg[]=Invalid file request:;
 $errmsg[]=File

./news/n.$ditem[news_id].d.$ditem[data_id]...substr($ditem[filenam

e],strpos($ditem[filename],.,0)+1,strlen($ditem[filename])-(strpos(fn
 ame,.,0)+1)). does not exist!;


$fwidth=(strlen($errmsg[count($errmsg)-1])$fwidth?strlen($errmsg[count($err
 msg)-1]):$fwidth);
   } elseif(!preg_match(/(jpg|jpeg|jpe)/i,$ditem[filename])) {
 $errmsg[]=Invalid image type request:;
 $errmsg[]=Script can only process image/jpeg files!;


$fwidth=(strlen($errmsg[count($errmsg)-1])$fwidth?strlen($errmsg[count($err
 msg)-1]):$fwidth);
   } else {
   // Spit out required [standard] MIME-type header
 header(Content-type: image/jpeg);
   // Fetch the original friendly filename
 $row=mysql_fetch_array(mysql_query(SELECT filename FROM
 opscifi_news_data WHERE data_id = .$_GET[d],$DB));
 $ditem[filename]=$row[0];
 header(Content-Disposition: image;
filename=.$ditem[filename]);

   // Update request field in images data element
 if(!isset($_GET[t

Re: [PHP] Create Thumbnails from image

2002-09-23 Thread -=| Julien Bonastre |=-
($img, 255,
0, 0));
imageinterlace($img,1);
imagejpeg($img);
exit();
  } else {
exit();
  }

--oOo---oOo--

 Julien Bonastre [The_RadiX]
 The-Spectrum Network CEO
 [EMAIL PROTECTED]
 www.the-spectrum.org

--oOo---oOo--

- Original Message -
From: Kjell Hansen [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, September 23, 2002 1:09 AM
Subject: [PHP] Create Thumbnails from image


 Hi,
 I'm using a Win2k with php4.1 and I'd like to make some thumbnails from
 pictures on my disk.
 I've gotten the impression that it's possible, but I havent' found out
 just how.

 I've stumbled across the ImageCopyResized function but it requires a
 imagehandle(?) to the file copied from. How do I get that? Is it the
 right way to do this?
 I guess I could use some picture manipulating program to do this, but
 doing it the PHP way is nicer :)

 TIA
 Kjell


 --
 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] Confused

2002-09-23 Thread -=| Julien Bonastre |=-

well it depends how you want to go about it..

I have done something exactly like this, this morning.. :-p

Firstly.. you can use a normal SQL SELECT statement, but use GROUPing to
seperate the groups in this case and ORDER them alphabetically or
something..

Next.. You can do something like this:

?
$curgrp=;
$sql=mysql_query(SELECT groups.group_name, users.user_name FROM groups
INNER JOIN users ON groups.group_id=users.group_id GROUP BY
groups.group_name ORDER BY groups.group_name ASC, users.user_name
ASC,$DBH);
while($row=mysql_fetch_array($sql)) {
  if($curgrp!=$row[group_name]) {
if(strlen($curgrp)0) echo /table;
$curgrp=$row[group_name];
echo table border=1 cellpadding=2 cellspacing=2trtd
colspan=2Group: b.$row[group_name]./b/td/tr;
  }
  echo trtdnbsp;nbsp;/tdtd.$row[user_name]./tdtr;
}
?


This HAS NOT been tested. but I have ran it through the inbuilt PHP
interpretor in my brain.. and passed it through the mySQL server also up in
my head.. and it seems OK..


In any case it was mainly to demonstrate the concept.. As you can see.. It
iterates through the result table which should look a little like this
(using your data supplied):

Blue,Tom
Blue,Nancy
Blue,Jim
Red,Bob
Red,Susan
Red,James

You get it?

HIH.. Please if you notice any bugs in the coding above.. point it out.. I
did it quite quickly and with very little checking as such or testing..


Good luck ;)

I could post what I used but that could get confusing.. :-p

Anyways.. Now I'm rambling.. ha. I'm off..

--oOo---oOo--

 Julien Bonastre [The_RadiX]
 The-Spectrum Network CEO
 [EMAIL PROTECTED]
 www.the-spectrum.org

--oOo---oOo--

- Original Message -
From: Rankin, Randy [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, September 23, 2002 10:36 PM
Subject: [PHP] Confused


 I have two MySQL tables, groups and users:

 groups: group_id, group_name

 users: user_id, user_name, group_id, etc.

 I would like to produce one table for each group which will list all the

 members for that particular group. For example:

 Blue (group_id 1)

 Tom (group_id 1)

 Nancy (group_id 1)

 Jim (group_id 1)

 Red (group_id 2)

 Bob (group_id 1)

 Susan (group_id 1)

 James (group_id 1)

 ...

 My question is, do I need to run 2 queries? The first to select all the

 groups and the second to select all the users in each group based on the

 group_id? How would I loop through to create a table for each group?

 Thanks in advance for any help.

 Randy Rankin





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Redirection

2002-09-23 Thread -=| Julien Bonastre |=-

Yes that's right.. It's a standard HTTP/1.0 command I'm pretty sure so yeah.

Actually referring to the rfc docs it could date back to even eariler HTTP
standards too..

Hmm.. Yeah just don't send anything but header's and you can successfully
redir. with that header(Location: xxx); function..





--oOo---oOo--

 Julien Bonastre [The_RadiX]
 The-Spectrum Network CEO
 [EMAIL PROTECTED]
 www.the-spectrum.org

--oOo---oOo--

- Original Message -
From: Chris Shiflett [EMAIL PROTECTED]
To: Sascha Braun [EMAIL PROTECTED]
Cc: PHP Mailingliste [EMAIL PROTECTED]
Sent: Monday, September 23, 2002 10:22 AM
Subject: Re: [PHP] Redirection


 Sascha Braun wrote:

 I want to post a form and after parsing i want to redirect the user to
the home page.
 
 header() doesn't work in this circumstance, what can I do else?
 

 header() does work in this circumstance. In what way do you think it
 doesn't?

 header(Location: http://www.google.com/;);
 exit;

 Include that code after parsing, and your users will be redirected to
 Google's Web site. I'm not aware of any Web client that does not support
 this, regardless of how old or uncommon.

 Chris


 --
 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] 256colour PNG?? WHY?!

2002-09-21 Thread -=| Julien Bonastre |=-

Hmm.. Interesting problem I seem to have stumbled upon


I am running apache2.0.36 and php4.2.2 (i am using gd1.6.2)

Now the catch is.. I just want to output a few diff image types directly to browser..

I can do JPEG's fine.. BMP's don't work because of using a older gdlib.. that's no big 
deal though.. i just wanted jpeg and hopefully PNG..

Thing is.. PNG's well.. it loads them fine.. but they end up 256colour palette in the 
browser.. it actually creates the new image from the original true colour (~24KB 
original) and instead spits out a 256colour ~4KB version.. since the palette's been 
reduced involuntarily this is not the desired effect..

I run the img resource through imagecolorstotal($img) to get the colour palette. sure 
enough.. it returns 256.. and yet i open the PNG in Photoshop and its a truecolour PNG 
and without discolouration..


It's definitely freaking me out since I have no idea why it's doing it. I started 
reading the docs' more closely to see if it was a known issue and that the png func's 
are supposed to return 256 colour images.. but to no avail..


Below is the code of the very simple (as can be seen) test php page:
?
header(Content-type: image/png);
//header(Content-Disposition: image; filename=test);
$img=imagecreatefrompng(./news/n1d1.png);
//imageinterlace($img,1);
imagepng($img);
?



As can be seen.. It's very simple.. hehe.. I was just using it to test the principle 
but even at these early stages the plan fell apart due to this wacky problem..



Thanks for any ideas/advice..

:) greatly appreciated..

--oOo---oOo--

 Julien Bonastre [The_RadiX]
 The-Spectrum Network CEO
 [EMAIL PROTECTED]
 www.the-spectrum.org

--oOo---oOo--




[PHP] PHP Execution Timer

2002-09-19 Thread -=[ Julien Bonastre ]=-

I have seen it on many sites now and since I have been using PHP for so long and done 
a huge amount of coding with it I thought it would add a nice touch and it could be 
used for statistical purposes to assist me in database effeciency and so forth.

The idea is a page execution timer.. or a database query timer.. basically it shows 
you just a time (usually in msecs) it took for the last command to be executed.. I 
have seen it used for queries and it returns the time it took.. And I am quite sure 
I've seen it used for actual page generation as well, whereby it says something like 
page generated in x.xxx secs



I just want to know what function or module covers this feature.. If it is at all 
possible..




Thanks a million people!


--oOo---oOo--

 Julien Bonastre [The_RadiX]
 The-Spectrum Network CEO
 [EMAIL PROTECTED]
 www.the-spectrum.org

--oOo---oOo--