Re: [PHP] Does PHP support utf16 encode / decode

2008-06-16 Thread Chris
hce wrote:
 Hi,
 
 I know PHP supports utf8 encode/decode, but does it support utf16
 encode/decode? If yes, would you please point me a php manual URL?

It's listed as supported under the mbstring functions here:

http://www.php.net/manual/en/mbstring.supported-encodings.php

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Apache RewriteRule Help!!!!

2008-06-16 Thread Miguel J. Jiménez
El Fri, 13 Jun 2008 10:23:29 -0400
Daniel Brown [EMAIL PROTECTED] escribió:

 You can start by asking your question on an Apache list.  This has
 nothing to do with PHP.  ;-P
 
 To answer your question, use this in your .htaccess file:
 
 RewriteCond %{SCRIPT_FILENAME} index
 RewriteCond %{QUERY_STRING} ^[a-zA-Z0-9]
 RewriteRule .* http://www.yourdomain.com/404.php [L]
 
 Next time, though, please try to ask questions on the appropriate
 lists.
 

I did write to the apache users list at the same time more or less and
still waiting a reply :'(


---
.-.
| Miguel J. Jiménez   |
| Sector Público, ISOTROL S.A.|
| [EMAIL PROTECTED]   |
:-:
| KeyID 0xFFE63EC6 hkp://pgp.rediris.es:11371 |
:-:
| Edificio BLUENET, Avda. Isaac Newton nº3, 4ª planta.|
| Parque Tecnológico Cartuja '93, 41092 Sevilla (ESP).|
| Tlfn: +34 955 036 800 (ext.1805) - Fax: +34 955 036 849 |
| http://www.isotrol.com  |
:-:
| UTM ED-50 X:765205.09 Y:4144614.91 Huso: 29 |
:-:
|   Me dijeron: 'instala Windows, se listo'; así que |
| instalé primero Windows y luego fui listo y lo borré|
| para instalar Linux|
'-'


signature.asc
Description: PGP signature


Re: [PHP] Does PHP support utf16 encode / decode

2008-06-16 Thread hce
On Mon, Jun 16, 2008 at 3:59 PM, Chris [EMAIL PROTECTED] wrote:
 hce wrote:
 Hi,

 I know PHP supports utf8 encode/decode, but does it support utf16
 encode/decode? If yes, would you please point me a php manual URL?

 It's listed as supported under the mbstring functions here:

 http://www.php.net/manual/en/mbstring.supported-encodings.php

Thanks Chris for the link, PHP has utf8_encode and utf8_decode. Does
PHP provide utf16_encode and utf16_decode, or the mbstring has
different functions to encode and decode utf16?

Thank you.

Jim

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



Re: [PHP] Does PHP support utf16 encode / decode

2008-06-16 Thread Lester Caine

hce wrote:

On Mon, Jun 16, 2008 at 3:59 PM, Chris [EMAIL PROTECTED] wrote:

hce wrote:

Hi,

I know PHP supports utf8 encode/decode, but does it support utf16
encode/decode? If yes, would you please point me a php manual URL?

It's listed as supported under the mbstring functions here:

http://www.php.net/manual/en/mbstring.supported-encodings.php


Thanks Chris for the link, PHP has utf8_encode and utf8_decode. Does
PHP provide utf16_encode and utf16_decode, or the mbstring has
different functions to encode and decode utf16?


the utf8_ functions are just a bodge to use with the xml parser and only works 
to ISO-8859-1.
mbstring will 'translate' any multibyte string between any of the formats on 
the list provided by the link.

So you just tell it what you want to do in
http://www.php.net/manual/en/function.mb-convert-encoding.php
There is no 'decode' since that is just a different 'encode'

--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

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



Re: [PHP] Canvas examples

2008-06-16 Thread Per Jessen
Richard Heyes wrote:

 That's very cool, Richard.
 
 Well, thanks, but I wouldn't call it very cool.  

I thought it was pretty cool too - I didn't know about canvas, but
your example says a lot, I think. 


/Per Jessen, Zürich


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



[PHP] question about the week's data read and show

2008-06-16 Thread EVEL_LIU
Dears,

Here is my question:

I am write a project manage system.

Now I need to echo one week’s data and send to html show.

Any one got a good idea or codes?

My code has some issues about the loop function. Could you help me check or 
give me some suggestion?

The show item like this:



This week is 25.th week of 2008

[Last Week]06/09--06/15// can be link and show the different week’s data

[This Week]06/16--06/22

[Next Week]06/23--06/29

Found 2 records in 23’Th week.

===

NAME\DAY 06/09 Monday06/10 Tuesday   06/11 Wednesday  06/12 
Thursday  06/13 Friday  06/14 Saturday  06/15 Sunday

Cathy00 08361-sb   02   
  03 04 05  
   06

James   10 08362-sb   12
 13   08362-sb15 16

Connie  20 21 08740-sa  
 23 24 25   
  26

Ken   30 31 08741-sb
   33 34 08741-sb   
36



My code here (But it seems that some issues on show)

?php

 //==Link to the 
database==

  $link = mysql_connect('localhost', 'evel', '00')//link the database

or die('Could not connect: ' . mysql_error());

  mysql_select_db('evel') or die('Could not select database');

 //==show the week 
information===

  $weeknumber=date(W);

  $yearnumber=date(Y);

  $tt=week_limits($weeknumber,$yearnumber);

  $begin=date(m/d l,1212973261);

  $end=date(m/d l, 1213491661);

  echo This week is $weeknumber th week of $yearnumberbr;

  echo Date from $begin($tt[0]) to $end($tt[1])br;

 
//===

 

 //==show the weekdate 
table==

$lowEnd=date(w);

$lowEnd=-$lowEnd;

$highEnd=$lowEnd +7;

$weekday=0;

$weektr.= link href=\require/style.css\ rel=\stylesheet\ 
type=\text/css\\n;

$weektr.= table width=\118\ bgcolor=\#FF\ align=center\n;

$weektr.= tr\n;

$weektr.= TD class=\Content\FONT 
COLOR=BLUEBNAME\DAY/B/FONT/TD;

for ($i=$lowEnd+1;$i=$highEnd;$i++)

{

  $WeekDate[$weekday]=date(m/d l,mktime(0, 0, 0, date(m)  , 
date(d)+$i, date(Y)));

  $datename[$weekday]=date(N,mktime(0, 0, 0, date(m)  , date(d)+$i, 
date(Y)));

  

  $weektr.= TD nowrap align=center bgcolor=\F1F1F1\;

  $weektr.= $WeekDate[$weekday];

  $weektr.= /TD\n;

}

 //===end of 
weekdate

 //=show the data 


$result = mysql_query(select PNB,Name,Time from report where 
Time='1212138371' AND Time='1212886861');//weelresult one week time area test

$num=mysql_num_rows($result);

