[PHP] Need to check whether a param exists!

2003-02-03 Thread Brian Dunning
Hi,

All I'm trying to do is check for the presence of a query string, but 
everything I try gives me an Undefined Index error. I want to set a 
variable $pagename to whatever was passed as the ?page= value, and if 
it wasn't passed, set it to some default value.

http://www.mysite.com/index.php?page=hello


if (is_object($_REQUEST['page']))
$pagename = $_REQUEST['page'];
else
$pagename = "home";
?>

I also tried is_null, tried if($_REQUEST) by itself, also tried all of 
these with $_GET, $_POST, $_GLOBAL, but they all give me Undefined 
Index error on that If line.

- Brian


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



Re: [PHP] Need to check whether a param exists!

2003-02-03 Thread Brian Dunning
Wow, an embarrassment of riches. Thanks to all of you who replied so 
quickly.

- Brian


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



[PHP] Is my syntax wrong?

2003-02-04 Thread Brian Dunning
Hi,
The following code is giving me a "parse error, unexpected T_STRING."

$inc_current_ad = WrapMySQLDatabaseResults("macasap", "update ads where 
ad_id = '.$current_ad->Value("ad_id").' set 
rotate='.$current_ad->Value("rotate")+1.'", 
"block=0","inc_current_ad");

It's supposed to increment the value ad_id in the ads table. The 
current_ad action works fine and correctly retrieves the right record. 
I suspect I have a problem with my quotes?

- Brian


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



Re: [PHP] Is my syntax wrong?

2003-02-04 Thread Brian Dunning
I think we are almost there. This code is not producing an error, but 
it is also not incrementing the database. The value stays at zero. Any 
idea what could be wrong?

$inc_current_ad = WrapMySQLDatabaseResults("macasap", "update ads where 
ad_id = ".$current_ad->Value("ad_id")." set 
rotate=".($current_ad->Value("rotate")+1), "block=0","inc_current_ad");

Other queries of the same db on the page are working, so it's probably 
not a configuration/connectivity issue.

- Brian


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



Re: [PHP] Is my syntax wrong?

2003-02-05 Thread Brian Dunning
On Tuesday, February 4, 2003, at 05:03  PM, John W. Holmes wrote:


I think we are almost there. This code is not producing an error, but
it is also not incrementing the database. The value stays at zero. Any
idea what could be wrong?

$inc_current_ad = WrapMySQLDatabaseResults("macasap", "update ads

where

ad_id = ".$current_ad->Value("ad_id")." set
rotate=".($current_ad->Value("rotate")+1),

"block=0","inc_current_ad");

Are you sure $current_ad->Value("rotate") is returning a value?


Yes it is.


If you're just trying to increment "rotate" by one, then you can use
Update ... set rotate = rotate + 1 where ...


Could you give me the full SQL statement?


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




[PHP] Include today's date in a SQL statement?

2003-02-05 Thread Brian Dunning
What would the SQL be to find a record where:

  start_date < today <= end_date

Thanks,
- Brian


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




[PHP] GoLive dynamic actions anyone?

2003-02-10 Thread Brian Dunning
I have a GoLive dynamic content site, and its pages require than you 
include at the top a file called mysql.runtime6.php. All is well, 
except when I try to type in my own SQL actions that are intended to be 
totally separate from anything the GoLive stuff is doing, I get an 
error in mysql.runtime6.php saying that there's some invalid MySQL 
result resource.

Is there something special I need to do to run my own database stuff 
without that GoLive thing interfering?

- Brian


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



[PHP] Installation help

2003-05-27 Thread Brian Dunning
Hi,

I am a lamer & a newbie, and ran the PHP and MySQL installers on my XP 
box, but can't connect to any database and don't see any new processes 
running. Is there someplace I can find documentation for this that is 
optimized for the newbie lamer? Thanks,

- Brian

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


[PHP] Can't change a cookie

2003-05-30 Thread Brian Dunning
Help,

I'm trying to change a cookie to whatever is submitted as a URL
parameter called 'aid.' But once it's set the first time, I can't get
it to overwrite it next time the 'aid' parameter is received. How do I
make this work? Here is my code:

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


[PHP] CR in MySQL?

2003-05-31 Thread Brian Dunning
How do you put a carriage return in a MySQL database and have it 
display as a line break on the web page?

- Brian

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


[PHP] Is this a new PHP technology??????

2003-06-27 Thread Brian Dunning
Check it out:

http://www.americansubstandard.com/index.php?sub=v&word=vmail

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


[PHP] Need PHP consulting - $!

2003-12-08 Thread Brian Dunning
I need some consulting assistance with a project. Complete information 
about what I need is on this page - 
http://www.briandunning.com/php-help.shtml

THANK YOU!!!

- Brian

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


Re: [PHP] Is there a brian I can pick?

2004-07-26 Thread Brian Dunning
I'm a Brian, but you can't pick me unless you're a really hot chick.
- Brian
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Newbie image manipulation question

2004-07-28 Thread Brian Dunning
I'm just about to dive into image uploading & resizing for the first 
time. Do I need Imagemagick for this, or are PHP's Image tags adequate? 
All I want to do is let the user upload a graphic, and have PHP 
automatically scale it to a couple of desired sizes, and name them, 
pretty basic stuff.

I don't suppose there is an example or tutorial of this process 
anywhere, geared toward B1FF the n00b? Obviously this has been done a 
thousand times before...

Thanks for any clueing-in,
- Brian
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Server's clock gone funny, maybe?

2004-07-29 Thread Brian Dunning
I've got a function where I reset an expiration datetime to 3 days in 
the future, using:

  update table set expire = NOW()+300 where ...
Has always worked great, but today it always sets the field to 
-00-00 00:00:00. No code was touched. Anyone have a clue? A problem 
with the ISP's server clock?

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


Re: [PHP] Server's clock gone funny, maybe?

2004-07-29 Thread Brian Dunning
On Jul 29, 2004, at 10:18 AM, Jay Blanchard wrote:
Have you asked the ISP?
No - that's like asking a black hole, unfortunately - I was hoping 
someone here might spot a problem on my end.

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


Re: [PHP] Server's clock gone funny, maybe?

2004-07-29 Thread Brian Dunning
On Jul 29, 2004, at 10:45 AM, Jay Blanchard wrote:
Please read this now, before you post again...
http://catb.org/~esr/faqs/smart-questions.html
Thank you for not trying to be a condescending smartass at all.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Conversion of Field Value to Hyperlink

2004-07-29 Thread Brian Dunning
Most people who use the term RTFM do not attach any hostile 
intentions with
it.
I'm among those who are really pissed off when I see honest questions 
being answered with 'RTFM' or 'STFW'. I am relatively new to PHP, but 
by no means am I new to programming: like everyone else here, I already 
know how to RTFM and STFW. But sometimes I like to get an opinion from 
a real person: correct me if I'm wrong; is that not the purpose of a 
list??

If you're going to answer with an insulting 'RTFM' or 'STFW' then don't 
even post. Your noise is not helpful. Go find a list where everyone 
already knows everything so you can masturbate all you want.

Please flame me back channel,
Brian Dunning
http://www.briandunning.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Why do I keep getting a 501 mail error?

2004-08-05 Thread Brian Dunning
Developing on a Windows server to be deployed on Linux. I get "SMTP 
server response: 501 Bad address syntax." Here's my code:

$mail_from = 'My Name <[EMAIL PROTECTED]>';
$mail_server = 'mail.servername.com'; // This is hosted externally
ini_set("SMTP", $mail_server);
ini_set("sendmail_from", $mail_from);
$mail_to = "$first_name $last_name <$email>";
mail($mail_to, "Here is my subject", "Please click this link to 
activate your  account:\n\n$http_root"."owner.php?id=$entry_code", "To: 
$mail_to\nFrom: $mail_from\nContent-type: text/plain\nMailer: 
PHP/".phpversion());

I read about trying \r\n instead of \n in the headers, but it didn't 
seem to make any difference, and \n is working on other mail actions on 
this same server.

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


Re: [PHP] How pass form variable to window.open()

2004-08-05 Thread Brian Dunning
Actually, I just did this last night with great success. Here is my  
code, I'm sure you can adapt it to your own. PHP was not needed, this  
was all done as part of the client-side validation JavaScript. Use  
JavaScript in the submit button's onClick to set the JavaScript  
variable with the value from the form field (I have a form field called  
"z" that is getting passed along as a GET request with the window.open  
href):



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

Re: [PHP] Why do I keep getting a 501 mail error?

2004-08-06 Thread Brian Dunning
Thanks very much to everyone for all the suggestions. I tried them all, 
and even the most minimal stripped down attempt:

  mail('[EMAIL PROTECTED]','Test','Test');
fails with a 501 error, "Bad address syntax." This is on a Windows box. 
Anything else I can try? Is it possible that there is some ini_set that 
is not configured?

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


Re: [PHP] Why do I keep getting a 501 mail error?

2004-08-06 Thread Brian Dunning
On Aug 6, 2004, at 8:35 AM, Nicklas Bondesson wrote:
Do you know what SMTP software they are running on the mailserver?
Just whatever IIS uses by default on my Windows box...
- Brian
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Why do I keep getting a 501 mail error? - SOLVED

2004-08-06 Thread Brian Dunning
Turns out I was doing one of these in my config file:
  ini_set("sendmail_from", 'First Last <[EMAIL PROTECTED]>');
And there's that Windows-unfriendly format again. Thanks much to all 
who showed me what to look for!  :)  :)

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


