Re: [PHP] Friday's Question

2013-09-20 Thread Sean Greenslade
On Fri, Sep 20, 2013 at 12:51:49PM -0400, Tedd Sperling wrote:
> Hi gang:
> 
> Do you use a Mousepad?

College Student (Electrical Engineer, go figure).
Age: 20
Mousepad: yes

I've used both optical and laser mice (they're a bit different, but
similar tech) and I've found that I like having the pad because it
sets the "DPI" of the mouse consistently. My favorite mousepad is this
cheap as hell thin rubber and cloth one that I got from dealextreme.com
many years ago. Go figure...

--Sean

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



Re: [PHP] [SOLVED] need some regex help to strip out // comments but not http:// urls

2013-05-29 Thread Sean Greenslade
On Wed, May 29, 2013 at 4:26 PM, Daevid Vincent  wrote:
>
>
>> -Original Message-----
>> From: Sean Greenslade [mailto:zootboys...@gmail.com]
>> Sent: Wednesday, May 29, 2013 10:28 AM
>>
>> Also, (I haven't tested it, but) I don't think that example you gave
>> would work. Without any sort of quoting around the "http://";
>> , I would assume the JS interpreter would take that double slash as a
>> comment starter. Do tell me if I'm wrong, though.
>
> You're wrong Sean. :-p

Glad to hear it. I knew I shouldn't have opened my mouth. =P
(In all seriousness, I realize that I mis-read that code earlier. I
think I was still reeling from the suggestion of doing arbitrary
string replacements in files.)

>
> This regex works in all cases listed in my example target string.
>
> \s*(?
> Or in my actual compress() method:
>
> $sBlob = preg_replace("@\s*(?
> Target test case with intentional traps:
>
> // another comment here
> http://foo.com";>
> function bookmarksite(title,url){
> if (window.sidebar) // firefox
> window.sidebar.addPanel(title, url, "");
> else if(window.opera && window.print){ // opera
> var elem = document.createElement('a');
> elem.setAttribute('href',url);
> elem.setAttribute('title',title);
> elem.setAttribute('rel','sidebar');
> elem.click();
> }
> else if(document.all)// ie
> window.external.AddFavorite(url, title);
> }
>

And if that's the only case you're concerned about, I suppose that
regex will do just fine. Just always keep an eye out for double
slashes elsewhere. My concern would be something within a quoted
string. If that happens, no regex will save you. As I mentioned
before, regexes aren't smart enough to understand whether they're
inside or outside matching quotes. Thus, a line like this may get
eaten by your regex:
document.getElementById("textField").innerHTML = "Lol slashes // are // fun";

The JS parser sees that the double slashes are inside a string, but
your regex won't. Just something to be aware of, especially because
it's something that might not show up right away.

-- 
--Zootboy

Sent from some sort of computing device.

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



Re: [PHP] Re: need some regex help to strip out // comments but not http:// urls

2013-05-29 Thread Sean Greenslade
On Wed, May 29, 2013 at 1:33 PM, Matijn Woudt  wrote:
>
>
>
> On Wed, May 29, 2013 at 7:27 PM, Sean Greenslade 
> wrote:
>>
>> > It is possible to write a whole parser as a single regex, being it
>> > terribly
>> > long and complex.
>> > That said, there's no other simple syntax that would work, for example
>> > in
>> > javascript you could to the following:
>> > var http = 5;
>> > switch(value) {
>> > case http:// Http case here! (this whould not be deleted)
>> > // Do something
>> > }
>> > But most likely you wouldn't care about that..
>> >

> I think it should be possible, but as I said, very very complex. Let's not
> try it;)
>>
>>
>> Also, (I haven't tested it, but) I don't think that example you gave
>> would work. Without any sort of quoting around the "http://";
>> , I would assume the JS interpreter would take that double slash as a
>> comment starter. Do tell me if I'm wrong, though.
>>
> Which is exactly what I meant. Because http is a var set to 5, it is a valid
> case statement, it would be equal to:
> switch(value) {
> case 5: // Http case here! (this whould not be deleted)
> // Do something
> }
>
> But any regex given above would treat the first one as a http url, and won't
> strip the // and everything after it, though in this modified case it will
> strip the comments.
>
> - Matijn

Sorry, I slightly mis-interpreted what that code was intending to do.
Regardless, it is still something that should be done by an
interpreter. So this is another edge case where regexes would more
than likely break down but an interpreter should (I do say should) do
The Right Thing.

-- 
--Zootboy

Sent from some sort of computing device.

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



Re: [PHP] Re: need some regex help to strip out // comments but not http:// urls

2013-05-29 Thread Sean Greenslade
> It is possible to write a whole parser as a single regex, being it terribly
> long and complex.
> That said, there's no other simple syntax that would work, for example in
> javascript you could to the following:
> var http = 5;
> switch(value) {
> case http:// Http case here! (this whould not be deleted)
> // Do something
> }
> But most likely you wouldn't care about that..
>
> - Matijn

I would have to disagree. There are things that regex just can't at a
fundamental level grok. Things like nested brackets (e.g. the standard
blocking syntax of C, javascript, php, etc.). It's not a parser, and
despite all the little lookahead/behind tricks that enhanced regex can
do, it can't at a fundamental level _interret_ the text it sees. This
task involves interpreting what the text you're looking for actually
means, and should therefore be handled by something that can
interpret.

Also, (I haven't tested it, but) I don't think that example you gave
would work. Without any sort of quoting around the "http://";
, I would assume the JS interpreter would take that double slash as a
comment starter. Do tell me if I'm wrong, though.

-- 
--Zootboy

Sent from some sort of computing device.

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



Re: [PHP] Re: need some regex help to strip out // comments but not http:// urls

2013-05-29 Thread Sean Greenslade
On Wed, May 29, 2013 at 9:57 AM, Jonesy  wrote:
> On Tue, 28 May 2013 14:17:06 -0700, Daevid Vincent wrote:
>> I'm adding some minification to our cache.class.php and am running into an
>> edge case that is causing me grief.
>>
>> I want to remove all comments of the // variety, HOWEVER I don't want to
>> remove URLs...
>
> KISS.
>
> To make it simple, straight-forward, and understandable next year when I
> have to re-read what I've written:
>
> I'd change all "://" to "QqQ"  -- or any unlikely text string.
>
> Then I'd do whatever needs to be done to the "//" occurances.
>
> Finally, I'd change all "QqQ" back to "://".
>
> Jonesy

Wow. This is just a spectacularly bad suggestion.

First off, this task is probably a bit beyond the capabilities of a
regex. Yes, you may be able to come up with something that works 99%
of the time, but this is really a job for a parser of some sort. I'm
sorry I don't have any suggestions on exactly where to go with that,
however I'm sure Google can be of assistance. The main problem is that
regex doesn't understand context. It just blindly finds patterns. A
parser understands context, and can figure out which //'s are comments
and which are something else. As a bonus, it can probably understand
other forms of comments like /* */, which regex would completely die
on.

Blindly replacing a string with "any unlikely text string" is just
bad. I don't care how unlikely your text string is, it _will_
eventually show up in a page. It may take 5 years, but it'll happen.
And when it does, this little hack will blow up spectacularly.

I'm sorry to rain on your parade, but this is not KISS. This may seem
simple, but the submarine bugs it introduces will be a nightmare to
track down, and then you'll be in the same boat that you are in right
now. Don't do that to yourself. Do it right the first time.


-- 
--Zootboy

Sent from some sort of computing device.

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



Re: [PHP] Finding an Address

2013-02-28 Thread Sean Greenslade
On Thu, Feb 28, 2013 at 3:18 PM, Serge Fonville wrote:

> well, not exactly.
> But I can help you (so can others) to go through code flow (it will
> probably be tedious)
>
> you have a position you start and a certain distance from that point (in a
> circle)
> From thereon you substract start(x,y) from dest(x,y) by substracting x from
> x and y from y the diffence is the amount of degrees between the two points
> are apart, if you add instead you determine a point.
>
> so for example you are currently at long: 75, lat: 31 and you want to know
> some point 6.9 miles away.
> you start by adding 0 to 75 and 0.1 to 31 you then have one point (both are
> degrees and one degree is roughly 69 miles) you can also do the opposite,
> add 0.1 to 75 and 0 to 31, you can also add 0.05 to both (again totaling
> 0.1), mind though the values that total 0.1 are absolute, even though the
> long/lat may be negative.
>
> The point is that the values added are combined the distance you want to
> measure against.
> From thereon you can determine if there is an address at the location
> (using reverse geo-coding).
> when increasing the number you add, you measure further and further
> you'll have to do that all arround the point you started from
>
> more information about how long/lat works:
> http://www.nationalatlas.gov/articles/mapping/a_latlong.html
>
> HTH
>
> Kind regards/met vriendelijke groet,
>
> Serge Fonville
>
> http://www.sergefonville.nl
>
> Convince Microsoft!
> They need to add TRUNCATE PARTITION in SQL Server
>
> https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table
>
> 
>

You should be careful of statements like "one degree is roughly 69 miles."
While this is true for latitude, it is only true for longitude at the
equator. To get the distance between two sets of latlon coordinates, you
need to use the great circle equation:

http://www.movable-type.co.uk/scripts/latlong.html


-- 
--Zootboy

Sent from some sort of computing device.


Re: [PHP] fopen and load balancing

2013-02-11 Thread Sean Greenslade
On Mon, Feb 11, 2013 at 10:11 AM, Adam Tong  wrote:
> On Mon, Feb 11, 2013 at 4:26 AM, ma...@behnke.biz 
> wrote:
> >
> >
> > Adam Tong  hat am 10. Februar 2013 um 23:41
> > geschrieben:
> >> Hi,
> >>
> >> We had an issue with the code of a junior php developer that used
> >> fopen to load images using the url of the companies website that is
> >> load balanced.
> >>
> >> We could not the detect the problem in dev and test because the dev
> >> and test servers are not load balanced.
> >>
> >> I know that he could load the images using just the filesystem, but I
> >> am curious to know why it failed and if the load balancer is really
> >> the source of the problem or it is a limitation on the function
> >> itself.
> >
> > Do you have any error messages for us?
> > If the load balancer accessable from the internal servers? Normally it
> > is not.

>
> I think this is what happened. As the application was trying to open
> our url domain the request was sent to the load balancer, and as it
> does not accept internal requests, the connection was timed out.
>
> The only way we could avoid that is to not use fopen our url, is that
> right?
>
>

Yeah, sure. That's as good of a guess as any of us will be able to
conjure up. Since you've given us no details, no code and no error
messages, we're basically relegated to blind guessing. I don't think
that's what you want, so if you still have a question, I suggest you
start by investigating the relevant logs. If you can't figure out the
issue from there, post _relevant_ snippets to the list.

Also remember that this is the PHP mailing list. (Even though we tend
to masquerade as the MySQL list from time to time) If it's an issue
with your very likely non-PHP load balancer, we can't really help you
out.

--Sean Greenslade

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



Re: [PHP] how to calculate how much data does each ip address use ?

2013-02-06 Thread Sean Greenslade
On Wed, Feb 6, 2013 at 11:15 AM, Aaron Holmes  wrote:
> No one has mentioned Cacti yet? It does exactly what Bulent is looking for.
>
> http://cacti.net/
>
>
> On 2/5/13 6:46 PM, Sean Greenslade wrote:
>>
>> On Tue, Feb 5, 2013 at 10:13 AM, Bulent  Malik 
>> wrote:
>>>
>>>
>>>>> This task is not really suited for php. I would suggest looking into
>>>
>>> Ntop.
>>>>>
>>>>> It does exactly what you described.
>>>>>>
>>>>>> Hello
>>>>>>
>>>>>> I have  a freebsdbox firewall . also I have some internet customers.
>>>>>> I want to save how much data they used in a table ( such as mysql
>>>>>> table ) for each ip address.
>>>>>> Apache2, php5 and mysql5.5 work on the box.
>>>>>>
>>>>>> How can I do it ?  any script or tool.
>>>>>>
>>>>>> Thanks
>>>>
>>>> How can i save in table using ntop ?  is there any document ?
>>>>
>>>>
>>>> --
>>>> PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
>>>> http://www.php.net/unsub.php
>>>>
>>>> Read the man pages. There are sql export options that you can specify on
>>>> run.
>>>
>>> I could not see any sql options on  the man file of ntop.
>>> Where is it?
>>>
>>>
>>>
>> Whoops, my mistake. I was reading the NetFlow documentation and going
>> off vague memories of older versions of Ntop.
>>
>> Ntop saves data in RRD files. There are PHP libraries to parse this
>> data [1]. You could theoretically scrape the RRDs and put them in a
>> SQL DB, but they may be useful enough on their own if you can parse
>> them correctly. (Note: I have never personally parsed RRDs manually.
>> This info was pulled from a simple Google search. YMMV.)
>>
>> [1]
>> http://www.ioncannon.net/system-administration/59/php-rrdtool-tutorial/
>>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

Neat, I'd never heard of that package before.

-- 
--Zootboy

Sent from some sort of computing device.

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



Re: [PHP] how to calculate how much data does each ip address use ?

2013-02-05 Thread Sean Greenslade
On Tue, Feb 5, 2013 at 10:13 AM, Bulent  Malik  wrote:
>
>
>> >This task is not really suited for php. I would suggest looking into
> Ntop.
>> >It does exactly what you described.
>>
>> >> Hello
>> >>
>> >> I have  a freebsdbox firewall . also I have some internet customers.
>> >> I want to save how much data they used in a table ( such as mysql
>> >>table ) for each ip address.
>> >>Apache2, php5 and mysql5.5 work on the box.
>> >>
>> >> How can I do it ?  any script or tool.
>> >>
>> >> Thanks
>>
>> How can i save in table using ntop ?  is there any document ?
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
>> http://www.php.net/unsub.php
>>
>
>>Read the man pages. There are sql export options that you can specify on run.
>
> I could not see any sql options on  the man file of ntop.
> Where is it?
>
>
>

Whoops, my mistake. I was reading the NetFlow documentation and going
off vague memories of older versions of Ntop.

Ntop saves data in RRD files. There are PHP libraries to parse this
data [1]. You could theoretically scrape the RRDs and put them in a
SQL DB, but they may be useful enough on their own if you can parse
them correctly. (Note: I have never personally parsed RRDs manually.
This info was pulled from a simple Google search. YMMV.)

[1] http://www.ioncannon.net/system-administration/59/php-rrdtool-tutorial/

-- 
--Zootboy

Sent from some sort of computing device.

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



RE: [PHP] how to calculate how much data does each ip address use ?

2013-02-01 Thread Sean Greenslade
On Feb 1, 2013 10:25 AM, "Bulent Malik"  wrote:
>
>
>
> >This task is not really suited for php. I would suggest looking into
Ntop.
> >It does exactly what you described.
>
> >> Hello
> >>
> >> I have  a freebsdbox firewall . also I have some internet customers.
> >> I want to save how much data they used in a table ( such as mysql
> >> table ) for each ip address.
> >>Apache2, php5 and mysql5.5 work on the box.
> >>
> >> How can I do it ?  any script or tool.
> >>
> >> Thanks
>
> How can i save in table using ntop ?  is there any document ?
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

Read the man pages. There are sql export options that you can specify on
run.


Re: [PHP] how to calculate how much data does each ip address use ?

2013-02-01 Thread Sean Greenslade
This task is not really suited for php. I would suggest looking into Ntop.
It does exactly what you described.
On Feb 1, 2013 9:40 AM, "Bulent Malik"  wrote:

> Hello
>
> I have  a freebsdbox firewall . also I have some internet customers.  I
> want
> to save how much data they used in a table ( such as mysql table ) for each
> ip address.
> Apache2, php5 and mysql5.5 work on the box.
>
> How can I do it ?  any script or tool.
>
> Thanks
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] free space

2012-01-31 Thread Sean Greenslade
On Tue, Jan 31, 2012 at 1:59 PM, saeed ahmed wrote:

> is there any free server where one can practice php(myadmin) - sql without
> installing on personal computer?
>

Not that I know of. There may be some, but I wouldn't bother. You can find
Virtualbox server images pre-made from sites such as this:

http://virtualboxes.org/images/ubuntu/

#5 has apache, mysql and php installed (a LAMP package). You can use
Virtualbox to run the server virtually, without having to install
everything on your dev computer. Similar packages for Xen and VMWare are
available, just go googling.

-- 
--Zootboy

Sent from my PC.


Re: [PHP] Friday Distraction

2011-10-23 Thread Sean Greenslade
On Sun, Oct 23, 2011 at 9:43 PM, tamouse mailing lists <
tamouse.li...@gmail.com> wrote:

> On Fri, Oct 21, 2011 at 4:27 PM, Christopher Lee 
> wrote:
> > This message is for the designated recipient only and may contain
> privileged, proprietary, or otherwise private information. If you have
> received it in error, please notify the sender immediately and delete the
> original. Any other use of the email by you is prohibited.
>
> Just wondering, who was the designated recipient here? What can I use
> of this? I'm wondering what's privileged and proprietary and private
> about a 3 line response to a world-wide mailing list?
>
>
I'm always amused that people think that they can somehow enter an email
recipient into a binding contract with a footer. Unless you hacked something
to get that email, you don't *have *to do anything with it.

-- 
--Zootboy

Sent from my PC.


Re: [PHP] Re: files outside of documentRoot

2011-10-09 Thread Sean Greenslade
On Sun, Oct 9, 2011 at 9:52 AM, Ricardo Martinez wrote:

> The files are, png, pdf and flv.
>
> Only users login can see or download it.
>
> thx ;>
>
> On Sat, Oct 8, 2011 at 11:16 PM, Shawn McKenzie  >wrote:
>
> > On 10/08/2011 03:40 PM, Ricardo Martinez wrote:
> > > Hi List!
> > >
> > > I need to access files outside the DocumentRoot.
> > >
> > > I've been looking for info and documentation, and I've read that it can
> > be
> > > done using symbolic links and another way is by using headers.
> > >
> > > I want to know, what do you think, what is the best way, and if anyone
> > knows
> > > a good doc about of it.
> > >
> > > Thanks!!!
> > >
> >
> > It depends on what you mean by "files".  Are they PHP files that need to
> > be run, or images, or files that need to be downloaded by the user?
> >
> > For PHP, you would add the external dir to your include path.
> >
> > For images you can use a php file as the img src and that file sets the
> > appropriate headers and uses readfile() to get and echo the image data:
> > getimage.php?image=someimage.gif
> >
> > For download files you would do it in the same manner as for images:
> > download.php?file=somefile.zip
> >
> >
> > --
> > Thanks!
> > -Shawn
> > http://www.spidean.com
> >
>
> --
> Ricardo
> ___
> IT Architect
> website: http://www.pulsarinara.com
>


Sounds like the downloader php script would be perfect (what Shawn
suggested). Have the script check the login status, then (if valid) send the
proper headers for the file and read out the data with the script.

-- 
--Zootboy

Sent from my PC.


Re: [PHP] PHP Download Of Application Question?

2011-10-08 Thread Sean Greenslade
On Sat, Oct 8, 2011 at 6:53 PM, Thomas Dineen  wrote:

> Gentle People:
>
>I am looking for a way to download a C based application binary, from
> an Apache / PHP server, via a client side Web Browser, and execute it
> seamlessly on the client side PC without storing it permanently on the
> client side
> hard disk drive. Temporary storage would be ok.
>
>I know this can be done because I have observed it operation in various
> applications. This concept allows a authorized customer to have the use of
> an application via the web without being able to keep or share the
> application
> binary.
>
>I am open to other approaches beyond Apache and PHP.
>
>So any ideas out there?
>
> Thanks for the help
> Thomas Dineen
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Well, you seem to want to enter the world of DRM. That's an odd subject for
a PHP list, but here goes.

PHP is a server-side language. In fact, for your circumstances, PHP would be
of little use. All you need is a web server to serve the file.

Unfortunately, there is no real way for a webserver to tell a client how to
handle the file it sends. All it does is pipe data over the wire. What you
want would have to be a function of the browser/downloader and AFAIK, no
browsers support anything like that.

Plus, if you're sending someone an EXE file, there's very little you can do
to stop them from keeping a copy of it. You would have to implement some
sort of authorization system within the C code to only allow access to the
users you want (or whatever other arbitrary restrictions you wish to
impose).

This question would be much better suited for a C mailing list. Again, PHP
== server side. It has NO control over anything client-side.

-- 
--Zootboy

Sent from my PC.


Re: [PHP] Attached without Attachment

2011-09-30 Thread Sean Greenslade
On Wed, Sep 28, 2011 at 12:15 PM, Gustavo - Emar Plásticos <
supo...@emar.com.br> wrote:

> Hi all, i made a code in PHP to save in a directory the XML attachments !
> All goes well until it comes across an email that has attachment but can
> not save !
>
> analyzing the source code of this email, i realized it has no line:
>
> Content-Disposition: attachment; filename="name of the file.xml"
>
> but only this line:
>
> Content-Type: application/octet-stream; name=name of file.xml
> Content-Transfer-Encoding: base64
>
> I´m using IMAP and the account is from Google: $host = "{
> imap.gmail.com:993/imap/ssl}**INBOX
> ";
>
> What happend ?
> Thanks any help
>
> Gustave
>

My suspicion is that the email contained no actual text body, so google
converted the entire email message into the attachment (in octet-stream
format).

Unfortunately, email is only somewhat standardized. You'll have to make your
programs deal with these sort of oddities, as they'll be inevitable.

-- 
--Zootboy

Sent from my PC.


Re: [PHP] PHP cron job optimization

2011-09-10 Thread Sean Greenslade
On Sat, Sep 10, 2011 at 4:35 AM, muad shibani wrote:

> I want to design an application that reads news from RSS sources.
> I have about 1000 RSS feed to collect from.
>
> I also will use Cron jobs every 15 minutes to collect the data.
> the question is: Is there a clever way to collect all those feed items
> without exhausting the server
> any Ideas
> Thank you in advance
>

Do them one at a time. Fetching web pages isn't a particularly taxing job
for any decent server.

My advice is just to try it. Even if you solution isn't 'elegant' or
'clever,' if it works and doesn't bog down the server, that's a win in my
book.

-- 
--Zootboy

Sent from my PC.


Re: [PHP] How to have a smooth hairless skin

2011-09-03 Thread Sean Greenslade
On Sat, Sep 3, 2011 at 8:44 PM, Ashley Sheridan 
wrote:

>
>
> How to have a smooth hairless skin  wrote:
>
> >How to have a smooth hairless skin.
> >   Hairless in the bikini zone.
> >Click  here:
> >
> >
>
>
>
> How does one go about compiling that module from source then? It's amazing
> what php can do these days!
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> --
>

I think it's just a make flag. --with-hair-removal or something.


-- 
--Zootboy

Sent from my PC.


Re: [PHP] Re: Login with Remember me Feature

2011-08-07 Thread Sean Greenslade
On Sun, Aug 7, 2011 at 3:11 PM, Richard Riley wrote:

> Andre Polykanine  writes:
>
> > Hello alekto,
> >
> > I've got several notes to point out:
> > 1. You can't do neither a header(), nor a SetCookie() after any echo
> > on the page. The out-of-php pieces of the page included.
>
> Not true.
>
> See ob_start and family.
>
> Yes, but it is better form to make sure there is no output before your
header or setcookie commands. This makes your code more portable. Your code
will need some restructuring, though.

I did notice some other issues in your code, however. You delete the cookies
in the beginning if they are set. This is probably what was killing your
remember me function.

But on a much more serious note, this script is full of security holes.
Unhashed passwords in the DB and cookies is just asking for trouble. Plus,
if you're using sessions, you should just use the session cookie to remember
a login. It's safer than storing a password in a cookie.
-- 
--Zootboy

Sent from my PC.


Re: [PHP] Updating to 5.3.6

2011-06-22 Thread Sean Greenslade
All I can suggest is either compile from source or find a different mac
binary. I don't often deal with macs, much less try to use them as servers,
so that's the best I can offer. Good luck.
On Jun 20, 2011 1:53 PM, "Bruno Coelho"  wrote:


Re: [PHP] Updating to 5.3.6

2011-06-20 Thread Sean Greenslade
How did you install it? Why can't you just uninstall it and reinstall with
the new version?
On Jun 20, 2011 12:52 PM, "Bruno Coelho"  wrote:
>
> I realize this is a basic matter, but I've installed PHP 5.3.1 with XAMPP
for Mac OS.
> How can I update my PHP version now?
>
>
> Thanks.
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


Re: RE: [PHP] phpsadness - P.C. shmee seee.

2011-06-04 Thread Sean Greenslade
Well said. I agree completely with your distaste for extreme political
correctness. Like I always say, "it's not a stereotype if it's true."
 On Jun 3, 2011 4:53 PM, "Daevid Vincent"  wrote:
>> >> Reminds me (obliquely) of an entry in the index for "The C Programming
>> >> Language" for recursion, which points right back to that index page. I
>> >> about doubled over when I first discovered it.
>> >
>> > That's hilarious. I love subtle humor like that.
>
> This whole thread seems to echo the original subject recursively too...
;-)
>
> How sad this topic has devolved from what was IMHO a fairly honest page
someone created (with valid grievances) to one of religion and name calling.

>
> I tried to avoid commenting at all but I do have to agree with Tedd here:
>
>> Instead, I think you saw an opportunity to be "politically correct"
>> and rise to the occasion in righteous indignation.
>
> I personally think Politically Correctness is a load of $h!t and causes
more harm and trouble than it's worth. I'm so sick of it being dictated to
me everywhere from media to schools to work to now even a programming
language list. People need thicker skins. If you are so easily offended,
then block that person's email from your mailbox. It's called the 1st
Amendment. I may not agree with, or even like the things you say, but I'll
defend to the death your right to say it -- whatever it is! I don't agree
with radical Muslims wanting to kill me either, but I'll defend their right
to protest and say whatever they want (as long as it's true!). Same goes for
KKK or any other extremist group.
>
>
http://en.wikipedia.org/wiki/First_Amendment_to_the_United_States_Constitution
>
> Ross Perot said it best, "every time you pass a new law, you give up some
of your freedoms".
> And this P.C. crap is just an un-official "law" that is being imposed on
people.
>
> People aren't "visually impaired", they are "blind". They're not "dwarfs"
or "little people", they're "midgets". A "retard" is "handicapped" and isn't
"mentally challenged". (there, how many people did I just offend?) DEAL WITH
IT. I have a "big nose" and I'm "balding" from Alopecia -- I'm not
"olfactory gifted" or "follicly deficient" either. Didn't your mommas ever
teach you, "sticks and stones will break my bones, but names can never hurt
me"??
>
> And don’t even get me started on "stereotypes" -- because those are based
on true observations too! If you don't like your stereotype, then
collectively as a people, you need to change it. "we" didn’t make up your
stereotype, "you" did! We just noticed it and pointed it out to you --
you're welcome.
>
> ...and watch this:
> http://www.youtube.com/watch?v=iqVhtHapFW4
>
> http://www.youtube.com/watch?v=UnDIvZKs4dA
>
> http://www.metacafe.com/watch/457799/allahu_akbar/
>
>
http://nation.foxnews.com/germany-airport-shooting/2011/03/03/obama-administration-refuses-call-attack-germany-act-terrorism
>
> shoot, I wouldn't be surprised if I just got myself on some government
watch list now that I googled for those videos!
>
> ...let the ~/.procmailrc filters begin!
>
> Here use this:
>
> :0
> * ^FROM.*daevid
> | (echo "From: POSTMASTER@YOUR_NAME_HERE.com"; \
> echo "To: $FROM"; \
> echo "Subject: You have lost your email privileges to me you politically
incorrect P.O.S."; \
> echo "";\
> echo "I have banned you from emailing me and I hope you die painfully.\n"
\
> ) | $SENDMAIL -oi -t
> /dev/null
>
> ...actually, I do have some good ones here:
> http://daevid.com/content/examples/procmail.php
>
> :)
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


Re: [PHP] php causes HTTP 500, but results in blank page in apache

2011-06-04 Thread Sean Greenslade
That's what I was thinking, thanks for  confirming it.
On Jun 3, 2011 3:49 PM, "Tamara Temple"  wrote:
>
> On Jun 2, 2011, at 7:09 PM, Stephon Chen wrote:
>
>> Hello Sean,
>>
>> 1. while I directed connected to these error pages such as 403, 404,
>> and 500.html,
>> they works correctly, showing correct error page
>>
>> 2. but while I use something like header('HTTP/1.1 500') to trigger
>> apache 500
>> the content of 500.html does not show, but blank page only.
>> both header('HTTP/1.1 403') and header('HTTP/1.1 404') shows the
>> correct custom error page.
>>
>> Thanks a lot
>> --
>> stephon
>>
>> On Fri, Jun 3, 2011 at 07:21, Sean Greenslade
>>  wrote:
>> So do you get the contents of that page in the response? What
>> happens when you browse to that page manually?
>>
>> On Jun 1, 2011 2:14 AM, "Stephon Chen"  wrote:
>> > All 403, 404, 500.html are static html pages like:
>> >
>> > 
>> > 500 error happens
>> > 
>> >
>> > On Wed, Jun 1, 2011 at 14:10, Tamara Temple
>>  wrote:
>> >
>> >>
>> >> On May 31, 2011, at 8:14 AM, Stephon Chen wrote:
>> >>
>> >> Hello Sean,
>> >>>
>> >>> Here is my apache config for error handling.
>> >>> 403, 404 works fine, but 500 shows blank page
>> >>>
>> >>> Alias /errorpage/ "/usr/local/www/apache22/errorpage/"
>> >>> 
>> >>> AllowOverride None
>> >>> Options -Indexes FollowSymLinks MultiViews
>> >>> Order allow,deny
>> >>> Allow from all
>> >>> 
>> >>> #
>> >>> ErrorDocument 403 /errorpage/403.html
>> >>> ErrorDocument 404 /errorpage/404.html
>> >>> ErrorDocument 500 /errorpage/500.html
>> >>>
>> >>
>> >> What's in 500.html?
>> >>
>> >>
>>
>
> Stephen,
>
> This doesn't quite work how you're expecting it to.
>
> If you have a php script that emits a 500 server error header, *you*
> have to supply the document contents. Thus:
>
>  header('HTTP/1.1 500 Server Error');
> include('/path/to/error_docs/500.html');
> ?>
>
> Will get you what you want.
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


Re: [PHP] Best authentication system

2011-06-04 Thread Sean Greenslade
IIRC, there is a google code project for a php login system. You might want
to check it out.
On Jun 4, 2011 2:46 PM, "Adam Tong"  wrote:
> Hi,
>
> I'm running a site for which I need an authentication system. I have
> already my own (that is too simplistic and not very secure).
> I want some advice here. I checked PEAR, but as there are several
> options there, I was not sure which one to choose. Here are my needs:
>
> - Some sections of the site cannot be accessed if the user does not
> have an account (at least login and password)
> - There are 2 type of users at this moment, depending on that type,
> the user can access some sections and not the others (the ones allowed
> for the other type). Maybe in the future there will be more types of
> users.
>
> Thank you
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


Re: [PHP] php causes HTTP 500, but results in blank page in apache

2011-06-03 Thread Sean Greenslade
What happens if you create a test page with just the 500 header and some
html content in it? IIRC, apache won't override a php-generated error page.
On Jun 2, 2011 8:09 PM, "Stephon Chen"  wrote:
> Hello Sean,
>
> 1. while I directed connected to these error pages such as 403, 404, and
> 500.html,
> they works correctly, showing correct error page
>
> 2. but while I use something like header('HTTP/1.1 500') to trigger apache
> 500
> the content of 500.html does not show, but blank page only.
> both header('HTTP/1.1 403') and header('HTTP/1.1 404') shows the correct
> custom error page.
>
> Thanks a lot
> --
> stephon
>
> On Fri, Jun 3, 2011 at 07:21, Sean Greenslade 
wrote:
>
>> So do you get the contents of that page in the response? What happens
when
>> you browse to that page manually?
>> On Jun 1, 2011 2:14 AM, "Stephon Chen"  wrote:
>> > All 403, 404, 500.html are static html pages like:
>> >
>> > 
>> > 500 error happens
>> > 
>> >
>> > On Wed, Jun 1, 2011 at 14:10, Tamara Temple 
>> wrote:
>> >
>> >>
>> >> On May 31, 2011, at 8:14 AM, Stephon Chen wrote:
>> >>
>> >> Hello Sean,
>> >>>
>> >>> Here is my apache config for error handling.
>> >>> 403, 404 works fine, but 500 shows blank page
>> >>>
>> >>> Alias /errorpage/ "/usr/local/www/apache22/errorpage/"
>> >>> 
>> >>> AllowOverride None
>> >>> Options -Indexes FollowSymLinks MultiViews
>> >>> Order allow,deny
>> >>> Allow from all
>> >>> 
>> >>> #
>> >>> ErrorDocument 403 /errorpage/403.html
>> >>> ErrorDocument 404 /errorpage/404.html
>> >>> ErrorDocument 500 /errorpage/500.html
>> >>>
>> >>
>> >> What's in 500.html?
>> >>
>> >>
>>


Re: [PHP] Re: smart auto download file

2011-06-02 Thread Sean Greenslade
What about an HTTP header redirect? You can set a delay on that AFAIK.
On Jun 1, 2011 10:52 AM, "Jonesy"  wrote:
> On Tue, 31 May 2011 21:01:09 +0100, Stuart Dallas wrote:
>>
>> Sometimes I miss the way the web was before javascript :/
>
> Sometimes???
>
> Jonesy
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


Re: [PHP] php causes HTTP 500, but results in blank page in apache

2011-06-02 Thread Sean Greenslade
So do you get the contents of that page in the response? What happens when
you browse to that page manually?
On Jun 1, 2011 2:14 AM, "Stephon Chen"  wrote:
> All 403, 404, 500.html are static html pages like:
>
> 
> 500 error happens
> 
>
> On Wed, Jun 1, 2011 at 14:10, Tamara Temple 
wrote:
>
>>
>> On May 31, 2011, at 8:14 AM, Stephon Chen wrote:
>>
>> Hello Sean,
>>>
>>> Here is my apache config for error handling.
>>> 403, 404 works fine, but 500 shows blank page
>>>
>>> Alias /errorpage/ "/usr/local/www/apache22/errorpage/"
>>> 
>>> AllowOverride None
>>> Options -Indexes FollowSymLinks MultiViews
>>> Order allow,deny
>>> Allow from all
>>> 
>>> #
>>> ErrorDocument 403 /errorpage/403.html
>>> ErrorDocument 404 /errorpage/404.html
>>> ErrorDocument 500 /errorpage/500.html
>>>
>>
>> What's in 500.html?
>>
>>


Re: [PHP] php causes HTTP 500, but results in blank page in apache

2011-05-31 Thread Sean Greenslade
Have you checked your apache settings for generating error pages? How is it
configured to handle 500 errors?
On May 30, 2011 4:51 AM, "Stephon Chen"  wrote:
> Hello all,
>
> I use a test script below to generate HTTP 500 status:
>
>  header('HTTP/1.1 500 Internal Server Error');
> ?>
>
> It causes HTTP 500 in apache log, but apache shows blank page instead of
> HTTP 500 error page
> But 403, 404 works correctly.
>
> Why this thing occurs? And is there any soultion?
>
> My platform is FreeBSD 8.2, PHP 5.3.6, and Apache 2.2.18, which running
php
> as php-cgi mode.
>
> Thanks a lot
> --
> stephon


Re: [PHP] mysql problems

2011-05-11 Thread Sean Greenslade
On Wed, May 11, 2011 at 2:25 PM, Curtis Maurand  wrote:

>
>
> Marc Guay wrote:
> >> Does anyone have any ideas?
> >
> > Sounds like it's getting caught in a loop.  Post the whole script
> for
> > best results.
> >
> It looks like the site is
> under attack, because I keep seeing the query, "SELECT catagory_parent FROM
> t_catagories where catagory_ID=" .
> $_currentCat"
>
> where $_currentCat is equal to a
> value not in the database.  The only way that this can happen is if
> the page is called directly without going through the default page.
>
>
> the script follows.  its called leftNav.php
>

[MASSIVE SNIP]

Well, from what I saw while wading through your code, you allow unsanitized
variables to be concatenated to your queries. Big no-no! For ANY
client-generated variable, always sanitize with mysql_real_escape_string. In
fact, sanitize all your variables. It can't hurt.

Also, please don't take a request for your entire code too literally. We
don't like to see pages and pages and pages of code, just the pertinent
bits.
-- 
--Zootboy

Sent from my PC.


Re: [PHP] refreshing pages in the cache

2011-04-27 Thread Sean Greenslade
On Wed, Apr 27, 2011 at 8:50 PM, Jim Giner wrote:

> thanks for the input but your first link is invalid and the second I don't
> understand why you sent me.
> Perhaps you could explain?
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Sure. In order to "tell" the browser to not cache a page, you need to set
the header "Cache-Control: no-cache". This can be done by the PHP command

header("Cache-Control: no-cache");



-- 
--Zootboy

Sent from my PC.


Re: [PHP] Destroying cookies... not working

2011-04-27 Thread Sean Greenslade
On Wed, Apr 27, 2011 at 8:52 PM, Rick Dwyer  wrote:

> The following did the trick... is there any reason I should not use it?
>
> $name="mysession";
> setcookie($name);
>
>  --Rick


Only if you're OCD, since the cookie is still technically there, just empty.
Without setting the expire arg, the browser will keep it until closed.
-- 
--Zootboy

Sent from my PC.


Re: [PHP] refreshing pages in the cache

2011-04-27 Thread Sean Greenslade
On Wed, Apr 27, 2011 at 4:42 PM, Jim Giner wrote:

> I"m trying to make my webpages display random photos on a border.  Got it
> all working now but have a question about the IE cache.  Seems that once
> the
> page has been displayed, no amount of "refresh" will make the page
> "rebuild"
> and thus show 'different' pics the second time around.
>
> Can php do something about a page in the cache?  I know that the cache is
> there to speed up performance and all, but I thought this random image
> thing
> would work if they just hit F5 to see a new array of images.
>
> Can php detect a user-requested 'refresh'?
>
>
>
Though you can't control everything, headers can help.

https://secure.wikimedia.org/wikipedia/en/wiki/List_of_HTTP_header_fields<%20https://secure.wikimedia.org/wikipedia/en/wiki/List_of_HTTP_header_fields>

http://us3.php.net/manual/en/function.header.php

Cache-Control is a nice one. =)

