Re: [PHP] Where Are Security Updates Announced?

2011-10-20 Thread Jon Watson
Hi,

On Thu, Oct 20, 2011 at 1:54 PM, Daniel Brown  wrote:

> On Thu, Oct 20, 2011 at 08:02, Jon Watson  wrote:
> > Hi All,
> >
> > I subscribed to this list thinking that this is where I would get
> security
> > update notices, but this appears to be more of a general list. I've
> looked
> > at all the lists available on PHP.net and I don't see one specifically
> about
> > security.
>
> Well, hence the "General" in PHP General.  So I guess we're doing
> something right here.
>

Absolutely. I was not complaining at all.

>
> > Can someone tell me which list I should sub to in order to ensure that I
> am
> > advised of security updates?
>
> There is no public PHP security mailing list.  Instead, we post
> things right in the open on the website itself, right on the homepage:
>
>http://php.net/


OK, thank you. That's not workable for me as I have far too much to keep
track of. I need stuff delivered to me so I'll follow up on some of the
other lists that you and Matthew mention.



>
>
>There are third-party sites that send out security alerts for
> software such as PHP, and you can likely find them easily enough via
> Google.  Off the top of my head, none are coming to mind by name, but
> I have subscribed to their mailings myself over the years, and found
> them to be a pretty reliable resource --- some "underground" public
> groups are particularly useful for zero-day vulnerabilities.
>
> --
> 
> Network Infrastructure Manager
> http://www.php.net/
>


[PHP] Where Are Security Updates Announced?

2011-10-20 Thread Jon Watson
Hi All,

I subscribed to this list thinking that this is where I would get security
update notices, but this appears to be more of a general list. I've looked
at all the lists available on PHP.net and I don't see one specifically about
security.

Can someone tell me which list I should sub to in order to ensure that I am
advised of security updates?

Thanks


Re: [PHP] Questions Regarding Recent Ubuntu PHP5 Security Announcement

2011-10-19 Thread Jon Watson
On Wed, Oct 19, 2011 at 11:54 AM, Jim Lucas  wrote:

> On 10/19/2011 7:00 AM, Jon Watson wrote:
> > Hello All,
> >
> > I am trying to make some sense of this PHP5 security vulnerability notice
> > from 18 October 2011:
> >
> > http://comments.gmane.org/gmane.linux.ubuntu.security.announce/1478
>
> 


> This is discussing the packages distributed for Ubuntu X.X.  Sounds like
> what
> you have is your own custom install.  If that is the case, the concern may
> still
> apply, but it is going to be up to you to figure out what the security
> issue is
> and verify your system in some manor.
>

Agreed and I guess that is what I am trying to assess. The Ubuntu security
notice doesn't go into specifics about the 5.2.x version has the issues
other than presumably something earlier than 5.2.4. It would have been most
helpful of them to provide some sort of test or at least the full version of
the affected release.

So, basically hunting around for some confirmation that my version is OK.

I also find it odd that there is no accompanying security notice from
PHP.net. If this is a security vulnerability in PHP 5 as reported by
Canonical, why has PHP.net not released a security notice?


[PHP] Questions Regarding Recent Ubuntu PHP5 Security Announcement

2011-10-19 Thread Jon Watson
Hello All,

I am trying to make some sense of this PHP5 security vulnerability notice
from 18 October 2011:

http://comments.gmane.org/gmane.linux.ubuntu.security.announce/1478

It states that for Ubuntu 8.04 users, a PHP upgrade to 5.2.4 is required to
take care of the security issues. It also states that for Ubuntu 10.04
users, a PHP upgrade to 5.3.3 is required.

For operational reasons, I am running 5.2.17 on Ubuntu 10.04 and cannot
upgrade to PHP 5.3, Does anyone know if 5.2.17 is safe since evidently 5.2.4
is?

The security notice doesn't go into any real detail on the specific version
numbers so I am having trouble understanding what needs to be done.

Thanks.


-- 
Jon Watson
Systems Engineer
Teamspace Canada
Suite 304 Bedford Tower
1496 Bedford Highway, Bedford, NS, Canada  B4A 1E5
Phone:  902.444.3490 x | Fax: 902.444.3495
email: jon.wat...@teamspace.ca
http://www.theredspace.com | http://www.teamspace.ca


Re: [PHP] Pulling from Multiple Databases

2011-02-01 Thread Jon Hood
Bah, forgot to reply-all

On Tue, Feb 1, 2011 at 11:59 AM, Jon Hood  wrote:

> Using pcntl_fork mostly accomplished what I wanted (I had to go back and
> create the actual connection in each of the forked processes, otherwise, the
> first process that ended would destroy the connection to the main DB). It
> seems to be working, and while it's not the most elegant solution, and
> certainly not the best performance, it's all I can do for now.
>
> Any chance I can bring up the topic of native multithreading support? What
> are the chances of feature request 
> http://bugs.php.net/bug.php?id=46919getting added to a roadmap for, say, PHP 
> version 7?
>
> -Jon
>


Re: [PHP] Pulling from Multiple Databases

2011-02-01 Thread Jon Hood
(comments in-line)

On Tue, Feb 1, 2011 at 10:34 AM, Richard Quadling wrote:

> I use a data warehouse (a semi denormalized db) to hold data from
> around 200 different data sources (DB, Excel spreadsheets, Web, etc.)
>
> I use multiple scripts to update the DB, each one tuned to a
> particular frequency.
>
>
A different script for each database is a possibility. It's a little extra
load on the app server, but it should be able to handle it. Maybe with
pcntl_fork? I haven't explored this option much.


> My main app's queries are always against the data warehouse.
>
> That way, the live front end isn't worried about getting the source data.
>
> If the data is needed live, then I'd be looking to see if I can get a
> live data feed from the source system. Essentially a push of the data
> to my data warehouse - or a staging structure to allow locally defined
> triggers to clean/process the data upon arrival.
>
> Automation is the key for me here. Rather than trying to do everything
> for the request, respond to the changes in the data or live with the
> fact that the data may be stale.
>
> Can you give us any clues as to the sort of app you are building? The
> sort of data you are working on? Are you running your own servers?
>

Data are needed live. 3 of the databases are MySQL. 14 are XML files that
change frequently. 3 are JSON. 1 is Microsoft SQL Server 2005. The main app
is running on linux (distribution doesn't matter - currently Debian, but I
can change it to whatever if there's a reason). Most is financial data that
needs ordered.

I'm going to explore the pcntl_fork option some more...

Thanks!
Jon


[PHP] Pulling from Multiple Databases

2011-02-01 Thread Jon Hood
I have a website that is currently pulling from more than 30 databases,
combining the data, and displaying it to the user. As more and more
databases are added, the script continues to get slower and slower, and I've
realized that I need to either find a way to pull these data in parallel. So
- what is the preferred method of pulling data from multiple locations in
parallel?

Thanks,
Jon


[PHP] Re: Building SoapClient as an extension

2010-09-20 Thread Jon Drukman
Phpster  gmail.com> writes:

> 
> It's already done
> 
> http://wso2.com/products/web-services-framework/php/
> 

I don't know what that has to do with what I asked.

I found the answer on my own:

./configure --enable-soap=shared

Produces a modules/soap.so file that can be loaded in to php at run time.



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



[PHP] Building SoapClient as an extension

2010-09-20 Thread Jon Drukman
Is it possible to build SoapClient as a loadable extension?  For various
reasons, I don't want to have to recompile PHP from scratch.  It would be much
simpler to just distribute another .so and .ini file.

How would I do that, if it's possible?

-jsd-


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



RE: [PHP] Dear Lazy Web: Pseudo Randomisation Strategies on Listing Websites

2010-08-20 Thread Jon Haworth
Hi Col,

Interesting problem.

> Are there any other approaches I've missed? 

Off the top of my head, how about this:

1. Add a new unsigned int column called "SortOrder" to the table of widgets
or whatever it is you're listing

2. Fill this column with randomly-generated numbers between 0 and whatever
the unsigned int max is (can't remember exactly but 4.2 billion ish)

3. Add the SortOrder column to the end of all your ORDER BY clauses - SELECT
foo ORDER BY TypeOfListing, SortOrder will give you widgets sorted by
Gold/Silver/Bronze type, but in a random order for each type

4. Every hour/day/week/whatever, update this column with different random
numbers

Advantages: practically no hassle/overhead/maintenance for you; provides
same ordering sequence for all users at the same time; only breaks "third
one down"-type references when you refresh the SortOrder column rather than
on each session or page view; reasonably proxy- and cache-friendly
especially if you send a meaningful HTTP Expires header.

Disadvantages: breaks user persistence if they visit before and after a
SortOrder refresh ("I'm sure the one I wanted was at the top of the list
yesterday..."); more effort to demonstrate randomness to the client ("OK,
see how you're in ninety-third place today? Well, check again tomorrow and
you should be somewhere else on the list").

Hopefully food for thought anyway.

Cheers
Jon


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



RE: [PHP] Text editor

2010-07-27 Thread Jon Haworth
Hi Jordan,

> Do you somebody know some simple text editor with buttons 
> for bold italic etc.

TinyMCE is worth a look:
http://tinymce.moxiecode.com/ 

HTH
Jon


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



Re: [PHP] mysql cache query as xml

2009-07-10 Thread Jon Tamayo
On Fri, 10 Jul 2009 13:29:31 -0400
Bastien Koert  wrote:

> On Fri, Jul 10, 2009 at 1:23 PM,
> workerho...@studysite.eu wrote:
> > hmm, the infrastructure ist good, this is just this query
> > so to solve my problem i could run mysql on the application server
> > and store just this table
> > and read the query from them, it could solve my problem litte, i
> > hope so!
> >
> >
> >
> > Daniel Brown schrieb:
> >>
> >> On Fri, Jul 10, 2009 at 13:07,
> >> workerho...@studysite.eu wrote:
> >>
> >>>
> >>> hi andrew i think you understand my problem a little,
> >>> but if 100 user load this query at the same time, the two mysql
> >>> server had a
> >>> lot to do!
> >>> so i think to cache this query as xml to the application server
> >>> local make
> >>> thinks faster,
> >>> but, i would like to have the same performance to read this xml
> >>> document as
> >>> read the query from mysql server...
> >>> i dont know why php is so slow to read the xml file...
> >>>
> >>
> >>    It will be slower to read a file than data from an SQL database
> >> by sheer design --- regardless of whether it's XML, CSV, plain
> >> text, etc. And MySQL is faster still because it's run as a server
> >> with it's own processing engine, completely independent of the PHP
> >> engine and spawned process.  Other factors involved are disk seek
> >> time, memory capabilities, et cetera, but the SQL-vs-file point is
> >> the biggest.
> >>
> >>    For PHP to locate something within the file, it must load the
> >> entire file into memory or read it byte-by-byte, line-by-line,
> >> from an exact offset (given explicitly).  SQL databases such as
> >> MySQL work similarly, but don't catalog all data in quite the same
> >> linear fashion.  Further, MySQL is capable of indexing, allowing
> >> it to return the data far faster.
> >>
> >>    There's a time and a place for each, but it sounds as though
> >> what you're attempting to do would not be best-served by caching
> >> it in an XML sheet.
> >>
> >>    Also, something to keep in mind (with no offense intended by any
> >> means): if you have two database servers (using replication) for
> >> load-balancing and they - combined - cannot handle 100 simultaneous
> >> connections and queries, you may want to re-evaluate your
> >> infrastructure and architecture.
> >>
> >>
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> is all the data from the query the same for each user? I.e. that they
> get the same 4K rows of data for that query? How is that query done?
> are there date parameters or other fields that would allow table
> partitioning on the data? Could you use a temp table, to store that
> data or a more fixed table that stores just that query's dataset?
> 
> Also how large is the main table?
> 
> 

I don't know much about mysql, as I've been using it only for some
basic things, but, couldn't you just set a bigger query_cache? The
first user would have that 0.3" query, but the other 99 would
get the results in... 0.001"? 0.002"?

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



[PHP] Encoding problems on IIS7 + FastCGI on windows server 2008

2009-07-02 Thread Jon Lau
Hi,

The php scripts works OK on windows 2000 server ( it supports chinese, 
english & japanese - UTF-8 encoding) but it shows ??? ( non-english chars ) 
when copied to IIS7 + Fastcgi on windows 2008.

Is there some settings to change in php.ini ?

Regards,

Jon Lau 



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



[PHP] Re: header modify errors

2008-12-15 Thread Jon Drukman

Terion Miller wrote:

*Warning*: Cannot modify header information - headers already sent by
(output started at
C:\Inetpub\Xampp\htdocs\SNLeader\WOSystem\Welcome.php:31)
in *C:\Inetpub\Xampp\htdocs\SNLeader\WOSystem\inc\dbconn_openTest.php* on
line *3*



Line 32-36 are:
". $msg ."";
}
?>



stick an ob_start(); at the beginning of the file and php will not 
complain about output started any longer.


-jsd-


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



Re: [PHP] Making array to string

2008-09-17 Thread Hunt Jon
Wow! Thanks all. It seems `implode` is what I wanted.

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



[PHP] Making array to string

2008-09-17 Thread Hunt Jon
Hi, I'm new to PHP. I have an array that I would like to convert into a string.

For example, I have

array(
0 => "Good morning",
1 => "Good afternoon",
2 => "Good evening",
3 => "Good night"
);

Now I would like to convert the array to something like:

"Good morning Good afternoon Good evening Good night".

The result has concatanation of each value, but has one space between it.
If possible, I would like to insert something like "\n" instead of space.

I've been looking into various "array" functions, but I have no clue
where to start.

-J

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



[PHP] Re: Incrementing variables based on database data

2008-08-12 Thread Jon Drukman

Vinny Gullotta wrote:
Well, what I need to be able to do is then take the numbers of each 
count and figure out which is used the most. We use this database to log 
actions taken on servers in our network. What my boss wants me to come 
up with is a list of which commands are issued the most, which servers 
get the most attention, and for each server, which command is issued the 
most, and so I was going to kind of do it messy-like as I'm not really 
100% sure of the best way to do it, but my goal was to create the count 
variables and then compare them using if statements to see which one is 
used the most. If you have a way of doing this more efficiently, I'd 
love to hear it. I'm not the best programmer in the world and I'm kind 
of just getting back into this stuff, so I'm all ears for any 
suggestions you may have =)


you can do it with one sql query.  i don't know the real names of your 
columns so i'm just going to make some up.


select message_type, count(1) x from table group by message_type order 
by x desc


you can do the same thing for machines - just change message_type to 
machine_name.


-jsd-


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



[PHP] Re: V4 Vs V5 Issue

2008-07-01 Thread Jon Drukman

Neil wrote:


Hi Thanks

I have tested the path, that works fine. I set up a dummy file on the 
same path just to check that,  it found that and printed out some echo'd 
text from that file.


I can see the content of core_js.php file  in the the IE view source view.


debugging javascript in IE is about as much fun as slamming your head in 
a car door.


try it in firefox with firebug installed, it should give you much better 
feedback about what is going on.


-jsd-


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



[PHP] Re: Execute command line as a different user

2008-07-01 Thread Jon Drukman

Matt Palermo wrote:

I'm using the following command and I'm not getting any feedback:

exec("echo 'adminPass' | sudo -u adminAccount -S whoami", $f, $r);

Both $f and $r don't contain any data.  This leads me to believe that 
the command is not being run for whatever reason.  Is there something 
wrong with this command?  Is there a different way to do it?


set up sudo to run that particular command for that particular user with 
no password.


adminAccountALL = NOPASSWD: /usr/bin/whoami


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



[PHP] Re: PHP and Apache

2008-06-23 Thread Jon Drukman

R B wrote:

Hello,

I´m developing a PHP system that needs one of these lines in the .htaccess,
depending of the server configuration:

AddHandler application/x-httpd-php .xyz
or

AddHandler application/x-httpd-php4 .xyz

or

AddHandler application/x-httpd-php5 .xyz

How can i detect "on the fly" which line i have to use?




AddHandler application/x-httpd-php5 .xyz



AddHandler application/x-httpd-php4 .xyz



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



[PHP] Re: class as default property

2008-06-23 Thread Jon Drukman

Chetan Rane wrote:


But this does not work:



do this:

f = new Foo();
}
}

