php-general Digest 2 Feb 2008 09:29:32 -0000 Issue 5270

2008-02-02 Thread php-general-digest-help

php-general Digest 2 Feb 2008 09:29:32 - Issue 5270

Topics (messages 268543 through 268558):

Re: Search function not working...
268543 by: Jim Lucas

Posting Summary for Week Ending 1 February, 2008: [EMAIL PROTECTED]
268544 by: PostTrack [Dan Brown]

Calling All Opinionated  
268545 by: Jochem Maas
268546 by: Warren Vail
268547 by: Eric Butera
268548 by: Greg Donald
268549 by: Mr Webber
268550 by: Jochem Maas
268555 by: Paul Scott

Re: Timeout while waiting for a server-client transfer to  start (large files)
268551 by: szalinski
268552 by: Casey

Re: PEAR website and MSIE 6 (M$ forcing IE7)
268553 by: Daevid Vincent
268556 by: mike

Redirecting STDERR to a file?
268554 by: js
268557 by: Per Jessen
268558 by: js

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

Jason Pruim wrote:
So I said in another thread that I would be asking another question 
about functions... So here it goes, I am attempting to write a function 
to search the database, which used to work just fine when I wrote it 
without using a function (Would that be considered static?) Now that I 
am attempting to rewrite my stuff so I can reuse the code, now it's not 
working... Here is what I used to do and it worked just fine:



$qstring = SELECT * FROM .$table. WHERE FName like '%$search%' or 
LName like '%$search%' or Add1 like '%$search%' or Add2 like '%$search%' 
or City like '%$search%' or State like '%$search%' or Zip like 
'%$search%' or XCode like '%$search%';