[PHP] [OFF] - Fraudulent web orders - any ideas?

2004-08-16 Thread Brian Dunning
Hi all,
I have a simple PHP store, and it appears that someone is using it to 
test credit card numbers. I'm getting a very high number of small 
orders every day, but a lot more declines. My merchant provider 
suggests blocking that person's IP address, but that's not practical 
since it's dynamic. I'll get a lot of orders from one IP address for a 
few hours, but then the address changes.

I wonder if anyone has any experience with this, and if so, can you 
suggest a way to deal with it?

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


Re: [PHP] [OFF] - Fraudulent web orders - any ideas?

2004-08-16 Thread Brian Dunning
Thanks to all of you for your suggestions. Yes I have been logging IP 
address in my orders database.

I think I may have solved it by an even simpler method: I emailed the 
perpetrator to "thank him for all of his orders" to see what he'd say. 
His first few orders came with real email addresses, and even a few 
under what appears to be his own name "Abang Batax." Ever since I sent 
that email I haven't had a single order come through from him. That 
alone may have scared him off.

Nevertheless, I think I will implement a few of your suggestions. I 
like the idea of an SQL table to store IP addresses that are blocked, 
though I'd make it last for a couple of days to be extra safe rather 
than 30 minutes.

Anyone know who the "proper authorities" are, to whom I could give my 
logs? Amazingly, my CardService rep didn't know. He also didn't seem to 
care or think it was a very big deal. The total orders that went 
through are about 100 orders at $15 each. My guess is that "Abang 
Batax" is probably overseas, so it may not be worthwhile following up.

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


Re: [PHP] [OFF] - Fraudulent web orders - any ideas?

2004-08-16 Thread Brian Dunning
On Aug 16, 2004, at 10:07 AM, Ed Lazor wrote:
Geesh, this sounds scary.  Are you requiring account login before 
processing
payments?
Not on this store, it's a really competitive market.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] EPS to PDF?

2004-08-20 Thread Brian Dunning
Does anyone know of a class or technology that can convert an EPS 
document in memory to an outputtable PDF? GD? ImageMagick?

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


[PHP] [OFF] Double charges to credit cards

2004-08-20 Thread Brian Dunning
This question is not necessarily PHP-specific, though we are running 
PHP classes.

Online store, credit card authorized at time of order, credit card 
charged at time of shipment (could be anywhere from a few minutes to a 
couple weeks later). Standard stuff. But customers are complaining that 
they're being double-charged. Turns out that both the authorization and 
the charge are showing up on their statements. Our merchant provider, 
ConcordEFSnet whose API we're using, says that this is just the way it 
works and there's nothing we can do about it.

Sounds too incredible to be true. I've never seen anything like this on 
my own credit card statements, and I can't imagine that Amazon, et. al. 
have this problem, though they follow our same business process. Can 
anyone shed any light on this?

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


[PHP] Linkpoint API question

2004-08-20 Thread Brian Dunning
I telephoned *just* as the Linkpoint API support folks left for the 
weekend

Currently we are doing just a SALE transaction. I want instead to first 
submit an authorization with AVS and CVV2 information, make a decision 
(2 out of 3) and then process the charge or not. The documentation is 
not clear to me: does anybody know which of Linkpoint's "ordertypes" 
these would be? Would the first be PREAUTH and the second be POSTAUTH?

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


Re: [PHP] Linkpoint API question