$x = new Bar();
print_r($x->f);

?>


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



Re: [PHP] Re: Search like php.net's URL thingy

2008-06-18 Thread Jon Drukman
On Wed, Jun 18, 2008 at 9:19 AM, Nate Tallman
<[EMAIL PROTECTED]> wrote:
> Not to beat a dead horse, but why would you *not* want to preserve the 404?
> If it's a bad url anyways, you probably *want* to return a 404 (albeit
> prettier) and you probably *don't* want search engines indexing it.

the original question was not how to serve fancy 404's, it was how to
serve urls like http://php.net/strtolower

you definitely want those indexed.

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



[PHP] Re: Password Protecting a page and email notification

2008-06-17 Thread Jon Drukman

R.C. wrote:

I'm going to ask you PHP gurus if someone can give me a hand in trying to
get this resolved.  I'm fairly new to PHP and learning as I go.

I've got two page "login.php" and video.php.  Video.php is supposed to be
protected i.e. if someone clicks on the direct link or brings up the page in
a browser, it comes back with an error message and a request to link to
"login.php"... they type in their username/pasword and it opens up the
video.php so they can download videos.

I actually managed to accomplish that with the following code which sits at
the top of video.php.  I also created a form on "login.php" for user input.
So far so good.  However, we also need an email to be sent to the site owner
when someone logs in plus their name.  For the hell of me, I can't figure
out how to combine the two elements.  I tried a lot of things sofar, but
nothing works.  It's either the page gets protected OR the email gets sent,
depending on what I leave in the script. I tried using part of Jenny's
script which is great for email forms but I can't combine this whole thing.
Hlp!!

/*this is the code that sits at the top of the protected page* which works
actually fine for the protection*/
";
  echo "Please log in at   HERE to enter your
Username and Password";
 exit();
 }

Can this be done on one form i.e. login.php?  I have 4 textfields set up:
username, password, email, name (for the person sending the email...)..
some if clause somewhere?

Best
R.C.


what you have here looks fine.  just put the mail() command in the first 
part of the if...


if (($_SESSION['username'] == 'logon')
 and ($_SESSION['userpass'] == 'password')) {
... SEND MAIL HERE ...
$_SESSION['authuser'] = 1;
 }
 else {
  echo "I'm sorry, access is denied ";
  echo "Please log in at   HERE to enter your
Username and Password";
 exit();
 }


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



[PHP] Re: Search like php.net's URL thingy

2008-06-17 Thread Jon Drukman

Nate Tallman wrote:

Why is an ErrorDocument "insufficient" or "not the elegant way"?
It accomplishes the goal in a clean way, no?


It's *WRONG*.  ErrorDocument still preserves the 404 error code, it just 
gives it a prettier face.  If the page really is there, returning a 404 
for it is not correct.  Search engines will not index it.  You probably 
don't want that.



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



[PHP] Re: Search like php.net's URL thingy

2008-06-17 Thread Jon Drukman

Ryan S wrote:

Hey!

Thanks for replying.

Digging a bit more i found 



RewriteEngine On
RewriteRule ^([a-z][0-9][A-Z][aA0-zZ0])$ jj.php?show=$1


But it does not work :( do you see any fault with the above?


this is an apache issue, not a php issue, so you'll probably have better 
luck on an apache mailing list.


however i will tell you that apache handles URLs in .htaccess 
differently from in the normal httpd.conf files.  in the .htaccess file, 
the URL presented to RewriteRule does NOT have a leading /.  in the conf 
file, it will.  so your rule might work if you do this:


RewriteRule ^/([a-z][0-9][A-Z][aA0-zZ0])$ jj.php?show=$1

i'm guessing that you are using .htaccess though, in which case the 
problem becomes the rule itself.  your regex is not going to do what you 
think.  it's saying "lower case letter followed by number followed by 
uppercase letter followed by i don't know what the heck that is."   try:


RewriteRule ^(\w+)$ jj.php?show=$1 [L]

\w is equivalent to [A-Za-z0-9_]  note that this is NOT the same as 
[A-Z][a-z][0-9]


you almost always want [L] in a situation like this to prevent later 
rules from messing with your rewritten string.


also i will tell you that if you ever plan to launch this feature on a 
site that gets significant traffic, turning off .htaccess file checking 
is a HUGE performance win.  unfortunately you will have to restart 
apache every time you want to modify your rewrite rules, but them's the 
breaks.


-jsd-


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



Re: [PHP] Regex to catch s (weird result)

2008-05-07 Thread Jon L.
Pretty close.

The only thing I'd suggest is a different way of wording step 2:
Can contain anything but '>' until step 3.

As for the switches/modifiers (Uis), check out:
http://us.php.net/manual/en/reference.pcre.pattern.modifiers.php

U = ungreedy
i = case-insensitive (|p| matches 'p' and/or 'P')
s = treat as single line

- Jon L.

On Wed, May 7, 2008 at 1:51 PM, Ryan S <[EMAIL PROTECTED]> wrote:

> 
> > http://www.ezee.se/tests/para_regex2.php.txt
>
> Yep, sorry...  Just add the s
>
> preg_match_all('|]*>(.*)|Uis', $myText, $myArray);
>
> 
>
> Swett! It works!
> If you _do get time_, would love to know the actual meaning of
> |]*>(.*)|Uis
> because although I do appreciate the help and the code, am learning to
> work a bit with regex
> and this is still quite advanced for me.
> So far I have gotten (correct me if I am wrong)
> |]*> = 1) Starts with " next > 3) end with ">"
> (.*)| = 1) can have whatever inbetween till the end which is ""
>
> Have no idea of the Uis switches...
>
> Thanks again,
> R
>
>
>
>
>  
> 
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile.  Try it now.
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] the Y2K38 BUG

2008-05-06 Thread Jon L.
Another possibility...
Port the Date object implementation from ECMA/Javascript.
It has a range of +/-8.64e15, or Tue, 20 Apr -271821 00:00:00 GMT to Sat, 13
Sep 275760 00:00:00 GMT.

You know...just to have a little extra time to find something else. ;)

- Jon L.

On Wed, May 7, 2008 at 12:56 AM, Paul Scott <[EMAIL PROTECTED]> wrote:

>
> On Tue, 2008-05-06 at 23:50 -0600, Nathan Nobbe wrote:
> > true-that ;)
> > anyway, the DateTime class is implemented as a 64-bit unsigned (i think)
> > value.  so if you use it you should be good to go.
> >
> > php > echo date_create('2040-10-24')->format('M-d-Y');
> > Oct-24-2040
> >
>
> a 64bit unsigned int is best, but that would only work properly on 64bit
> arch. For 32bit users, making it unsigned is the best option for now,
> and I suppose that by 2038 there will be another option.
>
> As far as I am concerned, this discussion is a discussion for the sake
> of discussion. If I am still using the same apps that I use today in
> 2038, I will officially rethink my usefulness as a human being :)
>
> --Paul
>
>
> All Email originating from UWC is covered by disclaimer
> http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


Re: [PHP] web based chat app

2008-05-04 Thread Jon L.
IFrames have their issues cause they're meant to be separate documents;
making the documents interact is the challenge.

But I think you're going to have to use some sort of HTTP Streaming [
http://ajaxpatterns.org/HTTP_Streaming] to get it to receive messages
interactively.
You can use IFrames like the other project, periodic Ajax pings, or a Comet
framework 
[http://en.wikipedia.org/wiki/Comet_(programming)<http://en.wikipedia.org/wiki/Comet_%28programming%29>
].
There may be other methods, but those are all I've heard of.

As for Jabber, you may want to take a look at XMPP: http://www.xmpp.org/
It's the XML protocol and standards behind all Jabber development.

Also, you may try their Social mailing list:
http://www.jabber.org/discussion-lists
The entire purpose of the list is for helping enable Jabber in social
network sites.
Although, your discussion will probably need to be split up, since questions
about using Jabber in PHP generally belong on their JDev list.

- Jon L.

On Sun, May 4, 2008 at 12:46 PM, Richard Heyes <[EMAIL PROTECTED]> wrote:

> well, good example. but, it is not very convenient. i saw the code, it
> > used
> > iframe and refreshing the page using meta tags. but, this method doesn't
> > work on all browser. if i am not
> > mistaken have problem with IE browser.
> >
>
> Well it's just an example, but you could use multiple methods of
> refreshing the page to try and catch more browsers, eg. the Refresh: header,
> Javascript etc. It uses an IFRAME so that when the page is refreshed it
> doesn't lose whatever the user may have typed into the form. Plus the
> progress bar "flashing" is irritating, though I believe that could be
> removed by using AJAX to drag down the latest page instead of refreshing the
> whole page.
>
>
> --
> Richard Heyes
>
> ++
> | 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] Any Running Simple Ajax Sample for Php

2008-05-02 Thread Jon L.
If you aren't already, I recommend putting to use a JS library with Ajax
support.
Nothing else, they can reduce the browser compatibility overhead coding
you'll need to do.

You can pick any of many, but I'm more familiar with Prototype:
http://prototypejs.org/

## credits.php



## credits.html
-

  
Checking credits...



/*** Reference ***/
 <a  rel="nofollow" href="http://prototypejs.org/api/periodicalExecuter">http://prototypejs.org/api/periodicalExecuter</a>
 <a  rel="nofollow" href="http://prototypejs.org/api/ajax/request">http://prototypejs.org/api/ajax/request</a>
 <a  rel="nofollow" href="http://prototypejs.org/api/element/observe">http://prototypejs.org/api/element/observe</a>