if ($_SESSION['search'] != NULL){
echo The search string is: strong$search/strong.BR;
$qrow[]= mysql_query($qstring) or die(mysql_error());
$qresult = $qrow[0];
$num_rows = mysql_num_rows($qresult);
//display search form
echo 
form action='search.php' method='GET'
labelSearch:
input type='text' name='search' id='search' /
/label
input type='submit' value='Go!' /
/form;



echo HTML

a href='index.php'Return to database/A
PTotal Records found: {$num_rows}/P
A href='excelexport.php'Export selection to excel/A
form method='GET' action='edit.php'
table border='1'
tr
tha href='?order=a'First Name/A/th
thA href='?order=b'Last Name/A/th
thA href='?order=c'Address Line 1/A/th
THA href='?order=d'Address Line 2/A/th
THA href='?order=e'City/A/th
thA href='?order=f'State/A/th
thA href='?order=g'Zip/A/th
THA href='?order=h'Code/A/th
thA href='?order=i'ID #/A/th
THEdit/th
thDelete/th
/tr
   
HTML;

echo Just testing: .$_SESSION['search'];
while($qrow = mysql_fetch_assoc($qresult)) {
//Display the search results using heredoc syntax
echo HTML

tr
   
td{$qrow['FName']}/td

td{$qrow['LName']}/td
td{$qrow['Add1']}/td
td{$qrow['Add2']}/td
td{$qrow['City']}/td
td{$qrow['State']}/td
td{$qrow['Zip']}/td
td{$qrow['XCode']}/td
td{$qrow['Record']}/td
tda href='edit.php?Record={$qrow['Record']}'Edit/a/td
tda href='delete.php?Record={$qrow['Record']}'Delete/a/td
/tr

/form

HTML;

Now, here is what I have as a function and is not working:

?PHP
$FName =;
$LName =;
$Add1 = ;
$Add2 = ;
//$_SESSION['search'] = $_GET['search'];
function search($searchvar, $table, $num_rows, $FName, $LName, 
$Add1, $Add2) {
$qstring = SELECT * FROM .$table. WHERE FName like '%$searchvar%' 
or LName like '%$searchvar%' or Add1 like '%$searchvar%' or Add2 like 
'%$searchvar%' or City like '%$searchvar%' or State like '%$searchvar%' 
or Zip like '%$searchvar%' or XCode like '%$searchvar%';

$qrow[]= mysql_query($qstring) or die(mysql_error());
$qresult = $qrow[0];
$num_rows = mysql_num_rows($qresult);
//while($qrow = mysql_fetch_assoc($qresult)) {   
   
$FName = $qrow['FName'];

$LName = $qrow['LName'];
$Add1 = $qrow['Add1'];
$Add2 = $qrow['Add2'];



return;

}

?


And what happens, is first of all it displays the entire database on the 
search page, which I'm kind of okay with... But when you search, it 
updates the variables, and echo's out the right search term, but it 
doesn't update the database to only show the search results... I think 
it might be tied to it displaying the entire database at page load... 
But I'm not sure.. Anyone have an idea of what I did wrong other then 
everything? :)



Oh, and as far as calling the function I do this: search($searchvar, 
$table, $num_rows, $FName, $LName, $Add1, 

php-general Digest 2 Feb 2008 23:04:30 -0000 Issue 5271

2008-02-02 Thread php-general-digest-help

php-general Digest 2 Feb 2008 23:04:30 - Issue 5271

Topics (messages 268559 through 268577):

Re: Redirecting STDERR to a file?
268559 by: Per Jessen
268562 by: js
268563 by: Per Jessen
268564 by: js
268565 by: Richard Heyes

Location in php's source for ini-values
268560 by: ehl lhe
268567 by: Nathan Rixham
268571 by: ehl lhe
268573 by: Daniel Brown

Re: PEAR website and MSIE 6 (M$ forcing IE7)
268561 by: Richard Heyes

Re: Calling All Opinionated  
268566 by: Nathan Rixham

Jacco van Hooren
268568 by: Nathan Rixham

PHPPDO 1.0RC1 released
268569 by: Nikolay Ananiev
268572 by: Larry Garfield
268574 by: Nikolay Ananiev

Server to client file transfer with authorization: file always corrupt
268570 by: szalinski

how can make like http://wallpaper.pc86.com ?
268575 by: RandMan
268576 by: dg

Re: PEAR website and MSIE 6
268577 by: Shawn McKenzie

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---
js wrote:

 nohup would work in some ways, but that's not a real daemon
 because the process will have tty, in a session and has a process
 group. I like to have a real daemon.

Well, it depends on what you're after.  Are you solving a problem or are
you doing an exercise because you can? 

If you're solving a problem, and my nohup suggestion isn't sufficient,
just write your daemon in C.  If it's an exercise, take a look at
proc_open().


/Per Jessen, Zürich
---End Message---
---BeginMessage---
Hi Per,

  nohup would work in some ways, but that's not a real daemon
  because the process will have tty, in a session and has a process
  group. I like to have a real daemon.

 Well, it depends on what you're after.  Are you solving a problem or are
 you doing an exercise because you can?

Not an exercise. This is for my day job...

 If you're solving a problem, and my nohup suggestion isn't sufficient,
 just write your daemon in C.  If it's an exercise, take a look at
 proc_open().

C would be the last resort. I suppose it would be easily done in Perl,
but most of my colleagues prefer PHP.
I love to make taking over the code easy, so PHP is more preferable to me.

I took your advice and tried proc_open, but it seems blocking the
parent process.
 (BTW, I didn't know this function, thanks!)

I've already spent a lot of time solving this, os might beter to give
up this problem
and go for the other solution...

Anyway, thanks for you help.
I do appreciate it very much.
---End Message---
---BeginMessage---
js wrote:

 C would be the last resort. I suppose it would be easily done in Perl,
 but most of my colleagues prefer PHP.
 I love to make taking over the code easy, so PHP is more preferable to
 me.

That makes perfect sense, but sometimes PHP is not the best/right
answer. 

What I think you need to do is: 

parent:   fork() your child process, then do whatever. 
child:use proc_open to call your program and redirect stderr. 



/Per Jessen, Zürich
---End Message---
---BeginMessage---
  C would be the last resort. I suppose it would be easily done in Perl,
  but most of my colleagues prefer PHP.
  I love to make taking over the code easy, so PHP is more preferable to
  me.

 That makes perfect sense, but sometimes PHP is not the best/right
 answer.

 What I think you need to do is:

 parent:   fork() your child process, then do whatever.
 child:use proc_open to call your program and redirect stderr.

That's kind of odd, but seems to be the only way to workaround this...
Thanks for you help.
---End Message---
---BeginMessage---

C would be the last resort. I suppose it would be easily done in Perl,
but most of my colleagues prefer PHP.
I love to make taking over the code easy, so PHP is more preferable to
me.

That makes perfect sense, but sometimes PHP is not the best/right
answer.

What I think you need to do is:

parent:   fork() your child process, then do whatever.
child:use proc_open to call your program and redirect stderr.


That's kind of odd, but seems to be the only way to workaround this...
Thanks for you help.


Having come to this rather late, I recently wrote some code that may be 
of some help to you which forks processes: 
http://www.phpguru.org/downloads/pcntl/


You need pcntl and it only works on *nix (I understand). It does make 
fork()ing somewhat easier though. Be careful of defunct processes though.


--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and Helpdesk software for £299pa hosted for you -
no installation, no maintenance, new features automatic and free
---End Message---
---BeginMessage---

hello,


I'd like to know where PHP finally sets the php.ini-values 

Re: [PHP] Redirecting STDERR to a file?

2008-02-02 Thread Per Jessen
js wrote:

 I was trying to write a script  in PHP that takes a program name
 as an argument and invoke it as a daemon.
 PHP provides fork(pcntl_fork), setsid(posix_setsid) and umask,
 so it was easy.
 However, I couldn't find a way  to redirect STDERR a file.
 I like to have the daemon write its log to its  own logfile, like
 apache and mysql do.

I think nohup program 2errorlog will do what you're after.


/Per Jessen, Zürich

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



Re: [PHP] Redirecting STDERR to a file?

2008-02-02 Thread js
nohup would work in some ways, but that's not a real daemon
because the process will have tty, in a session and has a process group.
I like to have a real daemon.

On Feb 2, 2008 5:25 PM, Per Jessen [EMAIL PROTECTED] wrote:
 js wrote:

  I was trying to write a script  in PHP that takes a program name
  as an argument and invoke it as a daemon.
  PHP provides fork(pcntl_fork), setsid(posix_setsid) and umask,
  so it was easy.
  However, I couldn't find a way  to redirect STDERR a file.
  I like to have the daemon write its log to its  own logfile, like
  apache and mysql do.

 I think nohup program 2errorlog will do what you're after.


 /Per Jessen, Zürich

 --
 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] Redirecting STDERR to a file?

2008-02-02 Thread Per Jessen
js wrote:

 nohup would work in some ways, but that's not a real daemon
 because the process will have tty, in a session and has a process
 group. I like to have a real daemon.

Well, it depends on what you're after.  Are you solving a problem or are
you doing an exercise because you can? 

If you're solving a problem, and my nohup suggestion isn't sufficient,
just write your daemon in C.  If it's an exercise, take a look at
proc_open().


/Per Jessen, Zürich

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



[PHP] Location in php's source for ini-values

2008-02-02 Thread ehl lhe

hello,


I'd like to know where PHP finally sets the php.ini-values in it's sourcecode, 
e.g. max_execution_time, open_basedir, etc...
What I need is to set several static values which must not be editable using 
php.ini, .htaccess, ini_set, or whatever - so I simply need to set final values 
for several php.ini-settings by modifying the php sourcecode...


regards,
ehl22
_
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PEAR website and MSIE 6 (M$ forcing IE7)

2008-02-02 Thread Richard Heyes

Feb 12th is D-day.


[Microsoft] has posted guidelines on how to ward off the automatic update

Not exactly forcing if they've provided an alternative.

--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and Helpdesk software for £299pa hosted for you -
no installation, no maintenance, new features automatic and free

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



Re: [PHP] Redirecting STDERR to a file?

2008-02-02 Thread js
Hi Per,

  nohup would work in some ways, but that's not a real daemon
  because the process will have tty, in a session and has a process
  group. I like to have a real daemon.

 Well, it depends on what you're after.  Are you solving a problem or are
 you doing an exercise because you can?

Not an exercise. This is for my day job...

 If you're solving a problem, and my nohup suggestion isn't sufficient,
 just write your daemon in C.  If it's an exercise, take a look at
 proc_open().

C would be the last resort. I suppose it would be easily done in Perl,
but most of my colleagues prefer PHP.
I love to make taking over the code easy, so PHP is more preferable to me.

I took your advice and tried proc_open, but it seems blocking the
parent process.
 (BTW, I didn't know this function, thanks!)

I've already spent a lot of time solving this, os might beter to give
up this problem
and go for the other solution...

Anyway, thanks for you help.
I do appreciate it very much.

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



Re: [PHP] Redirecting STDERR to a file?

2008-02-02 Thread Per Jessen
js wrote:

 C would be the last resort. I suppose it would be easily done in Perl,
 but most of my colleagues prefer PHP.
 I love to make taking over the code easy, so PHP is more preferable to
 me.

That makes perfect sense, but sometimes PHP is not the best/right
answer. 

What I think you need to do is: 

parent:   fork() your child process, then do whatever. 
child:use proc_open to call your program and redirect stderr. 



/Per Jessen, Zürich

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



Re: [PHP] Redirecting STDERR to a file?

2008-02-02 Thread js
  C would be the last resort. I suppose it would be easily done in Perl,
  but most of my colleagues prefer PHP.
  I love to make taking over the code easy, so PHP is more preferable to
  me.

 That makes perfect sense, but sometimes PHP is not the best/right
 answer.

 What I think you need to do is:

 parent:   fork() your child process, then do whatever.
 child:use proc_open to call your program and redirect stderr.

That's kind of odd, but seems to be the only way to workaround this...
Thanks for you help.

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



Re: [PHP] Redirecting STDERR to a file?

2008-02-02 Thread Richard Heyes

C would be the last resort. I suppose it would be easily done in Perl,
but most of my colleagues prefer PHP.
I love to make taking over the code easy, so PHP is more preferable to
me.

That makes perfect sense, but sometimes PHP is not the best/right
answer.

What I think you need to do is:

parent:   fork() your child process, then do whatever.
child:use proc_open to call your program and redirect stderr.


That's kind of odd, but seems to be the only way to workaround this...
Thanks for you help.


Having come to this rather late, I recently wrote some code that may be 
of some help to you which forks processes: 
http://www.phpguru.org/downloads/pcntl/


You need pcntl and it only works on *nix (I understand). It does make 
fork()ing somewhat easier though. Be careful of defunct processes though.


--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and Helpdesk software for £299pa hosted for you -
no installation, no maintenance, new features automatic and free

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



[PHP] Re: Calling All Opinionated ******** ....

2008-02-02 Thread Nathan Rixham

Jochem Maas wrote:

hi people,

I'm in the market for a new framework/toolkit/whatever-you-want-to-call-it.
I've been taking a good hard look at the Zend Framework - if nothing 
else the docs

are very impressive.

I'd like to hear from people who have or are using ZF with regard to their
experiences, dislikes, likes, problems, new found fame and fortune, etc 
... but

only if it concerns ZF.

I don't need to hear stuff like 'use XYZ it's great' - finding php 
frameworks/CMS/etc
is easy ... figuring out which are best of breed is another matter, if 
only because
it involves reading zillions of lines of code and documentation. besides 
I find that
you only ever get bitten in the ass by short-comings and bugs when your 
80% into the
project that needs to be online yesterday and you knee deep in a 
nightmare requirements

change or tackling some PITA performance issue.

so people, roll out your ZF love stories and nightmares - spare no 
details - share the

knowledge. or something :-)

tia,
Jochem


Jochem,

You develop sites in php, zend make php, zend have a framework, so that 
may aswell be the php framework - it's great, well coded, doc'd and 
stable, and doesn't try to do anything too fancy.


At the end of the day the ZF framework is a developer's framework, use 
it if you want to make sensible, structured OO php applications to a 
high standard, use something else if you want to quickly make it'll do 
applications in an webdev sweat shop.


ps: get zend studio and integrate it with svn aswell - zend studio cuts 
hours out your dev time.


Nathan

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



[PHP] Re: Location in php's source for ini-values

2008-02-02 Thread Nathan Rixham

ehl lhe wrote:

hello,


I'd like to know where PHP finally sets the php.ini-values in it's sourcecode, 
e.g. max_execution_time, open_basedir, etc...
What I need is to set several static values which must not be editable using 
php.ini, .htaccess, ini_set, or whatever - so I simply need to set final values 
for several php.ini-settings by modifying the php sourcecode...


regards,
ehl22
_
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


can't see any need for this? just set your webserver up with the 
appropriate permissions and you don't have a problem..


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



[PHP] Jacco van Hooren

2008-02-02 Thread Nathan Rixham
wish he'd turn that auto responder off.. *sigh* - he's now top of my 
contacts in gtalk..


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



[PHP] PHPPDO 1.0RC1 released

2008-02-02 Thread Nikolay Ananiev
Hi guys,
I've just released phppdo-1.0RC1. From the readme:

PHPPDO is a database abstraction layer over the current PHP database 
functions,
which aim is to offer a migration path for new applications to the PDO 
classes
presented in PHP 5.1.

Why a migration path?
Currently, most hosting providers offering a shared hosting do not include
support for PDO in their PHP5 enabled web servers. That means most web
developers are stuck with the old database functions and can't migrate to 
PDO.
PHPPDO makes such a migration possible by providing a PDO-like API interface
over the old database functions. After using PHPPDO, a migration to PDO 
afterwards
is a matter of changing a single line of code (this can even be automatic,
when the script detects PDO).

Downloading PHPPDO
http://sourceforge.net/project/showfiles.php?group_id=216242

For more info visit:
http://www.devuni.com/forums/viewforum.php?f=24

Testers needed :) 

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



[PHP] Server to client file transfer with authorization: file always corrupt

2008-02-02 Thread szalinski

Hi

I am having trouble with a file transfer script, as you can see, I am
trying trying to keep the code as simple as possible.

But everytime I download a file with it, it is corrupt. For example, when
I download a small .rar file, just to test, it is always corrupt
('Unexpected end of archive'). I also cleared my browser cache just to be
sure, but same problem.

I just can't get my head around why it wouldn't be working as it is...

A couple of questions:

Have I got too many header requests?
Do I need to worry about output buffering, which is possibly corrupting
the file output (if so, please tell me what to do!)?
Is there an easier way to get returned response header and get a
redirected link, instead of finding and cutting strings?
Is there maybe something wrong with the structure or order of the header
requests, and/or returned headers etc?

Here is what I have so far:

?php

//ob_start();
//ob_end_flush();
//ob_implicit_flush(TRUE);

$rslogin = '';
$rspass = '';
$link = addslashes(trim($_POST['link']));

function cut_str($str, $left, $right)
  {
  $str = substr(stristr($str, $left), strlen($left));
  $leftLen = strlen(stristr($str, $right));
  $leftLen = $leftLen ? -($leftLen) : strlen($str);
  $str = substr($str, 0, $leftLen);
  return $str;
  }

// Get the full premium link, and store it in $full_link after the
redirect. *Surely* there is an easier way to get redirections?

if(strlen($link)0)
{
$url = @parse_url($link);
$fp = @fsockopen($url['host'], 80, $errno, $errstr);
if (!$fp)
{
$errormsg = Error: b$errstr/b, please try again later.;
echo $errormsg;
exit;
}

$vars = dl.start=PREMIUMuri={$url['path']}directstart=1;
$out = POST {$url['path']} HTTP/1.1\r\n;
$out .= Host: {$url['host']}\r\n;
$out .= User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows
NT 5.1)\r\n;
$out .= Authorization: Basic
.base64_encode({$rslogin}:{$rspass}).\r\n;
$out .= Content-Type: application/x-www-form-urlencoded\r\n;
$out .= Content-Length: .strlen($vars).\r\n;
$out .= Connection: Close\r\n\r\n;
fwrite($fp, $out);
fwrite($fp, $out.$vars);
while (!feof($fp))
{
$string .= fgets($fp, 256);
}
 //Tell us what data is returned
 //print($string);
@fclose($fp);

if (stristr($string, Location:))
{
$redirect = trim(cut_str($string, Location:, \n));
$full_link = addslashes(trim($redirect));
}

//print($string);
//print(htmlbodyh1.$full_link./h1);



if ($full_link)

{

//Get info about the file we want to download:

$furl = parse_url($full_link);
$fvars = dl.start=PREMIUMuri={$furl['path']}directstart=1;
$head = Host: {$furl['host']}\r\n;
$head .= User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT
5.1)\r\n;
$head .= Authorization: Basic
.base64_encode({$rslogin}:{$rspass}).\r\n;
$head .= Content-Type: application/x-www-form-urlencoded\r\n;
$head .= Content-Length: .strlen($fvars).\r\n;
$head .= Connection: close\r\n\r\n;
$fp = @fsockopen($furl['host'], 80, $errno, $errstr);
if (!$fp)
{
echo The script says b$errstr/b, please try again later.;
exit;
}
fwrite($fp, POST {$furl['path']}  HTTP/1.1\r\n);
fwrite($fp, $head.$fvars);
while (!feof($fp))
{
//Keep reading the info until we get the filename and size from
the returned Header - is there no easy way
//of doing this? I also don't like the way I have to 'find' the
redirected link (above).??
$tmp .= fgets($fp, 256);
$d = explode(\r\n\r\n, $tmp);

// I tried changing this to if ($d), { etc..,  (instead of
$d[1]) and the download of the rar file *wasn't* corrupt, it just had a
filetype of x-rar-compressed instead of
//application/octet-stream, and the filesize was 'unknown' -
now this is just confusing me...!  So i think (and guess) the problem of
the file corruption is here,
//because it must add some data to the filestream which
corrupts it. Darn.
if($d[1])
{
preg_match(#filename=(.+?)\n#, $tmp, $fname);
preg_match(#Content-Length: (.+?)\n#, $tmp, $fsize);
$h['filename'] = $fname[1] !=  ? $fname[1] :
basename($furl['path']);
$h['fsize'] = $fsize[1];
break;
}

}
@fclose($fp);

$filename = $h['filename'];
$fsize = $h['fsize'];

//Now automatically download the file:

@header(Cache-Control:);
@header(Cache-Control: public);
@header(Content-Type: application/octet-stream);
@header(Content-Disposition: attachment; 

[PHP] Re: Location in php's source for ini-values

2008-02-02 Thread ehl lhe

please, don't ask me why I need this - I know exactly why I need it and why 
there is no other solution...
 
 
thanks anyway,
regards
ehl22
_
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHPPDO 1.0RC1 released

2008-02-02 Thread Larry Garfield
On Saturday 02 February 2008, Nikolay Ananiev wrote:
 Hi guys,
 I've just released phppdo-1.0RC1. From the readme:

 PHPPDO is a database abstraction layer over the current PHP database
 functions,
 which aim is to offer a migration path for new applications to the PDO
 classes
 presented in PHP 5.1.

 Why a migration path?
 Currently, most hosting providers offering a shared hosting do not include
 support for PDO in their PHP5 enabled web servers. That means most web
 developers are stuck with the old database functions and can't migrate to
 PDO.

Do you have a source for that?  Any web host running a stock PHP 5.1 or later 
will have PDO.  They'd have to go to extra effort not to, at which point 
they're not a host worth using.  (The same applies to SPL, PCRE, XML, and a 
bunch of other optional but default extension that only a suicidal web host 
would disable.)

-- 
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] Location in php's source for ini-values

2008-02-02 Thread Daniel Brown
On Feb 2, 2008 6:09 AM, ehl lhe [EMAIL PROTECTED] wrote:

 hello,


 I'd like to know where PHP finally sets the php.ini-values in it's 
 sourcecode, e.g. max_execution_time, open_basedir, etc...
 What I need is to set several static values which must not be editable using 
 php.ini, .htaccess, ini_set, or whatever - so I simply need to set final 
 values for several php.ini-settings by modifying the php sourcecode...

That's a question that's better asked on the Internals list.  Ask
on there and you'll probably get the answer you're looking for much
quicker.

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

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



[PHP] Re: PHPPDO 1.0RC1 released

2008-02-02 Thread Nikolay Ananiev

Larry Garfield [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Saturday 02 February 2008, Nikolay Ananiev wrote:
 Hi guys,
 I've just released phppdo-1.0RC1. From the readme:

 PHPPDO is a database abstraction layer over the current PHP database
 functions,
 which aim is to offer a migration path for new applications to the PDO
 classes
 presented in PHP 5.1.

 Why a migration path?
 Currently, most hosting providers offering a shared hosting do not 
 include
 support for PDO in their PHP5 enabled web servers. That means most web
 developers are stuck with the old database functions and can't migrate to
 PDO.

 Do you have a source for that?  Any web host running a stock PHP 5.1 or 
 later
 will have PDO.  They'd have to go to extra effort not to, at which point
 they're not a host worth using.  (The same applies to SPL, PCRE, XML, and 
 a
 bunch of other optional but default extension that only a suicidal web 
 host
 would disable.)

I can't give you exact numbers. I'm working for a web development company 
and
many of our clients have shared hosting. Since PHP 5.1 is out, the best I've 
seen is
PDO with SQLite driver and nothing more. The reason
to create PHPPDO is because our framework makes
heavy use of PDO and we need to mimic PDO for hosts that don't have it or
don't have the required driver. 

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



[PHP] how can make like http://wallpaper.pc86.com ?

2008-02-02 Thread RandMan
how can make like http://wallpaper.pc86.com ?

look like XP file manager, any body have idea ?
i feel this so simple, but i have't any direction

thank you ! 

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



Re: [PHP] how can make like http://wallpaper.pc86.com ?

2008-02-02 Thread dg

Looks like Treeview

http://developer.yahoo.com/yui/treeview/


On Feb 2, 2008, at 1:33 PM, RandMan wrote:


how can make like http://wallpaper.pc86.com ?

look like XP file manager, any body have idea ?
i feel this so simple, but i have't any direction

thank you !

--
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] PEAR website and MSIE 6