2004-08-22 Thread Brian Dunning
Solved. The first transaction should be a PREAUTH, and the second 
transaction should be a POSTAUTH. Linkpoint's documentation is 
incorrect where it lists the possible transaction types. POSTAUTH shows 
up as TICKET in the transaction report, but it doesn't work if you try 
to send it as TICKET.

Nicely done, Linkpoint. Thanks to all for the help.  :)
- Brian
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: [OFF] Double charges on credit cards

2004-08-22 Thread Brian Dunning
Solved. As suggested, the tech guy at EFS was on paint. The first 
transaction should be an AUTH, and the second transaction should be 
PRIOR_AUTH_CAPTURE, not just CAPTURE.

Thanks everyone for confirming there was no way what the guy said could 
be true...  :)

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


Re: [PHP] [OFF] - Fraudulent web orders - any ideas?

2004-08-23 Thread Brian Dunning
The plot thickens. I added AVS *and* CVM to the site - and the Amex 
orders are still going through. Amex ignores CVM, and the address was 
correct, so the thieves must have gotten ahold of printed statements 
that show the billing address. Any idea how to combat THAT? They are 
using fake IP addresses now so I can't keep up by blocking IP's.

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


Re: [PHP] [OFF] - Fraudulent web orders - any ideas?

2004-08-24 Thread Brian Dunning
On Aug 24, 2004, at 9:05 AM, [EMAIL PROTECTED] 
wrote:

are you passing the cvm on the mc/visa charges? is that stopping them?
Yes, I'm doing CVM (or whatever) and AVS on all orders. Where CVM 
passes, I accept anything but a NN match on AVS. If CVM is blank, I 
accept only YY on AVS. So far only one fake Amex order has gone 
through. This may be as good as I can get it without resorting to user 
accounts, etc.

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


[PHP] Cardservice lphp won't create array

2004-09-03 Thread Brian Dunning
You'll need to be generally familiar with Cardservice's lphp class to 
answer this one:

I'm properly setting the $myorder array (as verified by outputting it 
with a while loop) - but upon executing the next step:

  $charge_result = $mylphp->curl_process($myorder);
I then attempt to display the full results with this:
  while (list($key, $value) = each($charge_result))
  {
	echo htmlspecialchars($key) . " = " . htmlspecialchars($value) . 
"\n";
  }

But I get:
  Warning: Variable passed to each() is not an array or object
It appears that somehow lphp is not creating the results array that 
it's supposed to. I am properly including the lphp.php file, and I've 
verified that curl is turned on. Anyone have a clue, or is there any 
more info I need to provide?

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


[PHP] More on the credit card fraud

2004-09-06 Thread Brian Dunning
The fraudulent orders that I receive on my site come with email 
addresses of eight random alphanumerics @yahoo.com.

Is anyone handy enough with regex or can show me a quick way to test 
for that, so I can at least refuse all orders with that pattern? (it 
will work for a little while, until they get wise and change patterns 
again.)

Many thanks,
- Brian
PS - If anyone wants an update: the orders stopped for a while but 
started up this weekend with a vengeance. Now they are coming with 
valid address verification AND card validation numbers! Pretty darn 
good, whoever's doing it. One of the cops I've spoken with says that 
they're making a large number of small charges (like mine) to these 
cards and then, in one case, placing a large $2000 order from QVC. In 
that case the large charge was declined, thankfully.

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


[PHP] Re: Cardservice lphp won't create array

2004-09-08 Thread Brian Dunning
But I get:
   Warning: Variable passed to each() is not an array or object
I assume you have instantiated the $mylphp object with "new"?
Yes, in fact I'm using their demo files just to eliminate all the 
possible variables. It seems to only be a problem on my development 
server. Works fine in production. It sounds like it should be 
correctible by editing something in php.ini but nothing jumps out at 
me...

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


Re: [PHP] Re: Cardservice lphp won't create array

2004-09-08 Thread Brian Dunning
It seems the problem is that port 1129 is blocked somewhere, which lphp 
needs to communicate with Cardservice. Sorry for the noise, hope this 
is helpful to someone else.  :)

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


[PHP] Totaling sales by month

2004-09-10 Thread Brian Dunning
I have a MySQL db with a datetime field containing the date and time of 
the sale. I want to query for a simple report that shows total sales by 
month.

I thought this would be quick & easy but it's NOT! I can't figure out 
how to query for it.

If this question would be better posed to a SQL list, I'd appreciate a 
recommendation to a good one. I couldn't find one via STFW that had any 
kind of volume.

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


Re: [PHP] Totaling sales by month

2004-09-10 Thread Brian Dunning
Thanks Pablo - but it's more complicated than that. I'm trying to 
return totals for all calendar months, not all records within the past 
month. I'll word my question better and post it to one of your 
suggested lists.  :)