function creditsCheck(pe) {
  new Ajax.Request('foobar.php', {
method: 'get',
parameters: {ts: (new Date()).getTime()}, // cache prevention
onSuccess: function (transport) {
  var elem = $('credits');
  if (Number(transport.responseText) > 0) {
elem.update('Credits remaining: ' + transport.responseText);
  } else {
elem.update('Credits have expired.').setStyle({background:
'#f00'});
pe.stop();
  }
},
onFailure: function () {
  $('credits').update('Could not determine
credits.').setStyle({background: '#f00'});
}
  });
}

document.observe('dom:loaded', function () {
  var pe = new PeriodicalExecuter(creditsCheck, 60);
  creditsCheck(pe); // first check
});

  


- Jon L.

On Fri, May 2, 2008 at 4:13 AM, Heysem KAYA <[EMAIL PROTECTED]>
wrote:

> Hi,
>
> I would like to check each minute whether the user credit is finished and
> update the relevant place on page. So I have downloaded however was not
> able
> to run some sample ajax code.
>
> Is there anyone who has such a simple code to implement?
>
>
>
> Thanks,
>
>
>
> Heysem Kaya
>
>


Re: [PHP] Question About PHP Includes

2008-04-03 Thread Jon Wynacht

Whoopssorry abut the reply ;-(

Thanks for the advice...I'll start making the changes in the path.

Cheers,

Jon

On Apr 3, 2008, at 8:56 AM, Daniel Brown wrote:

On Thu, Apr 3, 2008 at 11:42 AM, Jon Wynacht  
<[EMAIL PROTECTED]> wrote:

Hi Dan,

 I just tried that and didn't see any errors on the screen or in  
my log
file. I'm really quite stumped and am wondering if my ISP made  
some changes

on their end?

 Thanks,

 Jon


Please keep all replies on-list, Jon, so others may benefit when
searching the web and the archives.

If you're on a shared host, that is most likely the reason it's
happening: your host likely made a change without informing you.
Since you can get everything to work with relative paths, but not
absolute paths, it sounds like your account has been chroot'd.  If you
can't use relative paths for some reason, try speaking with your host
to have the chroot (jail) removed for that account.

--

Ask me about:
Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo.,
and shared hosting starting @ $2.50/mo.



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



[PHP] Simple RegEx to pull out content between 2 markers

2008-03-29 Thread Jon Bennett
Hi,

I need to grab the what's between 2 markers in a Textile / html
string, but my regex skills aren't all that hot. The text I have is:



h3. Article Content

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.

p(image). !/app/image/1/large! Caption

p(image). !/app/image/24/large! drunken jonty





h3. Article Content

!/app/image/7/thumb! Lorem ipsum dolor sit amet, consectetur
adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute
irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum.





h3. Article Content

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua.

* Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat.
* Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur.
* Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
officia deserunt mollit anim id est laborum.



I'd like to grab the contents of left, right and main individually so
I can place them in separate form fields.

Any help greatly appreciated. I'm certain this is a cinch for people
who use regex often.

Thanks,

Jon


-- 

jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

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



Re: [PHP] One more data formatting question [SOLVED]

2007-11-29 Thread Jon Westcot
Hi:

Thanks for the answer!  That worked exactly as I needed it to work!

Jon

- Original Message - 
From: "T.Lensselink" <[EMAIL PROTECTED]>
To: "Jon Westcot" <[EMAIL PROTECTED]>
Cc: "PHP General" 
Sent: Thursday, November 29, 2007 8:17 AM
Subject: Re: [PHP] One more data formatting question


On Thu, 29 Nov 2007 07:53:56 -0700, "Jon Westcot" <[EMAIL PROTECTED]> wrote:
> Hi all:
> 
> I'm trying to parse out some HTML code back into "regular" string
> values and I keep getting tripped up by the non-breaking space value
> ( ).  I see that html_decode_entities() can be used to convert this
> back to a viewable space, but the documentation tells me that the space
> value it uses is not the same as a TRIMable space (i.e., ASCII 32).
> 
> Is there a quick, fast, and easily implemented way to convert any
> non-breaking space found in a string back to the ASCII 32 space value?  I
> suspect that one of those amazing POSIX expressions could do it, but I'm
> having trouble wrapping my head around them at this early hour.
> 
> Any help you all can provide will be extremely appreciated!
> 
> Thanks,
> 
> Jon

str_replace should do the trick.

str_replace(' ', chr(32), $string);
or
str_replace(' ', ' ', $string);

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



[PHP] One more data formatting question

2007-11-29 Thread Jon Westcot
Hi all:

I'm trying to parse out some HTML code back into "regular" string values 
and I keep getting tripped up by the non-breaking space value ( ).  I see 
that html_decode_entities() can be used to convert this back to a viewable 
space, but the documentation tells me that the space value it uses is not the 
same as a TRIMable space (i.e., ASCII 32).

Is there a quick, fast, and easily implemented way to convert any 
non-breaking space found in a string back to the ASCII 32 space value?  I 
suspect that one of those amazing POSIX expressions could do it, but I'm having 
trouble wrapping my head around them at this early hour.

Any help you all can provide will be extremely appreciated!

    Thanks,

Jon


Re: [PHP] Quick question on data formatting [SOLVED]

2007-11-28 Thread Jon Westcot
Thanks, Rob!  I can see that it's going to be important for me to get
familiar with the POSIX regular expressions.

Jon

- Original Message -
> On Wed, 2007-11-28 at 22:19 -0700, Jon Westcot wrote:
> > Hi all:
> >
> > Since I'm relatively new to PHP, I'm not familiar with all of the
shortcuts and efficient ways one could write a routine that handles
converting data from one format into another, so I thought I'd ask here for
recommendations on how to solve one particular issue I've got.  I'm viewing
this as a learning experience for me.
> >
> > I've got some text fields coming in that need to be added to a table
as numeric fields.  In particular, I've got to process dollar amounts that
appear with dollar signs and commas into their strictly numeric forms.  For
example:
> >
> > $123,456.78  becomes 123456.78
> > $24,680  becomes  24680
> > 1234B  becomes  1234
>
> $number = ereg_replace( '[^[:digit:].]', '' );
>
> Cheers,
> Rob.
> --
> ...
> SwarmBuy.com - http://www.swarmbuy.com
>
> Leveraging the buying power of the masses!
> ...
>

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



[PHP] Quick question on data formatting

2007-11-28 Thread Jon Westcot
Hi all:

Since I'm relatively new to PHP, I'm not familiar with all of the shortcuts 
and efficient ways one could write a routine that handles converting data from 
one format into another, so I thought I'd ask here for recommendations on how 
to solve one particular issue I've got.  I'm viewing this as a learning 
experience for me.

I've got some text fields coming in that need to be added to a table as 
numeric fields.  In particular, I've got to process dollar amounts that appear 
with dollar signs and commas into their strictly numeric forms.  For example:

$123,456.78  becomes 123456.78
$24,680  becomes  24680
1234B  becomes  1234

(That last example is an actual example of something I saw in the data 
file; I can only assume that the user wanted 1234, as that's the closest value 
I can assume from what was typed in.)

What is the fastest, most efficient way to perform these conversions?  I'm 
coming at PHP from "old school" experience where I'd normally read through the 
text character by character and return a value built from only the characters I 
have declared as acceptable (i.e., 0-9 and . and possibly a -), but I've got to 
believe that there's some technique -- or possibly a deeply buried function -- 
available to me now that would be faster and easier to implement.

Any help you can provide will, as always, be greatly appreciated!

Thanks,

Jon


Re: [PHP] Performance question for table updating (SOLVED)

2007-11-24 Thread Jon Westcot
Hi Rob, et al.:

- Original Message -
From: "Andrés Robinet" <[EMAIL PROTECTED]>
> > -Original Message-
> > From: Jon Westcot [mailto:[EMAIL PROTECTED]
> >
> > :: gigantic snip here::
> >
> > So, long story short (oops -- too late!), what's the concensus
> > among the learned assembly here?  Is it faster to just UPDATE the
> > record if it already exists regardless of the fact that maybe only one
> > or two out of 75 or more fields changed versus testing each one of
> > those 75 fields to try and figure out which ones actually changed and
> > then only update those?
> >
> > I look forward to reading all of your thoughts.
> >
> > Sincerely,
> >
> > Jon
>
> I don't know about consensus over here because I'm kind of newgie (stands
> for new geek, as opposed to newbie which stands for new ball breaker :D :D
> ). I don't know of your previous messages but I can tell you one story...
> Some time ago I got involved in a project that required geo-distance
> calculation (you know distance between two points with latitude and
> longitude). Basically I had to take a set of points and calculate the
> distance of each of those points to a given (reference) one. The math was
> something like the "square root of the sum of a constant times the square
> sin of..." well, I can't remember it, but the point is, it was a
complicated
> formula, which I thought it would allow for some optimizations in PHP.
> Accustomed to regular (compiled) programming languages I developed a set
of
> routines to optimize the task and went ahead and queried the database for
> the (say, 1000 records) dataset of points. Then applied the math to the
> points and the reference point and got the result... in about 5 minutes to
> my (disgusting) surprise.
> Then I grabbed the MySQL manual, built a "non-optimized" version of the
> formula to put directly in the SQL query and get the "shortest distance"
> (which was my goal in the end) calculated by MySQL right away. I thought
> "ok, I'll prepare a cup of coffee to wait for MySQL to finish the
> calculation". To my surprise the query returned the expected result in
less
> than 2 seconds.
> My logic was (wrongly) the following: PHP is a programming language, SQL
is
> a data access language; I'll get the data using MySQL and do the math
using
> PHP. But I forgot PHP is an interpreted language, that a number is more
than
> a number to PHP, but a ZVAL_ object behind the scenes. I forgot
> about the memory and the time required to build those objects when one
> retrieves data out of a database server. I forgot about parsing time, and
> "support logic and safety checks" in the language that overkill any
attempt
> to build TDCPL (Too Damn Complex Programming Logic) in PHP.
> So, now, when I have to do some logic stuff to the retrieved data, I first
> check "how much" I can push into the query itself, to get little or
nothing
> of programming logic in PHP after retrieving (before storing) the data.
> All that said, I'd give a shot to the MySQL REPLACE function (I wouldn't
> even branch the code to use INSERT or UPDATE depending on the record
already
> existing or not, If you have a primary key, all you need is REPLACE). But,
> PLEASE LOOK AT THE GOTCHAS (like set col_name=col_name+1). Furthermore, If
> those data files were to be uploaded by me (I mean, me, the coder, not the
> end user), I'd build (use) a program to convert them to SQL sentences in
my
> desktop PC where I can use faster programming languages and I can wait for
> five minutes of heavy processing (instead of overkilling the server for
five
> minutes which will slow down every other service in there).
> In the end it depends on your requirements and where you get the data from
> and if and how you want to automate the task (I didn't get your previous
> messages, I got subscribed recently, if you can send me a link to those
> ones... great!)
>
> Rob

Thanks for the comments and suggestions.  Prior to receiving your note,
I went back and did a bit of checking on my code.  Turns out that the
problem was "hardware" related -- the infamous "Loose Screw Behind the
Keyboard."

The problem actually boiled down to two quotation marks -- they were
present in the search code to see if a record with the specified key
existed, but were omitted in the WHERE clause of the UPDATE statement.  Said
update therefore refused to use the nice little index I'd provided for its
use and instead scanned through the entire table to find the record in
question.

Moral of the story?  Two, really.  First, ensure you always reference
values in the way most appropriate for their type.  Second, don't make your
idiocy public by asking stupid questions on a public forum.   What's the
quote (probably attributed to Churchill)?  "It is better to be ignorant and
silent than to voice one's opinions and remove all doubt." ;)

Jon

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



[PHP] Performance question for table updating

2007-11-23 Thread Jon Westcot
Hi all:

For those who've been following the saga, I'm working on an application 
that needs to load a data file consisting of approximately 29,000 to 35,000 
records in it (and not short ones, either) into several tables.  I'm using 
MySQL as the database.

I've noticed a really horrible performance difference between INSERTing 
rows into the table and UPDATEing rows with new data when they already exist in 
the table.  For example, when I first start with an empty table, the 
application inserts around 29,600 records in something less than 6 minutes.  
But, when I use the second file, updating that same table takes over 90 minutes.

Here's my question: I had assumed -- probably wrongly -- that it would be 
far more expedient to only update rows where data had actually changed; 
moreover, that I should only update the changed fields in the particular rows.  
This involves a large number of if statements, i.e.,

if($old_row["field_a"] !== $new_row["field_66"] {
$update_query .= "field_a = '" . 
mysql_real_escape_string($new_row["field_66"]) . "',";
}

Eventually, I wind up with a query similar to:

UPDATE table_01 SET field_a = 'New value here', updated=CURDATE() WHERE 
primary_key=12345

I thought that, to keep the table updating to a minimum, this approach made 
the most sense.  However, seeing the two hugely different performance times has 
made me question whether or not it would be faster to simply update every field 
in the table and eliminate all of these test conditions.

And, before someone comments that indexes on the table can cause 
performance hits, I DROP nearly all of the indexes at the start of the 
processing, only keeping those indexes necessary to do the original INSERT or 
the subsequent UPDATE, and then add all of the extra "steroid" indexes (you 
know -- the performance-enhancing ones ) after all of the INSERTs and 
UPDATEs have been finished.

So, long story short (oops -- too late!), what's the concensus among the 
learned assembly here?  Is it faster to just UPDATE the record if it already 
exists regardless of the fact that maybe only one or two out of 75 or more 
fields changed versus testing each one of those 75 fields to try and figure out 
which ones actually changed and then only update those?

I look forward to reading all of your thoughts.

Sincerely,

Jon


Re: [PHP] Looking for a navigation recommendation (SOLVED)

2007-11-17 Thread Jon Westcot
Hi Tedd:

> > YES!  Exactly!  Something like that would be very nice to have.
> >
> > MUCH appreciated!
> >
> > Jon
>
> Jon:
>
> Here it is:
>
> http://webbytedd.com/bbb/paging
>
> I'm assuming that you know how to establish communication with your
> database; how to set up your database; and how to use css and the
> images as shown there.
>
> If you get in trouble, I'm available for hire. :-)
>
> tedd

Thanks for the code sample.  It pointed me in exactly the right
direction to solve what I was trying to accomplish.

Appreciatively,

Jon

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



Re: [PHP] Looking for a navigation recommendation

2007-11-17 Thread Jon Westcot
Hi Tedd:

> >Hi all:
> >
> > I'm working on a project wherein I need to be able to navigate
> >to previous and next sections of data.  I'm wondering what the best
> >way to code for this would be.
> >
> > When I enter the page, I'd like it to use something in the MySQL
> >SELECT such as "LIMIT 0,25", but the "0" portion needs to change
> >with the appropriate selections of "Next" or "Prev".  I thought that
> >setting Next or Prev as an anchor back to the same page would let me
> >pass along data, but it doesn't seem to be happening, at least, not
> >in the $_POST variables.
> >
> > Any suggestions for me?  Or maybe a recommendation for a similar
> >page I could view and learn from?
> >
> > Thanks so much for any help you can send my way.
> >
> > Jon
>
> Jon:
>
> Do you mean something like this:
>
> http://webbytedd.com/bbb/proof
>
> Please note the page thing at the bottom. If so, I'll work up a demo for
you.
>
> Cheers,
>
> tedd

YES!  Exactly!  Something like that would be very nice to have.

MUCH appreciated!

Jon

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



[PHP] Looking for a navigation recommendation

2007-11-17 Thread Jon Westcot
Hi all:

I'm working on a project wherein I need to be able to navigate to previous 
and next sections of data.  I'm wondering what the best way to code for this 
would be.

When I enter the page, I'd like it to use something in the MySQL SELECT 
such as "LIMIT 0,25", but the "0" portion needs to change with the appropriate 
selections of "Next" or "Prev".  I thought that setting Next or Prev as an 
anchor back to the same page would let me pass along data, but it doesn't seem 
to be happening, at least, not in the $_POST variables.

Any suggestions for me?  Or maybe a recommendation for a similar page I 
could view and learn from?

    Thanks so much for any help you can send my way.

Jon


[PHP] I need help handling form posting

2007-11-15 Thread Jon Westcot
Hi all:

In my quest to make things seem easier for the user to understand, I'm 
trying to retrieve the time that I start posting a very large file via a form 
post.  The form action sends it back to itself, which is fine.  It took me some 
time to figure out that NOTHING happens on the client until the form has been 
completely transmitted to the server.  In my particular case, this can be a 
long time, anywhere from 15 to 30 minutes.  I'd like to be able to notify the 
user of when the file upload actually began.

Is there a way that I can intercept the click of the "Upload" button, have 
it update a field (probably a hidden one) with a date/time stamp, and then have 
that value included in the $_POSTed values?  I'm thinking (fearing, rather) 
that this is probably all off-topic and probably is best addressed with some 
type of JavaScript solution, but it's late, I'm not thinking clearly, and I've 
been doing data conversions all day, which is a sure-fire way to get me 
emulating some Romero zombies.

Any help you can spare will be greatly appreciated.

Jon


Re: [PHP] Newbie question - current date - time

2007-11-14 Thread Jon Westcot
Hi:

> > Hi Folks,
> >
> > Newbie question :
> >
> > - how do I get and display the current date?
> > - how do I get and display the current time?
> >
> > I see the getdate function - but I'm not sure if this is the right
> > function
> > or how to display it
> >
> > http://www.php.net/manual/en/function.getdate.php
>
> Give this a shot:
>
> $Date = date("y/m/d h:m:i");
> echo $Date;
>
> You can format it how ever you want. Lots of different options. Check
> out: HTTP://www.php.net/date for lots more info.

Um, not to pick nits, and being a newbie myself I'm really risking a lot
here by potentially exposing my ignorance, but was the purpose of the code
above to get the user to read the manual section?  It sure worked for me
when I saw the output of the date command and couldn't believe that the
process I was running completed in just six seconds.  It all boiled down to
changing (dare I say correcting?) "h:m:i" to "h:i:s" -- the "m" in question
related to the month in the date, not minutes in the time.

And thanks to everyone for being so willing to help and generous with
their time.  I really appreciate it!

Jon

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



Re: [PHP] Quick questions -- how do I place the cursor (i.e., set focus) to a field on page load?

2007-11-13 Thread Jon Westcot
Hi Tedd:

> > Also, while I'm asking questions, let me ask another one: I've
> >seen several pages (frequently, pages that come up after a login
> >page has been filled out) that provide some user mollification (you
> >know, the typical "Please be patient, don't get your nylons in a
> >knot, we're typing as fast as we can" message), often with some type
> >of moving text or graphics (probably an animated GIF) that then goes
> >away after a certain time and a third page is displayed.
>
> Here's a collection of animated wait gifs:
>
> http://webbytedd.com/bb/wait/
>
> Steal as you need -- I did.

Thanks.  I'll check that out.  I'm still wondering, though, how the
redirection works if it is supposed to occur only before any text appears in
the .

> >I know that the headers("Location") code can do this, but I was
> >under the (probably mistaken) impression that this will NOT work if
> >information has already been displayed on the page.  If that's the
> >case, how are these other pages doing this?  Knowing how to move
> >from page to page this way would really be helpful.
>
> Check out php sessions for passing data between pages.
>
> http://www.php.net/session
> http://www.tizag.com/phpT/phpsessions.php

I guess these will help explain things.  Thanks.

Greatly appreciated!

Jon

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



Re: [PHP] Quick questions -- how do I place the cursor (i.e., set focus) to a field on page load?

2007-11-13 Thread Jon Westcot
Hi Mike, Chris, et al.:

Thanks for the info.  I'm not certain if I'll be needing jquery, or what
benefits it might afford me with my meager little project, but I will check
it out.

In the meantime, Chris's snippet worked like a charm!  Thanks!

Jon

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



Re: [PHP] Quick questions -- how do I place the cursor (i.e., set focus) to a field on page load?

2007-11-13 Thread Jon Westcot
Hi Mike:

> you want javascript.
>
> i'd recommend using jquery (jquery.com)

I'll look into this.  Thanks.

> put an id="username" on the username box.
>
> then do
>
> 
> $(document).ready(function() {
>$("#username").focus();
> });
> 
>
> voila

Hmmm.  It didn't work for me.  Do I need to change any of the code you
provided or should it work as you wrote it?

Thanks, though, for the code snippet.  I'll look up its pieces to see if
I can figure out what isn't working for me.

Jon

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



[PHP] Quick questions -- how do I place the cursor (i.e., set focus) to a field on page load?

2007-11-13 Thread Jon Westcot
Hi all:

This may or may not be a PHP-related question, but, since I'm coding with 
PHP, I thought I'd ask:

When a form loads, such as a login form, I'd like to have the cursor placed 
automatically in the Username field.  Right now, it requires me to click it 
with the mouse or to tab into it.  I know I've seen this type of cursor control 
accomplished on countless web pages, but I can't find any hints on how to 
accomplish this on my own.  Can one of you wonderful code wizards point me in 
the right direction?

Also, while I'm asking questions, let me ask another one: I've seen several 
pages (frequently, pages that come up after a login page has been filled out) 
that provide some user mollification (you know, the typical "Please be patient, 
don't get your nylons in a knot, we're typing as fast as we can" message), 
often with some type of moving text or graphics (probably an animated GIF) that 
then goes away after a certain time and a third page is displayed.  I know that 
the headers("Location") code can do this, but I was under the (probably 
mistaken) impression that this will NOT work if information has already been 
displayed on the page.  If that's the case, how are these other pages doing 
this?  Knowing how to move from page to page this way would really be helpful.

Thanks so much.

Jon


Re: [PHP] Problem retrieving $_POST values

2007-11-13 Thread Jon Westcot
Hi Chris, et al.:

> > Here's a section of what comes back when I do this:
> >
> > [mls] => 1234567
> > [property_address] => Main St
> > [city_arr] => Array
> > (
> > [0] => CHNDHT
> > [1] => CHNDLR
> > [2] => GILBER
> > [3] => HIGLEY
> > [4] => MESA
> > [5] => TEMPE
> > )
>
> So it is there :)
>
> print_r($_POST['city_arr']);

After much wringing of hands and gnashing of teeth, I found the problem.
Typo.  Of course.  I'd only read over the code about a hundred times before
I asked for help, if that's any consolation.

> > > > Is there some (free ) way to test a php script outside of a web
page?
> > >
> > > cmd line you can do:
> > >
> > > php -l /path/to/file.php
> >
> > Is this something I can access through SSH?  And will it show me
errors as the script executes?
>
> Oops, I thought you meant for parse errors. That won't tell you about
> anything else unfortunately.

Ah, don't "oops" anything!  That tip was worth its weight in gold to me!
In fact, it told me where one of the typos was that was causing a syntax
error during the initial parsing.  The other typo was more insidious (trying
to use count() as $count()), but just as deadly to the output.

Thanks for the great tips!

Jon

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



Re: [PHP] Problem retrieving $_POST values

2007-11-13 Thread Jon Westcot
Hi Chris:

> Exactly as you have there.
> 
> print_r($_POST);
> 
> will show you everything.

Here's a section of what comes back when I do this:

[mls] => 1234567
[property_address] => Main St
[city_arr] => Array
(
[0] => CHNDHT
[1] => CHNDLR
[2] => GILBER
[3] => HIGLEY
[4] => MESA
[5] => TEMPE
)
 
> How are you creating the field in your form?

The three fields mentioned above on the form are specified thus:

  MLS#: 
 
Address: 

  
  City: 

 CHNDHT
CHNDLR
GILBER
HIGLEY
MESA
TEMPE


 
> > Is there some (free ) way to test a php script outside of a web page?
> 
> cmd line you can do:
> 
> php -l /path/to/file.php

Is this something I can access through SSH?  And will it show me errors as 
the script executes?

Thanks for the suggestions!

Jon


[PHP] Problem retrieving $_POST values

2007-11-12 Thread Jon Westcot
Hi all:

I'm having problems retrieving an array value that should be in a $_POST 
setting.  In fact, I'm having trouble with the code hanging with no warnings or 
errors whatsoever, so I've got no clue why it's not working.

Working code:

if(isset($_POST["mls"])) {
if(strlen(trim($_POST["mls"])) > 0) {
$query = "mls=" . $_POST["mls"];
}
}

Non-working code:

if(isset($_POST['city_arr'])) {
// This space intentionally left blank.
}

The only thing I know that is different is that "mls" is a single value and 
that city_arr is an array.  I have tried expressing it as "city_arr[]" with no 
success.

Does anyone have an example of how to reference the $_POST value when said 
value is an array?  I can't seem to find a sample of this anywhere in the 
manual.

While I'm on the subject, how can I get a php page to tell me where a 
syntax error exists if one does instead of just giving me a blank page?  Is 
there some (free ) way to test a php script outside of a web page?

Thanks!

Jon


[PHP] What to do when flush() doesn't?

2007-11-11 Thread Jon Westcot
Hi all:

I am trying to get information from a rather long-running PHP script to 
send out messages to the client as things are being processed.  In reading the 
manual, it seemed that using flush() was the ideal command for this.  Well, it 
doesn't seem to be working for me.  I've even tried sending over a large number 
of blanks (like 4096 of 'em) before doing anything, but still no go.

The flush() activity is supposed to occur on a page that has POSTed back to 
itself, so perhaps that's causing the heartburn?

Any suggestions on how I can accomplish this type of user mollification?

    Thanks,

Jon


Re: [PHP] More info on timeout problem, with code

2007-11-06 Thread Jon Westcot
Hi Chris:

> What indexes are on this table?

On the import table, there is only one index.  And I probably don't even
need an index on it since it will be processed sequentially into other
tables after it's been imported.

> When you do an insert, each one has to update the index
> as well as the data, so maybe that's where all the time is
> being spent in the database (doubt it's the problem but
> try dropping all of the indexes on the table).

I will try this.

> Are you commenting out this whole section?
>
>  $insert_query = "INSERT INTO evall VALUES(";
>  for ($c=0; $c < $num; $c++) {
>  if($c > 0) {
>  $insert_query .= ",";
>  }
>  $insert_query .= '"' . $data[$c] . '"';
>  }
>  $insert_query .= ");";

Only for the point of testing; normally, that code would need to be
included to generate the INSERT query.

> Try
>
> $insert_query = "INSERT INTO evall values ('" . implode('\'', $data) .
"')";
>
> so you're not doing a for loop when you don't need to.

Thanks for the suggestion.  But, won't the "glue" part actually need to
be something like:

'\',\''

That is, I need to close the single quote, place a comma after the
field, and then add in another opening quote.  One other thing: I suspect I
need to use addslashes() to the elements in $data -- is there a way to do
this with one statement as you've done above?

> Also as someone else suggested if this is a csv file you
> can use LOAD DATA INFILE to directly import it instead
> of having to create a bunch of insert queries.
>
> See http://dev.mysql.com/doc/refman/5.1/en/load-data.html
>
> Only do this if you are 100% sure of the data (ie it it sanitized in
> some other step).

Trying to use LOAD DATA INFILE was my initial plan, but that simply
didn't work.  Turns out that it's because of being on a shared server.  I've
talked with The Powers That Be about this and they're going to move to a
dedicated virtual server; that should give me much more flexibility and
control over what I need to update in the various settings and files and
things to get past all of the heartburn I've had over the last weeks.

> > As odd as this sounds, should I put in some type of
> > delay?  Could the system be thinking it's getting flooded
> > by all of the inserts?
>
> Doubt it.

Surprisingly enough, when I've used something like usleep(15000), I seem
to be able to process more records than when I don't have it at all.
::shrug::  Just clutching at straws.

Thanks again for your comments.  I appreciate them all!

Jon

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



Re: [PHP] More info on timeout problem, with code

2007-11-06 Thread Jon Westcot
Hi David, et al.:

Thanks for the comment.  I removed the trailing semi-colon in the two
areas where it was being sent to mysql_query() and tried the code again.
I'm still getting the same basic problem -- it silently aborts somewhere
around 22,000 to 26,000 records being processed out of just under 30,000.
When I don't build the $insert_query string, I am able to read through the
CSV file completely.

As odd as this sounds, should I put in some type of delay?  Could the
system be thinking it's getting flooded by all of the inserts?

Jon

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



[PHP] More info on timeout problem, with code

2007-11-05 Thread Jon Westcot
Hi all:

As requested, here's the code:

Session.gc_maxlifetime: " . ini_get("session.gc_maxlifetime") .
"\n";  // shows 1800
echo "Max execution time: " . ini_get("max_execution_time") .
"\n";  // shows 1800
echo "Max input time: " . ini_get("max_input_time") . "\n";
// shows -1

ignore_user_abort(TRUE);
set_time_limit(0);

$query = mysql_query("TRUNCATE evall;");

echo "Results of Truncate: $query\n";

$myfile_replace = "uploads/evall.csv";
$handle = @fopen($myfile_replace, 'rb');
$save_handle = @fopen("tmp/sql_calls.txt", "wb");

$process_count = 0;
if(!$handle) {
echo "The file ($myfile_replace) could not be opened.\n";
flush();
} else {
echo "The file ($myfile_replace) opened correctly.\n";
flush();

$headings = fgetcsv($handle, 1, ",");  // Just ignore the first
row returned.
$row = 0;
while (($data = fgetcsv($handle, 1, ",")) !== FALSE) {
$row++;
$num = count($data);
$insert_query = "INSERT INTO evall VALUES(";
for ($c=0; $c < $num; $c++) {
if($c > 0) {
$insert_query .= ",";
}
$insert_query .= '"' . $data[$c] . '"';
}
$insert_query .= ");";

if(fwrite($save_handle, $row . "; " . strlen($insert_query) . ":
" . "\n") === FALSE) {
echo "The query could not be written.\n";
} else {
$process_count++;
}
if($row % 1000 == 0) {
echo "$row records processed so far\n";
flush();
}
}
echo "File import completed. $row records read; $process_count
records added.\n";
flush();
fclose($save_handle);
fclose($handle);
}

ini_set("session.gc_maxlifetime",$old_session_gc_maxlifetime);
ini_set("max_execution_time",$old_max_execution_time);
ini_set("max_input_time",$old_max_input_time);

}
?>

Version 1.9 -- The file uploading process presupposes that the user
has uploaded the EVAll.CSV
file to the "uploads" folder. If this has been done and you're
ready to process
it, click the  button.
  


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



Re: [PHP] More info on timeout problem

2007-11-05 Thread Jon Westcot
Hi Kristen:

> I'm jumping in here late, so I haven't seen previous posts.  Another
> possible place I have seen limiting post/upload sizes:
>
> There is an Apache directive called LimitRequestSize or somesuch which
will
> take precedence (silently) over any PHP max post size you set.  I found
this
> set once before in an /conf.d/php.conf file that I eventually
> found.

I just conducted another test of my process, this time not even creating
the SQL INSERT string in the program, but just trying to read every record
from the input file and just writing a count of records to the file.  It
worked, much to my surprise and pleasure.  But then, when I put back the
code to build the string, it timed out again.

I'm starting to believe that I'm either using up some resource that
isn't being released, or that the directive you mentioned, LimitRequestSize,
is being trounced upon.  Any ideas on how to find out the value currently
set for this directive?  Or how I can override it?  Can I override it within
my own .htaccess file?

Thanks for the suggestion!

Jon

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



Re: [PHP] More info on timeout problem

2007-11-05 Thread Jon Westcot
Hi Instruct ICC:

> > How do I save the individual query statements to a file? That may give
> > me a good option for checking a "log" of activity when the process fails
> > again.
>
> I'm assuming you are building an $sql variable, so you would write that to
> a file instead of executing it in a query. Look at an example here
> http://php.he.net/manual/en/function.fwrite.php to write data to a file.

Thanks for the link; I should have guessed that fwrite() was the
command, but I'm starting to get so cross-eyed and synapse-tied here that my
thinking is really muzzy.

But get this -- I tried your suggestion and am writing the SQL query
text to a file and am not doing anything with updating the data in MySQL at
all.  And it still "times" out, in constantly random areas.

If it happened in the exact same place every time, I could live with
that, but it's not.  It's entirely random (or at least I haven't seen the
pattern yet), and that just makes me ill.

Jon

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



Re: [PHP] More info on timeout problem

2007-11-05 Thread Jon Westcot
Hi Wolf:

Thanks for the suggestion.  I've tried setting these in a php.ini file,
but that file seems to be constantly ignored, other than the fact that its
presence seems to cause every value to take on its default settings.
::sigh::  I am going to try and put the values into a .htaccess file
instead; at least I seem to have some control over that file.

I'm really starting to hate shared servers.

Jon


- Original Message -
From: "Wolf" <[EMAIL PROTECTED]>
To: "Jon Westcot" <[EMAIL PROTECTED]>
Cc: "PHP General" 
Sent: Monday, November 05, 2007 2:20 PM
Subject: Re: [PHP] More info on timeout problem


> One thing to note, if you have not upped the max file size to be over what
you are trying to load, the server will hang.
>
> ;;;
> ; Resource Limits ;
> ;;;
>
> max_execution_time = 7200 ; Maximum execution time of each script, in
seconds
> max_input_time = 7200   ; Maximum amount of time each script may spend
parsing request data
> memory_limit = 2G  ; Maximum amount of memory a script may consume
>
>
> ; Maximum size of POST data that PHP will accept.
> post_max_size = 8M  // CHANGE THIS!!
>
> ; Maximum allowed size for uploaded files.
> upload_max_filesize = 2M  // CHANGE THIS!!
>
> Also look in any php.ini files in apache's conf.d directory for files that
set it back to these default limits
>
> You'll notice, I have increased my max execution times, input times, and
memory limit but not my upload sizes, but that is only due to the server I
snagged it from not doing uploads.  I have another server which has a 879M
upload limit and has no problems with large files getting to it.
>
> Wolf
>
>  Jon Westcot <[EMAIL PROTECTED]> wrote:
> > Hi Instruct ICC:
> >
> > > > I'm now wondering if some error is occurring that, for some
reason,
> > is
> > > > silently ending the routine.  I'm building what may be a very long
SQL
> > > > INSERT statement for each line in the CSV file that I'm reading;
could
> > > > I be hitting some upper limit for the length of the SQL code?  I'd
think
> > > > that an error would be presented in this case, but maybe I have to
do
> > > > something explicitly to force all errors to display?  Even warnings?
> > > >
> > > > Another thing I've noticed is that the "timeout" (I'm not even
> > certain
> > > > the problem IS a timeout any longer, hence the quotation marks)
doesn't
> > > > happen at the same record every time.  That's why I thought it was a
> > > > timeout problem at first, and assumed that the varying load on the
> > server
> > > > would account for the different record numbers processed.  If I were
> > > > hitting some problem with the SQL statement, I'd expect it to stop
at
> > > > the same record every time.  Or is that misguided thinking, too?
> > >
> > > 1) When you say, "doesn't happen at the same record every time" are
you
> > > using the same dataset and speaking about the same line number?  Or
are
> > > you using different datasets and noticing that the line number varies?
If
> > it's
> > > the same dataset, it sounds like "fun" -- as in "a pain in the
assets".
> >
> > Yup, same dataset.  It took me forever to upload it, so I'm trying
to
> > keep it there until I know it's been successfully loaded.  It's got
about
> > 30,000 records in it, and each one has 240 fields.
> >
> > > 2) I'm writing something similar; letting a user upload a CSV file via
a
> > > webpage, then creating an SQL query with many records.  So now I'll
> > > be watching your thread.  For debugging purposes, create your SQL
> > > statement and print it out on the webpage (or save it somewhere --
> > > maybe a file).  Don't have your webpage script execute the query.
> > > Then see if you get the complete query you expect.  Then copy that
> > > query into a database tool like phpmyadmin and see if you get errors
> > > when executing the query.
> >
> > Sounds much like what I'm trying to do.  I have had to give up, for
the
> > time being, on using PHP to upload the datafile; it's about 56 MB in
size
> > and nothing I do seems to let me upload anything larger than a 2MB file.
:(
> >
> > How do I save the individual query statements to a file?  That may
give
> > me a good option for checking a "log" of activity when the process fails
> > again.
> >
> > Thanks for your suggestions!
> >
> > Jon
> >
> > --
> > 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] More info on timeout problem

2007-11-05 Thread Jon Westcot
Hi Instruct ICC:

> > I'm now wondering if some error is occurring that, for some reason,
is
> > silently ending the routine.  I'm building what may be a very long SQL
> > INSERT statement for each line in the CSV file that I'm reading; could
> > I be hitting some upper limit for the length of the SQL code?  I'd think
> > that an error would be presented in this case, but maybe I have to do
> > something explicitly to force all errors to display?  Even warnings?
> >
> > Another thing I've noticed is that the "timeout" (I'm not even
certain
> > the problem IS a timeout any longer, hence the quotation marks) doesn't
> > happen at the same record every time.  That's why I thought it was a
> > timeout problem at first, and assumed that the varying load on the
server
> > would account for the different record numbers processed.  If I were
> > hitting some problem with the SQL statement, I'd expect it to stop at
> > the same record every time.  Or is that misguided thinking, too?
>
> 1) When you say, "doesn't happen at the same record every time" are you
> using the same dataset and speaking about the same line number?  Or are
> you using different datasets and noticing that the line number varies?  If
it's
> the same dataset, it sounds like "fun" -- as in "a pain in the assets".