-- 
--Zootboy

Sent from my PC.


Re: [PHP] openssl question

2011-04-18 Thread Sean Greenslade
On Wed, Apr 6, 2011 at 3:41 PM, Kai Renz  wrote:

> Hi,
>
> i try to create a self signed certificate using this code:
> 
> I'm using a windows box with xampp installed.
>
> regards.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
http://us3.php.net/manual/en/function.openssl-csr-new.php

Check out this page, especially the second comment (by user AA). It seems
that "$csr = openssl_csr_new($dn, $privkey);" will generate its own private
key, and $privkey should be set to null initially.

I don't know for sure, though. I've never done this before.

-- 
--Zootboy

Sent from my PC.


Re: [PHP] What's your game? (X-PHP)

2010-04-25 Thread sean greenslade
On Sun, Apr 25, 2010 at 4:13 PM, Jason Pruim wrote:

>
> On Apr 25, 2010, at 9:16 AM, tedd wrote:
>
>  Hi gang:
>>
>> Considering we recently had several people mention what games they play,
>> it might be interesting to see what everyone plays.
>>
>> As for me, I currently play "Modern Warfare 2" on XBOX. It's the most
>> recent in a long line of war games (i.e., Call of Duty, Ghost Recon, etc.).
>>
>> My gamer tag is "special tedd"
>>
>> What's your game?
>>
>
> Personally I've played everything from those little mini facebook app games
> (Farmville, Mafia Wars) to the grand theft auto series on my ps2, but for
> christmas my wife surprised me with a wii... So now on my brand new game
> console I am playing Mario Brother 1 & 3 (Still need to get 2) :P But I'm
> also playing Mario Cart on it, and lego star wars plus a ton of kids games
> that my oldest loves for me to play with him on :)
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Warsow is my game. I love it.