On Sep 10, 2004, at 4:27 PM, Pablo Gosse wrote:
Brian Dunning wrote:
I have a MySQL db with a datetime field containing the date and time
of the sale. I want to query for a simple report that shows total
sales by month.
I thought this would be quick & easy but it's NOT! I can't figure out
how to query for it.
If this question would be better posed to a SQL list, I'd appreciate a
recommendation to a good one. I couldn't find one via STFW that had
any kind of volume.
- Brian
Haven't used MySQL in about four or five years (use PostgreSQL instead)
but it will be something like this:
select * from tablename where datetime_field <= (now() - interval('1
month'));
The difference for you would be in the now() function (whatever mysql
function returns the current system time is what you need) and the
interval function.  This just takes the present time and applys the
specified interval.
Check out http://forums.devshed.com and http://www.tek-tips.com.
They have a lot of forums that are pretty heavily visited.
HTH.
Pablo

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


Re: [PHP] Totaling sales by month

2004-09-10 Thread Brian Dunning
Amazing - that did it, first try! THANKS. I knew it had to be simple. 
SQL rocks.

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


[PHP] Can't maintain session across domains

2004-09-18 Thread Brian Dunning
I'm hosting on PowWeb where you have a different domain for SSL pages. 
I'm trying to pass the user from the www.mydomain.com pages to the 
mydomain.secure.powweb.com pages to complete a credit card transaction, 
so I pass sid=xx as a GET param on the link that jumps them to the 
new domain. This works on my development server and on another domain, 
but it's not working here (just dumps them to the login page on the 
secure domain). Any suggestions?

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


[PHP] Split haystack at nth occurrence of needle?

2004-09-22 Thread Brian Dunning
I've been RTFMing for about an hour and I can't find a string function 
to split haystack 'onetwothreefourfive' at the nth 
occurrence of needle ''. strpos gives me the position of the first 
needle, and strrpos gives me the position of the last needle. But I'm 
looking for the position of one of the in-between needles, so that I 
can use substr() to trim everything from there on. What very obvious 
function was I unable to find in the manual?

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


Re: [PHP] Split haystack at nth occurrence of needle?

2004-09-22 Thread Brian Dunning
twothreefourfive';
  $nthPos = 4;
  $tmpArr = explode( '', $string );
  $nthString = $tmpArr[($nthPos - 1)];
?>
Thanks Chris, that works great, but it's not doing what I want. I'm 
just trying to get the position of the 3rd occurrence (for example) of 
''. So I'm looking for a function that will return the value 19, 
given the above example string.

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


Re: [PHP] Split haystack at nth occurrence of needle?

2004-09-22 Thread Brian Dunning
I don't understand why explode won't work for you.
The explode solution is working. Thanks very much to everyone who 
replied with so much great information!

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


[PHP] Question about array_search

2004-10-11 Thread Brian Dunning
Say I'm trying to add a value to an array, only if it's not already in 
there somewhere; so I do an array_search to see. The problem is that if 
the item is at index 0 in the array, array_search gives the same answer 
as if it's not in there at all. How does one circumvent this potential 
pitfall?

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


[PHP] Grab an array from a cookie without throwing errors?

2004-10-08 Thread Brian Dunning
I've got a cookie that's either non-existent or a serialized array. I'm 
trying all sorts of different code combinations to retrieve it into an 
array variable, but everything I try throws up some combination of 
notices and/or warnings. Here is my latest & greatest:

$cookie = $_COOKIE['bookmarks'];
if(unserialize($cookie) == true) {
$bookmarks = unserialize($cookie);
} else {
$bookmarks = array();
}
Produces:
Notice: Undefined index: bookmarks in 
c:\Inetpub\wwwroot\palms\htdocs\bookmarks.php on line 5

Notice: unserialize() [function.unserialize]: Argument is not an string 
in c:\Inetpub\wwwroot\palms\htdocs\bookmarks.php on line 5

Any suggestions on how I can do this without throwing notices? I'm 
aware that I can turn notices off but I like them kept on to help me 
with debugging.

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


[PHP] Can GD make a JPG thumbnail of a PDF?

2008-11-20 Thread Brian Dunning

Well can it?

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



[PHP] Anyway to simulate pcntl_fork() on Windows?

2008-11-21 Thread Brian Dunning
It's the function I need most and it's not available on Windows, and  
unfortunately that's what the client uses. Any suggestions for a  
workaround?


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



[PHP] Slow file download

2008-12-02 Thread Brian Dunning
I'm using a PHP cron job to constantly download files from a remote  
server. Client and server both have abundant unused bandwidth, and the  
sysads have already eliminated switches, interface cards, etc. as the  
source of the slowdown. I'm looking at the script to see why file  
downloads are taking so long and going so much slower than if I were  
to simply manually download them with a browser on the same machine.  
The script says:


$ctx = stream_context_create(array('http' => array('timeout' =>  
1200))); // 20 minutes per file

$contents = file_get_contents($full_url, 0, $ctx);
$fp = fopen('D:\\DocShare\\'.$filename, "w");
$bytes_written = fwrite($fp, $contents);
fclose($fp);

Yes, it's on Windows. Any idea whether my PHP code might be  
introducing a slowdown? The files range from 500K to 50MB. I often  
launch multiple instances of the script but it doesn't seem to help  
much.


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



Re: [PHP] Slow file download

2008-12-02 Thread Brian Dunning
I'm open to something like that - we're in the middle of the holiday  
crunch and can't afford any downtime, so a significant change is out  
of the question. This is part of much larger and more involved  
scripting, so it would need to be a plug-n-play replacement and also  
be able to return information to the script calling it - bytes,  
success or failure. We're grabbing filenames and credentials out of  
MySQL, marking them "in progress", attempting the download, and then  
updating the MySQL record with the results.


On Dec 2, 2008, at 12:04 PM, Ashley Sheridan wrote:

Instead of using PHP for this, why not have a look at WGET for  
Windows.




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



Re: [PHP] Re: Slow file download

2008-12-02 Thread Brian Dunning

IIS, Windows PHP 5.2.6, and unfortunately the downloads are https.

On Dec 2, 2008, at 12:32 PM, Nathan Rixham wrote:

what's the server running? iis/apache, win/linux version of php (as  
accurate as you can) oh and via http or https/ssl?


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



Re: [PHP] Can GD make a JPG thumbnail of a PDF?

2008-12-10 Thread Brian Dunning
I've spent most of the last week trying to get ImageMagick working on  
my Windows PHP installation. I gather that since I'm going to be  
converting PDFs to JPEGs, I need Ghostscript.


Well, I've got ImageMagick installed: http://printhq2.com/info.php
I ran a Ghostscript installer, but it didn't seem to do very much.

Some site advised me to test my installation like this:
";
system("convert -version");
echo "";
?>
But it just returns blank. Can anyone help me get ImageMagick working  
on my server?



On Nov 20, 2008, at 4:41 PM, Stephen Johnson wrote:

No but you can use imagemagicks convert to convert the pdf to an  
image and

then make a thumbnail of it.



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



[PHP] Help debugging a file upload on IIS

2008-12-29 Thread Brian Dunning
Hi - I have a file upload that returns no error, but the file does not  
appear on the server. Here is the result of $_FILES:


Array (
[f] => Array (
[name] => Elephants.pdf
[type] => application/pdf
[tmp_name] => C:\WINDOWS\Temp\php3133.tmp
[error] => 0
[size] => 114109 ) )

Nothing new at all in C:\Windows\Temp\. PHP is properly putting its  
session files in there, so I know PHP has permission. Anyway I set  
Everyone permissions to Full Control for that directory. post_max_size  
and upload_max_filesize are both 250M. Just not sure what else to check.


PHP 5.2.6, Microsoft-IIS/6.0, Windows 2003 Server R2, Enterprise  
Edition, SP2


Thanks.

Re: [PHP] Help debugging a file upload on IIS

2008-12-29 Thread Brian Dunning

The one thing I was doing was:
move_uploaded_file($_FILES['upload_file']['tmp_name'], $new_path);

but nothing was happening, no new file appearing where it was supposed  
to, and no error returned, left me scratching my head. (Later the same  
script logs the upload to MySQL using data from $_FILES and that part  
works fine.)