Yup, same dataset.  It took me forever to upload it, so I'm trying to
keep it there until I know it's been successfully loaded.  It's got about
30,000 records in it, and each one has 240 fields.

> 2) I'm writing something similar; letting a user upload a CSV file via a
> webpage, then creating an SQL query with many records.  So now I'll
> be watching your thread.  For debugging purposes, create your SQL
> statement and print it out on the webpage (or save it somewhere --
> maybe a file).  Don't have your webpage script execute the query.
> Then see if you get the complete query you expect.  Then copy that
> query into a database tool like phpmyadmin and see if you get errors
> when executing the query.

Sounds much like what I'm trying to do.  I have had to give up, for the
time being, on using PHP to upload the datafile; it's about 56 MB in size
and nothing I do seems to let me upload anything larger than a 2MB file. :(

How do I save the individual query statements to a file?  That may give
me a good option for checking a "log" of activity when the process fails
again.

Thanks for your suggestions!

Jon

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



[PHP] More info on timeout problem

2007-11-05 Thread Jon Westcot
Hi all:

First, thanks for the multiple suggestions.  I'm pretty new at PHP 
programming, so all suggestions are great learning opportunities.

Now, some observations: I've tried placing the "ignore_user_abort(TRUE);" 
in the code.  It seems to have made little, if any, impact -- the page still 
appears to time out.  I've also tried placing "set_time_limit(0);" both before 
and after the "ignore_user_abort(TRUE);" call.  Still no improvement.

I'm now wondering if some error is occurring that, for some reason, is 
silently ending the routine.  I'm building what may be a very long SQL INSERT 
statement for each line in the CSV file that I'm reading; could I be hitting 
some upper limit for the length of the SQL code?  I'd think that an error would 
be presented in this case, but maybe I have to do something explicitly to force 
all errors to display?  Even warnings?

Another thing I've noticed is that the "timeout" (I'm not even certain the 
problem IS a timeout any longer, hence the quotation marks) doesn't happen at 
the same record every time.  That's why I thought it was a timeout problem at 
first, and assumed that the varying load on the server would account for the 
different record numbers processed.  If I were hitting some problem with the 
SQL statement, I'd expect it to stop at the same record every time.  Or is that 
misguided thinking, too?