2008-02-02 Thread Shawn McKenzie
Glad I read threads that I don't care about or I wouldn't have found out
about Firebug!  I just installed it, very cool!

Also, considering the price of oil/gas, I'm sorry that the 'war for oil'
didn't work out the way we had hoped.  You would have thought we would
have learned in WWII when we started the 'war for strudel'.  Have you
seen the price of strudel?  It went up during WWII and has continued to
rise.

I would call you a dumb ass, but you seem very knowledgeable in PHP and
I may need some help in the future :-)


Jochem Maas wrote:
 Daevid Vincent schreef:
  

 -Original Message-
 From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: Thursday,
 January 31, 2008 8:19 AM
 To: [EMAIL PROTECTED]
 Cc: PHP General List
 Subject: Re: [PHP] PEAR website and MSIE 6

 Richard Heyes schreef:
 firefox not an option?
 Nope.

   or anything else that resembles a proper browser ;-)

 Strange, IE has been working fine for me for the last eight years...

 Yes. http://pear.php.net crashes my IE6 too. This is a problem with the
 site, not the browser.
 seriously though - why is FF (or any other browser) not an option? your
 a web developer, I would imagine you should be running a complete
 arsenal of
 different browsers as part of the job, no?
 and then there's the question as to why you don't upgrade to IE7.

 Please stop with the browser wars.
 
 it's not browser wars - it's pragmatism - thinking aloud about how to
 get round the issue - I'm assuming Richard does have access to the PEAR
 site's
 source files or the means to upload them to the PEAR webserver.
 
  They're boring and tired and serve no
 purpose. IE6 is fast and launches in 1 second. FF takes many seconds.
 IE7 is
 also a bloated pig and I will be very sad in 15 days when M$ FORCES
 everyone
 to it. IE also has very nice DirectX rendering filters for gradients.
  
 or maybe rebuild the windows machine in question (hey it wouldn't be
 the first time something
 like this was helped by a clean install right?)

 It is NOT the OS. It is the PEAR site itself that is to blame. There is
 clearly some code or tag or something that is causing this failure. 
 
 let's see now - a webserver outputs some content, it may be invalid. a
 browser
 crashes upon trying to render the content. hmm, sounds to me like the
 problem is
 in the browser, decent software should crash because of shitty input.
 
 granted if the PEAR just didn't render properly or caused 'invalid
 XML/XHTML/whatever'
 message in the browser then yes it would be the site's problem. but
 until the browser
 is capable of saying 'hey this content is junk, I can't use it [because
 of XYZ]' then
 really the first issue is with that browser.
 
 it's same at the server end - if your browser (or you, maliciously)
 posts freaking/invalid
 byte sequences at some script I've got on the server then would you
 consider it correct
 that the server crashed? or would you expect some kind of 'your input
 sucks' error
 message to appear?
 
 It
 didn't used to be there either. I've gone to the PEAR site many times
 in the
 past. The site isn't even that compex, so I'm curious why the webmaster
 couldn't just fix this problem and make everyone happy? 
 
 we work around bugs and problems all day in the job we do - how is
 cranking up a
 different browser because a site happens not to work with a particular
 site any different?
 
 if we're really about making everyone happy - how about we tackle something
 serious like the whole 'war for oil' business? exactly how fragile is a
 human mind if
 a browser crashing on a particular site is deciding factor in being
 capable of
 experiencing happiness? (not that I'm suggesting this about Richard - Im
 sure he
 was just a little miffed and ping'ed the question out of curiousity more
 than anything)
 
 Or is the PHP
 community so snobbish that they're turning into the Linux community?
 I find it so ironic that all the fringe browser people freak out if their
 browser isn't supported by some site and demand retribution, yet when the
 tables are turned how quick they are to tell 80% of the world to use a
 20%
 browser...
 
 let's make it sound like they all *chose* IE shall we - a large majority
 of that 80% actually think IE *is* the internet, they certainly didn't
 choose it
 because they thought it was the best tool for the job (which it may or
 may not
 be depending or circumstance and/or perspective) - indoctrination and
 ignorance
 do not make good metrics for determining the superiority of a given
 product ...
 keyboard layout being another fine example ... de facto not necessarily
 equal da bom
 

 *sigh*
 
 indeed

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



