[PHP] html to jpeg conversion.

2007-08-18 Thread Bindu Walia
Hi,
   I am looking for  a way to convert a html page to a jpeg image. The html
page is a file with images and text. Could someone please suggest a method
or point me to any existing work on this?

Thanks,
Bindu


Re: [PHP] apache/php with sybase12.5

2007-08-18 Thread Thijs Lensselink
ROUKOS Michel wrote:

> Hi,
> I installed libtool 1.5 and tried again. The libphp.so was not created
> as well.
> I tried also to run with 
> ./configure --with-apx2=/usr/local/apache2/bin/apxs
> make
> make install
>
> same results: libphp5.so is not created under modules/ directory.
>
> Thanks and regards,
> Michel
>
> -Original Message-
> From: Lens Development [mailto:[EMAIL PROTECTED] 
> Sent: Friday, August 17, 2007 7:57 PM
> To: ROUKOS Michel
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] apache/php with sybase12.5
>
> ROUKOS Michel wrote:
>
>   
>> Hi,
>>
>> I am integrating httpd-2.0.59 with php-5.2.1 and Sybase 12.5 on a
>> solaris 8 machine. I followed these steps:
>> Install apache:
>>
>> ./configure --prefix=/usr/local/apache2 --enable-so
>> make
>> make install
>>
>>
>> PHP configuration:
>>
>>
>> I edited this file php-5.2.1/ext/sybase_ct/ php_sybase_ct.h and
>> 
> changed
>   
>> this line:
>> #define CTLIB_VERSION CS_VERSION_100
>> ...to...
>> #define CTLIB_VERSION CS_VERSION_125
>>
>> Then:
>> ./configure --with-apx2=/usr/local/apache2/bin/apxs
>> --with-sybase-ct=/opt/sybase/oc12.5-EBF11486/OCS-12_5/ --enable-bcmath
>> --enable-calendar --enable-ctype --enable-exif --enable-ftp
>> --enable-trans-sid --enable-shmop --enable-sockets --enable-sysvsem
>> --enable-sysvshm --enable-wddx
>> make
>> make install
>>
>>
>> then added these 2 lines in httpd.conf:
>> AddType application/x-httpd-php .php .phtml
>> AddType application/x-httpd-php-source .phps
>>
>>
>> When I access test.php, I am asked to download the file - meaning php
>> 
> is
>   
>> not working well. I also don't see libphp5.so under modules/
>> 
> directory.
>   
>> test.php is locate under htdocs/ and has this content:
>>
>> 
>>
>>
>> Could you please point to me why libphp5.so was not generated? Also
>> 
> why
>   
>> php is not working well with apache and sybase? 
>>  
>> ***
>> This e-mail contains information for the intended recipient only.  It
>> 
> may contain proprietary material or confidential information.  If you
> are not the intended recipient you are not authorised to distribute,
> copy or use this e-mail or any attachment to it.  Murex cannot guarantee
> that it is virus free and accepts no responsibility for any loss or
> damage arising from its use.  If you have received this e-mail in error
> please notify immediately the sender and delete the original email
> received, any attachments and all copies from your system.
>   
>>   
>> 
> What version of libtool do you use?
> What happens if you just run
>
> ./configure --with-apx2=/usr/local/apache2/bin/apxs
> make
> make install 
>  
> ***
> This e-mail contains information for the intended recipient only.  It may 
> contain proprietary material or confidential information.  If you are not the 
> intended recipient you are not authorised to distribute, copy or use this 
> e-mail or any attachment to it.  Murex cannot guarantee that it is virus free 
> and accepts no responsibility for any loss or damage arising from its use.  
> If you have received this e-mail in error please notify immediately the 
> sender and delete the original email received, any attachments and all copies 
> from your system.
>
>   
I have the feeling your build tools are hosed.
Maybe somebody else on the list has a suggestion.

You could try a newer version or a snapshot.

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



[PHP] iterating and changing value of an array using foreach and references - PHP 5.2.3

2007-08-18 Thread Yashesh Bhatia
Hi,

  Here's an interesting observation i noticed while using foreach to
iterate on arrays using
references for it's values.


-
PHP version
$ php -v
PHP 5.2.3 (cli) (built: Jun  8 2007 14:31:21)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
-
Source code
 15, 'ar_needed' => 'no');
$cat1[16] = array('tid' => 16, 'ar_needed' => 'no');
$cat1[17] = array('tid' => 17, 'ar_needed' => 'no');

// print it
print "\n\$cat1 = ";
print_r($cat1);
print "\n";

// iterate using foreach and reference
foreach ($cat1 as $k => &$v) {
  if ($k == 15) {
$v['ar_needed'] = 'yes'; // dummy change
  }
}

// print array
print "\n\$cat1 = ";
print_r($cat1);
print "\n";