More info: I've activated a session (have to be logged into the application 
to update the data), so is it possible that something with the session module 
could be causing the problem?  I have adjusted the session.gc_maxlifetime value 
(per an example I saw in the PHP manual comments elsewhere), but is there some 
other value I should adjust, too?

Thanks for all of your continued help and assistance!  And please don't 
argue over "best" ways to solve my problem -- ALL suggestions are welcome!  
(Even if I don't know thing one about CLI or even how to access it. )

Jon


Re: [PHP] Looking for ways to prevent timeout

2007-11-05 Thread Jon Westcot
Hi Jochem:

Thanks for the suggestion.  Not to sound more dense than I already seem,
but how do I do this?  How do I tell the browser that something is still
running?  I'm issuing a flush() after every 1000 records along with echoing
a textual status update.  Should I do it more frequently, say every 100
records?

I'm really struggling with this concept here, and I appreciate the help
that everyone is giving me!

Jon

- Original Message -
From: "Jochem Maas" <[EMAIL PROTECTED]>
To: "Jon Westcot" <[EMAIL PROTECTED]>
Cc: "PHP General" 
Sent: Sunday, November 04, 2007 7:28 PM
Subject: Re: [PHP] Looking for ways to prevent timeout


> Jon Westcot wrote:
> > Hi all:
> >
> > I'm hoping to find a solution to the problem I'm having with my
script timing out while inserting records into a table.
> >
> > Overall, the process is pretty fast, which is impressive, but when
it gets to the 22,000 to 23,000 record mark, it seems to time out.  I've had
it get up over 26,000 so far, but nothing better than that.  And I only need
to process around 30,000 right now.
> >
> > I've tried setting max_execution_time to 1800; no improvement.  The
value for max_input_time is -1, which, if I understood it correcctly, is the
same as saying no limit.  And I've tried calling set_time_limit() with both
0 and with 360, none of which seemed to help.
> >
> > Is there ANY WAY to increase the amount of time I can use when
running a script that will work?  I've tried everything I can find in the
PHP manual.
> >
> > Any help you can provide will be greatly appreciated!
>
> http://php.net/ignore_user_abort will help, but nothing will stop you
hitting a max execution time.
> but my guess is your not hitting the max but rather the browser is killing
the connection because it's
> had no response fom your script and as a result apache is killing your
script as it thinks it's no longer
> needed (i.e. the browser no longer wants the response).
>
> >
> > Jon
> >
>
>

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



Re: [PHP] Looking for ways to prevent timeout

2007-11-05 Thread Jon Westcot
Hi Nathan:

No, I'm not familiar with Ajax.  Where can I read up on it?  More
important, how can I find out if Ajax is implemented on the server?  Or is
it something I can add myself?

Thanks again,

        Jon

- Original Message -
From: "Nathan Nobbe" <[EMAIL PROTECTED]>
To: "Jon Westcot" <[EMAIL PROTECTED]>
Cc: "PHP General" 
Sent: Sunday, November 04, 2007 7:53 PM
Subject: Re: [PHP] Looking for ways to prevent timeout


> On 11/4/07, Jon Westcot <[EMAIL PROTECTED]> wrote:
> >
> > Hi all:
> >
> > I'm hoping to find a solution to the problem I'm having with my
script
> > timing out while inserting records into a table.
> >
> > Overall, the process is pretty fast, which is impressive, but when
it
> > gets to the 22,000 to 23,000 record mark, it seems to time out.  I've
had it
> > get up over 26,000 so far, but nothing better than that.  And I only
need to
> > process around 30,000 right now.
> >
> > I've tried setting max_execution_time to 1800; no improvement.  The
> > value for max_input_time is -1, which, if I understood it correcctly, is
the
> > same as saying no limit.  And I've tried calling set_time_limit() with
both
> > 0 and with 360, none of which seemed to help.
> >
> > Is there ANY WAY to increase the amount of time I can use when
running
> > a script that will work?  I've tried everything I can find in the PHP
> > manual.
> >
> > Any help you can provide will be greatly appreciated!
>
>
> are you familiar with ajax ?
> i would build some client side tool that would split the job into a series
> of requests.
> say, you input 20,000; then the script fires off 5 requests, to do 4000
> inserts a piece.
> you could easily implement a status bar and it would be guaranteed to
work.
> also, it would scale just about as high as you can imagine.
>
> -nathan
>

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



Re: [PHP] Question about php.ini file

2007-11-04 Thread Jon Westcot
Hi Nathan:

Another quick question regarding the use of the .htaccess file:

If I'm trying to set something like post_max_size, which takes a shorthand 
value such as 16M in place of the full value, will using the php_value type of 
statement also accept the shorthand value, or do I need to place in the full 
value?

Thanks again; this solution may be exactly what we need!

    Jon

- Original Message - 
From: Nathan Nobbe 
To: Jon Westcot 
Cc: PHP General 
Sent: Sunday, November 04, 2007 5:05 PM
Subject: Re: [PHP] Question about php.ini file


On 11/4/07, Jon Westcot <[EMAIL PROTECTED]> wrote:
  Hi Cristian:

  Thanks for the replies.

  In this case, what I've been noticing is that most of the values have
  gone DOWN (i.e., gotten smaller) after I placed my own php.ini file in
  place.  For example, upload_max_filesize was 8M before I placed my file, 
  but, afterwards, it was 2M!  I'm trying to increase this size, not decrease
  it.

  Could it be the line-ending characters that are causing the problem?
  Could PHP be seeing the new file but not realizing how to process it, which 
  would cause the values to flop over to their defaults?

do you have ssh access to the server?
i recommend you start out by creating the simplest file you can by editing it
directly on the linux server, via vim or w/e. 
then using a phpinfo() script, you should see your overridden value in the left
column (those are for the locally overridden values).
some other things to note are;

  1.. apache must be properly configured to allow the .htaccess overrides. 
  2.. you cant override all the values in php.ini; see the documentation
regarding which ones can be overriden and where


here is an article regarding the process, 
http://gentoo-wiki.com/HOWTO_php.ini_overrides_w/_.htaccess

-nathan



[PHP] Looking for ways to prevent timeout

2007-11-04 Thread Jon Westcot
Hi all:

I'm hoping to find a solution to the problem I'm having with my script 
timing out while inserting records into a table.

Overall, the process is pretty fast, which is impressive, but when it gets 
to the 22,000 to 23,000 record mark, it seems to time out.  I've had it get up 
over 26,000 so far, but nothing better than that.  And I only need to process 
around 30,000 right now.

I've tried setting max_execution_time to 1800; no improvement.  The value 
for max_input_time is -1, which, if I understood it correcctly, is the same as 
saying no limit.  And I've tried calling set_time_limit() with both 0 and with 
360, none of which seemed to help.

Is there ANY WAY to increase the amount of time I can use when running a 
script that will work?  I've tried everything I can find in the PHP manual.

Any help you can provide will be greatly appreciated!

Jon


Re: [PHP] Question about php.ini file

2007-11-04 Thread Jon Westcot
Hi Nathan:

I'm not certain if I have all of the items you've mentioned, but I'll look 
into it.  And thanks for the link; I'll check that out, too.

Jon

- Original Message - 
From: Nathan Nobbe 
To: Jon Westcot 
Cc: PHP General 
Sent: Sunday, November 04, 2007 5:05 PM
Subject: Re: [PHP] Question about php.ini file


On 11/4/07, Jon Westcot <[EMAIL PROTECTED]> wrote:
  Hi Cristian:

  Thanks for the replies.

  In this case, what I've been noticing is that most of the values have
  gone DOWN (i.e., gotten smaller) after I placed my own php.ini file in
  place.  For example, upload_max_filesize was 8M before I placed my file, 
  but, afterwards, it was 2M!  I'm trying to increase this size, not decrease
  it.

  Could it be the line-ending characters that are causing the problem?
  Could PHP be seeing the new file but not realizing how to process it, which 
  would cause the values to flop over to their defaults?

do you have ssh access to the server?
i recommend you start out by creating the simplest file you can by editing it
directly on the linux server, via vim or w/e. 
then using a phpinfo() script, you should see your overridden value in the left
column (those are for the locally overridden values).
some other things to note are;

  1.. apache must be properly configured to allow the .htaccess overrides. 
  2.. you cant override all the values in php.ini; see the documentation
regarding which ones can be overriden and where


here is an article regarding the process, 
http://gentoo-wiki.com/HOWTO_php.ini_overrides_w/_.htaccess

-nathan



Re: [PHP] Question about php.ini file

2007-11-04 Thread Jon Westcot
Hi Cristian:

Thanks for the replies.

In this case, what I've been noticing is that most of the values have
gone DOWN (i.e., gotten smaller) after I placed my own php.ini file in
place.  For example, upload_max_filesize was 8M before I placed my file,
but, afterwards, it was 2M!  I'm trying to increase this size, not decrease
it.

Could it be the line-ending characters that are causing the problem?
Could PHP be seeing the new file but not realizing how to process it, which
would cause the values to flop over to their defaults?

Thanks,

    Jon

- Original Message -

> You must take in count that before php even gets to receive something,
> it all passes through the HTTP server (apache or something). for most of
> these settings there are equivalents in the config file of the server
> that you need to change accordingly.
> this might be the cause of the weird results. for example, if your limit
> for uploaded files is 10M in php but the server is set to accept max 5M,
> 5M will be the limit
>
> Jon Westcot wrote:
> > Hi all:
> >
> > I've learned, much to my pleasure, that I can place a php.ini file
in the root directory of my shared domain to allow some customization of the
php settings.  However, when I do this, I keep getting weird results.  Some
of the values that I change appear as I've asked them to be.  Some appear to
not change at all.  And some have been changing to what appears to be
default values for php.
> >
> > I'm wondering a few things here.  First, my computer is
Windows-based, but the server is Linux-based.  Do I need to somehow convert
the Windows text file line termination characters to their Linux variants?
If so, how?  Is it possible that I'm trying to change values beyond some
upper limit which is causing php to use the default value?
> >
> > The main values that I'm trying to change are:
> >
> > post_max_size
> > upload_max_filesize
> > memory_limit
> > max_execution_time
> > max_input_time
> >
> > If anyone knows of upper limits for these, I'd appreciate learning
about them.
> >
> > As always, any help you can send my way will be greatly appreciated!
> >
> > Thanks,
> >
> > Jon

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



[PHP] Question about php.ini file

2007-11-04 Thread Jon Westcot
Hi all:

I've learned, much to my pleasure, that I can place a php.ini file in the 
root directory of my shared domain to allow some customization of the php 
settings.  However, when I do this, I keep getting weird results.  Some of the 
values that I change appear as I've asked them to be.  Some appear to not 
change at all.  And some have been changing to what appears to be default 
values for php.

I'm wondering a few things here.  First, my computer is Windows-based, but 
the server is Linux-based.  Do I need to somehow convert the Windows text file 
line termination characters to their Linux variants?  If so, how?  Is it 
possible that I'm trying to change values beyond some upper limit which is 
causing php to use the default value?

The main values that I'm trying to change are:

post_max_size
upload_max_filesize
memory_limit
max_execution_time
max_input_time

If anyone knows of upper limits for these, I'd appreciate learning about 
them.

As always, any help you can send my way will be greatly appreciated!

Thanks,

Jon


[PHP] How do I specify a local file for fopen()?

2007-11-04 Thread Jon Westcot
Hi all:

I've been beating my head against a brick wall trying to figure this out 
and I'm still no closer than I was two weeks ago.

How do I specify a local file on my computer to use with fopen() on the 
server?

I've checked and the allow_url_fopen setting is set to On.  I use the html 
 to let me browse to the file.  This, however, forces me to 
also POST the entire file to the server, which I DO NOT WANT it to do.  I just 
wanted to be able to use the  button to get to the file name.  But, 
even when I do this, the file name returned in the $_FILES array doesn't give 
me a file name that fopen() will actually open.

Do I somehow have to get the server to recognize my computer as an 
http-based address?  If so, how do I do this?  The computer that has the file 
to be opened is a Windows-based computer (running WinXP or Vista), and it 
obviously has an Internet connection.  Do I need to retrieve, from the server, 
my computer's IP address and use that, in whole or in part, to reference the 
file to be opened?  If so, how?

While I'm asking questions, does anyone know how to keep the file 
referenced in the  setup from actually being sent?  All I 
think I really need is the NAME of the file, not its actual contents, since I'm 
hoping to use fopen() to open the file and then to use fgetcsv() to retrieve 
the contents.

ANY help you all can send my way will be greatly appreciated!

Thanks in advance,

Jon


Re: [PHP] Can a PHP script process a file on a remote computer?

2007-10-24 Thread Jon Westcot
Hi again, Andrew:

You had asked some questions that I forgot to address with my previous
reply, so here goes:

The test file that I'm using -- which probably is a small version of the
normal file -- is around 60 MB in size (just under 30,000 records).

I checked the phpinfo info and it appears that the allow_url_fopen
setting is set to "On," which I take is a good thing.  How, then, do I
specify the filename at the server so that it points back to the file that
is on my computer (or whatever computer is trying to initiate the process)?

Thanks again for your help,

Jon


- Original Message -
From: "Jon Westcot" <[EMAIL PROTECTED]>
To: "PHP General" 
Sent: Wednesday, October 24, 2007 1:22 PM
Subject: Re: [PHP] Can a PHP script process a file on a remote computer?


> Hi Andrew:
>
> Thanks for the reply.
>
> If I use fopen() to open the remote file, how do I specify its
location?
> Isn't it going to need to know not only the address of the computer I'm
> using but the path on that computer to the file?  Does it get all that
from
> the name I pass over to it?
>
> Also, can I adjust the allow_url_fopen setting from within a PHP
script,
> or do I need to manually set it in the PHP.INI file?  The server I'm
> using -- not my own; this is for a friend -- is a shared server with
GoDaddy
> and they make it so incredibly hard to find anything.
>
> Thanks!
>
> Jon
>
>
> - Original Message -
> From: "Andrew Ballard" <[EMAIL PROTECTED]>
> To: "PHP General" 
> Sent: Wednesday, October 24, 2007 1:15 PM
> Subject: Re: [PHP] Can a PHP script process a file on a remote computer?
>
>
> > How big is the file? fgetcsv() will read any file that you can get a
> > handle to using fopen() or fsockopen(),  including remote files.
> > However, if allow_url_fopen is not enabled, you can't use fopen().
> > Also if the file is so large that your script is timing out while
> > waiting for it to be uploaded, it could also timeout just trying to
> > read the file remotely as well.
> >
> > Andrew
> >
> > --
> > 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Can a PHP script process a file on a remote computer?

2007-10-24 Thread Jon Westcot
Hi Andrew:

Thanks for the reply.

If I use fopen() to open the remote file, how do I specify its location?
Isn't it going to need to know not only the address of the computer I'm
using but the path on that computer to the file?  Does it get all that from
the name I pass over to it?

Also, can I adjust the allow_url_fopen setting from within a PHP script,
or do I need to manually set it in the PHP.INI file?  The server I'm
using -- not my own; this is for a friend -- is a shared server with GoDaddy
and they make it so incredibly hard to find anything.

Thanks!

Jon


- Original Message -
From: "Andrew Ballard" <[EMAIL PROTECTED]>
To: "PHP General" 
Sent: Wednesday, October 24, 2007 1:15 PM
Subject: Re: [PHP] Can a PHP script process a file on a remote computer?


> How big is the file? fgetcsv() will read any file that you can get a
> handle to using fopen() or fsockopen(),  including remote files.
> However, if allow_url_fopen is not enabled, you can't use fopen().
> Also if the file is so large that your script is timing out while
> waiting for it to be uploaded, it could also timeout just trying to
> read the file remotely as well.
>
> Andrew
>
> --
> 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] Can a PHP script process a file on a remote computer?