[PHP] Re: Server to client file transfer with authorization: file always corrupt

2008-02-02 Thread Nathan Rixham

szalinski wrote:

Hi

I am having trouble with a file transfer script, as you can see, I am
trying trying to keep the code as simple as possible.

But everytime I download a file with it, it is corrupt. For example, when
I download a small .rar file, just to test, it is always corrupt
('Unexpected end of archive'). I also cleared my browser cache just to be
sure, but same problem.

I just can't get my head around why it wouldn't be working as it is...

A couple of questions:

Have I got too many header requests?
Do I need to worry about output buffering, which is possibly corrupting
the file output (if so, please tell me what to do!)?
Is there an easier way to get returned response header and get a
redirected link, instead of finding and cutting strings?
Is there maybe something wrong with the structure or order of the header
requests, and/or returned headers etc?

Here is what I have so far:

?php

//ob_start();
//ob_end_flush();
//ob_implicit_flush(TRUE);

$rslogin = '';
$rspass = '';
$link = addslashes(trim($_POST['link']));

function cut_str($str, $left, $right)
  {
  $str = substr(stristr($str, $left), strlen($left));
  $leftLen = strlen(stristr($str, $right));
  $leftLen = $leftLen ? -($leftLen) : strlen($str);
  $str = substr($str, 0, $leftLen);
  return $str;
  }

