php-general Digest 20 Jun 2007 14:47:21 -0000 Issue 4859
Topics (messages 257472 through 257493):
Re: pdf and send to printer question
257472 by: Frank Arensmeier
Re: PHP calling an ISAPI Extension
257473 by: Tijnema
257478 by: Jochem Maas
Pixy - An Open-Source Vulnerability Scanner for PHP Applications
257474 by: Nenad Jovanovic
PHP error catching
257475 by: "Miguel J. Jiménez"
257476 by: Stut
Threading
257477 by: Darren Whitlen
257479 by: Richard Heyes
Re: patched
257480 by: martin.bugs.unl.edu.ar
strtotime returns 00:00 for 7am
257481 by: Phil Princely
Re: If statement duplicating mysql records?
257482 by: Jason Pruim
257483 by: Jason Pruim
257492 by: Jim Lucas
Date
257484 by: Ron Piggott
257485 by: Stut
257486 by: Jim Moseby
257487 by: Jim Moseby
257488 by: Zoltán Németh
257489 by: Fredrik Thunberg
257490 by: Dan Shirah
Re: Hey, where can i get your chat script?
257491 by: Daniel Brown
Re: Chat system
257493 by: Daniel Brown
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]
----------------------------------------------------------------------
--- Begin Message ---
Mike. I would start by confirming that the pdf library has been
enabled/loaded successfully. Call phpinfo() and look for the pdf
library. It should be there. Since I am on Mac OS X, I am not sure
what php_cpdf.dll/php_pdf.dll really is (pdflib? - why two
libraries?). Anyway, the error you get indicates that the pdf
extension hasn't been loaded successfully. Did you restart the server
after enabling it?
Regarding the printing issue, assuming that you are on Windows, there
is a PECL extension called php_printer.dll that should do what you want.
For download: http://pecl4win.php.net/ext.php/php_printer.dll
Documentation: http://se2.php.net/manual/en/ref.printer.php
//frank
19 jun 2007 kl. 22.43 skrev Mike Ryan:
I am trying to get a query to run and outputed to a pdf file I get the
following error
Fatal error: Call to undefined function pdf_begin_document()
in my php.ini I have php_cpdf.dll and php_pdf.dll enabled am I missing
something.?
also is there a way to send the document I create to the printer
instead of
the screen?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On 6/19/07, Dan <[EMAIL PROTECTED]> wrote:
I modified your code to work with what I'm doing and this is what I got:
$post_data = "name=wow&likes=true";
$fp = fsockopen("localhost",8080);
fwrite($fp,"POST /Project1.dll HTTP/1.1\r\nHost:
localhost\r\nContent-Length:
".strlen($post_data)."\r\n\r\n".$post_data);
Is all above on one single line, or is it split across lines like here
in the email. It should be all on a single line.
$result = fread($fp,102400); // Reads 100KB, change if you need more
echo $result;
Now when I try that I get a "Bad Request invalid header name" error.
I have an IIS server running localy on port 8080, the Project1.dll is in the
root directory, it contains two input components 1 a textfield to type your
name, the other a checkbox called likes. What's wrong? Here's it's code:
<snip code>
It has nothing to do with your code, you have made an invalid request,
if the above is correct, then the Host: header must be wrong, I'm not
sure what it should be for localhost, but if above doesn't work, try
127.0.0.1.
Tijnema
"Tijnema" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On 6/19/07, Jim Lucas <[EMAIL PROTECTED]> wrote:
>> Dan wrote:
>> > I wish I could, I can't count on the script being on a linux machine.
>> > I
>> > also can't expect people to rebuild PHP with the curl library just to
>> > use my script. Is there any other way to do a post to a page from a
>> > php
>> > function?
>> >
>> > - Daniel
>> >
>> > "Jim Lucas" <[EMAIL PROTECTED]> wrote in message
>> > news:[EMAIL PROTECTED]
>> >> Dan wrote:
>> >>> I would normaly do it with an AJAX call but I need to do a post from
>> >>> WITHIN a PHP function, so when it's doing php stuff
>> >>> ex.
>> >>> function something()
>> >>> {
>> >>> echo 'whatever';
>> >>> $response = post some data to a ISAPI Extension eg. post to
>> >>> http://domain.com/scripts/app.dll
>> >>> return $response . "other data";
>> >>> }
>> >>>
>> >>>
>> >>> ""Jay Blanchard"" <[EMAIL PROTECTED]> wrote in message
>> >>> news:[EMAIL PROTECTED]
>> >>> [snip]
>> >>> I'm in need of a way to contact an ISAPI Extension from a PHP
>> >>> function.
>> >>> Does anyone know how I would be able to do this? Usually you would
>> >>> post
>> >>> a
>> >>> page to their URL/actionname. Can I do a POST from a PHP function
>> >>> without
>> >>> reloading the page, and get a result back? That's one tall order.
>> >>> Anyone
>> >>> want to give it a shot?
>> >>> [/snip]
>> >>>
>> >>> Do the POST with an AJAX call
>> >>
>> >> perform an ajax call the a php script that calls curl to do a post to
>> >> the ISAPI extension
>> >>
>> >> --
>> >> Jim Lucas
>> >>
>> >> "Some men are born to greatness, some achieve greatness,
>> >> and some have greatness thrust upon them."
>> >>
>> >> Twelfth Night, Act II, Scene V
>> >> by William Shakespeare
>> >
>> The only method that I am aware of is the fsockopen method you mention in
>> your other email
>>
>> --
>> Jim Lucas
>
> Yes, and what's wrong with it?
> <?php
> $post_data = "form_a=1&form_b=4";
> $fp = fsockopen("www.domain.com",80);
> fwrite($fp,"POST /scripts/app.dll HTTP/1.1\r\nHost:
> www.domain.com\r\nContent-Length:
> ".strlen($post_data)."\r\n\r\n".$post_data);
> $result = fread($fp,102400); // Reads 100KB, change if you need more
> ?>
>
> That's not too long is it?
>
> Tijnema
>>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Dan wrote:
> I've looked arround and I can't find any mention of ISAPI COM, it's a
> pretty low level way of making applications,
it would be upto the ISAPI code to 'publish' a COM interface to its
functionality. in php you merely start a COM session by creating a COM object
that inits the functionality offered by the ISAPI code by way of the passed in
'modulename'
... the functionality available via the php COM object interface is dependent on
whatever the ISAPI exposes via COM.
try also searching for ISAPI and OLE combinations.
I'll be honest and say that I'm just stabbing in the dark, but it just seems
right that
you should be able to talk to the ISAPI interface somehow withit involve the
network stack
or HTTP.
goodluck.
> you used to be able to
> install PHP itself as a COM application on IIS to do PHP stuff.
>
> Is there any sort of compatiblity list for com?
not sure what you mean.
>
> - Daniel
>
> "Jochem Maas" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> Dan wrote:
>>> For example, I could use function fsockopen but that seems like it would
>>> probably be pretty slow doing all that, and if there's a php function or
>>> small script that would be preferable over the 50/60 lines you would
>>> need to do it properly with fsockopen.
>>
>> with the caveat that it'll only work as a GET request (which probably
>> means no cigar for you),
>> and requires that your php is setup to allow open urls (ini setting
>> 'allow_url_fopen')
>>
>> $response =
>> file_get_contents('http://your.iis.machine/some/path/some_isapi.dll?foo=bar');
>>
>>
>> otherwise the fsockopen() route is all that seems to be open to you,
>> given that curl reliance
>> is a no-no. - the biggest factor in the response speed is likely to be
>> the server at the other
>> end (assuming the network connection between the 2 machines is
>> generally ok), so if things
>> are slow you might consider caching the results locally (again,
>> assuming that this is feasable.)
>>
>> is the isapi extension on the same machine?
>> if so maybe it has a COM interface with which you can talk to it?
>>
>> http://php.net/com
>>
>> no idea if that is feasible - I've never really used IIS, let alone
>> had to deal with isapi extensions.
>>
>>>
>>> - Daniel
>>>
>>> ""Jay Blanchard"" <[EMAIL PROTECTED]> wrote in message
>>> news:[EMAIL PROTECTED]
>>> [snip]
>>> I'm in need of a way to contact an ISAPI Extension from a PHP function.
>>> Does anyone know how I would be able to do this? Usually you would post
>>> a
>>> page to their URL/actionname. Can I do a POST from a PHP function
>>> without
>>> reloading the page, and get a result back? That's one tall order.
>>> Anyone
>>> want to give it a shot?
>>> [/snip]
>>>
>>> Do the POST with an AJAX call
>
--- End Message ---
--- Begin Message ---
The Secure Systems Lab at the Technical University of Vienna has released the
newest version of Pixy, an open-source vulnerability scanner. Here are some of
the highlights:
- detection of SQL injection and XSS vulnerabilities in PHP source code
- automatic resolution of file inclusions
- computation of dependence graphs that help you understand the causes of
reported vulnerabilities
- static analysis engine (flow-sensitive, interprocedural, context-sensitive)
- platform-independent (written in Java)
Pixy can be downloaded for free from http://pixybox.seclab.tuwien.ac.at/. There,
you can also find a web interface that allows you to test Pixy online. Enjoy!
We would be happy to receive feedback, comments, and other contributions! Please
send your suggestions to "pixy-tool at seclab" (domain see below).
Nenad Jovanovic
Secure Systems Lab
Technical University of Vienna
http://www.seclab.tuwien.ac.at/
--- End Message ---
--- Begin Message ---
Hi. I have been asked to try to catch the php error generated when the
PHP script exceed execution time, but I do not know if that can be
done... Any ideas? Mainly I want to show a custimized error page instead
of that error (kind of "Sorry but we are busy right now" or something
similar)
Thanks.
--
.---------------------------------------------------------------------.
| Miguel J. Jiménez |
| Programador Senior |
| Área de Internet/XSL/PHP |
| [EMAIL PROTECTED] |
:---------------------------------------------------------------------:
| ISOTROL, S.A. |
| Edificio BLUENET, Avda. Isaac Newton nº3, 4ª planta. |
| Parque Tecnológico Cartuja '93, 41092 Sevilla (ESP). |
| Teléfono: +34 955 036 800 - Fax: +34 955 036 849 |
| http://www.isotrol.com |
:---------------------------------------------------------------------:
| "The dark side lives within all of us, from the most primitive |
| species, to the most highly evolved." |
| Da'an, Earth Final Conflict |
'---------------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
Miguel J. Jiménez wrote:
Hi. I have been asked to try to catch the php error generated when the
PHP script exceed execution time, but I do not know if that can be
done... Any ideas? Mainly I want to show a custimized error page instead
of that error (kind of "Sorry but we are busy right now" or something
similar)
Depends what the error is. See http://php.net/set_error_handler for details.
-Stut
--
http://stut.net/
--- End Message ---
--- Begin Message ---
I'm currently creating a socket cerver class, similar to Twisted for
python. I have a simple socket server working now, but would like to
extend it using threads.
I've done a fair bit of research on threads in PHP in the past, but
coming up to the conclusion that there is no way to have real multi
threading in PHP.
Would anybody here know of any way to use threads in PHP that I may have
missed? I'm hoping to find a way that would work on most OS's without
any major changes.
Darren
--- End Message ---
--- Begin Message ---
I've done a fair bit of research on threads in PHP in the past, but
coming up to the conclusion that there is no way to have real multi
threading in PHP.
There's no way full stop.
> Would anybody here know of any way to use threads in PHP that I may
> have missed? I'm hoping to find a way that would work on most OS's
> without any major changes.
You could look iinto using ticks or forking new processes using pcntl,
but that's the limit.
--
Richard Heyes
0844 801 1072
http://www.websupportsolutions.co.uk
Knowledge Base and HelpDesk software
--- End Message ---
--- Begin Message ---
See the file.
--- End Message ---
--- Begin Message ---
Hi all
I'm new to this list. I hope this hasn't been discussed already.
using this code:
function test_time($time_string) {
echo strftime("%X %A, %b %e\n", strtotime($time_string));
}
test_time('now');
test_time('4pm + 2 Hours');
test_time('now + 2 fortnights');
test_time('last Monday');
test_time('tomorrow');
test_time('5am tomorrow');
test_time('7am 12 days ago');
gives this output:
21:46:18 Wednesday, Jun 20
18:00:00 Wednesday, Jun 20
21:46:18 Wednesday, Jul 18
00:00:00 Monday, Jun 18
00:00:00 Thursday, Jun 21
00:00:00 Thursday, Jun 21
07:00:00 Friday, Jun 8
I'm wondering why the 2nd and 3rd last both give 00:00 as the
time. Especially why 5am tomorrow doesn't work. Using PHP5.
Thanks
Phil P.
--- End Message ---
--- Begin Message ---
On Jun 19, 2007, at 5:10 PM, Roberto Mansfield wrote:
Jason Pruim wrote:
Okay, so I have a question... Probably pretty easy, but why would
my if
statement show more records then what are in the database?
if($row[5] =='Level4'){ // White Highlight
}// End of Level 4
else
{// Green Highlight
}// End of Unclassified
If I have a record that matches Level4 it will display both with the
$Level4 color and the $unclassified color. Ideally it would only
show up
under the $Level4 category if it's Level4... If that makes sense.
I don't think IF is the culprit. I'm guessing you have a bad join in
your sql query so you are getting back more records than you expect.
Have you run the query directly in to see what your results are?
Hi Roberto,
Thanks for the reply! The query I'm using to grab the records from
MySQL is a very simple one:
$sql = "SELECT * FROM tasks WHERE completed='0' order by id";
I don't totally understand yet why it happened, but Jim's suggestion
worked great.
Thanks though!
Roberto
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On Jun 19, 2007, at 4:20 PM, Jim Lucas wrote:
Jason Pruim wrote:
Okay, so I have a question... Probably pretty easy, but why would
my if statement show more records then what are in the database?
if($row[5] =='Level4'){ // White Highlight
echo "<TR><TD bgcolor=".$Level4.">$row[0] </td>";
echo "<td bgcolor=".$Level4.">$row[1] </td>";
echo "<td bgcolor=".$Level4."><A href ='$row
[2]'>Instructions</A></td>";
echo "<TD bgcolor=".$Level4."><A href='update.php?
taskid=$row[0]'>Click here!</A>";
}// End of Level 4
else
{// Green Highlight
echo "<TR><TD bgcolor=".$unclassified.">$row[0] </td>";
echo "<td bgcolor=".$unclassified.">$row[1] </td>";
echo "<td bgcolor=".$unclassified."><A href ='$row
[2]'>Instructions</A></td>";
echo "<TD bgcolor=".$unclassified."><A
href='update.php?taskid=$row[0]'>Click here!</A>";
}// End of Unclassified
Why not do it this way instead.
while( $row = mysql_fetch_array($results) ) {
$rowColor = $unclassified;
// White Highlight
if($row[5] =='Level4'){
$rowColor = $Level4;
}
echo "<TR><TD bgcolor=".$rowColor.">$row[0] </td>";
echo "<td bgcolor=".$rowColor.">$row[1] </td>";
echo "<td bgcolor=".$rowColor."><A href='$row[2]'>Instructions</
A></td>";
echo "<TD bgcolor=".$rowColor."><A href='update.php?taskid=$row
[0]'>Click here!</A>";
}
And that just goes to show how much I have yet to learn! Once I typed
that out I went from like, 86 lines of code down to 55... And it
works as well!
Just for my own knowledge, Do you know why the else was being applied
after the condition was met?
Thanks Jim!
--- End Message ---
--- Begin Message ---
Jason Pruim wrote:
On Jun 19, 2007, at 4:20 PM, Jim Lucas wrote:
Jason Pruim wrote:
Okay, so I have a question... Probably pretty easy, but why would my
if statement show more records then what are in the database?
if($row[5] =='Level4'){ // White Highlight
echo "<TR><TD bgcolor=".$Level4.">$row[0] </td>";
echo "<td bgcolor=".$Level4.">$row[1] </td>";
echo "<td bgcolor=".$Level4."><A href
='$row[2]'>Instructions</A></td>";
echo "<TD bgcolor=".$Level4."><A
href='update.php?taskid=$row[0]'>Click here!</A>";
}// End of Level 4
else
{// Green Highlight
echo "<TR><TD bgcolor=".$unclassified.">$row[0] </td>";
echo "<td bgcolor=".$unclassified.">$row[1] </td>";
echo "<td bgcolor=".$unclassified."><A href
='$row[2]'>Instructions</A></td>";
echo "<TD bgcolor=".$unclassified."><A
href='update.php?taskid=$row[0]'>Click here!</A>";
}// End of Unclassified
Why not do it this way instead.
while( $row = mysql_fetch_array($results) ) {
$rowColor = $unclassified;
// White Highlight
if($row[5] =='Level4'){
$rowColor = $Level4;
}
echo "<TR><TD bgcolor=".$rowColor.">$row[0] </td>";
echo "<td bgcolor=".$rowColor.">$row[1] </td>";
echo "<td bgcolor=".$rowColor."><A
href='$row[2]'>Instructions</A></td>";
echo "<TD bgcolor=".$rowColor."><A
href='update.php?taskid=$row[0]'>Click here!</A>";
}
And that just goes to show how much I have yet to learn! Once I typed
that out I went from like, 86 lines of code down to 55... And it works
as well!
Just for my own knowledge, Do you know why the else was being applied
after the condition was met?
Thanks Jim!
nope, couldn't guess why.
I would look at your result set and see if you had multiple lines
returned. One person mentioned that you might be using a JOIN in you
SQL call. This could lead to multiple lines.
Start investigating your SQL statement I would suggest.
--
Jim Lucas
"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."
Unknown
--- End Message ---
--- Begin Message ---
How do I break $start_date into 3 variables --- 4 digit year, 2 digit
month and 2 digit day?
$start_year = ;
$start_month = ;
$start_day = ;
--- End Message ---
--- Begin Message ---
Ron Piggott wrote:
How do I break $start_date into 3 variables --- 4 digit year, 2 digit
month and 2 digit day?
$start_year = ;
$start_month = ;
$start_day = ;
Depends what $start_date looks like.
-Stut
--
http://stut.net/
--- End Message ---
--- Begin Message ---
>
>
> How do I break $start_date into 3 variables --- 4 digit year, 2 digit
> month and 2 digit day?
>
> $start_year = ;
> $start_month = ;
> $start_day = ;
>
Can you give us an example of $start_date?
--- End Message ---
--- Begin Message ---
>
>
> How do I break $start_date into 3 variables --- 4 digit year, 2 digit
> month and 2 digit day?
>
> $start_year = ;
> $start_month = ;
> $start_day = ;
>
>
<?PHP
$start_date='2007-06-20';
$parts=explode('-',$start_date);
$start_year = $parts[0];
$start_month = $parts[1];
$start_day = $parts[2];
?>
--- End Message ---
--- Begin Message ---
2007. 06. 20, szerda keltezéssel 09.35-kor Ron Piggott ezt írta:
> How do I break $start_date into 3 variables --- 4 digit year, 2 digit
> month and 2 digit day?
>
> $start_year = ;
> $start_month = ;
> $start_day = ;
>
depends on what format do you have $start_date in
if you have something like 2007-02-01 then you could use
$parts = explode('-', $start_date);
$start_year = $parts[0];
$start_month = $parts[1];
$start_day = $parts[2];
or you could use substr like
$start_year = substr($start_date, 0, 4);
$start_month = substr($start_date, 4, 2);
$start_day = substr($start_date, 7, 2);
and you have several other options also, like strtotime() etc ;)
greets
Zoltán Németh
--- End Message ---
--- Begin Message ---
Ron Piggott skrev:
How do I break $start_date into 3 variables --- 4 digit year, 2 digit
month and 2 digit day?
$start_year = ;
$start_month = ;
$start_day = ;
Of course depending on what $start_date looks like, but this should work
most of the time:
$timestamp = strtotime( $start_date );
$start_year = date( "Y", $timestamp );
$start_month = date( "m", $timestamp );
$start_day = date( "d", $timestamp );
/T
--- End Message ---
--- Begin Message ---
If you are pulling $start_date from a database, depending on the format you
could use something like the following:
Assuming the data is 20070215.
Connect and query your database, get the result and assign it to a variable.
$start_date = $my_result_row['start_date'];
$start_year = substr($start_date, 0, 4);
$start_month = substr($start_date, 4, 2);
$start_day = substr($start_date, 6, 2);
Now you will have variables for the entire date, the year, the month and the
day to play around with however you want.
On 6/20/07, Fredrik Thunberg <[EMAIL PROTECTED]> wrote:
Ron Piggott skrev:
> How do I break $start_date into 3 variables --- 4 digit year, 2 digit
> month and 2 digit day?
>
> $start_year = ;
> $start_month = ;
> $start_day = ;
>
>
Of course depending on what $start_date looks like, but this should work
most of the time:
$timestamp = strtotime( $start_date );
$start_year = date( "Y", $timestamp );
$start_month = date( "m", $timestamp );
$start_day = date( "d", $timestamp );
/T
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On 6/20/07, Sascha Braun, CEO @ ejackup.com <[EMAIL PROTECTED]> wrote:
I wrote an ajax chat on my own too, but it only
supports private chats in a new window.
The poor thing is, that it is tied to my application,
because it shows, pictures of the chatters, but this
might be possible to change.
Is it possible to download yours somewhere, I would
like to use it.
As soon I made fixes to mine, i can send you a copy
if you like.
Best Regards
Sascha
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Sure, I just have to clean up the code a bit and I'll post a link
to the list.
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
--- End Message ---
--- Begin Message ---
On 6/19/07, robert mena <[EMAIL PROTECTED]> wrote:
Hi Daniel,
Thanks.
How can the user chooses the nickname? How about the list of connected users?
On 6/19/07, Daniel Brown <[EMAIL PROTECTED]> wrote:
> On 6/19/07, robert mena <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I am looking for a simple php chat system (no registration, no private
> > channels). Unfortunately the ones I've found (phpopenchat,
> > phpfreechat) are too complicate, requiring the user to register or
> > fail to work properly in IE6 or IE7.
> >
> > Any tips?
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> I have a one that I started putting together a few days ago that
> uses AJAX. It can accept user registration, multiple rooms, et
> cetera, but unless the files are included with the distribution, it's
> a single room without registration.
>
> Check it out: http://www.pilotpig.net/gchat/
>
> --
> Daniel P. Brown
> [office] (570-) 587-7080 Ext. 272
> [mobile] (570-) 766-8107
>
I'm adding all of that stuff in. As of now, the user can change
their name by typing:
/nick name
.... but there may still be some bugs. I've only put about two
hours of work into it so far, so there's a lot of stuff left undone.
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
--- End Message ---