On Dec 29, 2008, at 12:43 PM, Ashley Sheridan wrote:


Sorry, that's a silly question, ignore that. As far as I'm aware, IIS
removes the files once the script has run it's course; so unless  
you're

doing something with the file in your code, you won't really see it.




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



[PHP] IM Convert PDF->JPG works in command line, not in PHP

2008-12-31 Thread Brian Dunning
Here's a weird thing. I have a new Redhat machine, with PHP 5.2.6 and  
IM 6.4.8. The following works beautifully on the command line:


convert original.pdf new.jpg

But from PHP, it only works beautifully if I specify complete  
pathnames for convert, the original file, and the new file (that's OK,  
no problem), but it only works converting JPG and GIF images. As soon  
as I try to convert a PDF image, it fails:


$command_line = "/usr/local/imagemagick/bin/convert  /var/www/html/ 
original.pdf /var/www/new.jpg";

system($command_line, $return_var);
?>

$return_var = 1. I don't have ghostscript, but I figured I don't need  
it since the PDF->JPG conversions works on the command line. Any  
suggestions?


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



Re: [PHP] IM Convert PDF->JPG works in command line, not in PHP

2008-12-31 Thread Brian Dunning
My typo skipping the '/html/' in the pathname, the paths are correct  
in my actual code.


On Dec 31, 2008, at 3:24 PM, Brian Dunning wrote:


/var/www/html/original.pdf /var/www/html/new.jpg




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



Re: [PHP] IM Convert PDF->JPG works in command line, not in PHP

2008-12-31 Thread Brian Dunning
Interesting. When I try this, $return_output gives an empty array, and  
$return_code gives 1.


On Dec 31, 2008, at 3:38 PM, chris smith wrote:


Try using exec() so you get the whole return message, might be

something useful in there.

exec($command_line, $return_output, $return_code);




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



Re: [PHP] IM Convert PDF->JPG works in command line, not in PHP

2008-12-31 Thread Brian Dunning
OMG. I had not set the permissions properly on the destination  
directory. It works now.

Sorry for wasting the list's time, and thanks to Chris for your help.



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



[PHP] Anyone else have trouble with Apple Mail threading this list?

2008-12-31 Thread Brian Dunning
I use Apple Mail, and subscribe to many lists but PHP-General is the  
only one I have this problem with. People tell me that my replies are  
not properly threaded to the original post. When I hit Reply or Reply  
All in Mail, it wants to reply directly to the poster, and only CC's  
the list. So I drag the CC address up to the To field and delete the  
poster's address. Seems like the best I can do, but it creates this  
problem people have reported. Do I just totally suck, or is there a  
more reasonable explanation?


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



[PHP] How can a script tell if there's a MySQL problem?

2009-01-09 Thread Brian Dunning
I have one server that's pretty busy and runs into "Too many  
connections" from MySQL from time to time, and needs to have MySQL  
restarted to clear it up.


I've tried everything I can think of to have PHP take note of this  
error but continue executing with other stuff, but no matter what I  
try the PHP script stops whenever it encounters this and just displays  
"Too many connections."


Anyone know if there's a way for PHP to gracefully detect this and  
resume operation without choking?


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



[PHP] imagejpeg, imagecreatefromjpeg both choke

2009-01-09 Thread Brian Dunning
I'm trying a stripped down test just to try to get this work. I have a  
valid jpeg on disk:


3.jpg<- 3316x2220, 3.6 MB

And am trying either of the following:

// This does nothing at all
imagejpeg('3.jpg');

// This displays "failed"
$im = imagecreatefromjpeg('3.jpg');
if(!$im) echo 'failed';

phpinfo() shows GD enabled, JPEG functions enabled, memory_limit at  
256M, permissions on the file and the enclosing folder are 777. Any  
suggestions what else I can try to debug this?


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



Re: [PHP] imagejpeg, imagecreatefromjpeg both choke

2009-01-09 Thread Brian Dunning
Same thing, no output at all. I can access the image directly in my  
browser and it's fine.


On Jan 9, 2009, at 7:52 AM, Zechim wrote:


try,

  header('Content-type: image/jpeg');
  $image   = imagecreatefromjpeg($your_file);
  imagejpeg($image,"", 100);
  imagedestroy($image);

zechim



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



[PHP] Convert CMYK values to RGB values?

2009-01-09 Thread Brian Dunning
Anyone know how to convert CMYK values to RGB values? I'm just trying  
to translate the numbers from one to the other, not actually do any  
graphic stuff. Thanks.


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



Re: [PHP] Convert CMYK values to RGB values?

2009-01-09 Thread Brian Dunning
I think your short answer is the right one. This explains why I didn't  
find that cmyk_to_rgb() function on php.net. Thanks...   :-(



On Jan 9, 2009, at 3:14 PM, c...@l-i-e.com wrote:



Short Answer:

You can't.
:-)




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



[PHP] Best way to post XML via curl?

2009-02-11 Thread Brian Dunning
I'm going crazy, can't quite get this encoding to work. I've tried all  
the various combinations, trying to send this block $xml (which is a  
simple string variable) via post along with 3 other params:


$postArgs = http_build_query(array('method'=>'newPrintRequest',  
'login'=>$login, 'password'=>$password, 'orderxml'=>$xml));