// Get the full premium link, and store it in $full_link after the
redirect. *Surely* there is an easier way to get redirections?

if(strlen($link)0)
{
$url = @parse_url($link);
$fp = @fsockopen($url['host'], 80, $errno, $errstr);
if (!$fp)
{
$errormsg = Error: b$errstr/b, please try again later.;
echo $errormsg;
exit;
}

$vars = dl.start=PREMIUMuri={$url['path']}directstart=1;
$out = POST {$url['path']} HTTP/1.1\r\n;
$out .= Host: {$url['host']}\r\n;
$out .= User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows
NT 5.1)\r\n;
$out .= Authorization: Basic
.base64_encode({$rslogin}:{$rspass}).\r\n;
$out .= Content-Type: application/x-www-form-urlencoded\r\n;
$out .= Content-Length: .strlen($vars).\r\n;
$out .= Connection: Close\r\n\r\n;
fwrite($fp, $out);
fwrite($fp, $out.$vars);
while (!feof($fp))
{
$string .= fgets($fp, 256);
}
 //Tell us what data is returned
 //print($string);
@fclose($fp);

if (stristr($string, Location:))
{
$redirect = trim(cut_str($string, Location:, \n));
$full_link = addslashes(trim($redirect));
}

//print($string);
//print(htmlbodyh1.$full_link./h1);