2007-10-24 Thread Jon Westcot
Thanks, Wolf.  I'm going to have to do a lot of long processes -- uploads,
queries, and the like -- and I appreciate knowing that I can adjust that.
Now if I can just find the PHP.INI file  (Stupid GoDaddy-shared-domains;
can't find anything on 'em.)

Jon

- Original Message -
From: "Wolf" <[EMAIL PROTECTED]>
To: "Jon Westcot" <[EMAIL PROTECTED]>
Cc: "PHP General" 
Sent: Wednesday, October 24, 2007 1:16 PM
Subject: Re: [PHP] Can a PHP script process a file on a remote computer?


> Go into your php.ini file and increase the script timeout length, which
should allow the upload to finish.
>
>
>  Jon Westcot <[EMAIL PROTECTED]> wrote:
> > Hi all:
> >
> > I'm working on a project that requires frequent updating of a large
amount of data to a MySQL database.  Currently, I'm trying to transfer a CSV
file to the server, have it process the file, and then delete it once the
processing is complete.  Rather than waste the up-front time of having to
upload the file (which is currently timing out without fully uploading the
file and I have no idea how to resolve this!), is it possible to have the
server open the specified file remotely and read it using the fgetcsv()
function?  If so, how?
> >
> > Any help you can give me will be GREATLY appreciated!
> >
> > Thanks,
> >
> > Jon
>
> --
> 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] Can a PHP script process a file on a remote computer?

2007-10-24 Thread Jon Westcot
Hi all:

I'm working on a project that requires frequent updating of a large amount 
of data to a MySQL database.  Currently, I'm trying to transfer a CSV file to 
the server, have it process the file, and then delete it once the processing is 
complete.  Rather than waste the up-front time of having to upload the file 
(which is currently timing out without fully uploading the file and I have no 
idea how to resolve this!), is it possible to have the server open the 
specified file remotely and read it using the fgetcsv() function?  If so, how?

Any help you can give me will be GREATLY appreciated!

Thanks,

    Jon


Re: [PHP] Need help adding dBase support to PHP

2007-10-12 Thread Jon Westcot
Hi Nathan:

Thanks for the info.  Unfortunately, it's not my call which host to use.
I'm just being asked to help write some code, and I know that there are DBFs
in the process that need to be examined and brought into MySQL on a daily
basis, if not more often.

From what I've been told, the GoDaddy server is a shared server, which I
guess means that we, the underlings using it, can't really get in and make
whatever changes we'd like to make.

I did use the browser search to look for any occurence of "dbase" in the
phpinfo-returned data, but nothing showed up.

I appreciate the help you've given.  I'll just have to wait and see if
the person who owns the site is able to get anywhere with the GoDaddy tech
support.