http://www.warsow.net

I play as radonWarrior.



-- 
--Zootboy


Re: [PHP] Mediawiki's url confusion

2009-07-23 Thread sean greenslade
On Thu, Jul 23, 2009 at 10:28 PM, Dengxule  wrote:

> Thanks a lot. As far as i know, both methods dealing with urls are
> WEB-SERVER-TECH. While I was installing mediawiki, i did nothing with the
> file "httpd.conf", no changes made on .
>
> The mediawiki install script cannot do nothing to httpd.conf i think.
>
> So i'm confused about how the url-rewriting mechanism is activited.
>
> Best Wishes~
>
> Deng
> 09/07/24
>
>
> 2009/7/23 Ford, Mike 
>
> > > -Original Message-
> > > From: Paul M Foster [mailto:pa...@quillandmouse.com]
> > > Sent: 23 July 2009 06:13
> > >
> > > On Thu, Jul 23, 2009 at 11:57:51AM +0800, ?? wrote:
> > >
> > > > But I cannot help myself with the url pattern :
> > > > /somepath_to_mediawiki/index.php/pagetitle.
> > > >
> > > > How can this kind of url be parsed to the file "index.php" and the
> > > > "pagetitle" be parsed as params?
> > > >
> > > > Why the web server not go straight into path "index.php/" and look
> > > for the
> > > > file named "pagetitle" ?
> > > >
> > >
> > > This type of thing is common for sites using the "MVC" or
> > > "Model-View-Controller" paradigm. The index.php file is what's
> > > called a
> > > "front controller". A front controller is usually the entrance to
> > > all
> > > the other pages of a site. URLs like this often take advantage of an
> > > Apache feature called "mod_rewrite", which tells Apache how to
> > > handle
> > > URLs which look like this.
> >
> > Or by the "pathinfo" mechanism, which I believe is also supported by
> other
> > Web servers, and can work just as well, if it satisfies your
> requirements,
> > without all the complications of mod_rewrite.
> >
> >
> > Cheers!
> >
> > Mike
> >  --
> > Mike Ford,
> > Electronic Information Developer,Libraries and Learning Innovation,
> > Leeds Metropolitan University, C507, Civic Quarter Campus,
> > Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom
> > Email: m.f...@leedsmet.ac.uk
> > Tel: +44 113 812 4730
> >
> >
> >
> >
> >
> >
> > To view the terms under which this email is distributed, please go to
> > http://disclaimer.leedsmet.ac.uk/email.htm
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>