if ($full_link)

{

//Get info about the file we want to download:

$furl = parse_url($full_link);
$fvars = dl.start=PREMIUMuri={$furl['path']}directstart=1;
$head = Host: {$furl['host']}\r\n;
$head .= User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT
5.1)\r\n;
$head .= Authorization: Basic
.base64_encode({$rslogin}:{$rspass}).\r\n;
$head .= Content-Type: application/x-www-form-urlencoded\r\n;
$head .= Content-Length: .strlen($fvars).\r\n;
$head .= Connection: close\r\n\r\n;
$fp = @fsockopen($furl['host'], 80, $errno, $errstr);
if (!$fp)
{
echo The script says b$errstr/b, please try again later.;
exit;
}
fwrite($fp, POST {$furl['path']}  HTTP/1.1\r\n);
fwrite($fp, $head.$fvars);
while (!feof($fp))
{
//Keep reading the info until we get the filename and size from
the returned Header - is there no easy way
//of doing this? I also don't like the way I have to 'find' the
redirected link (above).??
$tmp .= fgets($fp, 256);
$d = explode(\r\n\r\n, $tmp);

// I tried changing this to if ($d), { etc..,  (instead of
$d[1]) and the download of the rar file *wasn't* corrupt, it just had a
filetype of x-rar-compressed instead of
//application/octet-stream, and the filesize was 'unknown' -
now this is just confusing me...!  So i think (and guess) the problem of
the file corruption is here,
//because it must add some data to the filestream which
corrupts it. Darn.
if($d[1])
{
preg_match(#filename=(.+?)\n#, $tmp, $fname);
preg_match(#Content-Length: (.+?)\n#, $tmp, $fsize);
$h['filename'] = $fname[1] !=  ? $fname[1] :
basename($furl['path']);
$h['fsize'] = $fsize[1];
break;
}

}
@fclose($fp);

$filename = $h['filename'];
$fsize = $h['fsize'];

//Now automatically download the file:

@header(Cache-Control:);
@header(Cache-Control: public);
@header(Content-Type: application/octet-stream);
@header(Content-Disposition: attachment; 

[PHP] Re: how can make like http://wallpaper.pc86.com ?

2008-02-02 Thread Jonesy
On Sun, 3 Feb 2008 04:33:57 +0800, RandMan wrote:
 how can make like http://wallpaper.pc86.com ?

Hell!  Why would you want to?

http://validator.w3.org/#validate_by_uri
Validation Output: 26 Errors

Pretty much renders as crap in 4 different browsers here.

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



Re: [PHP] PEAR website and MSIE 6

2008-02-02 Thread Jochem Maas

Shawn McKenzie schreef:

Glad I read threads that I don't care about or I wouldn't have found out
about Firebug!  I just installed it, very cool!


it can definitely make your day less painful :-)



Also, considering the price of oil/gas, I'm sorry that the 'war for oil'
didn't work out the way we had hoped.  You would have thought we would
have learned in WWII when we started the 'war for strudel'.  Have you
seen the price of strudel?  It went up during WWII and has continued to
rise.


I'm not much a strudel fan, unfortunately I'm just as hooked on oil as the next
man ... the point I was making is that alot of the 'problems' encountered in
'cyberspace' aqre pretty lame compared to the crap going on in meatspace.

the iraqi that just watched his wife and children mowed down by 'friendly fire'
probably doesn't care too much that pear.php.net crashes IE6.


I would call you a dumb ass, but you seem very knowledgeable in PHP and
I may need some help in the future :-)