// echo $num;//show the record number,control the table

if($num)

{

echo Found $num recordsbr;

$weektr.= tr\n;

   // while($myrow=mysql_fetch_array($result,MYSQL_NUM))

   // {

   // $weekdaynumber=date(N,$myrow[2]);

for($x = 0;$x  $num;$x++)//create the data array,for the search resule 
number

{

$weekdaynumber=date(N,$myrow[2]);

for($y = 0;$y  7;$y++)//loop for tr

{

 for($i=0;$i8;$i++)

  {

   if($weekdaynumber==$y)//get the relate week date data

   {

$data[$x][$y] =$myrow[0];

   }

   else

$data[$x][$y] =$x$y;

  }

 $mat[$x][$y] = $x,$y;

}

   

}



 //echo $weekdaynumber;



while ($x= mysql_fetch_row($result))//one by one show the data record

  {  $x=0;

// for($x = 0;$x = mysql_fetch_row($result);$x++){

  //  for($x = 0;$x  count($data[$x]);$x++)//output the data,as the 
dataarray number is 

  //  {

   for($y = 0;$y 7;$y++)

{

 if($y==0)//devide the cell to name and the week date and 
project cell

  {

   $weektr.=td  align=\center\$myrow[1]/td;

   $weektr.=td  align=\center\.$data[$x][$y]./td;

  }

 else

   

Re: [PHP] extension=mssql.so vs. ;extension=php_mssql.dll

2008-06-16 Thread T Lensselink
Wei, Alice J. wrote:
 Hi,

   I am not sure what is exactly the problem with my configurations while I am 
 trying to configure Apache, PHP and FreeTDS throughout my attempts to install 
 these packages into my Linux.

  It appears that I am doing everything correctly as I am going through 
 listservs, forums and online articles for the configurations, but there is 
 something that goes wrong. So far I have noticed that in my phpinfo() page, I 
 still don't see the mssql packages listed as I should have.

   Some things I need to be clarified:


 1.  I noticed that in http://us.php.net/mssql, it mentioned how we are 
 supposed to add extension=mssql.so in the php.ini file, while in other places 
 I was told to uncomment extension=php_mssql.dll. It appears that this did not 
 give me the right configurations, still, even though the installation did 
 suggest that mssql support is yes.



 2.  I used the following to configure my PHP AFTER I had installed and 
 compiled FreeTDS like most of you said, ./configure 
 --with-mssql=/usr/local/freetds --prefix=/usr/local/php, but every single 
 time, it gives me this: Directory /usr/local/freetds is not a FreeTDS 
 installation directory



 Could this signify the reason why I cannot see PHP configured with MSSQL 
 connection? If yes, why is it possible that the support for MSSQL in the 
 php.ini file has been commented out?


 Thanks in advance.

 ---
 Alice Wei
 MIS 2009
 School of Library and Information Science
 Indiana University Bloomington
 [EMAIL PROTECTED]

   
I had the same problem trying to compile php 5.2.6 with freetds on
Ubutu. No matter what i tried it kept giving me the Directory
/usr/local/freetds is not a FreeTDS installation directory. I ended up
coping some files. wich resulted in a working mssql extension. It's a
hack. But for me it worked.

I configured freeTDS with the following config options:
./configure --with-tdsver=7.0 --enable-msdblib --enable-dbmfix
--with-gnu-ld --enable-shared --enable-static --prefix=/usr/local/freetds

And after make  make install; i copied the following files.

cp [tds source]/include/tds.h /usr/local/freetds/include
cp [tds source]src/tds/.libs/libtds.a /usr/local/freetds/lib

Then i configured php with --with-mssql=shared,/usr/local/freetds

Hope it helps.

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



Re: [PHP] Canvas examples

2008-06-16 Thread Richard Heyes

I thought it was pretty cool too - I didn't know about canvas, but
your example says a lot, I think. 


But when you compare it to something like this:

http://ejohn.org/apps/processing.js/examples/custom/molten.html

it looks pretty basic (which it is). Mine is perhaps an intro, whereas 
this illustrates what can be done with some (a lot?) of work.


--
Richard Heyes

Employ me:
http://www.phpguru.org/cv

++
| Access SSH with a Windows mapped drive |
|http://www.phpguru.org/sftpdrive|
++

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



Re: [PHP] Canvas examples

2008-06-16 Thread Per Jessen
Richard Heyes wrote:

 I thought it was pretty cool too - I didn't know about canvas, but
 your example says a lot, I think.
 
 But when you compare it to something like this:
 
 http://ejohn.org/apps/processing.js/examples/custom/molten.html
 
 it looks pretty basic (which it is). Mine is perhaps an intro, whereas
 this illustrates what can be done with some (a lot?) of work.

True - far too much work, in my opinion.  But I wouldn't mind seeing
some real life use/examples.  

I guess the other browser doesn't do much with canvas ? 



/Per Jessen, Zürich


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



Re: [PHP] UK PHP Host/Developer Required

2008-06-16 Thread Robin Vickery
2008/6/14 Iv Ray [EMAIL PROTECTED]:
 Robin Vickery wrote:

 Out of hours technical support often gets billed at a punitive rate.
 Which is a bugger if their out of hours is your working day.

 It seems you haven't tried Rackspace (UK) yet.

 And while you might get tech support out of hours, accounts and
 billing usually keep normal office hours.

 True.

 But if you pay your bills on time, you will never talk to these.

When a minute's downtime can cost you tens of thousands of
pounds worth of transactions, you can often find quite pointed
questions to ask your account handler. Like how the hell did
both independent power rails AND fail at once? Why didn't the
backup generators start? and what are you doing to 1. ensure
that it never happens again and 2. dissuade us from moving to
a hosting facility that exhibits some competence?

Having to do an emergency failover to a secondary hosting
facility on one of you busiest days of the year can put you in
a really bad mood.

-robin

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



[PHP] How to prevent DoS on PHP script?

2008-06-16 Thread Michelle Konzack

*   Do not Cc: me, because I READ THIS LIST, if I write here   *
*Keine Cc: am mich, ich LESE DIESE LISTE wenn ich hier schreibe*


Hello,

on my devel server I have a script, which allow me  to  upload  Debian
packages which then are included in my private Debian mirror.

Now I have gotten several 1000 hits in the last days.  I call it DoS.

There are idiots who have tried to upload shit on my Webspace but  since
I check it to be ONLY Debian files they where not successful.

My biggest problem is, that the /fileupload.php was always  references
from outside my webspace.  OK, I was thinking  this  can  be  solved  by
using HTTP_REFERER which has then worked for some  days  but  NOW  those
pigs are back and sending spoofed HTTP_REFERER.

Since I have only a VHost @ISP I can not  go  deeper  into  the  Apache2
config what I have done when I was running my own server.

Can anyone suggest me something, how to block requests from outside?

Size limitation is not possibel, since some of my upload files are  very
huge and I must be able to  upload  files  without  Laptop  and  FTP/SCP
access.

Thanks, Greetings and nice Day/Evening
Michelle Konzack
Systemadministrator
24V Electronic Engineer
Tamay Dogan Network
Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
# Debian GNU/Linux Consultant #
Michelle Konzack   Apt. 917  ICQ #328449886
+49/177/935194750, rue de Soultz MSN LinuxMichi
+33/6/61925193 67100 Strasbourg/France   IRC #Debian (irc.icq.com)


signature.pgp
Description: Digital signature


[PHP] Boa Webserver and PHP5

2008-06-16 Thread Michelle Konzack

*   Do not Cc: me, because I READ THIS LIST, if I write here   *
*Keine Cc: am mich, ich LESE DIESE LISTE wenn ich hier schreibe*


Hello,

since my small Laptop (TP570) can not handel the Dino of apache2,
I am running the light webserver boa und Debian/Sarge.

Question:  Can anyone tell me HOW to get PHP5 running with it?

Thanks, Greetings and nice Day/Evening
Michelle Konzack
Tamay Dogan Network

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
# Debian GNU/Linux Consultant #
Michelle Konzack   Apt. 917  ICQ #328449886
+49/177/935194750, rue de Soultz MSN LinuxMichi
+33/6/61925193 67100 Strasbourg/France   IRC #Debian (irc.icq.com)


signature.pgp
Description: Digital signature


Re: [PHP] UK PHP Host/Developer Required

2008-06-16 Thread Richard Heyes

Out of hours technical support often gets billed at a punitive rate.
Which is a bugger if their out of hours is your working day.




It seems you haven't tried Rackspace (UK) yet.


What do you mean? Personally I've had good experiences with Rackspace.

--
Richard Heyes

Employ me:
http://www.phpguru.org/cv

++
| Access SSH with a Windows mapped drive |
|http://www.phpguru.org/sftpdrive|
++

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



Re: [PHP] How to prevent DoS on PHP script?

2008-06-16 Thread Per Jessen
Michelle Konzack wrote:

 My biggest problem is, that the /fileupload.php was always 
 references
 from outside my webspace.  OK, I was thinking  this  can  be  solved 
 by
 using HTTP_REFERER which has then worked for some  days  but  NOW 
 those pigs are back and sending spoofed HTTP_REFERER.
 
 Since I have only a VHost @ISP I can not  go  deeper  into  the 
 Apache2 config what I have done when I was running my own server.
 
 Can anyone suggest me something, how to block requests from outside?

Check client IP-addresses? 


/Per Jessen, Zürich


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



Re: [PHP] Canvas examples

2008-06-16 Thread Richard Heyes
I guess the other browser doesn't do much with canvas ? 


Nope. Eg:

canvas id=foo
This gets shown on none supporting browsers, but not on supportive
browsers.
/canvas

MSIE just shows the text and doesn't do anything with the canvas.

One thing about using a canvas is bandwidth. If it's a big concern I 
would hazard a guess that a bar chart (for example) would cost less in 
terms of code required to build the image compared to JPGraph, and also 
less in terms of output (particularly if you were to use output 
compression).


--
Richard Heyes

Employ me:
http://www.phpguru.org/cv

++
| Access SSH with a Windows mapped drive |
|http://www.phpguru.org/sftpdrive|
++

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



Re: [PHP] Re: Capture homepage screenshot

2008-06-16 Thread paragasu
well, i never try it for my self but somebody out there already develop a simple
library to convert any HTML to image.. google for html2png give me

http://marginalhacks.com/Hacks/html2jpg/

i believe there is more interesting solutions out there. tell me if
you found one.
good luck..

On 6/14/08, Manuel Lemos [EMAIL PROTECTED] wrote:
 Hello,

 on 06/13/2008 02:46 PM Shiplu said the following:
 Hello,
 How can i capture homepage screenshot of a webpage by php?

 I know a way.
 I'll run a executable written in C/C++. when It will be called to process
 a
 screen shot It will just load the webpage in firefox and capture the
 image.
 It'll send the image path to php. The executable will be running.
 The problem with this solution is, I have to run X, Firefox in my web
 server, which doesn't look efficient for a server.

 I wanna know, is there any other way to achieve this? without creating a
 screen shot server.

 If you run PHP on Windows, you can use this PHP class that was just
 released and does exactly what you need. I think it could be adapted to
 work with Firefox too.

 http://www.phpclasses.org/win-screenshot

 --

 Regards,
 Manuel Lemos

 PHP professionals looking for PHP jobs
 http://www.phpclasses.org/professionals/

 PHP Classes - Free ready to use OOP components written in PHP
 http://www.phpclasses.org/

 --
 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] Boa Webserver and PHP5

2008-06-16 Thread Daniel Brown
On Sat, Jun 14, 2008 at 11:12 AM, Michelle Konzack
[EMAIL PROTECTED] wrote:
 
 *   Do not Cc: me, because I READ THIS LIST, if I write here   *
 *Keine Cc: am mich, ich LESE DIESE LISTE wenn ich hier schreibe*
 

Keep in mind two things:

1.) Reply-all automatically includes you, where a simple Reply
does not include the list.
2.) Not every person to write to the list is a subscriber, so
Reply-all is the best option.