$ch = curl_init('http://test.server.com/rest_interface.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postArgs);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml"));
$response = curl_exec($ch);

Is this use of http_build_query the best way to send XML? Any other  
curl options I should be setting? I tried urlencoding() the $xml, I  
tried htmlspecialchars(), I tried nothing at all, I tried & and  
& is there a "best practice" for how a big block of xml should be  
posted?


:-(


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



Re: [PHP] Best way to post XML via curl?

2009-02-11 Thread Brian Dunning

Just realized I didn't happen to mention the problem.   :-)

The server is not seeing any of my posted fields. It's returning a  
properly-formatted XML response that says I did not submit the  
required fields. Unfortunately the server is a black box, but lots of  
other partners use it every day and supposedly there are no problems  
server side.




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



Re: [PHP] Best way to post XML via curl?

2009-02-11 Thread Brian Dunning
This line is the key. WITH the line, I get a properly formatted XML  
response from the server, telling me that I did not send any valid  
post fields. WITHOUT the line, all I get back from the server is a '1'  
and their tech reports that no valid call was received from me.



On Feb 11, 2009, at 4:56 PM, Stuart wrote:

curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/ 
xml"));


Drop the above line and I reckon it should work. The content you're
sending is not XML, it's form fields which CURL will default to. It
just happens that one of those fields is XML.


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



Re: [PHP] Best way to post XML via curl?

2009-02-11 Thread Brian Dunning

From the documentation:

Parameters
The following POST parameters are required:
login - Assigned
password - Assigned
method - newPrintRequest, updatePrintRequest, reprintRequest
orderxml - XML according to accompanying documentation

The error that I get says no method was provided, and if you look at  
my code, it clearly is.



On Feb 11, 2009, at 5:08 PM, Stuart wrote:


2009/2/12 Brian Dunning :
This line is the key. WITH the line, I get a properly formatted XML  
response
from the server, telling me that I did not send any valid post  
fields.
WITHOUT the line, all I get back from the server is a '1' and their  
tech

reports that no valid call was received from me.


In that case you're not sending them what they're asking for. Are the
method, login and password fields supposed to be separate or should
they be included in the xml? At the moment they're separate so when
you tell the server it's in XML format you're lying because only part
of it is.

As a test try setting $postArgs = $xml. If I'm right it might either
work or give you and authentication error.

-Stuart


On Feb 11, 2009, at 4:56 PM, Stuart wrote:

curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/ 
xml"));


Drop the above line and I reckon it should work. The content you're
sending is not XML, it's form fields which CURL will default to. It
just happens that one of those fields is XML.


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


--
http://stut.net/



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



[PHP] Need to hire some PHP help...

2009-02-12 Thread Brian Dunning
I need probably no more than an hour of two of help from someone  
better than me at PHP, but have money sitting here ready to pay you.  
My project is way behind schedule and I'm burning too much time and  
making no progress trying to solve two problems.


(1) Submitting some XML to a web service via curl. I posted some  
questions on this yesterday, but can't get it to work. This is not  
something new to me, so whatever the problem is has got to be really  
obscure.


(2) Using FPDF and am unable to solve the "FPDF error: Could not  
include font definition file". So I'm looking for someone familiar  
with using makefont with FPDF.


If you can help with the above, and feel confident that you're  
familiar enough with the technologies that you can probably resolve  
the issues in not too much time, please email me directly ASAP. Thanks.


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



[PHP] Zend Guard/Optimizer alternatives?

2009-02-16 Thread Brian Dunning
Is there a cheaper alternative to Guard/Optimizer? I have a single  
small PHP file that is part of a larger solution I sell, and I want it  
to be protected - and it has to be a runtime so it will run on  
anyone's standard PHP server. Zend's $600 was a little bit of sticker  
shock. Any alternatives?



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



Re: [PHP] Zend Guard/Optimizer alternatives?

2009-02-16 Thread Brian Dunning
I should mention that I did try the ionCube online encoder, which I  
think is a great idea... but its runtimes failed to load on both of my  
test systems, requiring editing of php.ini. That's over the top for my  
users. I need something that's rock-solid and that will never require  
my users to have to know anything or do anything special (they are  
business people, not developers or server admins).


On Feb 16, 2009, at 9:10 AM, Brian Dunning wrote:

Is there a cheaper alternative to Guard/Optimizer? I have a single  
small PHP file that is part of a larger solution I sell, and I want  
it to be protected - and it has to be a runtime so it will run on  
anyone's standard PHP server. Zend's $600 was a little bit of  
sticker shock. Any alternatives?





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



Re: [PHP] Re: Reverse IP lookup

2009-02-16 Thread Brian Dunning
And an equally important question: How do you prevent your servers  
from showing up in searches like this?


On Feb 16, 2009, at 7:51 AM, Lewis Wright wrote:


This may be a little more accurate:
http://www.domaintools.com/reverse-ip/





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



[PHP] file_get_contents doesn't work on one particular server

2009-04-29 Thread Brian Dunning
Howdy all - We have a production server that runs our script fine.  
We're setting up a test server, and this particular script returns a  
length of zero:


$ctx = stream_context_create(array('http' => array('timeout' =>  
1200))); // 20 minutes per file

$contents = file_get_contents($full_url, 0, $ctx);

You can paste the $full_url into a browser and it works fine (it's  
always a PDF document). It works fine with the same variables on the  
production server. Is there some configuration option that we've  
missed that's preventing it from working? Note that this is all https,  
and I did notice this difference in the phpinfo() but don't know if  
it's relevant:


Production server: PHP 5.2.6
Registered PHP streams: php, file, data, http, ftp, compress.zlib,  
compress.bzip2, https, ftps, zip


Test server: PHP 5.2.9-2
Registered PHP streams: php, file, data, http, ftp, compress.zlib



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



[PHP] fopen() on a network share?

2009-06-15 Thread Brian Dunning
Running on Windows... I have a network share, \\sharename\foldername,  
and I want to write a file. How do I format the pathname with fopen()  
for this?



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



Re: [PHP] fopen() on a network share?

2009-06-15 Thread Brian Dunning

Extra info, in case needed: my code says

fopen('\\servername\sharename\folder\file.xml', 'w');

and it returns "Failed to open stream, no such file or directory".  
I've verified that the PHP machine does have unrestricted permissions  
to that share and to the directory. Thanks.



On Jun 15, 2009, at 1:39 PM, Brian Dunning wrote:

Running on Windows... I have a network share, \\sharename 
\foldername, and I want to write a file. How do I format the  
pathname with fopen() for this?





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



[PHP] Totally weird behavior trying to download a Mac DMG file

2009-06-16 Thread Brian Dunning
So I've added a product to my online store that's in .DMG format. Most  
of the other files are ZIP or PDF. When someone completes a purchase,  
it downloads the file to them, and this works great:


header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'. 
$file_row["filename"].'"');

$size = filesize('../../store/files/'.$file_row['filename']);
header('Content-Length: '.$size);
readfile('../../store/files/'.$file_row['filename']);

So I have my DMG file. I've verified that it automounts and behaves  
friendly. If you do a direct download, it mounts on the desktop  
perfectly, and there's all the stuff inside.


However, when I complete a test purchase and download using the above  
code, the DMG file downloads, but then it mounts; the contents are  
copied into the Downloads folder; the image unmounts; and then  
deletes. All the contents are delivered, but not in a desirable way.  
You can see the status change in the Downloads window:


Mounting the image
Copying the image
Unmounting the image
Cleaning up

WTF?



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



Re: [PHP] Totally weird behavior trying to download a Mac DMG file

2009-06-16 Thread Brian Dunning

Don't think so, only when I download via the PHP code I posted:

On Jun 16, 2009, at 10:40 AM, Brian Dunning wrote:

 If you do a direct download, it mounts on the desktop perfectly,  
and there's all the stuff inside.





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



Re: [PHP] Totally weird behavior trying to download a Mac DMG file

2009-06-16 Thread Brian Dunning

Good idea, thanks.   :-)