// reiterate
foreach ($cat1 as $k => $v) {
  print "\$k = $k\n";
  print "\$v = ";
  print_r($v);
  print "\n";
}
?>
-
OUTPUT
$cat1 = Array
(
[15] => Array
(
[tid] => 15
[ar_needed] => no
)
[16] => Array
(
[tid] => 16
[ar_needed] => no
)
[17] => Array
(
[tid] => 17
[ar_needed] => no
)
)

$cat1 = Array
(
[15] => Array
(
[tid] => 15
[ar_needed] => yes
)
[16] => Array
(
[tid] => 16
[ar_needed] => no
)
[17] => Array
(
[tid] => 17
[ar_needed] => no
)
)

$k = 15
$v = Array
(
[tid] => 15
[ar_needed] => yes
)

$k = 16
$v = Array
(
[tid] => 16
[ar_needed] => no
)

$k = 17
$v = Array
(
[tid] => 16
[ar_needed] => no
)
-

As seen in the above output all the print statements give expected
output except the last
set in the 2nd iteration
$k = 17
$v = Array
(
[tid] => 16
[ar_needed] => no
)

the $k looks fine but the $v is not correct for some reason. Any clue
what could be wrong
here ?. Also, in the 2nd iteration of the name of the variable is
changed from $v to $v1
it displays correctly
$k = 17
$v1 = Array
(
[tid] => 17
[ar_needed] => no
)


Thanks.

Yashesh Bhatia.

--
Go Pre
http://www2.localaccess.com/rlalonde/pre.htm
--

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



[PHP] Cookies and sent headers

2007-08-18 Thread Otto Wyss
If built a simple login page and store any information within 
$_SESSION's. Yet I'd like to move these into cookies but I always get an 
error about sent headers. Is there a way to circumvent this problem 
without changing too much in the page?