If you're getting overloaded, check your email client settings and filters.


 since my small Laptop (TP570) can not handel the Dino of apache2,
 I am running the light webserver boa und Debian/Sarge.

 Question:  Can anyone tell me HOW to get PHP5 running with it?

RTFM:  http://www.boa.org/documentation/boa-2.html#ss2.3

Just like Apache's httpd.conf, you add an AddType directive.
Compile PHP into a static, standalone (non-modular, non-ASPX) binary
and add the binary as an extension.

That's only a guess based on 2 seconds of Googling though.

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



RE: [PHP] extension=mssql.so vs. ;extension=php_mssql.dll

2008-06-16 Thread Wei, Alice J.
Hi,

 I just realized after someone else replying to me saying that I need mssql.so 
instead of php_mssql.dll.

  What I don't understand is why every time when I tried to install this with 
yum by precessing yum install php, yum install apache, I can never see the 
phpinfo page, but when I installed it with the Windows binary, I can get the 
PHP to show up with my Apahce on my Linux machine. The problem is, I can see 
that I wouldn't have mssql.so in my package no matter what.

  Does anyone have any solution to this?
  Thanks in advance.

Alice
==
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
[EMAIL PROTECTED]

From: T Lensselink [EMAIL PROTECTED]
Sent: Monday, June 16, 2008 4:22 AM
To: php-general@lists.php.net
Subject: Re: [PHP] extension=mssql.so vs. ;extension=php_mssql.dll