On Jun 16, 2009, at 12:30 PM, Shawn McKenzie wrote:


Use livehttpheaders or some other header capture utility and see what
the difference in the headers are between the dl from the PHP page and
direct download.




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



[PHP] Server change affecting ability to send downloaded files???

2009-08-07 Thread Brian Dunning

Hey all --

A couple of weeks ago my online stores, on a machine I host at  
Rackspace, stopped delivering files that people purchase. I've used  
this for years, and it's always worked perfectly with all filetypes:


header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'. 
$file_row["filename"].'"');

$size = filesize('../../store/files/'.$file_row['filename']);
header('Content-Length: '.$size);
readfile('../../store/files/'.$file_row['filename']);

But then, all of a sudden, it only works with ZIP files. There were no  
changes to the code or to the files, just one day all of a sudden any  
time someone purchases a DMG, EXE, PDF, etc. they get zero bytes. I've  
asked Rackspace if they upgraded something that might produce this  
change but they say "check your code". The code had not been touched  
in years (literally). I've tried a zillion combos of different headers  
but I'm having no luck.


Has anyone ever heard of something (besides my code and my files) that  
could cause this behavior? You'll be my best friend if you can help.  
Thanks.




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



Re: [PHP] Server change affecting ability to send downloaded files???

2009-08-07 Thread Brian Dunning
Very interesting. Excellent debugging advice. It's giving me a 500  
error, probably why the Rackspace techs told me to check my code:


HTTP/1.0 500 Internal Server Error
Date: Sat, 08 Aug 2009 00:01:10 GMT
Server: Apache/2.0.52 (Red Hat)
X-Powered-By: PHP/5.2.10
Content-Disposition: attachment; filename="Installer.bin"
Content-Length: 23223296
Connection: close
Content-Type: application/octet-stream

I'm at a loss. Nothing changed in the code and it works for ZIP files.


On Aug 7, 2009, at 4:57 PM, Adam Randall wrote:


Can you do a commandline test with curl to see what you get back?

curl -I http://url/file.php?something=here

That should allow you to see what is actually being produced by the
code, and if it's being tweaked in some manner unknown to you.





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



Re: [PHP] Server change affecting ability to send downloaded files???

2009-08-07 Thread Brian Dunning
Correct, the files on the server have not changed either, and have  
been working fine for a long time. No funny characters.


On Aug 7, 2009, at 4:59 PM, Adam Randall wrote:


Sorry for replying to myself, but the files themselves only contain
US-ASCII characters, and no quotes, correct? Having extended
characters in your file names might cause weirdness, and quotes will
break your HTTP header in your code there.





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



Re: [PHP] Server change affecting ability to send downloaded files???

2009-08-08 Thread Brian Dunning
A Rackspace guy determined that php.ini was set to use 16MB of memory,  
and he upped it to 32MB, and now everything works. Some of my  
downloads are as large as 41MB so I asked him to up it to 48MB.


Maybe they upgraded the PHP version or something and wiped this  
setting. The 41MB files had always been downloading to customers  
before, without any problem -- is there some way that could have  
worked with php.ini set to 16MB, or does this mean for sure that the  
setting was changed somehow?



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



[PHP] Really quick try/catch question

2009-08-18 Thread Brian Dunning

I have a "new SimpleXMLElement()" that is occasionally throwing:
'Exception: String could not be parsed as XML'

Will this catch it when it happens, or am I missing something?

function domyfunction() {
// This does some stuff to exit the script gracefully
}

try {
$xmlobject = new SimpleXMLElement($xml);
} catch($e) {
domyfunction($e);
}



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



[PHP] Simple PDF manipulation

2006-12-27 Thread Brian Dunning
Let's say I have a complicated PDF document, like a Christmas card,  
that was made in Illustrator -- too complicated to easily create from  
scratch using PDFlib. Is there a way to use PHP make simple text  
changes - like changing "Dear XXX" to "Dear John"? I've opened the  
files with a text editor and cannot locate the simple text, it  
appears to be encoded somehow. The PDF has no security or encryption  
in it. Thanks


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



Re: [PHP] Simple PDF manipulation

2006-12-27 Thread Brian Dunning
Interesting, that's a good idea. I was not aware that it was possible  
to load an existing PDF into memory and then add stuff to it.



On Dec 27, 2006, at 7:28 AM, tedd wrote:


At 6:32 AM -0800 12/27/06, Brian Dunning wrote:
Let's say I have a complicated PDF document, like a Christmas  
card, that was made in Illustrator -- too complicated to easily  
create from scratch using PDFlib. Is there a way to use PHP make  
simple text changes - like changing "Dear XXX" to "Dear John"?  
I've opened the files with a text editor and cannot locate the  
simple text, it appears to be encoded somehow. The PDF has no  
security or encryption in it. Thanks


Brian:

I'm not saying that there is/isn't a way to do this, but I tried  
and failed.


In my investigation, I found that the insides of a PDF file are not  
conducive to a simple search and replace mechanism. The text is  
encoded in some fashion that is not easy to decode and reassemble.


The solution I came up with was to combine the existing PDF file  
with my coding and write over (on top of) the old to produce the  
new PDF that I wanted. In your case, take your Christmas Card with  
a big space where "xxx" appears and then write over that space with  
"John" in your new code.


I wish someone would show me a simpler way to do this.

hth's

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



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



[PHP] Hash/checksum for an image?

2007-01-15 Thread Brian Dunning
I want to make sure that a jpg uploaded by the user is unique. I was  
thinking about storing a hash code for each image in its MySQL record  
(got a db record for each uploaded image already). Is there an easy  
way to generate such a string?


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



[PHP] Storing compiled code on the server

2007-02-21 Thread Brian Dunning
I have a few scripts that I want to protect from the prying eyes of  
even people with root access to my server. The best suggestion I've  
heard is to store only the compiled version on the server itself. I  
have no idea how to do this or how those scripts would be called. Can  
anyone point me to a good starting place?


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



[PHP] Zend question

2007-02-21 Thread Brian Dunning
I have eAccelerator on my server. I want to use Zend Guard. Anyone  
know if I'll need to lose eAccelerator and switch to Zend Optimizer?


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