Thanks again,

Jon

- Original Message -
From: "Nathan Nobbe" <[EMAIL PROTECTED]>
To: "Jon Westcot" <[EMAIL PROTECTED]>
Cc: "PHP General" 
Sent: Friday, October 12, 2007 12:27 AM
Subject: Re: [PHP] Need help adding dBase support to PHP


> On 10/12/07, Jon Westcot <[EMAIL PROTECTED]> wrote:
> >
> > Hi Nathan:
> >
> > The page you referenced in the PHP documentation is exactly what I
saw
> > that indicated that the dBase functions needed to be compiled in with
the
> > --enable-dbase directive.  What I need to know is HOW to do this, even
in
> > general terms.
>
>
> basically you run about 3 commands.
> configure
> make
> make install
> and configure is the command you would pass --enable-dbase to.
> windows systems typically have binary installs available; but i really
have
> never setup php on a windows box.
>
> anyway, the reason i asked about the distribution to begin with is many
> distributions handle php configuration / installation so its quite simple.
> on gentoo you just add or remove a use flag and emerge it again if you
want
> to make a change.  on debian there are modules so i believe you can just
> apt-get a new module if it isnt already installed.
> seems nice, but ill tell you, on gentoo you spend time compiling; on
debian
> you spend time saying where is that package i want and how do i trick
> apt-get to install it correctly.  but i digress... :)
>
> GoDaddy is being very little help (no big surprise there).  Their last
> > message indicated updating values in the php.ini file would let this
work,
> > but, as you pointed out, this isn't an option with the php.ini.  I
looked
> > in the phpinfo data and couldn't find anything that matched "dbase"
> > anywhere; certainly, no section in the output indicated any dBase
settings
> > whatsoever.
>
>
> if you havent done so i would just use the search feature of your browser
> and type in dbase on that page.  you should see something in the configure
> directive; either --enable-dbase or --disable-dbase most likely.
>
> I'm fearing that I'm going to have to find some other way to handle
the
> > extraction of data from DBF files if I can't get this to work.
> >
>
> are you really committed to godaddy at this point ?
>
> -nathan
>

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



Re: [PHP] Need help adding dBase support to PHP

2007-10-12 Thread Jon Westcot
Hi Nathan:

The page you referenced in the PHP documentation is exactly what I saw that 
indicated that the dBase functions needed to be compiled in with the 
--enable-dbase directive.  What I need to know is HOW to do this, even in 
general terms.  GoDaddy is being very little help (no big surprise there).  
Their last message indicated updating values in the php.ini file would let this 
work, but, as you pointed out, this isn't an option with the php.ini.  I looked 
in the phpinfo data and couldn't find anything that matched "dbase" anywhere; 
certainly, no section in the output indicated any dBase settings whatsoever.

I'm fearing that I'm going to have to find some other way to handle the 
extraction of data from DBF files if I can't get this to work.

Thanks again for your help.

Jon



- Original Message - 
From: Nathan Nobbe 
To: Jon Westcot 
Cc: PHP General 
Sent: Thursday, October 11, 2007 6:06 PM
Subject: Re: [PHP] Need help adding dBase support to PHP


On 10/11/07, Jon Westcot <[EMAIL PROTECTED]> wrote:
  Hi again:

  Thanks for the info.  From what I can see, GoDaddy does NOT provide 
access to ssh.  Any other thoughts?  Or is there some way to tell me, in 
general terms, how to configure PHP to allow the dbase functions to be used? 


if  godaddy is recommending that you place values in a .htaccess file they 
probly mean you should upload a .htaccess
file via ftp.  im assuming thats how the give you access to the system (since 
there is no ssh access). 
im a bit unsure of the .htaccess setting, though i recently posted a small 
how-to on using .htaccess files to override
settings in php.ini; this is common in shared hosting environments.
http://gentoo-wiki.com/HOWTO_php.ini_overrides_w/_.htaccess

basically, to have dbase support, php must be compiled w/ --enable-dbase, per 
the documentation.
http://www.php.net/manual/en/rlef.dbase.php

perhaps, it is compiled in and the php.ini settings are preventing you from 
using the functions (though that sounds hard to believe).
you might try tossing a phpinfo script on the box and looking for dbase in the 
output; particularly look for --enable-dbase, or --disable-dbase. 
you should see a dbase section also, if its compiled in.  if it is there we can 
get a better idea of what sort of values could be placed in the
.htaccess file that would influence the behavior of the dbase component on that 
system. 

-nathan





Re: [PHP] Need help adding dBase support to PHP

2007-10-11 Thread Jon Westcot
Hi again:

Thanks for the info.  From what I can see, GoDaddy does NOT provide access 
to ssh.  Any other thoughts?  Or is there some way to tell me, in general 
terms, how to configure PHP to allow the dbase functions to be used?

Jon

- Original Message - 
From: Nathan Nobbe 
To: Jon Westcot 
Cc: PHP General 
Sent: Thursday, October 11, 2007 5:34 PM
Subject: Re: [PHP] Need help adding dBase support to PHP


On 10/11/07, Jon Westcot <[EMAIL PROTECTED]> wrote:
  Hi again, Nathan:

  I'm not certain how to get to a command line.  The server is a shared 
server provided by GoDaddy, if that's any help.  They told me that I needed to 
change something in the .htaccess file, but that didn't sound right at all. 


they may be right.  did they give you some sort of documentation you could 
point us to?
also, to determine if you have command line access, look around and see if they 
provide ssh
access to the machine.  if so i can tell you how to ssh in, even if you have 
windows or mac. 
that will give you a command line prompt on the remote machine.

-nathan





Re: [PHP] Need help adding dBase support to PHP

2007-10-11 Thread Jon Westcot
Hi again, Nathan:

I'm not certain how to get to a command line.  The server is a shared 
server provided by GoDaddy, if that's any help.  They told me that I needed to 
change something in the .htaccess file, but that didn't sound right at all.

Thanks again for your help.

Jon

- Original Message - 
From: Nathan Nobbe 
To: Jon Westcot 
Cc: PHP General 
Sent: Thursday, October 11, 2007 5:08 PM
Subject: Re: [PHP] Need help adding dBase support to PHP


On 10/11/07, Jon Westcot <[EMAIL PROTECTED]> wrote:
  Hi Nathan:

  I have no idea.  Where would I look to find this out?  Will phpinfo() 
give me this?  And, if so, where would I find it?

you might try

uname -a

from the command line; but theres no guarantee it will show the distribution.  
it will show the kernel, and sometime kernels 
are named after the distro since they are often modified by the distribution.

-nathan





Re: [PHP] Need help adding dBase support to PHP

2007-10-11 Thread Jon Westcot
Hi Nathan:

I have no idea.  Where would I look to find this out?  Will phpinfo() give 
me this?  And, if so, where would I find it?

Jon

- Original Message - 
From: Nathan Nobbe 
To: Jon Westcot 
Cc: PHP General 
Sent: Thursday, October 11, 2007 5:00 PM
Subject: Re: [PHP] Need help adding dBase support to PHP


On 10/11/07, Jon Westcot <[EMAIL PROTECTED]> wrote:
  Hi all:

  I'm not versed at all with Linux, and I need some help in configuring PHP 
to allow me to use the dBase-related functions.  From what I read in the help 
files, it seems that I need to recompile PHP with the "--enable-dbase" command, 
but I don't know how to do this. 

  Can someone out there help me out?  All help will be greatly appreciated!

what linux distribution are you using?

-nathan




[PHP] Need help adding dBase support to PHP

2007-10-11 Thread Jon Westcot
Hi all:

I'm not versed at all with Linux, and I need some help in configuring PHP 
to allow me to use the dBase-related functions.  From what I read in the help 
files, it seems that I need to recompile PHP with the "--enable-dbase" command, 
but I don't know how to do this.

Can someone out there help me out?  All help will be greatly appreciated!

    Thanks,

Jon



Re: [PHP] Alternate Colors in Rows

2007-10-03 Thread Jon Anderson

Steve Marquez wrote:

I am attempting to alternate the colors of the container DIV. Anyone know
how to do this? 


I've used variants of this:


   


jon

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



Re: [PHP] Secure Image Storage

2007-10-01 Thread Jon Anderson

Kevin Murphy wrote:

Hello all,

Following up with my success last week with putting downloadable files 
in a directory above the web root and then using a combination of 
fopen and stuff to download the file, I am now trying to do something 
similar with images.


However, what I am trying to do is to put an image file above the web 
root, then use PHP to display that image in the web page, and not 
download it. I have the feeling that this isn't possible (all 
solutions I've seen involve using header() function, which won't work 
since this is midway down the page), but I wanted to make sure. This 
will return the binary source of the file:


print file_get_contents($file_path);

but doesn't display the image. Is there any way to have this (or 
something else) generate the image?


What I get from the text above is that you're trying to actually display 
the image *inside* the HTML, which you can't do. You need to link to the 
"image" (which may be an image fetcher script), for example:




And have a corresponding "image.php" script that does the header and 
binary output.


jon

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



Re: [PHP] Strategy for Secure File Storage

2007-09-24 Thread Jon Anderson

Kevin Murphy wrote:
I'm working on a intranet site that uses an LDAP server to 
authenticate users and then a integrated CMS (kind of like a wiki with 
security features so only certain people can post things or upload 
files) runs the whole thing. (The CMS is custom built with PHP).


I've got a need to make certain files secured so that if someone 
uploads a file they can specify that no one except certain people can 
view the file. I've got all the security features set up, what I need 
to do is come up with the best way of securing those files. Obviously 
the link won't show to those files if the user doesn't have access to 
it, but I'm worried that someone might know the link and be able to 
access the file that they are not supposed be able to see.


This doesn't need to be NSA level security, but I do need to protect 
against some computer savvy users. So, I'm pondering the following 
ideas for hiding those files. Any insight on the best method would be 
appreciated:


1) Write secure files to MySQL as a blob (only secure files would be 
written there)


2) Write secure files to the level below the web root and come up with 
a way of copying the files over to a temporary directory for access, 
then delete the files as soon as they are accessed.


3) Use Unix passwords to protect a folder in the web level and then 
the CMS knows the password and can pass the password for access (so 
that the user doesn't know this password, but the CMS does).


4) Some various forms of link obfuscation, where the CMS goes through 
all the secure files once an hour or so and rewrites the file name 
with a random string.


5) Or  I'm open to suggestions. 



You can easily force all file access to pass through a PHP script -> 
just do this kind of thing:


- Fetch file information from a get variable, like file.php?fileid=12345 
(or even file.php?filename=somefile.bin)
- Check if the user is allowed access to that file (yes: continue, no: 
display an error)


header("Content-Type: " . $file->getContentType());
readfile("/path/to/secure/" . $file->getFileName());

Then just make sure that the "/path/to/secure/" (as in the example 
above) is not readable by web users by some means.


jon

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



Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)

2007-09-12 Thread Jon Anderson

Per Jessen wrote:

Uh, how do know you it's do with the version-number??  Did I miss that
posting?
  


Not necessarily to do with the version number itself - it's that PHP is 
dying before having actually done anything - it never gets to any PHP code.


From the first post - the last line of what I pasted below:

php -v:

PHP 5.2.3 with Suhosin-Patch 0.9.6.2 (cli) (built: Sep 12 2007 08:59:52)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
Segmentation fault (core dumped)


In my experience, the Suhosin patch (while excellent for security) 
caused significant instability in several modules. I ended up having to 
scrap it. (It may not have been the patch - it could easily have been 
several of the PECL modules we were using. Regardless, they didn't 
segfault without the Suhosin patch.)


If possible, you could try building without the patch.



Assuming your machine isn't overclocked and has been tested for hardware 
problems...


If the version of PHP you're using is a binary package, you should 
probably generate a backtrace from the core that was dumped and report 
it as a bug to the provider of that binary. The same goes if it was 
built as a FreeBSD port - they should probably know that their default 
port builds are segfaulting.


I think Stut's advice for troubleshooting is a good path to take as well.

jon

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



Re: [PHP] Premature Ajax-ulation

2007-08-03 Thread Jon Anderson

Stut wrote:
Validation, validation, validation. The big danger with doing anything 
on the client-side is that it's all to easy to fall into blindly 
trusting what the client is giving you, even the smallest assumption 
can create a big hole in your app.


Don't assume events will happen the way you expect them to. Don't 
assume users won't be able to make requests just because your logic 
*should not* allow it.


In short, don't treat it any different to any other web application. 
There is no difference, you still need to do all the validation on 
every request whether it's AJAX or not. 



Beyond data validation, the thing that *really* bothers me about 
AJAX/JSON, etc is functions that can read or even modify data. Until 
recently, AJAX frameworks didn't do much verification on the source of 
the request, so If you happened to be logged to some private/sensitive 
site, a 3rd party site in another tab/window could call your AJAX 
functions and glean whatever data from the responses, or even modify 
data. (e.g. ajax_getUsers(), or ajax_launchAllNukesNowNowNow()!)


I think all the major frameworks added protection against this, but 
home-brewed or out-of-date AJAX/JSON framework users beware!


jon

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



Re: [PHP] UTF-8 support

2007-08-03 Thread Jon Anderson

Naz Gassiep wrote:
The functions trim() and explode() appear to be munging multibyte 
UTF-8 strings. I can't find multibyte safe versions of them in the 
manual, do they exist, or do I have to make my own?


In what way are they munging the strings? I just tried with a bunch of 
UTF-8 characters pasted into a string, and it did exactly what I'd expect.


jon

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



Re: [PHP] Strategy when working with designer(s)?

2007-07-23 Thread Jon Anderson

Steve Finkelstein wrote:
I was curious how do you folks who strictly do development and not 
designing, strategically work with a designer in this fashion? Do you 
have a skeleton you follow or preload some existing templates and then 
code around that? If there's even a book which focuses on such 
concepts, I'd be more than happy to purchase and read it. 


This is just my opinion. I have only ever worked with a limited set of 
professional designers...Your mileage may vary.