It could use a .htaccess file. Look in the directory of the index.php file
for a file named .htaccess

-- 
--Zootboy


Re: [PHP] php-general@lists.php.net, Tim-Hinnerk Heuer has invited you to open a Google mail account

2009-05-08 Thread sean greenslade
On Fri, May 8, 2009 at 5:27 PM, Lenin  wrote:
> Yeah gmail is a nice thing :)
>
> The best ever mailing system world has ever seen until now.
>

Agreed.

-- 
--Zootboy

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



Re: [PHP] php-general@lists.php.net, Tim-Hinnerk Heuer has invited you to open a Google mail account

2009-05-08 Thread sean greenslade
On Fri, May 8, 2009 at 12:18 AM, Tim-Hinnerk Heuer  wrote:
> I've been using Gmail and thought you might like to try it out. Here's
> an invitation to create an account.
> if you send me mail on here it will probably be more secure than over
> the rest of the network. just let me know what the new address will be
> in case you change mail providers.
>
> ---
> Tim-Hinnerk Heuer has invited you to open a free Google Mail account.
>
> To accept this invitation and register for your account, visit
> http://mail.google.com/mail/a-f5f2afb0c7-9207f3d89b-bd8bac4aaf494e87
>
> Once you create your account, Tim-Hinnerk Heuer will be notified with
> your new email address so you can stay in touch with Google Mail!
>
> If you haven't already heard about Google Mail, it's a new
> search-based webmail service that offers:
>
> - Over 2,700 megabytes (two gigabytes) of free storage
> - Built-in Google search that instantly finds any message you want
> - Automatic arrangement of messages and related replies into "conversations"
> - Powerful spam protection using innovative Google technology
> - No large, annoying ads--just small text ads and related pages that
> are relevant to the content of your messages
>
> To learn more about Google Mail before registering, visit:
> http://mail.google.com/mail/help/intl/en_GB/benefits.html
>
> We're still working every day to improve Google Mail, so we might ask
> for your comments and suggestions periodically.  We hope you'll like
> Google Mail.  We do.  And, it's only going to get better.
>
> Thanks,
>
> The Google Mail Team
>
> (If clicking the URLs in this message does not work, copy and paste
> them into the address bar of your browser).
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Lol, I don't think the mailing list can sign up for gmail.

-- 
--Zootboy

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



[PHP] Generate unique login token

2009-02-09 Thread sean greenslade
I have a login system that I am coding. I need it to generate a unique token
on login to be stored in the browser's cookie. I currently use a script that
generates a MD5 hash of the current unix timestamp, then checks the mysql
database to see if the token already exists. It loops this generate/check
until it gets a unique token. Is there a better way to do this? I want a
token that cannot be easiy predicted (i.e. not an auto-increment value).
Thanks in advance!
-- 
--Zootboy


FWD: [PHP] Require error

2008-12-19 Thread sean greenslade
On Fri, Dec 19, 2008 at 1:11 PM, Kyle Terry  wrote:

>
>
> On Fri, Dec 19, 2008 at 10:07 AM, sean greenslade 
> wrote:
>
>> On Fri, Dec 19, 2008 at 1:04 PM, Philip Graham 
>> wrote:
>>
>> >
>> > > So, I have this code in a php file called testing.php:
>> > > $incl = '/webs/www.zootboy.com/sl/sql.inc';
>> > >  if(!is_readable($incl)) die('ERROR: MySQL Include file does not
>> > > exist??!?');
>> > >  require $incl or die('MySQL page not found. Unable to continue.');
>> > >
>> > >
>> > > When I run the code in command line, it outputs this:
>> > >
>> > > [r...@localhost ~]# php -f /webs/www.zootboy.com/sl/testing.php
>> > > PHP Warning:  require(1): failed to open stream: No such file or
>> > directory
>> > > in /webs/www.zootboy.com/sl/testing.php on line 13
>> >
>> > Line 13?
>> >
>> > > PHP Fatal error:  require(): Failed opening required '1'
>> > > (include_path='/var/php/inc/') in /webs/
>> www.zootboy.com/sl/testing.phpon
>> > > line 13
>> > >
>> > > I have no idea what's going on. All the files have 777 perms.
>> >
>> > What happens if you remove the die() statement?
>> >
>> >  require $incl;
>> >
>> > --
>> > Philip Graham
>> >
>>
>> Hey! That fixed it. That's strange.
>>
>> --
>> --Zootboy
>>
>
> I totally forgot you have to wrap requires and includes in () if you are
> putting the die statement after it.
>
> (require $incl) or die('message'); //should work just fine for you.
>
>
> --
> Kyle Terry | www.kyleterry.com
>

That worked. Thanks! < Forwarded to php list. Sorry, I forgot to cc it.>

-- 
--Zootboy


Re: [PHP] Require error

2008-12-19 Thread sean greenslade
On Fri, Dec 19, 2008 at 1:04 PM, Philip Graham  wrote:

>
> > So, I have this code in a php file called testing.php:
> > $incl = '/webs/www.zootboy.com/sl/sql.inc';
> >  if(!is_readable($incl)) die('ERROR: MySQL Include file does not
> > exist??!?');
> >  require $incl or die('MySQL page not found. Unable to continue.');
> >
> >
> > When I run the code in command line, it outputs this:
> >
> > [r...@localhost ~]# php -f /webs/www.zootboy.com/sl/testing.php
> > PHP Warning:  require(1): failed to open stream: No such file or
> directory
> > in /webs/www.zootboy.com/sl/testing.php on line 13
>
> Line 13?
>
> > PHP Fatal error:  require(): Failed opening required '1'
> > (include_path='/var/php/inc/') in /webs/www.zootboy.com/sl/testing.phpon
> > line 13
> >
> > I have no idea what's going on. All the files have 777 perms.
>
> What happens if you remove the die() statement?
>
>  require $incl;
>
> --
> Philip Graham
>

Hey! That fixed it. That's strange.

-- 
--Zootboy


Re: [PHP] Require error

2008-12-19 Thread sean greenslade
On Fri, Dec 19, 2008 at 12:55 PM, Kyle Terry  wrote:

>
>
> On Fri, Dec 19, 2008 at 9:50 AM, Wolf  wrote:
>
>>
>>  Kyle Terry  wrote:
>> > On Fri, Dec 19, 2008 at 9:43 AM, Wolf  wrote:
>> >
>> > > Bottom Post
>> > >
>> > >  sean greenslade  wrote:
>> > > > No. The file is called testing.php and it is trying to include
>> sql.inc
>> > > >
>> > > > On Fri, Dec 19, 2008 at 12:36 PM, Kyle Terry 
>> wrote:
>> > > >
>> > > > >
>> > > > >
>> > > > > On Fri, Dec 19, 2008 at 9:28 AM, sean greenslade <
>> > > zootboys...@gmail.com>wrote:
>> > > > >
>> > > > >> So, I have this code in a php file called testing.php:
>> > > > >> $incl = '/webs/www.zootboy.com/sl/sql.inc';
>> > > > >>  if(!is_readable($incl)) die('ERROR: MySQL Include file does not
>> > > > >> exist??!?');
>> > > > >>  require $incl or die('MySQL page not found. Unable to
>> continue.');
>> > > > >>
>> > > > >>
>> > > > >> When I run the code in command line, it outputs this:
>> > > > >>
>> > > > >> [r...@localhost ~]# php -f /webs/www.zootboy.com/sl/testing.php
>> > > > >> PHP Warning:  require(1): failed to open stream: No such file or
>> > > directory
>> > > > >> in /webs/www.zootboy.com/sl/testing.php on line 13
>> > > > >> PHP Fatal error:  require(): Failed opening required '1'
>> > > > >> (include_path='/var/php/inc/') in /webs/
>> > > www.zootboy.com/sl/testing.php on
>> > > > >> line 13
>> > > > >>
>> > > > >> I have no idea what's going on. All the files have 777 perms.
>> > > > >>
>> > > > >> --
>> > > > >> --Zootboy
>> > > > >>
>> > > > >
>> > > > > Are you trying to require itself?
>> > >
>> > > Change your line to:
>> > > require('$incl') or die('File not found');
>> > >
>> > > Require can be dork about things like this, I normally wind up
>> handling to
>> > > fiddle with the coding for them.
>> > >
>> > > Wolf
>> > >
>> >
>> > Actually, single quoted will be string literal. He would need to encase
>> them
>> > in double quotes so the parser knows it might be looking for a variable.
>> > require("$incl") is what he wants.
>> >
>>
>> See!  I told you I always have problems with those!  :)
>>
>> Normally I'm not so literal though.
>>
>> so yeah:
>> require("$incl");
>> include("$incl");
>>
>> I prefer the includes over the requires, but that is personal preference.
>>
>> Wolf
>>
>
> It really all depends on how you want to handle errors. If you want to kill
> the script because the database can't be reached, use require or
> require_once, if you want the script to continue and handle everything
> differently in the event that a file isn't loaded, use include or
> include_once.
>
>
> --
> Kyle Terry | www.kyleterry.com
>

I want the page to stop if it can't access the DB. It is required for the
function of the page.

-- 
--Zootboy


Re: [PHP] Require error

2008-12-19 Thread sean greenslade
On Fri, Dec 19, 2008 at 12:50 PM, Wolf  wrote:

>
>  Kyle Terry  wrote:
> > On Fri, Dec 19, 2008 at 9:43 AM, Wolf  wrote:
> >
> > > Bottom Post
> > >
> > >  sean greenslade  wrote:
> > > > No. The file is called testing.php and it is trying to include
> sql.inc
> > > >
> > > > On Fri, Dec 19, 2008 at 12:36 PM, Kyle Terry 
> wrote:
> > > >
> > > > >
> > > > >
> > > > > On Fri, Dec 19, 2008 at 9:28 AM, sean greenslade <
> > > zootboys...@gmail.com>wrote:
> > > > >
> > > > >> So, I have this code in a php file called testing.php:
> > > > >> $incl = '/webs/www.zootboy.com/sl/sql.inc';
> > > > >>  if(!is_readable($incl)) die('ERROR: MySQL Include file does not
> > > > >> exist??!?');
> > > > >>  require $incl or die('MySQL page not found. Unable to
> continue.');
> > > > >>
> > > > >>
> > > > >> When I run the code in command line, it outputs this:
> > > > >>
> > > > >> [r...@localhost ~]# php -f /webs/www.zootboy.com/sl/testing.php
> > > > >> PHP Warning:  require(1): failed to open stream: No such file or
> > > directory
> > > > >> in /webs/www.zootboy.com/sl/testing.php on line 13
> > > > >> PHP Fatal error:  require(): Failed opening required '1'
> > > > >> (include_path='/var/php/inc/') in /webs/
> > > www.zootboy.com/sl/testing.php on
> > > > >> line 13
> > > > >>
> > > > >> I have no idea what's going on. All the files have 777 perms.
> > > > >>
> > > > >> --
> > > > >> --Zootboy
> > > > >>
> > > > >
> > > > > Are you trying to require itself?
> > >
> > > Change your line to:
> > > require('$incl') or die('File not found');
> > >
> > > Require can be dork about things like this, I normally wind up handling
> to
> > > fiddle with the coding for them.
> > >
> > > Wolf
> > >
> >
> > Actually, single quoted will be string literal. He would need to encase
> them
> > in double quotes so the parser knows it might be looking for a variable.
> > require("$incl") is what he wants.
> >
>
> See!  I told you I always have problems with those!  :)
>
> Normally I'm not so literal though.
>
> so yeah:
> require("$incl");
> include("$incl");
>
> I prefer the includes over the requires, but that is personal preference.
>
> Wolf
>

I tried includes, and they fail as well. I tried putting the var in
double-quotes, and it did nothing.

-- 
--Zootboy


Re: [PHP] Require error

2008-12-19 Thread sean greenslade
No. The file is called testing.php and it is trying to include sql.inc

On Fri, Dec 19, 2008 at 12:36 PM, Kyle Terry  wrote:

>
>
> On Fri, Dec 19, 2008 at 9:28 AM, sean greenslade wrote:
>
>> So, I have this code in a php file called testing.php:
>> $incl = '/webs/www.zootboy.com/sl/sql.inc';
>>  if(!is_readable($incl)) die('ERROR: MySQL Include file does not
>> exist??!?');
>>  require $incl or die('MySQL page not found. Unable to continue.');
>>
>>
>> When I run the code in command line, it outputs this:
>>
>> [r...@localhost ~]# php -f /webs/www.zootboy.com/sl/testing.php
>> PHP Warning:  require(1): failed to open stream: No such file or directory
>> in /webs/www.zootboy.com/sl/testing.php on line 13
>> PHP Fatal error:  require(): Failed opening required '1'
>> (include_path='/var/php/inc/') in /webs/www.zootboy.com/sl/testing.php on
>> line 13
>>
>> I have no idea what's going on. All the files have 777 perms.
>>
>> --
>> --Zootboy
>>
>
> Are you trying to require itself?
>
>
> --
> Kyle Terry | www.kyleterry.com
>



-- 
--Zootboy


[PHP] Require error

2008-12-19 Thread sean greenslade
So, I have this code in a php file called testing.php:
$incl = '/webs/www.zootboy.com/sl/sql.inc';
 if(!is_readable($incl)) die('ERROR: MySQL Include file does not
exist??!?');
 require $incl or die('MySQL page not found. Unable to continue.');


When I run the code in command line, it outputs this:

[r...@localhost ~]# php -f /webs/www.zootboy.com/sl/testing.php
PHP Warning:  require(1): failed to open stream: No such file or directory
in /webs/www.zootboy.com/sl/testing.php on line 13
PHP Fatal error:  require(): Failed opening required '1'
(include_path='/var/php/inc/') in /webs/www.zootboy.com/sl/testing.php on
line 13

I have no idea what's going on. All the files have 777 perms.

-- 
--Zootboy


Fwd: [PHP] Bitwise operation giving wrong results

2008-10-31 Thread sean greenslade
-- Forwarded message --
From: sean greenslade <[EMAIL PROTECTED]>
Date: Fri, Oct 31, 2008 at 11:22 PM
Subject: Re: [PHP] Bitwise operation giving wrong results
To: Yeti <[EMAIL PROTECTED]>


Cool, thanks. It worked. I didn't know you typeset PHP like that.


On Thu, Oct 30, 2008 at 3:42 AM, Yeti <[EMAIL PROTECTED]> wrote:

> Usually in PHP one does not take much care about the data types, but
> in this case you absoloodle have to.
> If you use bit operators on a character then its ascii number will be
> taken instead (how should a number based operation work with a
> string?)
>
> also if you pass on $_GET params directly into ay bitwise operation
> you might get some un-nice behaviour. So check them first.
>
>  $a = $b = false;
> if (is_numeric($_GET['b'].$_GET['a'])) {
>$a = (int)$_GET['a'];
>$b = (int)$_GET['b'];
>echo $a & $b;
> }
> ?>
>



-- 
--Zootboy



-- 
--Zootboy


[PHP] Bitwise operation giving wrong results

2008-10-29 Thread sean greenslade
I have the following code as a test:


if I set a to 15 and b to 2 in the URL like so:

test.php?a=15&b=2

it outputs zero as the answer. When I run the hard-coded '&' operation (the
commented out echo), it returns 2. I'm stumped.
-- 
--Zootboy


Re: [PHP] textarea html generation problem

2008-09-18 Thread sean greenslade
I prefer the htmlentities because it allows me to edit the real code, not an
edited form of the code. All the <> still appear.

On Tue, Sep 16, 2008 at 9:41 AM, TQ White II <[EMAIL PROTECTED]> wrote:

>
> I add str_replace('textarea', 'textareaHIDE', ... to the display code and
> the reverse to the store it away code.
>
> Good luck.
>
> tqii
>
> On Sep 15, 2008, at 8:08 PM, sean greenslade wrote:
>
> Hi all! I am trying to make a PHP HTML editor. I have made the entire
> editor
> function, but it has a big problem. If the page contains a  tag,
> it ends the editor's textarea and the browser starts rendering the HTML.
> How
> do I go about preventing this from happening?
>
> Thanks a lot!
> --Zootboy
>
>
>
>
> TQ White II • 708-763-0100
> Website • JustKidding.com <http://justkidding.com/>
>
>
>


-- 
Feh.


Re: [PHP] textarea html generation problem

2008-09-16 Thread sean greenslade
Thanks to all for your responses. I ended up using htmlentities. Thanks
Stephen.

Also, the reason I didn't use a premade editor is that I am planning on
selling a web-editor system and don't want any troubles with licenses.



Hi all! I am trying to make a PHP HTML editor. I have made the entire editor
function, but it has a big problem. If the page contains a  tag,
it ends the editor's textarea and the browser starts rendering the HTML. How
do I go about preventing this from happening?

Thanks a lot!
--Zootboy



Re: [PHP] php not reading file properly

2008-08-25 Thread sean greenslade
Yeah, well, I don't want everyone to view my logs. Only me. So it won't add
any unnecessary load to my server.

On Mon, Aug 25, 2008 at 8:04 AM, Jochem Maas <[EMAIL PROTECTED]> wrote:

> sean greenslade schreef:
>
>> Well, if you really want to know, I have to go to many places that do not
>> have internet access. For those places, I have a PDA. I have Avantgo
>> software on the PDA, and I wanted it to be able to store a copy of the log
>> file to review it when I do not have internet access. All I needed was a
>> webpage to access it, and the Avantgo software automatically downloads a
>> copy of it before I leave.
>>
>
> I see. :-) I was worried that it was going to cause grief ... people
> constantly looking at the output of that script would do no good for
> your servers performance.
>
> you must have good eyesight to be reading apache logs on a PDA :-P
>
>
>
>> On Sun, Aug 24, 2008 at 7:42 PM, Jochem Maas <[EMAIL PROTECTED]>
>> wrote:
>>
>>  sean greenslade schreef:
>>>
>>>  I have this snippet of code that is supposed to read the apache access
>>> log
>>>
>>>> and display it:
>>>> >>>   $myFile = "/var/log/httpd/access_log";
>>>>   $fh = fopen($myFile, 'r');
>>>>   $theData = fread($fh, filesize($myFile));
>>>>   fclose($fh);
>>>>   echo
>>>>   "This weeks apache log (clears every sunday morning):".
>>>>   substr($theData,0,2000);
>>>> ?>
>>>> For some reason, it displays the logs when I run the php file thru
>>>> terminal:
>>>> php -f /web/apache.php
>>>>
>>>> but not when I access it thru the web. when I browse to it, it just
>>>> displays
>>>> the static text ("This weeks apache log (clears every sunday
>>>> morning):"),
>>>> not the log text.
>>>>
>>>>  you fixed the problem, but I have to ask:
>>>
>>> why on earth you want to do this?
>>>
>>>
>>>  Very confused,
>>>> zootboy
>>>>
>>>>
>>>>
>>
>>
>


-- 
Feh.


Re: [PHP] php not reading file properly

2008-08-24 Thread sean greenslade
Well, if you really want to know, I have to go to many places that do not
have internet access. For those places, I have a PDA. I have Avantgo
software on the PDA, and I wanted it to be able to store a copy of the log
file to review it when I do not have internet access. All I needed was a
webpage to access it, and the Avantgo software automatically downloads a
copy of it before I leave.

On Sun, Aug 24, 2008 at 7:42 PM, Jochem Maas <[EMAIL PROTECTED]> wrote:

> sean greenslade schreef:
>
>  I have this snippet of code that is supposed to read the apache access log
>> and display it:
>> >$myFile = "/var/log/httpd/access_log";
>>$fh = fopen($myFile, 'r');
>>$theData = fread($fh, filesize($myFile));
>>fclose($fh);
>>echo
>>"This weeks apache log (clears every sunday morning):".
>>substr($theData,0,2000);
>> ?>
>> For some reason, it displays the logs when I run the php file thru
>> terminal:
>> php -f /web/apache.php
>>
>> but not when I access it thru the web. when I browse to it, it just
>> displays
>> the static text ("This weeks apache log (clears every sunday morning):"),
>> not the log text.
>>
>
> you fixed the problem, but I have to ask:
>
> why on earth you want to do this?
>
>
>> Very confused,
>> zootboy
>>
>>
>


-- 
Feh.


Re: [PHP] Help and Advice needed please.

2008-08-23 Thread sean greenslade
So Byron, what do you think? Do you like the idea of a mysql database?

On Sat, Aug 23, 2008 at 11:57 AM, Luke <[EMAIL PROTECTED]> wrote:

> I'm up for helping too. Also, a big agree to Sean too, MySQL seems the best
> way to go here.
>
> 2008/8/23 sean greenslade <[EMAIL PROTECTED]>
>
> I would be willing to help with this project. Because of all the different
>> requirements of this, I would recommend a totally custom set of scripts,
>> and
>> a mysql database to hold all the data.
>>
>> On Sat, Aug 23, 2008 at 7:22 AM, Byron <[EMAIL PROTECTED]> wrote:
>>
>> > Hey.
>> >
>> > I do some part-time IT work for a voluntary paramilitary youth
>> > organisation,
>> > and we're loooking for a system to digitize the personell files of our
>> > members. Here's a features list, all advice on how to implement will be
>> a
>> > great help.
>> >
>> > * Web-accesable via login
>> > * Rank, Name, Phone Number, Address, Email Address, Physical Address.
>> > * Training History
>> > * Promotion History
>> > * Miscellanous Notes.
>> > * Different types of Administrator and notes that can be attached to
>> > personell files that are seen by different types of administrator.
>> > * Activity report page. I.e. This activity happenened on this date and
>> > these
>> > people attended from this time to this time. Attendance must be visible
>> on
>> > personell files.
>> > * Attendance Register and counter for attendances of members.
>> > * UI that a 65-year old who believes dialup is fast (the Unit Commander)
>> > can
>> > find his way around.
>> > * Easily copiable and deployable. As in can be used by more than one
>> unit.
>> >
>> > --
>> > I'm going out to find myself, if you see me here, keep me here untill I
>> can
>> > catch up
>> >
>> > If I haven't said so already,
>> >
>> > Thanks
>> > Byron
>> >
>>
>>
>>
>> --
>> Feh.
>>
>
>
>
> --
> Luke Slater
>



-- 
Feh.


Re: [PHP] Help and Advice needed please.

2008-08-23 Thread sean greenslade
I would be willing to help with this project. Because of all the different
requirements of this, I would recommend a totally custom set of scripts, and
a mysql database to hold all the data.

On Sat, Aug 23, 2008 at 7:22 AM, Byron <[EMAIL PROTECTED]> wrote:

> Hey.
>
> I do some part-time IT work for a voluntary paramilitary youth
> organisation,
> and we're loooking for a system to digitize the personell files of our
> members. Here's a features list, all advice on how to implement will be a
> great help.
>
> * Web-accesable via login
> * Rank, Name, Phone Number, Address, Email Address, Physical Address.
> * Training History
> * Promotion History
> * Miscellanous Notes.
> * Different types of Administrator and notes that can be attached to
> personell files that are seen by different types of administrator.
> * Activity report page. I.e. This activity happenened on this date and
> these
> people attended from this time to this time. Attendance must be visible on
> personell files.
> * Attendance Register and counter for attendances of members.
> * UI that a 65-year old who believes dialup is fast (the Unit Commander)
> can
> find his way around.
> * Easily copiable and deployable. As in can be used by more than one unit.
>
> --
> I'm going out to find myself, if you see me here, keep me here untill I can
> catch up
>
> If I haven't said so already,
>
> Thanks
> Byron
>



-- 
Feh.


Re: Fwd: [PHP] php not reading file properly

2008-08-22 Thread sean greenslade
Hey! That worked! Turns out, the folder needs exec perms to read the files.
Thanks!

On Fri, Aug 22, 2008 at 10:28 AM, Micah Gersten <[EMAIL PROTECTED]> wrote:

> What are the permssions of /var/log and /var/log/httpd?
>
> Thank you,
> Micah Gersten
> onShore Networks
> Internal Developer
> http://www.onshore.com
>
>
>
> sean greenslade wrote:
> > Yeah, but it wouldn't read access_log.tmp, which wasn't being written to
> at
> > the time of loading. I think the whole logs folder is restricted from php
> > access.
> >
> > On Fri, Aug 22, 2008 at 10:13 AM, Ashley Sheridan
> > <[EMAIL PROTECTED]>wrote:
> >
> >
> >>  The log file was in the process of being written to as you were trying
> to
> >> read it. It's a bit like trying to look at a quark. By doing so, you've
> >> already affected its position. Although, unlike a quark, you can create
> a
> >> copy of the log file ;)
> >>
> >>   Ash
> >> www.ashleysheridan.co.uk
> >>
> >>
> >> -- Forwarded message --
> >> From: "sean greenslade" <[EMAIL PROTECTED]>
> >> To: php-general@lists.php.net
> >> Date: Fri, 22 Aug 2008 10:04:07 -0400
> >> Subject: Re: Fwd: [PHP] php not reading file properly
> >> Yeah, I tried changing the perms, and that didn't work. I originally
> made
> >> the cron job put the temp copy in the same logs folder, but it refused
> to
> >> open that. I changed it to put the temp copy in the web folder, and it
> can
> >> read that. I think apache and/or php may have certain restrictions that
> >> keep
> >> them from accessing important system folders.
> >>
> >> On Fri, Aug 22, 2008 at 3:09 AM, Ashley Sheridan
> >> <[EMAIL PROTECTED]>wrote:
> >>
> >>
> >>> You can change the permissions on the file, which I believe you said
> you
> >>> did. If that didn't work, it must be because you are trying to read
> from
> >>> the file at the very same instant that Apache is writing to it logging
> >>> that you are trying to access it, if that makes sense?
> >>>
> >>> Ash
> >>> www.ashleysheridan.co.uk
> >>>
> >>>
> >>> -- Forwarded message --
> >>> From: "sean greenslade" <[EMAIL PROTECTED]>
> >>> To: php-general@lists.php.net
> >>> Date: Fri, 22 Aug 2008 02:31:47 -0400
> >>> Subject: Re: Fwd: [PHP] php not reading file properly
> >>> So I made a cron jop to copy the log to the web folder every 5 minutes.
> >>> That
> >>> worked fine. It seems that php can't read the /var/log/httpd folder
> >>>
> >> without
> >>
> >>> root perms.
> >>>
> >>> On Wed, Aug 20, 2008 at 7:53 PM, Ashley Sheridan
> >>> <[EMAIL PROTECTED]>wrote:
> >>>
> >>>
> >>>> Yeah, Apache is still running, but it is the access log you are trying
> >>>> to read, at the same time that you are Apache is being accessed.
> >>>> Accessing the log from the terminal will be fine while Apache is
> >>>> running, as it is unlikely it is being accessed at the very same
> >>>> instant. Are you able to access other files? Also, have you tried
> >>>> copying the file to another temporary version from within PHP an
> >>>> accessing that? If that doesn't work, try executing a Bash script that
> >>>> copies it someplace. Make sure to run the script in the background,
> and
> >>>> maybe add a sleep period to it so that it doesn't interfere with
> Apache
> >>>> accessing things.
> >>>>
> >>>> Ash
> >>>> www.ashleysheridan.co.uk
> >>>>
> >>>>
> >>>> -- Forwarded message --
> >>>> From: "sean greenslade" <[EMAIL PROTECTED]>
> >>>> To: "Micah Gersten" <[EMAIL PROTECTED]>
> >>>> Date: Wed, 20 Aug 2008 19:41:54 -0400
> >>>> Subject: Re: Fwd: [PHP] php not reading file properly
> >>>> Ashley Sheridan wrote:
> >>>>
> >>>>
> >>>>> As it's the Apache access log that you are trying to read in, are you
> >>>>>
> >>> sure
> >>>
> >>>> that Apache is >not in the process of writin

Re: Fwd: [PHP] php not reading file properly

2008-08-22 Thread sean greenslade
The cron job only runs every 5 minutes, so not likely

On Fri, Aug 22, 2008 at 10:22 AM, Ashley Sheridan
<[EMAIL PROTECTED]>wrote:

>  Are you sure they are both not accessed at around about the same time?
> Look at the timestamps. The only analysis I've ever done with logs has been
> offline, so I've not run into this problem before.
>
>   Ash
> www.ashleysheridan.co.uk
>
>
> -- Forwarded message --
> From: "sean greenslade" <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Date: Fri, 22 Aug 2008 10:13:37 -0400
> Subject: Re: Fwd: [PHP] php not reading file properly
> Yeah, but it wouldn't read access_log.tmp, which wasn't being written to at
> the time of loading. I think the whole logs folder is restricted from php
> access.
>
> On Fri, Aug 22, 2008 at 10:13 AM, Ashley Sheridan <
> [EMAIL PROTECTED]> wrote:
>
>>  The log file was in the process of being written to as you were trying to
>> read it. It's a bit like trying to look at a quark. By doing so, you've
>> already affected its position. Although, unlike a quark, you can create a
>> copy of the log file ;)
>>
>>   Ash
>> www.ashleysheridan.co.uk
>>
>>
>> -- Forwarded message --
>> From: "sean greenslade" <[EMAIL PROTECTED]>
>> To: php-general@lists.php.net
>> Date: Fri, 22 Aug 2008 10:04:07 -0400
>> Subject: Re: Fwd: [PHP] php not reading file properly
>> Yeah, I tried changing the perms, and that didn't work. I originally made
>> the cron job put the temp copy in the same logs folder, but it refused to
>> open that. I changed it to put the temp copy in the web folder, and it can
>> read that. I think apache and/or php may have certain restrictions that
>> keep
>> them from accessing important system folders.
>>
>> On Fri, Aug 22, 2008 at 3:09 AM, Ashley Sheridan
>> <[EMAIL PROTECTED]>wrote:
>>
>> > You can change the permissions on the file, which I believe you said you
>> > did. If that didn't work, it must be because you are trying to read from
>> > the file at the very same instant that Apache is writing to it logging
>> > that you are trying to access it, if that makes sense?
>> >
>> > Ash
>> > www.ashleysheridan.co.uk
>> >
>> >
>> > -- Forwarded message --
>> > From: "sean greenslade" <[EMAIL PROTECTED]>
>> > To: php-general@lists.php.net
>> > Date: Fri, 22 Aug 2008 02:31:47 -0400
>> > Subject: Re: Fwd: [PHP] php not reading file properly
>> > So I made a cron jop to copy the log to the web folder every 5 minutes.
>> > That
>> > worked fine. It seems that php can't read the /var/log/httpd folder
>> without
>> > root perms.
>> >
>> > On Wed, Aug 20, 2008 at 7:53 PM, Ashley Sheridan
>> > <[EMAIL PROTECTED]>wrote:
>> >
>> > > Yeah, Apache is still running, but it is the access log you are trying
>> > > to read, at the same time that you are Apache is being accessed.
>> > > Accessing the log from the terminal will be fine while Apache is
>> > > running, as it is unlikely it is being accessed at the very same
>> > > instant. Are you able to access other files? Also, have you tried
>> > > copying the file to another temporary version from within PHP an
>> > > accessing that? If that doesn't work, try executing a Bash script that
>> > > copies it someplace. Make sure to run the script in the background,
>> and
>> > > maybe add a sleep period to it so that it doesn't interfere with
>> Apache
>> > > accessing things.
>> > >
>> > > Ash
>> > > www.ashleysheridan.co.uk
>> > >
>> > >
>> > > -- Forwarded message --
>> > > From: "sean greenslade" <[EMAIL PROTECTED]>
>> > > To: "Micah Gersten" <[EMAIL PROTECTED]>
>> > > Date: Wed, 20 Aug 2008 19:41:54 -0400
>> > > Subject: Re: Fwd: [PHP] php not reading file properly
>> > > Ashley Sheridan wrote:
>> > >
>> > > >As it's the Apache access log that you are trying to read in, are you
>> > sure
>> > > that Apache is >not in the process of writing to it as you are
>> > > attempting to read from it? That might explain   >why it seems to be
>> > empty,
>> > > although I would have thought it would just append the data to >the
>> end
>

Re: Fwd: [PHP] php not reading file properly

2008-08-22 Thread sean greenslade
Yeah, but it wouldn't read access_log.tmp, which wasn't being written to at
the time of loading. I think the whole logs folder is restricted from php
access.

On Fri, Aug 22, 2008 at 10:13 AM, Ashley Sheridan
<[EMAIL PROTECTED]>wrote:

>  The log file was in the process of being written to as you were trying to
> read it. It's a bit like trying to look at a quark. By doing so, you've
> already affected its position. Although, unlike a quark, you can create a
> copy of the log file ;)
>
>   Ash
> www.ashleysheridan.co.uk
>
>
> -- Forwarded message --
> From: "sean greenslade" <[EMAIL PROTECTED]>
> To: php-general@lists.php.net
> Date: Fri, 22 Aug 2008 10:04:07 -0400
> Subject: Re: Fwd: [PHP] php not reading file properly
> Yeah, I tried changing the perms, and that didn't work. I originally made
> the cron job put the temp copy in the same logs folder, but it refused to
> open that. I changed it to put the temp copy in the web folder, and it can
> read that. I think apache and/or php may have certain restrictions that
> keep
> them from accessing important system folders.
>
> On Fri, Aug 22, 2008 at 3:09 AM, Ashley Sheridan
> <[EMAIL PROTECTED]>wrote:
>
> > You can change the permissions on the file, which I believe you said you
> > did. If that didn't work, it must be because you are trying to read from
> > the file at the very same instant that Apache is writing to it logging
> > that you are trying to access it, if that makes sense?
> >
> > Ash
> > www.ashleysheridan.co.uk
> >
> >
> > -- Forwarded message --
> > From: "sean greenslade" <[EMAIL PROTECTED]>
> > To: php-general@lists.php.net
> > Date: Fri, 22 Aug 2008 02:31:47 -0400
> > Subject: Re: Fwd: [PHP] php not reading file properly
> > So I made a cron jop to copy the log to the web folder every 5 minutes.
> > That
> > worked fine. It seems that php can't read the /var/log/httpd folder
> without
> > root perms.
> >
> > On Wed, Aug 20, 2008 at 7:53 PM, Ashley Sheridan
> > <[EMAIL PROTECTED]>wrote:
> >
> > > Yeah, Apache is still running, but it is the access log you are trying
> > > to read, at the same time that you are Apache is being accessed.
> > > Accessing the log from the terminal will be fine while Apache is
> > > running, as it is unlikely it is being accessed at the very same
> > > instant. Are you able to access other files? Also, have you tried
> > > copying the file to another temporary version from within PHP an
> > > accessing that? If that doesn't work, try executing a Bash script that
> > > copies it someplace. Make sure to run the script in the background, and
> > > maybe add a sleep period to it so that it doesn't interfere with Apache
> > > accessing things.
> > >
> > > Ash
> > > www.ashleysheridan.co.uk
> > >
> > >
> > > -- Forwarded message --
> > > From: "sean greenslade" <[EMAIL PROTECTED]>
> > > To: "Micah Gersten" <[EMAIL PROTECTED]>
> > > Date: Wed, 20 Aug 2008 19:41:54 -0400
> > > Subject: Re: Fwd: [PHP] php not reading file properly
> > > Ashley Sheridan wrote:
> > >
> > > >As it's the Apache access log that you are trying to read in, are you
> > sure
> > > that Apache is >not in the process of writing to it as you are
> > > attempting to read from it? That might explain   >why it seems to be
> > empty,
> > > although I would have thought it would just append the data to >the end
> > of
> > > the file, rather than rewriting the whole thing.
> > >
> > > I dunno. Like I said, I can read it thru the terminal. Apache is still
> > > running then.
> > >
> > > As for Micah's response, that function won't work either.
> > >
> > > On Wed, Aug 20, 2008 at 7:34 PM, Micah Gersten <[EMAIL PROTECTED]>
> > wrote:
> > >
> > > > If the directory above it doesn't have execute privileges, it won't
> be
> > > > able to read it either.
> > > > Also, why not use the PHP5 function file_get_contents()?
> > > >
> > > > Thank you,
> > > > Micah Gersten
> > > > onShore Networks
> > > > Internal Developer
> > > > http://www.onshore.com
> > > >
> > > >
> > > >
> > > > sean greenslade wrote:
> > > > > Thanks f

Re: Fwd: [PHP] php not reading file properly

2008-08-22 Thread sean greenslade
Yeah, I tried changing the perms, and that didn't work. I originally made
the cron job put the temp copy in the same logs folder, but it refused to
open that. I changed it to put the temp copy in the web folder, and it can
read that. I think apache and/or php may have certain restrictions that keep
them from accessing important system folders.

On Fri, Aug 22, 2008 at 3:09 AM, Ashley Sheridan
<[EMAIL PROTECTED]>wrote:

> You can change the permissions on the file, which I believe you said you
> did. If that didn't work, it must be because you are trying to read from
> the file at the very same instant that Apache is writing to it logging
> that you are trying to access it, if that makes sense?
>
> Ash
> www.ashleysheridan.co.uk
>
>
> ------ Forwarded message --
> From: "sean greenslade" <[EMAIL PROTECTED]>
> To: php-general@lists.php.net
> Date: Fri, 22 Aug 2008 02:31:47 -0400
> Subject: Re: Fwd: [PHP] php not reading file properly
> So I made a cron jop to copy the log to the web folder every 5 minutes.
> That
> worked fine. It seems that php can't read the /var/log/httpd folder without
> root perms.
>
> On Wed, Aug 20, 2008 at 7:53 PM, Ashley Sheridan
> <[EMAIL PROTECTED]>wrote:
>
> > Yeah, Apache is still running, but it is the access log you are trying
> > to read, at the same time that you are Apache is being accessed.
> > Accessing the log from the terminal will be fine while Apache is
> > running, as it is unlikely it is being accessed at the very same
> > instant. Are you able to access other files? Also, have you tried
> > copying the file to another temporary version from within PHP an
> > accessing that? If that doesn't work, try executing a Bash script that
> > copies it someplace. Make sure to run the script in the background, and
> > maybe add a sleep period to it so that it doesn't interfere with Apache
> > accessing things.
> >
> > Ash
> > www.ashleysheridan.co.uk
> >
> >
> > -- Forwarded message --
> > From: "sean greenslade" <[EMAIL PROTECTED]>
> > To: "Micah Gersten" <[EMAIL PROTECTED]>
> > Date: Wed, 20 Aug 2008 19:41:54 -0400
> > Subject: Re: Fwd: [PHP] php not reading file properly
> > Ashley Sheridan wrote:
> >
> > >As it's the Apache access log that you are trying to read in, are you
> sure
> > that Apache is >not in the process of writing to it as you are
> > attempting to read from it? That might explain   >why it seems to be
> empty,
> > although I would have thought it would just append the data to >the end
> of
> > the file, rather than rewriting the whole thing.
> >
> > I dunno. Like I said, I can read it thru the terminal. Apache is still
> > running then.
> >
> > As for Micah's response, that function won't work either.
> >
> > On Wed, Aug 20, 2008 at 7:34 PM, Micah Gersten <[EMAIL PROTECTED]>
> wrote:
> >
> > > If the directory above it doesn't have execute privileges, it won't be
> > > able to read it either.
> > > Also, why not use the PHP5 function file_get_contents()?
> > >
> > > Thank you,
> > > Micah Gersten
> > > onShore Networks
> > > Internal Developer
> > > http://www.onshore.com
> > >
> > >
> > >
> > > sean greenslade wrote:
> > > > Thanks for the advice. I changed the perms to 777 and changed the
> user
> > > and
> > > > group to apache, but it still won't open.
> > > >
> > > >
> > > > On Wed, Aug 20, 2008 at 3:35 PM, Robbert van Andel <
> > > [EMAIL PROTECTED]>wrote:
> > > >
> > > >
> > > >> Does the user your PHP instance runs as have access to the file?
>  It's
> > > >> possible that it runs under a different users depending on if you're
> > > running
> > > >> the script on the terminal or in a web browser.  The function fopen
> > will
> > > >> return false if the file fails to open.  Find out if $fh is equal to
> > > false.
> > > >> While you're debugging, you might consider changing the display
> errors
> > > >> setting to see what warning fopen generates if the file fails to
> open.
> > >  From
> > > >> http://us.php.net/fopen
> > > >>  Errors/Exceptions
> > > >>
> > > >> If the open fails, the function an error of level *E_WARNING* is
> > > >> generated. You may us

Re: Fwd: [PHP] php not reading file properly

2008-08-21 Thread sean greenslade
So I made a cron jop to copy the log to the web folder every 5 minutes. That
worked fine. It seems that php can't read the /var/log/httpd folder without
root perms.

On Wed, Aug 20, 2008 at 7:53 PM, Ashley Sheridan
<[EMAIL PROTECTED]>wrote:

> Yeah, Apache is still running, but it is the access log you are trying
> to read, at the same time that you are Apache is being accessed.
> Accessing the log from the terminal will be fine while Apache is
> running, as it is unlikely it is being accessed at the very same
> instant. Are you able to access other files? Also, have you tried
> copying the file to another temporary version from within PHP an
> accessing that? If that doesn't work, try executing a Bash script that
> copies it someplace. Make sure to run the script in the background, and
> maybe add a sleep period to it so that it doesn't interfere with Apache
> accessing things.
>
> Ash
> www.ashleysheridan.co.uk
>
>
> -- Forwarded message --
> From: "sean greenslade" <[EMAIL PROTECTED]>
> To: "Micah Gersten" <[EMAIL PROTECTED]>
> Date: Wed, 20 Aug 2008 19:41:54 -0400
> Subject: Re: Fwd: [PHP] php not reading file properly
> Ashley Sheridan wrote:
>
> >As it's the Apache access log that you are trying to read in, are you sure
> that Apache is >not in the process of writing to it as you are
> attempting to read from it? That might explain   >why it seems to be empty,
> although I would have thought it would just append the data to >the end of
> the file, rather than rewriting the whole thing.
>
> I dunno. Like I said, I can read it thru the terminal. Apache is still
> running then.
>
> As for Micah's response, that function won't work either.
>
> On Wed, Aug 20, 2008 at 7:34 PM, Micah Gersten <[EMAIL PROTECTED]> wrote:
>
> > If the directory above it doesn't have execute privileges, it won't be
> > able to read it either.
> > Also, why not use the PHP5 function file_get_contents()?
> >
> > Thank you,
> > Micah Gersten
> > onShore Networks
> > Internal Developer
> > http://www.onshore.com
> >
> >
> >
> > sean greenslade wrote:
> > > Thanks for the advice. I changed the perms to 777 and changed the user
> > and
> > > group to apache, but it still won't open.
> > >
> > >
> > > On Wed, Aug 20, 2008 at 3:35 PM, Robbert van Andel <
> > [EMAIL PROTECTED]>wrote:
> > >
> > >
> > >> Does the user your PHP instance runs as have access to the file?  It's
> > >> possible that it runs under a different users depending on if you're
> > running
> > >> the script on the terminal or in a web browser.  The function fopen
> will
> > >> return false if the file fails to open.  Find out if $fh is equal to
> > false.
> > >> While you're debugging, you might consider changing the display errors
> > >> setting to see what warning fopen generates if the file fails to open.
> >  From
> > >> http://us.php.net/fopen
> > >>  Errors/Exceptions
> > >>
> > >> If the open fails, the function an error of level *E_WARNING* is
> > >> generated. You may use @<
> > http://us.php.net/manual/en/language.operators.errorcontrol.php>to
> > suppress this warning.
> > >>
> > >>
> > >> On Wed, Aug 20, 2008 at 12:15 PM, sean greenslade <
> > [EMAIL PROTECTED]>wrote:
> > >>
> > >>
> > >>> I have this snippet of code that is supposed to read the apache
> access
> > log
> > >>> and display it:
> > >>>  > >>>$myFile = "/var/log/httpd/access_log";
> > >>>$fh = fopen($myFile, 'r');
> > >>>$theData = fread($fh, filesize($myFile));
> > >>>fclose($fh);
> > >>>echo
> > >>>"This weeks apache log (clears every sunday morning):".
> > >>>substr($theData,0,2000);
> > >>> ?>
> > >>> For some reason, it displays the logs when I run the php file thru
> > >>> terminal:
> > >>> php -f /web/apache.php
> > >>>
> > >>> but not when I access it thru the web. when I browse to it, it just
> > >>> displays
> > >>> the static text ("This weeks apache log (clears every sunday
> > morning):"),
> > >>> not the log text.
> > >>>
> > >>> Very confused,
> > >>> zootboy
> > >>>
> > >>>
> > >>
> > >
> > >
> > >
> >
>
>
>
> --
> Feh.
>
>


-- 
Feh.


Re: Fwd: [PHP] php not reading file properly

2008-08-20 Thread sean greenslade
Ashley Sheridan wrote:

>As it's the Apache access log that you are trying to read in, are you sure
that Apache is >not in the process of writing to it as you are
attempting to read from it? That might explain   >why it seems to be empty,
although I would have thought it would just append the data to >the end of
the file, rather than rewriting the whole thing.

I dunno. Like I said, I can read it thru the terminal. Apache is still
running then.

As for Micah's response, that function won't work either.

On Wed, Aug 20, 2008 at 7:34 PM, Micah Gersten <[EMAIL PROTECTED]> wrote:

> If the directory above it doesn't have execute privileges, it won't be
> able to read it either.
> Also, why not use the PHP5 function file_get_contents()?
>
> Thank you,
> Micah Gersten
> onShore Networks
> Internal Developer
> http://www.onshore.com
>
>
>
> sean greenslade wrote:
> > Thanks for the advice. I changed the perms to 777 and changed the user
> and
> > group to apache, but it still won't open.
> >
> >
> > On Wed, Aug 20, 2008 at 3:35 PM, Robbert van Andel <
> [EMAIL PROTECTED]>wrote:
> >
> >
> >> Does the user your PHP instance runs as have access to the file?  It's
> >> possible that it runs under a different users depending on if you're
> running
> >> the script on the terminal or in a web browser.  The function fopen will
> >> return false if the file fails to open.  Find out if $fh is equal to
> false.
> >> While you're debugging, you might consider changing the display errors
> >> setting to see what warning fopen generates if the file fails to open.
>  From
> >> http://us.php.net/fopen
> >>  Errors/Exceptions
> >>
> >> If the open fails, the function an error of level *E_WARNING* is
> >> generated. You may use @<
> http://us.php.net/manual/en/language.operators.errorcontrol.php>to
> suppress this warning.
> >>
> >>
> >> On Wed, Aug 20, 2008 at 12:15 PM, sean greenslade <
> [EMAIL PROTECTED]>wrote:
> >>
> >>
> >>> I have this snippet of code that is supposed to read the apache access
> log
> >>> and display it:
> >>>  >>>$myFile = "/var/log/httpd/access_log";
> >>>$fh = fopen($myFile, 'r');
> >>>$theData = fread($fh, filesize($myFile));
> >>>fclose($fh);
> >>>echo
> >>>"This weeks apache log (clears every sunday morning):".
> >>>substr($theData,0,2000);
> >>> ?>
> >>> For some reason, it displays the logs when I run the php file thru
> >>> terminal:
> >>> php -f /web/apache.php
> >>>
> >>> but not when I access it thru the web. when I browse to it, it just
> >>> displays
> >>> the static text ("This weeks apache log (clears every sunday
> morning):"),
> >>> not the log text.
> >>>
> >>> Very confused,
> >>> zootboy
> >>>
> >>>
> >>
> >
> >
> >
>



-- 
Feh.


Fwd: [PHP] php not reading file properly

2008-08-20 Thread sean greenslade
Thanks for the advice. I changed the perms to 777 and changed the user and
group to apache, but it still won't open.


On Wed, Aug 20, 2008 at 3:35 PM, Robbert van Andel <[EMAIL PROTECTED]>wrote:

> Does the user your PHP instance runs as have access to the file?  It's
> possible that it runs under a different users depending on if you're running
> the script on the terminal or in a web browser.  The function fopen will
> return false if the file fails to open.  Find out if $fh is equal to false.
> While you're debugging, you might consider changing the display errors
> setting to see what warning fopen generates if the file fails to open.  From
> http://us.php.net/fopen
>  Errors/Exceptions
>
> If the open fails, the function an error of level *E_WARNING* is
> generated. You may use 
> @<http://us.php.net/manual/en/language.operators.errorcontrol.php>to suppress 
> this warning.
>
>
> On Wed, Aug 20, 2008 at 12:15 PM, sean greenslade <[EMAIL PROTECTED]>wrote:
>
>> I have this snippet of code that is supposed to read the apache access log
>> and display it:
>> >$myFile = "/var/log/httpd/access_log";
>>$fh = fopen($myFile, 'r');
>>$theData = fread($fh, filesize($myFile));
>>fclose($fh);
>>echo
>>"This weeks apache log (clears every sunday morning):".
>>substr($theData,0,2000);
>> ?>
>> For some reason, it displays the logs when I run the php file thru
>> terminal:
>> php -f /web/apache.php
>>
>> but not when I access it thru the web. when I browse to it, it just
>> displays
>> the static text ("This weeks apache log (clears every sunday morning):"),
>> not the log text.
>>
>> Very confused,
>> zootboy
>>
>
>


-- 
Feh.



-- 
Feh.


[PHP] php not reading file properly

2008-08-20 Thread sean greenslade
I have this snippet of code that is supposed to read the apache access log
and display it:

For some reason, it displays the logs when I run the php file thru terminal:
php -f /web/apache.php

but not when I access it thru the web. when I browse to it, it just displays
the static text ("This weeks apache log (clears every sunday morning):"),
not the log text.

Very confused,
zootboy