[PHP] [X-POST] PHP script to make sure MySQL is up?

2007-03-01 Thread Brian Dunning
I host at Rackspace, and one thing that their monitoring service does  
NOT catch is a problem when too many connections hit MySQL, and for  
some reason it remains hung up until the service is manually  
restarted. In the meantime, this is happening to us once or twice a  
month. It gets hammered with a huge number of brief connections from  
other Apache servers.


Slow queries and mysql_close() are NOT the problem. It's just too  
many connections, even though they're super fast.


Is there such a thing as a PHP script that I can put on a cron job to  
run every minute and make a test query, and upon failure, restart the  
service and maybe send an email to Rackspace support? I don't know  
how you'd check that the query was refused due to too many  
connections, and I also don't know how PHP would restart the MySQL  
service.


Thanks...  :)

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



[PHP] Payflow Pro

2007-03-16 Thread Brian Dunning
Hey is anyone using the pfpro extension, or is their XMLPay the newer  
and groovier option? Any opinions appreciated.


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



[PHP] Why can't I ini_set('upload_max_filesize')?

2007-04-17 Thread Brian Dunning

If I do this:

ini_set('upload_max_filesize', 30720);
echo ini_get('upload_max_filesize');

it returns 2M. Why is it not accepting the ini_set? The server is  
Windows, PHP 5.2.


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



Re: [PHP] Why can't I ini_set('upload_max_filesize')?

2007-04-17 Thread Brian Dunning
Dang. There is no remote access to the server, no way to remotely  
edit php.ini - everything is blocked by the firewall. It's running  
IIS not Apache.



On Apr 17, 2007, at 1:40 PM, Daniel Brown wrote:



That particular variable is a PHP_INI_SYSTEM variable, which  
means it can only be set in php.ini or httpd.conf.  This means  
that, unfortunately, even if your system uses Apache on Windows and  
the host allows .htaccess overrides, you still can't set it using  
php_flags.


On 4/17/07, Brian Dunning <[EMAIL PROTECTED]> wrote:
If I do this:

ini_set('upload_max_filesize', 30720);
echo ini_get('upload_max_filesize');

it returns 2M. Why is it not accepting the ini_set? The server is
Windows, PHP 5.2.

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




--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107




[PHP] Uploading: Safari=happy, IE7/Firefox=unhappy

2007-04-17 Thread Brian Dunning
I got everything configured on my server and uploads working great,  
max_input_time=3600, upload_max_filesize=30M, post_max_size=30M, and  
anything I upload up to 30M works great on Safari. IE7 and Firefox  
choke, returning broser-generated "page not found, connection reset"  
if the file is bigger than a couple megs. Any suggestions on how to  
make IE7 & Safari behave as nicely as Safari with large files?


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



Re: [PHP] Why can't I ini_set('upload_max_filesize')?

2007-04-18 Thread Brian Dunning
We finally got it resolved by editing php.ini. This was classic: A  
clueless office assistant did it, talked through step-by-step over a  
cell phone, while an armed security guard accompanied her into their  
server room.


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



[PHP] Cookie Quandary

2009-10-27 Thread Brian Dunning
I wrote some cookies for a whole bunch of site admins, but failed to  
set the path, so all the cookies are set to '/admin', which is not  
going to work for everything they need to do. They are also too long,  
set for 6 months.


I need to correct both issues, so I changed it to write cookies to '/'  
for 72 hours. I've checked my Safari, and I see that I have both  
cookies set: A long one for '/admin' and a short one for '/'. I'm  
worried that once the admins' short cookies run out, their browsers  
will pick up the longer lasting value for the '/admin' version of the  
cookie.


I want to kill everyones' '/admin' cookies, but I'm worried that some  
browsers might erase both cookies if I do this. Does anyone know if I  
can safely kill the '/admin' cookie without risking deletion of the  
'/' cookie?



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



Re: [PHP] Cookie Quandary

2009-10-27 Thread Brian Dunning
No, I'm talking about cookies, thus the references to pathnames and  
expirations.


On Oct 27, 2009, at 10:56 AM, Ashley Sheridan wrote:


Cookies are client-side. Do you mean session files?




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



[PHP] Emergency! Performance downloading big files

2009-12-01 Thread Brian Dunning
This is a holiday-crunch emergency.

I'm dealing with a client from whom we need to download many large PDF docs 
24x7, several thousand per hour, all between a few hundred K and about 50 MB. 
Their security process requires the files to be downloaded via https using a 
big long URL with lots of credential parameters.

Here's how I'm doing it. This is on Windows, a quad Xeon with 16GB RAM:

$ctx = stream_context_create(array('http' => array('timeout' => 1200)));
$contents = file_get_contents($full_url, 0, $ctx);
$fp = fopen('D:\\DocShare\\'.$filename, "w");
$bytes_written = fwrite($fp, $contents);
fclose($fp);

It's WAY TOO SLOW. I can paste the URL into a browser and download even the 
largest files quite quickly, but the PHP method bottlenecks and cannot keep up.

Is there a SUBSTANTIALLY faster way to download and save these files? Keep in 
mind the client's requirements cannot be changed. Thanks for any suggestions.



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



Re: [PHP] Emergency! Performance downloading big files

2009-12-01 Thread Brian Dunning
Oops, it's several hundred per hour, several thousand per day. Sorry for the 
accidental superlative.

> I'm dealing with a client from whom we need to download many large PDF docs 
> 24x7, several thousand per hour, all between a few hundred K and about 50 MB. 



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



Re: [PHP] Emergency! Performance downloading big files

2009-12-01 Thread Brian Dunning
Can someone explain how this would work? It's a Windows web server running IIS 
and the files are saved to a drive that is outside the web root. PHP is 
grabbing each filename from a MySQL database, along with the URL and 
credentials for it, and ends up with a url something like this:
https://server.com?filename=filename.pdf&user=xxx&pass=xxx&something=xxx


On Dec 1, 2009, at 2:55 PM, Ashley Sheridan wrote:

> Why not put the files behind a secured directory. Apache will handle
> that, so PHP needs not be involved. Once logged in, they can download
> loads without it being asked for again.



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



[PHP] Good source for sample data?

2010-01-28 Thread Brian Dunning
Hey all -

I need a few million sample contact records - name, company, address, email, 
web, phone, fax. ZIP codes and area codes and street addresses should be 
correct and properly formatted, but preferably not real people or companies or 
email addresses. But they'd work if you did address validation or mapping. 
Anyone have a suggestion?

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



  1   2   3   4   >