The setting of the cookies happens just at the end of the page.

  if (!$errortext and $Anmelden) {
if (!empty($Permanent)) {
  $expires = time()+ 365 * 86400;  // 365 days
  setcookie ("l.Lastname", $_SESSION['l_Lastname'], $expires);
  setcookie ("l.Firstname", $_SESSION['l_Firstname'], $expires);
  setcookie ("l.Email1", $_SESSION['l_Email1'], $expires);
  setcookie ("l.Email2", $_SESSION['l_Email2'], $expires);
}
echo "
  parent.location.replace('$index_php";
  ";
exit;
  }

O. Wyss

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



Re: [PHP] Cookies and sent headers

2007-08-18 Thread Kelvin Park

Kelvin Park wrote:

Otto Wyss wrote:
If built a simple login page and store any information within 
$_SESSION's. Yet I'd like to move these into cookies but I always get 
an error about sent headers. Is there a way to circumvent this 
problem without changing too much in the page?


The setting of the cookies happens just at the end of the page.

  if (!$errortext and $Anmelden) {
if (!empty($Permanent)) {
  $expires = time()+ 365 * 86400;  // 365 days
  setcookie ("l.Lastname", $_SESSION['l_Lastname'], $expires);
  setcookie ("l.Firstname", $_SESSION['l_Firstname'], $expires);
  setcookie ("l.Email1", $_SESSION['l_Email1'], $expires);
  setcookie ("l.Email2", $_SESSION['l_Email2'], $expires);
}
echo "
  parent.location.replace('$index_php";
  ";
exit;
  }

O. Wyss


ob_start() might help



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



Re: [PHP] Cookies and sent headers

2007-08-18 Thread Wouter van Vliet / Interpotential
You best option would be to go through all of your include'd or require'd
files and make sure there is no whitespace before and after you open your
php tags. Those are often the cause for such problems. The easy way would
indeed be to use output buffering. In that case, put the call to ob_start();
on the first line of the file you're calling. You will still have to make
sure to not have any whitespace before your  wrote:
>
> Kelvin Park wrote:
> > Otto Wyss wrote:
> >> If built a simple login page and store any information within
> >> $_SESSION's. Yet I'd like to move these into cookies but I always get
> >> an error about sent headers. Is there a way to circumvent this
> >> problem without changing too much in the page?
> >>
> >> The setting of the cookies happens just at the end of the page.
> >>
> >>   if (!$errortext and $Anmelden) {
> >> if (!empty($Permanent)) {
> >>   $expires = time()+ 365 * 86400;  // 365 days
> >>   setcookie ("l.Lastname", $_SESSION['l_Lastname'], $expires);
> >>   setcookie ("l.Firstname", $_SESSION['l_Firstname'], $expires);
> >>   setcookie ("l.Email1", $_SESSION['l_Email1'], $expires);
> >>   setcookie ("l.Email2", $_SESSION['l_Email2'], $expires);
> >> }
> >> echo "
> >>   parent.location.replace('$index_php";
> >>   ";
> >> exit;
> >>   }
> >>
> >> O. Wyss
> >>
> > ob_start() might help
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Interpotential.com
Phone: +31615397471


RE: [PHP] Cookies and sent headers

2007-08-18 Thread Bastien Koert

sessions and cookies either need to be set at the beginning of the page, or you 
can look into the ob_start(), ob_flush() functions to use output buffering


bastien


> To: php-general@lists.php.net
> Date: Sat, 18 Aug 2007 11:25:54 +0200
> From: [EMAIL PROTECTED]
> Subject: [PHP] Cookies and sent headers
> 
> If built a simple login page and store any information within 
> $_SESSION's. Yet I'd like to move these into cookies but I always get an 
> error about sent headers. Is there a way to circumvent this problem 
> without changing too much in the page?
> 
> The setting of the cookies happens just at the end of the page.
> 
>if (!$errortext and $Anmelden) {
>  if (!empty($Permanent)) {
>$expires = time()+ 365 * 86400;  // 365 days
>setcookie ("l.Lastname", $_SESSION['l_Lastname'], $expires);
>setcookie ("l.Firstname", $_SESSION['l_Firstname'], $expires);
>setcookie ("l.Email1", $_SESSION['l_Email1'], $expires);
>setcookie ("l.Email2", $_SESSION['l_Email2'], $expires);
>  }
>  echo "";
>  exit;
>}
> 
> O. Wyss
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

_
Explore the seven wonders of the world
http://search.msn.com/results.aspx?q=7+wonders+world&mkt=en-US&form=QBRE
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: html to jpeg conversion.

2007-08-18 Thread Al

I didn't check; but seem to recall that Imagemagick will do it.

If it does, then I'd suggest using the new php Imagick API for it. Works great. 
 Don't be put off by the CVS status.  Thats' most because of the lac of 
documentation so far. http://us3.php.net/manual/en/ref.imagick.


Bindu Walia wrote:

Hi,
   I am looking for  a way to convert a html page to a jpeg image. The html
page is a file with images and text. Could someone please suggest a method
or point me to any existing work on this?

Thanks,
Bindu



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



Re: [PHP] Cookies and sent headers

2007-08-18 Thread Otto Wyss
ob_start() at the beginning and ob_end_flush() at the end of the PHP 
section seems to do the trick albeit I've still problems to understand 
why. The description in the manual is rather sparse unfortunately. Is 
there any more information about what's going on?


O. Wyss

Wouter van Vliet / Interpotential wrote:

You best option would be to go through all of your include'd or require'd
files and make sure there is no whitespace before and after you open your
php tags. Those are often the cause for such problems. The easy way would
indeed be to use output buffering. In that case, put the call to ob_start();
on the first line of the file you're calling. You will still have to make
sure to not have any whitespace before your  wrote:

Kelvin Park wrote:

Otto Wyss wrote:

If built a simple login page and store any information within
$_SESSION's. Yet I'd like to move these into cookies but I always get
an error about sent headers. Is there a way to circumvent this
problem without changing too much in the page?

The setting of the cookies happens just at the end of the page.

  if (!$errortext and $Anmelden) {
if (!empty($Permanent)) {
  $expires = time()+ 365 * 86400;  // 365 days
  setcookie ("l.Lastname", $_SESSION['l_Lastname'], $expires);
  setcookie ("l.Firstname", $_SESSION['l_Firstname'], $expires);
  setcookie ("l.Email1", $_SESSION['l_Email1'], $expires);
  setcookie ("l.Email2", $_SESSION['l_Email2'], $expires);
}
echo "
  parent.location.replace('$index_php";
  ";
exit;
  }

O. Wyss


ob_start() might help


--
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] Cookies and sent headers

2007-08-18 Thread Bastien Koert


The commands start and use an output buffer, a chunk of memory that stores all 
the output on the server until the ob_flush, the buffer flush, function is 
called. You need to be aware that in high load situations this may adversly 
affect performance since it loads the servers memory, also be aware that you 
may hit a memory limit for large pages. This is server / OS depandant so you 
may want to read up on server documentation

bastien




> To: php-general@lists.php.net; [EMAIL PROTECTED]
> Date: Sat, 18 Aug 2007 16:39:29 +0200
> From: [EMAIL PROTECTED]
> CC: [EMAIL PROTECTED]; php-general@lists.php.net
> Subject: Re: [PHP] Cookies and sent headers
> 
> ob_start() at the beginning and ob_end_flush() at the end of the PHP 
> section seems to do the trick albeit I've still problems to understand 
> why. The description in the manual is rather sparse unfortunately. Is 
> there any more information about what's going on?
> 
> O. Wyss
> 
> Wouter van Vliet / Interpotential wrote:
> > You best option would be to go through all of your include'd or require'd
> > files and make sure there is no whitespace before and after you open your
> > php tags. Those are often the cause for such problems. The easy way would
> > indeed be to use output buffering. In that case, put the call to ob_start();
> > on the first line of the file you're calling. You will still have to make
> > sure to not have any whitespace before your  > 
> > To even bypass that, the output_buffering ini setting might be useful. Alter
> > it in your php.ini if you can, otherwise try your apache vhost configuration
> > or .htaccess. The syntax there is:
> > 
> >  php_flag output_buffering On
> > 
> > Good luck!
> > 
> > On 18/08/07, Kelvin Park  wrote:
> >> Kelvin Park wrote:
> >>> Otto Wyss wrote:
>  If built a simple login page and store any information within
>  $_SESSION's. Yet I'd like to move these into cookies but I always get
>  an error about sent headers. Is there a way to circumvent this
>  problem without changing too much in the page?
> 
>  The setting of the cookies happens just at the end of the page.
> 
>    if (!$errortext and $Anmelden) {
>  if (!empty($Permanent)) {
>    $expires = time()+ 365 * 86400;  // 365 days
>    setcookie ("l.Lastname", $_SESSION['l_Lastname'], $expires);
>    setcookie ("l.Firstname", $_SESSION['l_Firstname'], $expires);
>    setcookie ("l.Email1", $_SESSION['l_Email1'], $expires);
>    setcookie ("l.Email2", $_SESSION['l_Email2'], $expires);
>  }
>  echo "";
>  exit;
>    }
> 
>  O. Wyss
> 
> >>> ob_start() might help
> >>>
> >> --
> >> 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
> 

_
Discover the new Windows Vista
http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Cookies and sent headers

2007-08-18 Thread M. Sokolewicz
On a sidenote, 99% of the world never calls ob_flush (or any such 
function) since PHP flushes the buffer automatically at the end of its 
execution.


The reason why setting cookies for you doesn't work is because of the 
way a HTTP response is structured. It consists of 2 parts: header and 
body separated by 2 new lines (\n\n). It is _required_ that _all_ 
headers come _before_ the body. Cookies are actually headers (a 
set-cookie: [...] header) aswell as any headers set via php's header() 
function. Any output made by the script (be it a single whitespace, a 
bunch of text, etc.) will automatically flush the headers, followed by 
the separator (\n\n) followed by the specified output. After that has 
been sent, everything outputted will be dumped into the body of the 
response (simply because you can't "go back" to the headers which were 
already sent earlier), so you can't set cookies (which are headers 
themselves).


So, why does output buffering help here? Simply put, instead of dumping 
headers and any other output directly to the client, PHP buffers it all 
into memory. As such, since it hasn't been sent yet, PHP can still 
alter/add headers even though it also has body-output. Once it receives 
the command, PHP will send all headers, the separator and the output to 
the client. This is done when PHP encounters an ob_flush or ob_end_flush 
call, _and_ when the script has finished execution automatically.


The documentation seems pretty clear to me, however, if you feel it 
should be clarified better, feel free to send a patch to the 
[EMAIL PROTECTED] list.


- Tul


Bastien Koert wrote:


The commands start and use an output buffer, a chunk of memory that stores all 
the output on the server until the ob_flush, the buffer flush, function is 
called. You need to be aware that in high load situations this may adversly 
affect performance since it loads the servers memory, also be aware that you 
may hit a memory limit for large pages. This is server / OS depandant so you 
may want to read up on server documentation

bastien





To: php-general@lists.php.net; [EMAIL PROTECTED]
Date: Sat, 18 Aug 2007 16:39:29 +0200
From: [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]; php-general@lists.php.net
Subject: Re: [PHP] Cookies and sent headers

ob_start() at the beginning and ob_end_flush() at the end of the PHP 
section seems to do the trick albeit I've still problems to understand 
why. The description in the manual is rather sparse unfortunately. Is 
there any more information about what's going on?


O. Wyss

Wouter van Vliet / Interpotential wrote:

You best option would be to go through all of your include'd or require'd
files and make sure there is no whitespace before and after you open your
php tags. Those are often the cause for such problems. The easy way would
indeed be to use output buffering. In that case, put the call to ob_start();
on the first line of the file you're calling. You will still have to make
sure to not have any whitespace before your  > 
To even bypass that, the output_buffering ini setting might be useful. Alter

it in your php.ini if you can, otherwise try your apache vhost configuration
or .htaccess. The syntax there is:

 php_flag output_buffering On

Good luck!

On 18/08/07, Kelvin Park  wrote:

Kelvin Park wrote:

Otto Wyss wrote:

If built a simple login page and store any information within
$_SESSION's. Yet I'd like to move these into cookies but I always get
an error about sent headers. Is there a way to circumvent this
problem without changing too much in the page?

The setting of the cookies happens just at the end of the page.

  if (!$errortext and $Anmelden) {
if (!empty($Permanent)) {
  $expires = time()+ 365 * 86400;  // 365 days
  setcookie ("l.Lastname", $_SESSION['l_Lastname'], $expires);
  setcookie ("l.Firstname", $_SESSION['l_Firstname'], $expires);
  setcookie ("l.Email1", $_SESSION['l_Email1'], $expires);
  setcookie ("l.Email2", $_SESSION['l_Email2'], $expires);
}
echo "";
exit;
  }

O. Wyss


ob_start() might help


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



_
Discover the new Windows Vista
http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE


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



RE: [PHP] Cookies and sent headers

2007-08-18 Thread Sanjeev N
Hi,
Its not the problem of cookies. Its problem of redirection or the
parent.location.replace function. I mean if you already output something on
the page and tries to redirect then this problem happens.

Redirect before outputting anything on the page.. like space is also an
output.

Warm Regards,
Sanjeev
http://www.sanchanworld.com/
http://webdirectory.sanchanworld.com - Submit your website URL
http://webhosting.sanchanworld.com - Choose your best web hosting plan
-Original Message-
From: Otto Wyss [mailto:[EMAIL PROTECTED] 
Sent: Saturday, August 18, 2007 2:56 PM
To: php-general@lists.php.net
Subject: [PHP] Cookies and sent headers

If built a simple login page and store any information within 
$_SESSION's. Yet I'd like to move these into cookies but I always get an 
error about sent headers. Is there a way to circumvent this problem 
without changing too much in the page?

The setting of the cookies happens just at the end of the page.

   if (!$errortext and $Anmelden) {
 if (!empty($Permanent)) {
   $expires = time()+ 365 * 86400;  // 365 days
   setcookie ("l.Lastname", $_SESSION['l_Lastname'], $expires);
   setcookie ("l.Firstname", $_SESSION['l_Firstname'], $expires);
   setcookie ("l.Email1", $_SESSION['l_Email1'], $expires);
   setcookie ("l.Email2", $_SESSION['l_Email2'], $expires);
 }
 echo "
   parent.location.replace('$index_php";
   ";
 exit;
   }

O. Wyss

-- 
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 Session And Cookies

2007-08-18 Thread Sanjeev N
Hi Kelvin,
You can use the session for your ecommerce website..
Cookies also good, but if it is disabled then it is of no use.

I basically use session variable to particular member for accessing his
data.

Warm Regards,
Sanjeev
http://www.sanchanworld.com/
http://webdirectory.sanchanworld.com - Submit your website URL
http://webhosting.sanchanworld.com - Choose your best web hosting plan

-Original Message-
From: Kelvin Park [mailto:[EMAIL PROTECTED] 
Sent: Saturday, August 18, 2007 3:32 AM
To: php-general@lists.php.net
Subject: [PHP] About Session And Cookies

I am trying to setup a secure login system.
I've heard that if I use just cookies for login, members without cookie 
turned out won't be able to see the member pages.

Is using session recommended for e-commerce websites with shopping carts?
Or, using both of them might be more effective in some way.

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



Re: [PHP] html to jpeg conversion.

2007-08-18 Thread brian

Bindu Walia wrote:

Hi,
   I am looking for  a way to convert a html page to a jpeg image. The html
page is a file with images and text. Could someone please suggest a method
or point me to any existing work on this?



Keep in mind that any server-side application that can create 
screenshots will require its own HTML/CSS engine in order to interpret 
the markup. Gecko would seem to be the way to go but i don't know of any 
PHP scripts that interface with it. I believe there's been some work 
done with Java.


Or, if you can install KDE on the server (really not a great idea) you 
could use kwebdesktop, which uses Konqueror's layout engine to create 
PNGs (a better choice for this than JPEG, IMO).


brian

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



[PHP] Photo upload framework/library for PHP

2007-08-18 Thread Steve Finkelstein
Hi all,

Can anyone suggest a photo upload/framework type library I can incorporate
seamlessly into a PHP project I'm working on?

I'd like for users to have an elegant UI to upload photos of their vehicles
into my application. Mutli-file and progress bars would be a plus. I'm
looking to integrate this code using the Code Igniter framework.

Thanks all for any suggestions.

- sf


[PHP] Capturing shell command output.

2007-08-18 Thread shiplu
HI,
I am working on a PHP project that interacts with command  line utilities.
My php is running by apache. Means I am not running any php CLI.

here is the function that I am using for capturing command output.

function run_command($comamnd){
$ret=`$command 1> COMMAND.OUT 2>1`;
$contents=get_file_contents("COMMAND.OUT");
return $contents;
}

The function does not work. If I use any shell command like ls, cat,
echo, set. it works.
But If I use any utility like, mpg321, cd-info. It does not work. It
outputs a blank string.
I used system(), passthru() with both "2&>1" and "2>1". But no out put.
All the time, its blank.
Even I used a shell script "run.sh"
run.sh contents:
=
#!/bin/sh
sh COMMAND 1> COMMAND.OUT 2&>1
cat COMMAND.OUT
echo 0 > COMMAND
=

I called this script by this function
function run_command($command){
   $h=fopen("COMMAND","w");
   fwrite($h,$command);
   fclose($h);
   ob_start();
   passthru("./run.sh");
   $ret = ob_get_contents();
   ob_end_clean();
   return $ret;
}

and by this.

function run_command($command){
   $h=fopen("COMMAND","w");
   fwrite($h,$command);
   fclose($h);
   return system("./run.sh");
}

Please help me. or show me some way.


-- 
shout at http://shiplu.awardspace.com/

Available for Hire/Contract/Full Time

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



Re: [PHP] Capturing shell command output.

2007-08-18 Thread Wouter van Vliet / Interpotential
You may want to look into shell_exec, which executes a command and returns
the output. If you're accepting arguments from user input, don't forget
proper use of escapeshellcmd and escapeshellarg ;-).

Something else that might cause your commands from failing, is that the
utilities are not inside apache's PATH - trying to call them by there
absolute filename can help out. Have you inspected your error_log? There
often tends to be a lot of useful stuff in there.

Good luck!
Wouter

On 18/08/07, shiplu <[EMAIL PROTECTED]> wrote:
>
> HI,
> I am working on a PHP project that interacts with command  line utilities.
> My php is running by apache. Means I am not running any php CLI.
>
> here is the function that I am using for capturing command output.
>
> function run_command($comamnd){
> $ret=`$command 1> COMMAND.OUT 2>1`;
> $contents=get_file_contents("COMMAND.OUT");
> return $contents;
> }
>
> The function does not work. If I use any shell command like ls, cat,
> echo, set. it works.
> But If I use any utility like, mpg321, cd-info. It does not work. It
> outputs a blank string.
> I used system(), passthru() with both "2&>1" and "2>1". But no out put.
> All the time, its blank.
> Even I used a shell script "run.sh"
> run.sh contents:
> =
> #!/bin/sh
> sh COMMAND 1> COMMAND.OUT 2&>1
> cat COMMAND.OUT
> echo 0 > COMMAND
> =
>
> I called this script by this function
> function run_command($command){
>$h=fopen("COMMAND","w");
>fwrite($h,$command);
>fclose($h);
>ob_start();
>passthru("./run.sh");
>$ret = ob_get_contents();
>ob_end_clean();
>return $ret;
> }
>
> and by this.
>
> function run_command($command){
>$h=fopen("COMMAND","w");
>fwrite($h,$command);
>fclose($h);
>return system("./run.sh");
> }
>
> Please help me. or show me some way.
>
>
> --
> shout at http://shiplu.awardspace.com/
>
> Available for Hire/Contract/Full Time
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Interpotential.com
Phone: +31615397471


Re: [PHP] Photo upload framework/library for PHP

2007-08-18 Thread Wouter van Vliet / Interpotential
I often use MCImageManager, by moxiecode:
http://tinymce.moxiecode.com/paypal/item_imagemanager.php. Integrates well
into tinyMCE, but can be used without that as well.

I'm not entirely sure it's what you are looking for, but I think it very
well may be. And if it doesn't help you now, it may do so at some other
point ;-)

On 18/08/07, Steve Finkelstein <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> Can anyone suggest a photo upload/framework type library I can incorporate
> seamlessly into a PHP project I'm working on?
>
> I'd like for users to have an elegant UI to upload photos of their
> vehicles
> into my application. Mutli-file and progress bars would be a plus. I'm
> looking to integrate this code using the Code Igniter framework.
>
> Thanks all for any suggestions.
>
> - sf
>



-- 
Interpotential.com
Phone: +31615397471


[PHP] getting from one table listing from another

2007-08-18 Thread Nate
I know this is kinda crazy but I need it :P
I have one table that lists name's
and I have another table that has the name's and points
I want to know how to list the name's of the first table by the points
of the second table

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



Re: [PHP] Cookies and sent headers

2007-08-18 Thread M. Sokolewicz

bullshit,

what he sees is a warning emitted by PHP, his redirect is done using 
JavaScript (which is clientside and has no, 0.0 effect on what PHP 
emits). Now, I'm not going to go into how redirecting that way won't 
work (or at least shouldn't), but a hint would be to do it properly 
using header('Location: [...]') instead.


- Tul


Sanjeev N wrote:

Hi,
Its not the problem of cookies. Its problem of redirection or the
parent.location.replace function. I mean if you already output something on
the page and tries to redirect then this problem happens.

Redirect before outputting anything on the page.. like space is also an
output.

Warm Regards,
Sanjeev
http://www.sanchanworld.com/
http://webdirectory.sanchanworld.com - Submit your website URL
http://webhosting.sanchanworld.com - Choose your best web hosting plan
-Original Message-
From: Otto Wyss [mailto:[EMAIL PROTECTED] 
Sent: Saturday, August 18, 2007 2:56 PM

To: php-general@lists.php.net
Subject: [PHP] Cookies and sent headers

If built a simple login page and store any information within 
$_SESSION's. Yet I'd like to move these into cookies but I always get an 
error about sent headers. Is there a way to circumvent this problem 
without changing too much in the page?


The setting of the cookies happens just at the end of the page.

   if (!$errortext and $Anmelden) {
 if (!empty($Permanent)) {
   $expires = time()+ 365 * 86400;  // 365 days
   setcookie ("l.Lastname", $_SESSION['l_Lastname'], $expires);
   setcookie ("l.Firstname", $_SESSION['l_Firstname'], $expires);
   setcookie ("l.Email1", $_SESSION['l_Email1'], $expires);
   setcookie ("l.Email2", $_SESSION['l_Email2'], $expires);
 }
 echo "
   parent.location.replace('$index_php";
   ";
 exit;
   }

O. Wyss



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



Re: [PHP] getting from one table listing from another

2007-08-18 Thread Stephen Johnson
You might try sending this to a group that is more orientated towards data
basing.. Since that seems to be what your asking about...



On 8/18/07 3:53 PM, "Nate" <[EMAIL PROTECTED]> wrote:

> I know this is kinda crazy but I need it :P
> I have one table that lists name's
> and I have another table that has the name's and points
> I want to know how to list the name's of the first table by the points
> of the second table

-- 
Stephen Johnson
The Lone Coder

http://www.myonlinepros.com
*How can we help you today?*

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--

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



RE: [PHP] getting from one table listing from another

2007-08-18 Thread Jay Blanchard
[snip]
I know this is kinda crazy but I need it :P
I have one table that lists name's
and I have another table that has the name's and points
I want to know how to list the name's of the first table by the points
of the second table
[/snip]

Not crazy, pretty standard from a database point of view;

SELECT a.name, b.points 
FROM table a LEFT OUTER JOIN table b
ON(a.name = b.name)

This only works if the name in table a matches a name in table b.

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



[PHP] Delete row in a lookup table

2007-08-18 Thread nitrox .


Hi all,
Is it not considered good practice to have a primary key on a lookup table for 
a database?
I have 3 tables setup, games, memberleagues and members. The memberleagues 
table holds the id of the games table and members table. The problem I have is 
that Im not sure how to delete a row from the memberleagues table without a 
primary key. If its not considered bad practice I could add a primary key to 
the memberleagues table and be done. Anybody have any tutorials on how to write 
the php for this?
_
Messenger Café — open for fun 24/7. Hot games, cool activities served daily. 
Visit now.
http://cafemessenger.com?ocid=TXT_TAGLM_AugWLtagline

Fwd: [PHP] Cookies and sent headers

2007-08-18 Thread Kelvin Park
-- Forwarded message --
From: Kelvin Park <[EMAIL PROTECTED]>
Date: Aug 18, 2007 4:34 PM
Subject: Re: [PHP] Cookies and sent headers
To: "M. Sokolewicz" <[EMAIL PROTECTED]>

the javascript code can definitely change to head("location: whatever.php")
for redirection, if that's the solution, that would be the way to go, but if
you're encountering quite similar problems later you can try ob_start() or
whatever that was recommended in the comments before M. Sokolewicz's
bullshitting comment.

On 8/18/07, M. Sokolewicz <[EMAIL PROTECTED]> wrote:
>
> bullshit,
>
> what he sees is a warning emitted by PHP, his redirect is done using
> JavaScript (which is clientside and has no, 0.0 effect on what PHP
> emits). Now, I'm not going to go into how redirecting that way won't
> work (or at least shouldn't), but a hint would be to do it properly
> using header('Location: [...]') instead.
>
> - Tul
>
>
> Sanjeev N wrote:
> > Hi,
> > Its not the problem of cookies. Its problem of redirection or the
> > parent.location.replace function. I mean if you already output something
> on
> > the page and tries to redirect then this problem happens.
> >
> > Redirect before outputting anything on the page.. like space is also an
> > output.
> >
> > Warm Regards,
> > Sanjeev
> > http://www.sanchanworld.com/
> > http://webdirectory.sanchanworld.com - Submit your website URL
> > http://webhosting.sanchanworld.com - Choose your best web hosting plan
> > -Original Message-
> > From: Otto Wyss [mailto:[EMAIL PROTECTED]
> > Sent: Saturday, August 18, 2007 2:56 PM
> > To: php-general@lists.php.net
> > Subject: [PHP] Cookies and sent headers
> >
> > If built a simple login page and store any information within
> > $_SESSION's. Yet I'd like to move these into cookies but I always get an
>
> > error about sent headers. Is there a way to circumvent this problem
> > without changing too much in the page?
> >
> > The setting of the cookies happens just at the end of the page.
> >
> >if (!$errortext and $Anmelden) {
> >  if (!empty($Permanent)) {
> >$expires = time()+ 365 * 86400;  // 365 days
> >setcookie ("l.Lastname", $_SESSION['l_Lastname'], $expires);
> >setcookie (" l.Firstname", $_SESSION['l_Firstname'], $expires);
> >setcookie ("l.Email1", $_SESSION['l_Email1'], $expires);
> >setcookie ("l.Email2", $_SESSION['l_Email2'], $expires);
> >  }
> >  echo "
> >parent.location.replace('$index_php";
> >";
> >  exit;
> >}
> >
> > O. Wyss
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Delete row in a lookup table

2007-08-18 Thread Larry Garfield
Whether or not it's good practice depends on who you ask. :-)  

Every table should have a primary key.  Primary keys, however, may span 
multiple columns.  That's perfectly legal.  In some cases that primary key 
may span every column, but generally that's a sign of bad design unless 
you're talking about a table that just relates one table to another (many to 
many relation).

The question is whether it's better to have a surrogate key[1].  That is, a 
unique integer value that has no meaning itself beyond being a unique key.  
For example, in pretty much any authentication system the username will be 
unique, and therefore could easily be used as the primary key.  Other tables, 
then, would reference back to the user table using the username as the 
foreign key.  

There's pros and cons to surrogate keys over "natural" keys.  See more links 
below that I don't feel like repeating[2].  

Personaly I tend toward surrogate keys in most cases for entities, but not for 
relationships.  In your case, then, no, I would not have a surrogate key on 
the membersleagues table.  Instead I'd define (game_id, member_id) as the 
primary key.  You can absolutely then DELETE from membersleagues WHERE 
game_id=4 AND member_id=3.  Or just delete by one or the other.  You don't 
have to have a primary key defined in order to be able to DELETE, it's just 
frequently simpler if you do.  You can write a WHERE clause on anything.

In practice, I generally find it easier to do a delete/rebuild than to try and 
track an extra surrogate key.  That is, I'd do something like:

$db->query("DELETE FROM foo WHERE thing_id=5");
foreach ($foo->things as $thing_id) {
  $db->query("INSERT INTO foo (foo_id, thing_id) VALUES (5, $thing_id)");
}

(Actually I wouldn't do that.  I'd use prepared statements because just 
inserting the variable into the string like that is a security risk.  Don't 
do it.  It's just easier to explain without the prepared statement for now.)

That should be fine unless $foo->things is rather large or is very frequently 
edited (for some defintions of large and frequent).

Cheers.

[1] http://en.wikipedia.org/wiki/Surrogate_key

[2]
http://www.bcarter.com/intsurr1.htm
http://r937.com/20020620.html
http://articles.techrepublic.com.com/5100-22-1045050.html

On Saturday 18 August 2007, nitrox . wrote:
> Hi all,
> Is it not considered good practice to have a primary key on a lookup table
> for a database? I have 3 tables setup, games, memberleagues and members.
> The memberleagues table holds the id of the games table and members table.
> The problem I have is that Im not sure how to delete a row from the
> memberleagues table without a primary key. If its not considered bad
> practice I could add a primary key to the memberleagues table and be done.
> Anybody have any tutorials on how to write the php for this?
> _
> Messenger Café — open for fun 24/7. Hot games, cool activities served
> daily. Visit now. http://cafemessenger.com?ocid=TXT_TAGLM_AugWLtagline


-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

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



Re: [PHP] Cookies and sent headers

2007-08-18 Thread Otto Wyss

M. Sokolewicz wrote:
On a sidenote, 99% of the world never calls ob_flush (or any such 
function) since PHP flushes the buffer automatically at the end of its 
execution.


I'll keep the ob_end_flush just for showing what's going on, but thanks 
for the hint.


The reason why setting cookies for you doesn't work is because of the 
way a HTTP response is structured. It consists of 2 parts: header and 
body separated by 2 new lines (\n\n). It is _required_ that _all_ 
headers come _before_ the body. Cookies are actually headers (a 
set-cookie: [...] header) aswell as any headers set via php's header() 
function. Any output made by the script (be it a single whitespace, a 
bunch of text, etc.) will automatically flush the headers, followed by 
the separator (\n\n) followed by the specified output. After that has 
been sent, everything outputted will be dumped into the body of the 
response (simply because you can't "go back" to the headers which were 
already sent earlier), so you can't set cookies (which are headers 
themselves).



Thanks, now it's understandable.

So, why does output buffering help here? Simply put, instead of dumping 
headers and any other output directly to the client, PHP buffers it all 
into memory. As such, since it hasn't been sent yet, PHP can still 
alter/add headers even though it also has body-output. Once it receives 
the command, PHP will send all headers, the separator and the output to 
the client. This is done when PHP encounters an ob_flush or ob_end_flush 
call, _and_ when the script has finished execution automatically.


The documentation seems pretty clear to me, however, if you feel it 
should be clarified better, feel free to send a patch to the 
[EMAIL PROTECTED] list.


- Tul


O. Wyss

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



[PHP] Redirection with header (was Re: [PHP] Cookies and sent headers)

2007-08-18 Thread Otto Wyss

M. Sokolewicz wrote:

emits). Now, I'm not going to go into how redirecting that way won't
work (or at least shouldn't), but a hint would be to do it properly
using header('Location: [...]') instead.


I'm aware that using Javascript within a PHP code block doesn't seems
logical yet I haven't known header ('Location...). In my case I could 
easilly do without redirection but just exit and fall back on the 
calling page. Yet I want to remove the login page from the browser 
history. Does the header function have the same effect?


O. Wyss

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