Having worked with a designer I very much respect for almost two years 
now, my only real suggestion is to make sure you write very 
standards-compliant xhtml. Lay out your pages so that they flow from top 
to bottom without any formatting whatsoever (think extreme simplicity). 
Output data naturally - tabular data in tables, paragraphs in p tags, 
headings in hN tags, inputs with labels, etc. Conceptually different 
parts can be split into div tags too. (Like Page 
Title, Page data etc.)


It should look something like:

Global Header

* Page 1 link
* Page 2 link
* Page 3 link
* Page 4 link

Page Data



Here's why:
- A good web designer can work absolute magic with CSS - they can turn a 
well written xhtml page into a beautiful page that looks consistent 
across all modern browsers. (I'm lucky enough to work day-to-day with an 
absolute design wizard.)
- It's very accessible - even simple mobile browsers screen readers and 
will have no problems with it.
- If you don't like the work the designer has done, you can hire another 
and plug-in different style sheets.


Depending on the calibre of designer, I think that integration may be a 
bit of a headache in the end though.


jon

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



Re: [PHP] Re: PHP Brain Teasers

2007-07-12 Thread Jon Anderson

Daniel Brown wrote:

   Did you come before or after the chicken egg?


Relevant to the above:

$a = array('Chicken','Egg');
echo "The " . $a[array_rand($a)] . " comes first.";

I appologize if this one's already been done...I've only glanced at a 
few entries in this thread, entertaining though it is. :-)


jon

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



Re: [PHP] how PHP is batter?

2007-07-03 Thread Jon Anderson

Andrei wrote:

I saw there is a free version of Studio, but I think it's for
students... You cannot go build a corporate project with it I think...
  


They're just "designed" for students and hobbyists (i.e. they stipped 
out the cool stuff), but you can use 'em for whatever.



From the faq: http://msdn.microsoft.com/vstudio/express/support/faq/

*4.**Can I use Express Editions for commercial use?*



Yes, there are no licensing restrictions for applications built using 
the Express Editions.




jon

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



Re: [PHP] A Guide to running Apache 2, PHP 4 & PHP 5 on Windows XP

2007-05-17 Thread Jon Anderson

Richard Davey wrote:

Sure, but you're in the minority*, so what do I care? :)

* I just took the Zend PHP IDE research poll, and at the end it gives
you the chance to view the stats of everyone else who took the poll.
Interestingly, 70% of them use Windows XP for development.

I actually use a combination of Vista and OS X, which puts me in the
11% and 19% categories respectively.


I find it funny that the addition of the numbers above would logically 
put me in the 0% category.


My $0.02...I use Linux almost 100% of the time at work, and consider 
myself to be a "linux guy". That said, I disagree with people who 
discard Windows as an option. If you develop in PHP, chances are pretty 
good that more than 85% of the people you're developing for will use 
Windows to view your end result. In my book, that makes a WAMP 
workstation/laptop a pretty good self-contained development environment.


"Argumentum ad populum" doesn't apply in the usage-for-development case. 
It's not asking "If everyone else jumped off a bridge would you jump 
too?" It's asking "If everyone else jumped off a bridge, would you 
design your bridge with a soft fluffy landing spot?"


jon

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



Re: [PHP] Blocking the direct download of a file

2007-05-07 Thread Jon Anderson

Greg Donald wrote:

There will be legitimate requests that will fail since not all
browsers send a referer.


How many browsers out there that support the Java plug-in will not 
support referrers?


Besides, the simple solution to that problem is just check for a 
non-existant referrer. If the browser doesn't support it, then it works 
anyway.


jon

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



Re: [PHP] Blocking the direct download of a file

2007-05-07 Thread Jon Anderson

Greg Donald wrote:

$_SERVER['HTTP_REFERER'] is unreliable.

http://us2.php.net/manual/en/reserved.variables.php#reserved.variables.server 



So?

In the context, I think the only thing that matters is that other people 
don't link to his jar file from other websites.


jon

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



Re: [PHP] Blocking the direct download of a file

2007-05-07 Thread Jon Anderson

pw wrote:

I have a phtml file that contains a reference to
a java archive (jar) file.

I only want the archive used in the context of
a specific html page. I don't want the archive
to be downloaded directly. 


I can think of two easy ways to do this. If you're using Apache, you 
could fiddle with the config a little to deny non-local downloads:


SetEnvIfNoCase Referer "^http://www.myweb.com/"; local_ref=1

   Order Allow, Deny
   Allow From env=local_ref


(Stolen from: http://apache-server.com/tutorials/ATimage-theft.html. 
Have used something similar, but don't want to dig through my own configs.)


Alternately, you can do something like this - similar to your idea, but 
in this case, the download actually happens from the PHP script:


if (strpos($_SERVER['HTTP_REFERER'],'http://www.myweb.com/') === 0) {
   header('Content-Type: application/java-archive');
   readfile('/path/to/real/jarfile.jar');
   exit(0);
}


There are probably lots of other ways to do that kind of thing.

jon

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



[PHP] sorting multi array

2007-04-25 Thread Jon Bennett

hi,

I have the following array, which I need to sort by quantity...

Array
(
   [2408] => Array
   (
   [name] => Havaianas Top Pink Crystal
   [size] => 5 (37/38)
   [quantity] => 4
   )

   [3388] => Array
   (
   [name] => Havaianas Brazil Silver
   [size] => 6/7 (39/40)
   [quantity] => 6
   )

   [2666] => Array
   (
   [name] => Havaianas Brasil Black
   [size] => 8/9 (41/42)
   [quantity] => 1
   )

   [3210] => Array
   (
   [name] => Havaianas Margaridas Yellow
   [size] => 5 (37/38)
   [quantity] => 1
   )

   [2552] => Array
   (
   [name] => Havaianas Flash White
   [size] => 5 (37/38)
   [quantity] => 1
       )
)

I need to keep the indexes if poss.

Many thanks,

jon

--


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

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



Re: [PHP] Keep-Alive problem

2007-03-23 Thread Jon Anderson

Julien Allali wrote:

Then, the second call is blocked until the first call is entirely done.

Now, If I explicitly ask the browser for closing the connection:

all work fine.
I believe the reason for this is specifically because of the connection 
to one apache process. Since apache prefork just uses one 
single-threaded (forked) process to handle each connection, when you 
issue a connection: keep-alive header, that one process is busy handling 
the first request, so the second request just sits and waits for the 
first to complete. If you issue a connection: close header, it works 
simply because your first request hits one apache process (which will be 
busy for some time), and your second request hits an entirely different 
apache process.


For other apache threading models, replace "process" above with 
"thread". Same idea.

To my question is really simple:
  How could I tell to php to notify apache that the response is done so
it will treat the second response hence if the first call is not 
finished?
It's one process (or thread). AFAIK, it can't do that. You're asking one 
thread of execution to understand (automagically) that it has to pause 
execution, handle the next request, then resume the first.


Using "connection: close" does almost exactly what you need, with the 
unfortunate side effect of having to re-establish a connection...Why not 
just stick with that? Alternately, you might be able to spawn off 
another command-line PHP process by calling system() or similar.
 *I think there is no php functions/way to do so, so isn't it a bug? 
(missing important
feature). 

IMO, it's expected behavior.

jon

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



Re: [PHP] Re: CONTENT-type for sending HTML attachments

2007-03-20 Thread Jon Anderson

Angelo Zanetti wrote:
So if the HTML files are attachments and the text is just plain text 
then will the content-type of the message be text/plain and then each 
attachment be multipart/alternative. Please note that the HTML files 
need to be sent as attachments and not part of the body.


On my email client I was receiving the emails correctly (IE: message 
body and HTML files as attachments) but on my client's email client 
they were just receiving blank messages.


I'm just a little confused about the content types as you might have 
gathered. 


You're trying to do this, right?

MIME Email
-> Part 1: Text Message (The message that you want displayed)
-> Part 2: HTML Attachment
-> Part 3: HTML Attachment
-> ...
-> Part N: HTML Attachment

Because it's a mime email, your text part will be a mime part (an 
attachment) as well, but basically any mail reader these days will 
render that as the main part.


You want your main email ("MIME Email" above) to have a 
multipart/alternative content type. Your text part ("Part 1" above) 
should be text/plain. Each HTML part ("Part 2" to "Part N" above) could 
be text/html. If you want to force those HTML parts as attachments you 
could use application/octet-stream for the content type - mail readers 
should treat them as binary. Whatever mime class you're using should 
hopefully take care of any encoding that may or may not be necessary.


jon

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



[PHP] APC errors - realpath failed to canonicalize

2007-03-16 Thread Jon Drukman
I've been trying to smoke out some problems with APC under high load. 
We're using PHP 4.4.6 and APC 3.0.13.  We are finding loads of this in 
our error log:


realpath failed to canonicalize PEAR.php - bailing

I know APC prefers you to use absolute paths but lots of PEAR modules 
just do require_once('PEAR.php')


Why does this realpath error occur?  Why is realpath being used? 
According to the manpage, it says "Do not use this function."


-jsd-

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



Re: [PHP] Back to security

2007-03-13 Thread Jon Anderson

jekillen wrote:

For what it is worth, I am only aware of one drawback to https with
respect to how requests are handled that makes it difficult to use
with virtual hosting. I am a little hazy  on how it works but when
https is used only the ip address of the request is available to the
server before the rest of the request is decrypted.
I might be able to shed a little more light on that point...It's pretty 
simple actually...


The client establishes an SSL connection with the server. That involves 
verifying the identity of the server (via a signed certificate). This is 
all done prior to the client sending the HTTP Host header. So you have a 
chicken and egg problem:


You want to tell the server what virtual host you want via a header, but 
that requires a connection first. However, the server needs to tell you 
who it is before you can even connect.


End result? Only one domain per vhost. :-)

jon

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



Re: [PHP] different and logic between PHP4 and PHP5

2007-03-13 Thread Jon Anderson

Vieri wrote:

I didn't code this. We have inherited some code that
worked this way in php4:
if string1 and string2 exist then return true or 1
else return false or 0
in php5 it just doesn't behave the same way.
  
Rather than echo, try var_dump. You'll find that it's returning a 
boolean, which is what you want according to the above paragraph?


jon

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



Re: [PHP] Launch a seperate process

2007-03-06 Thread Jon Anderson

fedt wrote:
pcntl_ fork() and pcntl_ wait(), yo 
If you're using PHP as an apache DSO, you may find that those functions 
aren't available. If you don't have the pcntl_* functions available, 
there a less attractive options...I've done a request with curl with a 
short timeout to "spawn" the second request from PHP. You could likely 
also do it with JavaScript/AJAX. There are probably lots of other ways, 
in fact there may have been a discussion here some time ago about it 
though I don't remember the outcome.


jon

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



Re: [PHP] operational musings

2007-02-27 Thread Jon Anderson
Without any more than a few minutes worth of work, you can make MySQL do 
that with replication. Your in-store system could act as a slave to for 
the central system databases (any central updates trickle down to the 
slave automatically) and your in-store machine could be the master for 
the store_xyz database(s).


Network disconnect? No problem!
Network reconnect? Easy!
In-store machine failure? No problem! Just update the tables from the 
central master!

Work? Almost none!

And since this is a PHP list...



Jay Blanchard wrote:

Howdy cats and kittens!

I had an interesting thought after watching a demo of a POS system and
wondered if the same type of methodology could be applied in a PHP
application. I haven't thought this all the way through, but a
fully-hatched idea like this could signal a major change in applications
designed with PHP.

In the POS if the network connectivity was lost the store could continue
to operate, once the network connectivity was restored the data from
each store would sync back up and data would be sent to the central
server, yadda, yadda, yadda. Of course this is in a client/server
application with an executable residing on each workstation.

So, if you wanted to do this with PHP you would likely have to have a
local web /database server (each store), establish a socket (primary and
store servers?) to watch for an outage/restore and then write the code
to support the sync up. Can it be done with PHP? It would definitely be
worth the trouble given the frequency that connections to stores get
lost.

Thanks in advance for ideas, thoughts, etc.

  


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



Re: [PHP] can this be fone with PHP?

2007-02-22 Thread Jon Anderson
Bruce Gilbert wrote:
> I have created forms with PHP where the information in the fields is
> sent via sendmail to an email, but is there a way to have the
> information extracted and a pdf form created when the user hits the
> submit button?
>
Yep, probably. See http://www.php.net/manual/en/ref.pdf.php

jon

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



Re: [PHP] php and .net webservice

2007-02-21 Thread Jon Anderson

Arno Coetzee wrote:
I have a php client that needs to interact with a .net web service. 
The method I call returns a strongly typed dataset (some or other .net 
object). I cannot seem to get my php client to understand what this 
dataset is. I can see the information with a tcpdump, but for the life 
of me I can’t get php to display the results returned. 
Assuming you're using PHP's built-in SOAP handling stuff, it should work 
fine. Just var_dump or print_r the returned object to see what you get.


.NET SOAP likes to do some inconsistent/odd things. By default, I 
believe it wraps one message in an additional object/array layer for no 
apparent reason, but doesn't for messages traveling in the other 
direction, at least that has been the case in my very limited experience 
with dotnet/php SOAP interaction. (Dumping the resulting messages should 
provide you with the odd object structure.)


jon

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



Re: [PHP] PDO database drivers

2007-02-20 Thread Jon Anderson

Sandy Keathley wrote:
I upgraded PHP 5.2 => 5.2.1 and added PDO support.  It installed 
the SQLLITE driver by default.  I wanted to add the MYSQL driver.

I ran pecl install PDO_MYSQL and it failed with an autoconf error.
  
It probably depends on how you're installing PHP. If you're using a 
distribution's built-in PHP support, there should be a PDO/mysql package 
or in Gentoo's case pdo and mysql use flags. If you're compiling from 
source, just add --with-pdo-mysql to your ./configure line.
I then downloaded the driver from pecl and unpacked it, but there 
were no instructions on installing it, and there is no configure script.

Why use pecl? It's built-in to PHP.

jon

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



  1   2   3   4   5   6   7   8   9   10   >