nuff people would agree with you on the first part, some might credit me
with the second part and here's hoping I can offer some help of the third
part happens to pass.

credit given for a smarty comment ... appreciated :-)

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



[PHP] using the mail() command

2008-02-02 Thread Ron Piggott
When I use the mail($email, $subject, $message, $headers); command I
assign the value of $message as follows:

$boundary = md5(uniqid(time()));

$message = 

--$boundary
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

blah

--$boundary
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

bBlah/bp

--$boundary--
;

I would like to be able to include a  in my message body --- both the
HTML and text version --- how can I accomplish this?  (I use a  to
assign the value of $subject).  I have been able to get \ to work ---
but \ shows when reading the e-mail, not just the .

Thanks for your help

Ron

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



Re: [PHP] using the mail() command

2008-02-02 Thread Ron Piggott
Thanks for the new command and help.  It worked!  Ron

On Sat, 2008-02-02 at 19:46 -0500, Greg Bowser wrote:
 First off, I would use heredoc syntax so you don't need to escape the
 quotes:
 
 $message = EOF
 blah blah blah
 $your $stuff
 $here
 
 '
 \ blah blah
 
 EOF;
 
 Also, since you're using text/html as your content-type, you should
 probably be using quot; instead of .
 
 --Greg

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



[PHP] how to make multiple website on one host

2008-02-02 Thread jeffry s
i am wondering whether this can be done. i know it can.
is it possible to make one website with the ability to host multiple
website.
it is something like website generator. eg: www.shopify.org

let say for example i have a website www.example.org.
i can point a domain name (www.example1.org) to the server where
www.example.org hosted,
and when user visit www.example1.org, it execute the same scripts as
www.example.org with
with different themes and website configuration.

anyone have the idea?

thanks


Re: [PHP] how to make multiple website on one host

2008-02-02 Thread Larry Garfield
You can, in your code, check the $_SERVER super-global to see what domain name 
was requested.  You can then branch your code however you need to, just as 
you can for any other conditional.

Have a look at the Drupal framework, which includes that exact feature.  

On Sunday 03 February 2008, jeffry s wrote:
 i am wondering whether this can be done. i know it can.
 is it possible to make one website with the ability to host multiple
 website.
 it is something like website generator. eg: www.shopify.org

 let say for example i have a website www.example.org.
 i can point a domain name (www.example1.org) to the server where
 www.example.org hosted,
 and when user visit www.example1.org, it execute the same scripts as
 www.example.org with
 with different themes and website configuration.

 anyone have the idea?

 thanks


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