Wei, Alice J. wrote:
 Hi,

   I am not sure what is exactly the problem with my configurations while I am 
 trying to configure Apache, PHP and FreeTDS throughout my attempts to install 
 these packages into my Linux.

  It appears that I am doing everything correctly as I am going through 
 listservs, forums and online articles for the configurations, but there is 
 something that goes wrong. So far I have noticed that in my phpinfo() page, I 
 still don't see the mssql packages listed as I should have.

   Some things I need to be clarified:


 1.  I noticed that in http://us.php.net/mssql, it mentioned how we are 
 supposed to add extension=mssql.so in the php.ini file, while in other places 
 I was told to uncomment extension=php_mssql.dll. It appears that this did not 
 give me the right configurations, still, even though the installation did 
 suggest that mssql support is yes.



 2.  I used the following to configure my PHP AFTER I had installed and 
 compiled FreeTDS like most of you said, ./configure 
 --with-mssql=/usr/local/freetds --prefix=/usr/local/php, but every single 
 time, it gives me this: Directory /usr/local/freetds is not a FreeTDS 
 installation directory



 Could this signify the reason why I cannot see PHP configured with MSSQL 
 connection? If yes, why is it possible that the support for MSSQL in the 
 php.ini file has been commented out?


 Thanks in advance.

 ---
 Alice Wei
 MIS 2009
 School of Library and Information Science
 Indiana University Bloomington
 [EMAIL PROTECTED]


I had the same problem trying to compile php 5.2.6 with freetds on
Ubutu. No matter what i tried it kept giving me the Directory
/usr/local/freetds is not a FreeTDS installation directory. I ended up
coping some files. wich resulted in a working mssql extension. It's a
hack. But for me it worked.

I configured freeTDS with the following config options:
./configure --with-tdsver=7.0 --enable-msdblib --enable-dbmfix
--with-gnu-ld --enable-shared --enable-static --prefix=/usr/local/freetds

And after make  make install; i copied the following files.

cp [tds source]/include/tds.h /usr/local/freetds/include
cp [tds source]src/tds/.libs/libtds.a /usr/local/freetds/lib

Then i configured php with --with-mssql=shared,/usr/local/freetds

Hope it helps.

--
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] UK PHP Host/Developer Required

2008-06-16 Thread Daniel Brown
On Mon, Jun 16, 2008 at 5:33 AM, Robin Vickery [EMAIL PROTECTED] wrote:

 Having to do an emergency failover to a secondary hosting
 facility on one of you busiest days of the year can put you in
 a really bad mood.

This no longer sounds like a hypothetical.  ;-P

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



[PHP] Binary data in $_POST, not in $_FILES, why?

2008-06-16 Thread Jim Feniello
Hi,

I'm working on an app with a external provider (voicexml), which at the end
of the day is posting an html form with normal and file data.  

 

I've got 3 test cases, one is an html form with fields and a file, the other
test case is another voicexml provider, and the third is my provider, which
is where my problem resides. 

 

All three have [Content-Type] = multipart/form-data; in the header.  The
html form and provider X shows the request data correctly, some in _request
and one in _files, but my provider ends up with an empty _files array, and i
finally dumped the _request array, and it was in there as an item with a
bunch of binary data.

 

What would cause php to not put it in _files?  The obvious is the
multipart/form-data but i've confirmed that.  Anything else i can look into?

 

thanks,

-jim

 



Re: [PHP] Binary data in $_POST, not in $_FILES, why?

2008-06-16 Thread Daniel Brown
On Mon, Jun 16, 2008 at 11:14 AM, Jim Feniello [EMAIL PROTECTED] wrote:
 Hi,

 What would cause php to not put it in _files?  The obvious is the
 multipart/form-data but i've confirmed that.  Anything else i can look into?

What does the line for the file input in the HTML source say?  Can
you provide the whole snippet of code from the form section, starting
with form  and ending with /form ?

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



RE: [PHP] Binary data in $_POST, not in $_FILES, why?

2008-06-16 Thread Jim Feniello
I can't because it's a third party provider with a voicexml browser.  The
best I have is this log from apache mod_security:

POST /temp/save2.php HTTP/1.1
Accept: */*
Host: recording.repsstudio.com
User-Agent: HVP/4.2
Content-Length: 37486
Content-Type: multipart/form-data; boundary=osb_inet_multipart_boundary

37486
--osb_inet_multipart_boundary
Content-Disposition: form-data; name=dnis

1a
--osb_inet_multipart_boundary
Content-Disposition: form-data; name=resp
Content-Type: audio/x-wav
Content-Length: 37050

RIFF±gÿÿWAVEfmt
[EMAIL PROTECTED]@[EMAIL PROTECTED]@^A^@@[EMAIL PROTECTED]@@[EMAIL 
PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL 
PROTECTED]
ýýþ|{yxyz{ùúþþöýy{xz{xzzzutvx{{x|z|ÿÿüúúûúûûûûüûûøü
ýûúûüýþ~}ÿ}}ÿ~ú÷ûüÃ*^Ã^æ'#Õ»(^V+^Ã^Ã^Ã^Ztnosx{}üúûýú
úùû}þýþüü}ú÷ôóùøû$
^S«^Ã^ÃB9¯¨,^O^T®^Ã^ÃÃ^N^O7^çCH ^ÃÃ^P
#^Ã^Ã^Ã2.K3(-BèWáp]çôëwèïqïÃ\Ã~þ|Ã¥vôvéyüæôjÃ]Ãíkòýuqë
nîõwWÃWîTàh÷ráìeäaæh[Ã\QÃZbú{küþ~Ã[lâIð^]fmvlázÃUÃÃ^ÃÃ[Ã÷luÃ
§Ã»Ã¾ÃµÃ¤Ã¥ÃþîÃ_mäj$
--osb_inet_multipart_boundary
Content-Disposition: form-data; name=usercode

3a
--osb_inet_multipart_boundary
Content-Disposition: form-data; name=userexerciseid

2a vxml version
--osb_inet_multipart_boundary--




Re: [PHP] How to prevent DoS on PHP script?

2008-06-16 Thread Jim Lucas

Per Jessen wrote:

Michelle Konzack wrote:

My biggest problem is, that the /fileupload.php was always 
references
from outside my webspace.  OK, I was thinking  this  can  be  solved 
by
using HTTP_REFERER which has then worked for some  days  but  NOW 
those pigs are back and sending spoofed HTTP_REFERER.


Since I have only a VHost @ISP I can not  go  deeper  into  the 
Apache2 config what I have done when I was running my own server.


Can anyone suggest me something, how to block requests from outside?


Check client IP-addresses? 



/Per Jessen, Zürich




The problem that the OP is going to run into is the Chicken before the Egg 
problem.  PHP will not start processing until the file upload has already been 
completely uploaded.


Personally, I do not see a PHP solution to your problem.  Unless allowing them 
to upload then just throwing it away is ok with the op.


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


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



Re: [PHP] How to prevent DoS on PHP script?

2008-06-16 Thread Per Jessen
Jim Lucas wrote:

 Per Jessen wrote:
 Michelle Konzack wrote:
 
 My biggest problem is, that the /fileupload.php was always
 references
 from outside my webspace.  OK, I was thinking  this  can  be  solved
 by
 using HTTP_REFERER which has then worked for some  days  but  NOW
 those pigs are back and sending spoofed HTTP_REFERER.

 Since I have only a VHost @ISP I can not  go  deeper  into  the
 Apache2 config what I have done when I was running my own server.

 Can anyone suggest me something, how to block requests from outside?
 
 Check client IP-addresses?
 
 
 /Per Jessen, Zürich
 
 
 
 The problem that the OP is going to run into is the Chicken before
 the Egg problem.  PHP will not start processing until the file upload
 has already been completely uploaded.

I was about to say Then let apache check it, but I hadn't read the
last paragraph of the OPs question.


/Per Jessen, Zürich


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



Re: [PHP] How to prevent DoS on PHP script?

2008-06-16 Thread Nitsan Bin-Nun
I think you can handle this with 2 pages, the first is checking whether the
user is permitted to upload or not and if so passing him to the upload form
with a simple (bool) $_SESSION variable which indicates his permissions.
If you will try to access the second page and the $_SESS variable won't
exist it will throw you back to page 1 to validate your permissions.

Am I missing something? (its pretty simple..)

HTH

On 16/06/2008, Per Jessen [EMAIL PROTECTED] wrote:

 Jim Lucas wrote:

  Per Jessen wrote:
  Michelle Konzack wrote:
 
  My biggest problem is, that the /fileupload.php was always
  references
  from outside my webspace.  OK, I was thinking  this  can  be  solved
  by
  using HTTP_REFERER which has then worked for some  days  but  NOW
  those pigs are back and sending spoofed HTTP_REFERER.
 
  Since I have only a VHost @ISP I can not  go  deeper  into  the
  Apache2 config what I have done when I was running my own server.
 
  Can anyone suggest me something, how to block requests from outside?
 
  Check client IP-addresses?
 
 
  /Per Jessen, Zürich
 
 
 
  The problem that the OP is going to run into is the Chicken before
  the Egg problem.  PHP will not start processing until the file upload
  has already been completely uploaded.

 I was about to say Then let apache check it, but I hadn't read the
 last paragraph of the OPs question.


 /Per Jessen, Zürich


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




Re: [PHP] How to prevent DoS on PHP script?

2008-06-16 Thread Andrew Ballard
On Mon, Jun 16, 2008 at 1:01 PM, Nitsan Bin-Nun [EMAIL PROTECTED] wrote:
 I think you can handle this with 2 pages, the first is checking whether the
 user is permitted to upload or not and if so passing him to the upload form
 with a simple (bool) $_SESSION variable which indicates his permissions.
 If you will try to access the second page and the $_SESS variable won't
 exist it will throw you back to page 1 to validate your permissions.

 Am I missing something? (its pretty simple..)

 HTH

Yes, it's missing something. There is nothing in this approach to
prevent the remote client from attempting to access the second page
directly. Even if they do not have the valid $_SESSION variable set,
the server will still receive the entire uploaded content before
passing control to the PHP script to validate permissions. In a DoS
attack, the attacker doesn't care whether the request is actually
allowed; only that resources were consumed in handling the request.
It's still the chicken and egg problem already described in this
thread.

Andrew

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



Re: [PHP] How to prevent DoS on PHP script?

2008-06-16 Thread Jim Lucas

Nitsan Bin-Nun wrote:

I think you can handle this with 2 pages, the first is checking whether the
user is permitted to upload or not and if so passing him to the upload form
with a simple (bool) $_SESSION variable which indicates his permissions.
If you will try to access the second page and the $_SESS variable won't
exist it will throw you back to page 1 to validate your permissions.

Am I missing something? (its pretty simple..)



Yes, PHP hasn't started yet.

When someone tries to upload a file to a server, Apache is accepting the file 
first.  Once the file is completely uploaded, Apache hands off the processing to 
Apache.  Problem is, by this time the DoS has already happened.  Apache has 
waisted its time receiving the file.



HTH

On 16/06/2008, Per Jessen [EMAIL PROTECTED] wrote:

Jim Lucas wrote:


Per Jessen wrote:

Michelle Konzack wrote:


My biggest problem is, that the /fileupload.php was always
references
from outside my webspace.  OK, I was thinking  this  can  be  solved
by
using HTTP_REFERER which has then worked for some  days  but  NOW
those pigs are back and sending spoofed HTTP_REFERER.

Since I have only a VHost @ISP I can not  go  deeper  into  the
Apache2 config what I have done when I was running my own server.

Can anyone suggest me something, how to block requests from outside?

Check client IP-addresses?


/Per Jessen, Zürich



The problem that the OP is going to run into is the Chicken before
the Egg problem.  PHP will not start processing until the file upload
has already been completely uploaded.

I was about to say Then let apache check it, but I hadn't read the
last paragraph of the OPs question.


/Per Jessen, Zürich


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







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


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



Re: [PHP] How to prevent DoS on PHP script?

2008-06-16 Thread Nitsan Bin-Nun
Okay, I got the idea,
I think you can use PHP to write .htaccess file for IP blocking or something
like that (shared hosts allow this and I'm pretty sure that Apache .htaccess
are able to manage IP blocking).

HTH,
Nitsan

On 16/06/2008, Jim Lucas [EMAIL PROTECTED] wrote:

 Nitsan Bin-Nun wrote:

 I think you can handle this with 2 pages, the first is checking whether
 the
 user is permitted to upload or not and if so passing him to the upload
 form
 with a simple (bool) $_SESSION variable which indicates his permissions.
 If you will try to access the second page and the $_SESS variable won't
 exist it will throw you back to page 1 to validate your permissions.

 Am I missing something? (its pretty simple..)


 Yes, PHP hasn't started yet.

 When someone tries to upload a file to a server, Apache is accepting the
 file first.  Once the file is completely uploaded, Apache hands off the
 processing to Apache.  Problem is, by this time the DoS has already
 happened.  Apache has waisted its time receiving the file.

 HTH

 On 16/06/2008, Per Jessen [EMAIL PROTECTED] wrote:

 Jim Lucas wrote:

 Per Jessen wrote:

 Michelle Konzack wrote:

 My biggest problem is, that the /fileupload.php was always
 references
 from outside my webspace.  OK, I was thinking  this  can  be  solved
 by
 using HTTP_REFERER which has then worked for some  days  but  NOW
 those pigs are back and sending spoofed HTTP_REFERER.

 Since I have only a VHost @ISP I can not  go  deeper  into  the
 Apache2 config what I have done when I was running my own server.

 Can anyone suggest me something, how to block requests from outside?

 Check client IP-addresses?


 /Per Jessen, Zürich


 The problem that the OP is going to run into is the Chicken before
 the Egg problem.  PHP will not start processing until the file upload
 has already been completely uploaded.

 I was about to say Then let apache check it, but I hadn't read the
 last paragraph of the OPs question.


 /Per Jessen, Zürich


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





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




Re: [PHP] Canvas examples

2008-06-16 Thread Ray Hauge

Richard Heyes wrote:
I guess the other browser doesn't do much with canvas ? 


Nope. Eg:

canvas id=foo
This gets shown on none supporting browsers, but not on supportive
browsers.
/canvas

MSIE just shows the text and doesn't do anything with the canvas.

One thing about using a canvas is bandwidth. If it's a big concern I 
would hazard a guess that a bar chart (for example) would cost less in 
terms of code required to build the image compared to JPGraph, and also 
less in terms of output (particularly if you were to use output 
compression).




Another idea for dynamic graphing could be:

http://solutoire.com/plotr/

It also uses the canvas element, but if you use excanvas for IE it'll 
work in most newer browsers.  I've used it in a project to provide 
dynamic bar graphs from a queue so that they could see in semi-real time 
how many customer requests were in different queues.  It was an internal 
app, or else I'd link it :(


--
Ray Hauge
www.primateapplications.com

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



Re: [PHP] How to prevent DoS on PHP script?

2008-06-16 Thread Jim Lucas

Nitsan Bin-Nun wrote:

Okay, I got the idea,
I think you can use PHP to write .htaccess file for IP blocking or something
like that (shared hosts allow this and I'm pretty sure that Apache .htaccess
are able to manage IP blocking).



As long as Apache allows .htaccess files

But...   even then what IP's would you write to this?

If a person changed their IP each time they access the script, then it still 
would not work.


I would have to say that I just don't think that PHP is going to be the medium 
in which this problem has to be handled.



HTH,
Nitsan

On 16/06/2008, Jim Lucas [EMAIL PROTECTED] wrote:

Nitsan Bin-Nun wrote:


I think you can handle this with 2 pages, the first is checking whether
the
user is permitted to upload or not and if so passing him to the upload
form
with a simple (bool) $_SESSION variable which indicates his permissions.
If you will try to access the second page and the $_SESS variable won't
exist it will throw you back to page 1 to validate your permissions.

Am I missing something? (its pretty simple..)



Yes, PHP hasn't started yet.

When someone tries to upload a file to a server, Apache is accepting the
file first.  Once the file is completely uploaded, Apache hands off the
processing to Apache.  Problem is, by this time the DoS has already
happened.  Apache has waisted its time receiving the file.

HTH

On 16/06/2008, Per Jessen [EMAIL PROTECTED] wrote:


Jim Lucas wrote:

Per Jessen wrote:

Michelle Konzack wrote:

My biggest problem is, that the /fileupload.php was always

references
from outside my webspace.  OK, I was thinking  this  can  be  solved
by
using HTTP_REFERER which has then worked for some  days  but  NOW
those pigs are back and sending spoofed HTTP_REFERER.

Since I have only a VHost @ISP I can not  go  deeper  into  the
Apache2 config what I have done when I was running my own server.

Can anyone suggest me something, how to block requests from outside?


Check client IP-addresses?


/Per Jessen, Zürich


The problem that the OP is going to run into is the Chicken before

the Egg problem.  PHP will not start processing until the file upload
has already been completely uploaded.


I was about to say Then let apache check it, but I hadn't read the
last paragraph of the OPs question.


/Per Jessen, Zürich


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




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







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


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



Re: [PHP] How to prevent DoS on PHP script?

2008-06-16 Thread Nitsan Bin-Nun
Umm yes I don't think so too, but thats one of the only possibile options..
so give it a shot because you have nothing to loose (:

I also think he should speak to the server administrator / the guy he pays
him the money and ask what to do, I'm pretty sure that he had already
encountered something like this before.

On 16/06/2008, Jim Lucas [EMAIL PROTECTED] wrote:

 Nitsan Bin-Nun wrote:

 Okay, I got the idea,
 I think you can use PHP to write .htaccess file for IP blocking or
 something
 like that (shared hosts allow this and I'm pretty sure that Apache
 .htaccess
 are able to manage IP blocking).


 As long as Apache allows .htaccess files

 But...   even then what IP's would you write to this?

 If a person changed their IP each time they access the script, then it
 still would not work.

 I would have to say that I just don't think that PHP is going to be the
 medium in which this problem has to be handled.

 HTH,
 Nitsan

 On 16/06/2008, Jim Lucas [EMAIL PROTECTED] wrote:

 Nitsan Bin-Nun wrote:

 I think you can handle this with 2 pages, the first is checking whether
 the
 user is permitted to upload or not and if so passing him to the upload
 form
 with a simple (bool) $_SESSION variable which indicates his permissions.
 If you will try to access the second page and the $_SESS variable won't
 exist it will throw you back to page 1 to validate your permissions.

 Am I missing something? (its pretty simple..)


 Yes, PHP hasn't started yet.

 When someone tries to upload a file to a server, Apache is accepting the
 file first.  Once the file is completely uploaded, Apache hands off the
 processing to Apache.  Problem is, by this time the DoS has already
 happened.  Apache has waisted its time receiving the file.

 HTH

 On 16/06/2008, Per Jessen [EMAIL PROTECTED] wrote:

 Jim Lucas wrote:

 Per Jessen wrote:

 Michelle Konzack wrote:

 My biggest problem is, that the /fileupload.php was always

 references
 from outside my webspace.  OK, I was thinking  this  can  be  solved
 by
 using HTTP_REFERER which has then worked for some  days  but  NOW
 those pigs are back and sending spoofed HTTP_REFERER.

 Since I have only a VHost @ISP I can not  go  deeper  into  the
 Apache2 config what I have done when I was running my own server.

 Can anyone suggest me something, how to block requests from outside?

 Check client IP-addresses?


 /Per Jessen, Zürich


 The problem that the OP is going to run into is the Chicken before

 the Egg problem.  PHP will not start processing until the file upload
 has already been completely uploaded.

 I was about to say Then let apache check it, but I hadn't read the
 last paragraph of the OPs question.


 /Per Jessen, Zürich


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



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





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




[PHP] looping through a database

2008-06-16 Thread Richard Kurth
I am looping through a database of files that are numbers 1 through 10 
if  number 1 is in the database I what to print out the first table 
below if it is not then print the else section below. Then loop through 
the database to see if 2 through 10 are there and do the same thing. Of 
course what I am doing does not work. Should I move it all to an array 
and then loop through it. Or use a foreach loop.

Could you please give me an idea where to start looking

while($row=mysql_fetch_array($sql_result)){

if ($row[number]==1) {
tr
td File 1/td
tdThis is the file/td
tdDelete/td
/tr
}else{
tr
tdFile1/td
td/td
tdAdd/td
/tr
}

}

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



RE: [PHP] Binary data in $_POST, not in $_FILES, why?

2008-06-16 Thread Jim Feniello
Anyone know if PHP keys off the content-disposition for form pre-processing
to populate the $_FILES array?
In my html form example, the raw data looks like:
Content-Disposition: form-data; name=resp; filename=tada.wav
Content-Type: audio/x-wav

But the form posting from the voicexml browser/server looks like:

Content-Disposition: form-data; name=recording
Content-Type: audio/x-wav

That's the only difference I have found so far, so I was wondering if php
parses form elements that have the filename attribute on the
Content-Disposition item.  The bad side of that is that from what I can
tell, Content-Disposition isn't a standard/requirement, just an RFC.

Thanks,
-jim





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



[PHP] Re: Strategy to protect images

2008-06-16 Thread Jonesy
On Sun, 15 Jun 2008 14:07:14 -0400, tedd wrote:
 At 4:11 PM +0100 6/15/08, Richard Heyes wrote:
But, a sophisticated user will find a way around that.

A less sophisticated one will use the PrintScr key... :-)

 Must be a windozes thing.  :-)

Nope.  Works a treat in KDE in linux.

Jonesy


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



Re: [PHP] Re: Strategy to protect images

2008-06-16 Thread Daniel Brown
On Mon, Jun 16, 2008 at 5:23 PM, Jonesy [EMAIL PROTECTED] wrote:
 On Sun, 15 Jun 2008 14:07:14 -0400, tedd wrote:
 At 4:11 PM +0100 6/15/08, Richard Heyes wrote:
But, a sophisticated user will find a way around that.

A less sophisticated one will use the PrintScr key... :-)

 Must be a windozes thing.  :-)

 Nope.  Works a treat in KDE in linux.


Status:  Myth.

This is only if you have KDE configured to bind the key to an
external application such as KSnapshot, which is not the default.

Unless, of course, your distro does it by default, which is always
possible but in general, it's not the case.  ;-P

-- 
/Daniel P. Brown
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



RE: [PHP] Binary data in $_POST, not in $_FILES, why?

2008-06-16 Thread Kirk . Johnson
Jim Feniello [EMAIL PROTECTED] wrote on 06/16/2008 03:16:02 PM:

 Anyone know if PHP keys off the content-disposition for form 
pre-processing
 to populate the $_FILES array?

I believe that the $_FILES array is only populated when the form tag 
contains 'enctype=multipart/form-data' and there is an input field of 
type file in the form, but I am not going to guarantee that ;)

Kirk


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



Re: [PHP] How to prevent DoS on PHP script?

2008-06-16 Thread Nathan Nobbe
On Mon, Jun 16, 2008 at 2:11 PM, Nitsan Bin-Nun [EMAIL PROTECTED] wrote:

 Umm yes I don't think so too, but thats one of the only possibile options..
 so give it a shot because you have nothing to loose (:

 I also think he should speak to the server administrator / the guy he pays
 him the money and ask what to do, I'm pretty sure that he had already
 encountered something like this before.


i would like to offer a suggestion, half as a question, because i have not
tried this approach yet myself.  the php curl extension supports http
authentication, via the option *CURLOPT_USERPWD*.  so a client script which
will supply the parameters and then ftp the file upon success shouldnt be
too bad to write.  the requirements being support for http authentication on
the server side, and php w/ curl support on the client side.

thoughts?

-nathan


Re: [PHP] looping through a database

2008-06-16 Thread Wolf

Richard Kurth wrote:
I am looping through a database of files that are numbers 1 through 10 
if  number 1 is in the database I what to print out the first table 
below if it is not then print the else section below. Then loop through 
the database to see if 2 through 10 are there and do the same thing. Of 
course what I am doing does not work. Should I move it all to an array 
and then loop through it. Or use a foreach loop.

Could you please give me an idea where to start looking

while($row=mysql_fetch_array($sql_result)){

if ($row[number]==1) {
tr
td File 1/td
tdThis is the file/td
tdDelete/td
/tr
}else{
tr
tdFile1/td
td/td
tdAdd/td
/tr
}

}



What is the query being executed?

Seriously, this needs more information.  On the upside, it LOOKS like it 
should work, however...


Here's what I use to get 1 random quote from a table I have:
--
$query=select quote from quotes where id=$id;
$query_res = mysql_query($query) or die(mysql_error());
if (mysql_num_rows($query_res)  1)
{ //print message
 $display_block = PSomething blew up./P;
}
else
{ //get info and build Quote display
 $Quote = mysql_fetch_array($query_res);
 echo $Quote['quote'];
}


It could be as simple as the  not working where you really need '  but 
that depends on what/how you are doing things.


Wolf



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



Re: [PHP] How to prevent DoS on PHP script?

2008-06-16 Thread Wolf

Michelle Konzack wrote:


*   Do not Cc: me, because I READ THIS LIST, if I write here   *
*Keine Cc: am mich, ich LESE DIESE LISTE wenn ich hier schreibe*


Hello,

on my devel server I have a script, which allow me  to  upload  Debian
packages which then are included in my private Debian mirror.

Now I have gotten several 1000 hits in the last days.  I call it DoS.

There are idiots who have tried to upload shit on my Webspace but  since
I check it to be ONLY Debian files they where not successful.

My biggest problem is, that the /fileupload.php was always  references
from outside my webspace.  OK, I was thinking  this  can  be  solved  by
using HTTP_REFERER which has then worked for some  days  but  NOW  those
pigs are back and sending spoofed HTTP_REFERER.

Since I have only a VHost @ISP I can not  go  deeper  into  the  Apache2
config what I have done when I was running my own server.

Can anyone suggest me something, how to block requests from outside?

Size limitation is not possibel, since some of my upload files are  very
huge and I must be able to  upload  files  without  Laptop  and  FTP/SCP
access.


There's a number of things you can try, depending on what EXACTLY they 
are doing.


If they are uploading things to your server which they then reference, 
it is a simple apache configuration that you could do.  For instance, 
you can upload fine to my server, but once it is there, the system knows 
nothing about it.  You can see the file all day long, but nothing is 
going to allow it to get served back to you.


If they are continuing to load the page, implement a simple login and 
page check for that specific page.  Sure, apache loads the page, but 
that's done PDQ instead of letting them upload a file first.  If the 
login works, great, give them the upload form, otherwise error them out. 
 You could snag the IP address, browser type, other information and 
store it all in a DB, then do a quick check to see if the IP matches, 
followed by a browser and whatnot.  It's overkill, but you should also 
see HOW they are doing it as well, and you could implement the block to 
work on a number of factors.


If they are uploading to just stall you out, talk to the ISP and let 
them know you are getting DDOS and get their network admins involved.


You could change the filename, but maybe that's too simple a suggestion? 
 If it is for your personal use, rename the upload page to 
Michelles_dumb_upload_script.php or even have a cron job that randomly 
changes the name of the file and emails you the new name when it is done.


OH, and check your email sending server for dates and such.  According 
to the headers, you sent the email this morning.  But according to the 
dates on the sent email, you sent it on the 13th at 4:21 PM which is 
about 2 days and 15 hours and 32 minutes before you actually did.


Wolf


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



Re: [PHP] looping through a database

2008-06-16 Thread Richard Kurth

Wolf wrote:

Richard Kurth wrote:
I am looping through a database of files that are numbers 1 through 
10 if  number 1 is in the database I what to print out the first 
table below if it is not then print the else section below. Then loop 
through the database to see if 2 through 10 are there and do the same 
thing. Of course what I am doing does not work. Should I move it all 
to an array and then loop through it. Or use a foreach loop.

Could you please give me an idea where to start looking

while($row=mysql_fetch_array($sql_result)){

if ($row[number]==1) {
tr
td File 1/td
tdThis is the file/td
tdDelete/td
/tr
}else{
tr
tdFile1/td
td/td
tdAdd/td
/tr
}

}



What is the query being executed?

Seriously, this needs more information.  On the upside, it LOOKS like 
it should work, however...


Here's what I use to get 1 random quote from a table I have:
--
$query=select quote from quotes where id=$id;
$query_res = mysql_query($query) or die(mysql_error());
if (mysql_num_rows($query_res)  1)
{ //print message
 $display_block = PSomething blew up./P;
}
else
{ //get info and build Quote display
 $Quote = mysql_fetch_array($query_res);
 echo $Quote['quote'];
}


It could be as simple as the  not working where you really need '  
but that depends on what/how you are doing things.


Wolf




This is the query being executed
$sql = SELECT * FROM table WHERE members_id = . $_SESSION[members_id];
$sql_result = mysql_query($sql) or die(mysql_error());

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



Re: [PHP] looping through a database

2008-06-16 Thread Wolf

Richard Kurth wrote:

Wolf wrote:

Richard Kurth wrote:

Could you please give me an idea where to start looking

while($row=mysql_fetch_array($sql_result)){

if ($row[number]==1) {
tr
td File 1/td
tdThis is the file/td
tdDelete/td
/tr
}else{
tr
tdFile1/td
td/td
tdAdd/td
/tr
}

}



What is the query being executed?

!-- SNIP --




This is the query being executed
$sql = SELECT * FROM table WHERE members_id = . $_SESSION[members_id];
$sql_result = mysql_query($sql) or die(mysql_error());


That still pretty much tells me nothing.

Does your table named table exist?
Does your script connect or error?
What DOES output to your screen?
Does the schema for your table contain numbers?

What happens when you use $row['number']?

Or are you just hoping for someone to write your code?

As written, your code will fail due to having PHP interspersed with HTML 
code.  As such, you either need to echo or exit out of the PHP areas and 
then continue.


Wolf


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



[PHP] mysqliconnect issue

2008-06-16 Thread Jason Pruim
Okay, So I'm going to just assume that my issue is the fact that I'm  
tired... and my mind won't work properly.


[Mon Jun 16 22:27:58 2008] [error] PHP Warning:  mysqli_connect()  
expects parameter 5 to be long, string given


Now parameter 5 is the database name, I echoed out each of the  
parameters and everything looks right...


here's the line that's causing the problem:

		mysqli_connect($link, $server, $username, $password, $database) or  
die('Connection failed in dbmysqliconnect.php');


Any ideas?

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



Re: [PHP] mysqliconnect issue

2008-06-16 Thread Chris
Jason Pruim wrote:
 Okay, So I'm going to just assume that my issue is the fact that I'm
 tired... and my mind won't work properly.
 
 [Mon Jun 16 22:27:58 2008] [error] PHP Warning:  mysqli_connect()
 expects parameter 5 to be long, string given
 
 Now parameter 5 is the database name, I echoed out each of the
 parameters and everything looks right...
 
 here's the line that's causing the problem:
 
 mysqli_connect($link, $server, $username, $password, $database)
 or die('Connection failed in dbmysqliconnect.php');

No, #5 is the port number (http://www.php.net/mysqli_connect).

You want:

$link = mysqli_connect($server, $user, $pass, $dbname);

$link can't be passed to mysqli_connect because it doesn't exist yet ;)

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] looping through a database

2008-06-16 Thread paragasu
i am not sure what u want to do, for this case you need to tell us
about your database table
structure. i quess you have table like this.. assume the table name is
table1 and there are ten
column in it file1..file10 respectively

|table1 |
|member_id |
|file1|
|file2|
|file3|
|   :  |
|file10  |

while($row =  mysql_fecth_array($sql_result))
{
  echo display_file($row['file1']);
  echo display_file($row['file2']);
  :
  echo display_file($row['file10']);

}

function display_file($filename)
{
   if file not exist or null etc
  return   add file here link
  else
  return  display file, delete file

}

this is the idea. of course maybe not what you want, unless you can tell us what
really you want to do or what you got..

On 6/17/08, Wolf [EMAIL PROTECTED] wrote:
 Richard Kurth wrote:
 Wolf wrote:
 Richard Kurth wrote:
 Could you please give me an idea where to start looking

 while($row=mysql_fetch_array($sql_result)){

 if ($row[number]==1) {
 tr
 td File 1/td
 tdThis is the file/td
 tdDelete/td
 /tr
 }else{
 tr
 tdFile1/td
 td/td
 tdAdd/td
 /tr
 }

 }


 What is the query being executed?
 !-- SNIP --


 This is the query being executed
 $sql = SELECT * FROM table WHERE members_id = . $_SESSION[members_id];
 $sql_result = mysql_query($sql) or die(mysql_error());

 That still pretty much tells me nothing.

 Does your table named table exist?
 Does your script connect or error?
 What DOES output to your screen?
 Does the schema for your table contain numbers?

 What happens when you use $row['number']?

 Or are you just hoping for someone to write your code?

 As written, your code will fail due to having PHP interspersed with HTML
 code.  As such, you either need to echo or exit out of the PHP areas and
 then continue.

 Wolf


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



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



[PHP] conversion of unicode characters into utf-8

2008-06-16 Thread valsaraj

Hi,
I am using code 
$val = htmlentities($val, ENT_QUOTES, UTF-8);

but it's not working in version 5.2.0. Is there any additional configuration
needed for this. it's working well in 5.2.2. Could you please help me???
-- 
View this message in context: 
http://www.nabble.com/conversion-of-unicode-characters-into-utf-8-tp17878398p17878398.html
Sent from the PHP - General mailing list archive at Nabble.com.


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