Re: [PHP] Re: Files redirect - using PHP and .htaccess

2009-02-17 Thread Per Jessen
Martin Zvarík wrote:

> AHA, from what I've just read, the .htaccess is server-side, so the
> client won't know the real directory.
> 
> Can somebody confirm?

Unless you do an external redirect, confirmed.

/Per

-- 
Per Jessen, Zürich (0.6°C)


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



Re: [PHP] Why is this secure?

2009-02-17 Thread Ashley Sheridan
On Mon, 2009-02-16 at 20:23 -0500, Sean DeNigris wrote:
> lol, neither.  It was from a site I had coded.  I read an article  
> about session fixation and it seemed vulnerable based on what I read,  
> but when I tested it, it didn't seem to be and I wasn't sure why.
> What made you think that?
> 
> - Sean
> 
> On Feb 16, 2009, at 8:16 PM, Ashley Sheridan wrote:
> 
> > On Mon, 2009-02-16 at 13:49 -0500, Sean DeNigris wrote:
> >> Hi all!  The following code seems like it should be open to session
> >> fixation attacks, but is not.  Why?!
> >>
> >> This is the beginning of the private page...
> >>  >> session_start();
> >> if (!isset($_SESSION['user']))
> >> {
> >>header("Location: http://[address of login page]? 
> >> requestedpage=[token
> >> for this page]");
> >>exit();
> >> }
> >> 
> >>
> >> If an attacker caused a known user to request the above page with ?
> >> PHPSESSID=1234, the session_start would then register 1234 as the
> >> current session
> >>
> >> This is from the login page...
> >>  >> if($_POST['[a posted form var]'])
> >> {
> >>// check submitted credentials against known users
> >>$status = authenticate(...);
> >>// if  user/pass combination is correct
> >>if ($status == 1)
> >>{
> >>// initiate a session
> >>session_start();
> >>
> >>// register some session variables
> >>$_SESSION['XX] = filter($_POST['XX']);
> >>
> >>// redirect to protected page
> >>header("Location: ...[requested page]);
> >>exit();
> >>}
> >> }
> >>
> >> When the user logged in above, the session_start would use the  
> >> session
> >> cookie from the first session_start above and have a validated  
> >> session
> >> with an SID known to the attacker.
> >>
> >> However, the top snippet does not cause an SID to be recorded in a
> >> cookie, but the bottom one does.  Hence, the attack is prevented, but
> >> why?
> >>
> >> Thanks, cheers!
> >>
> >> - Sean
> >>
> > Erm, is this a trick question or your homework?
> >
> >
> > Ash
> > www.ashleysheridan.co.uk
> >
> 
> 
Lol, just seemed test-like, and I couldn't spot anything glaringly
obvious.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Re: for the security minded web developer - secure way to login?

2009-02-17 Thread Per Jessen
Colin Guthrie wrote:

> I appreciate that https doesn't provide "trust" by default, but
> ultimately that's how Joe Bloggs public has been told to deal with it
> "look for the padlock" etc. etc. to be sure that your session is
> secure blah blah. 

Yeah.  Which is probably because all of the intricacies are way beyond
Joe Bloggs, so the issue was cut down to something about "trust". 

> Now with the HV certs the UI also has the company 
> name in the URL and this *is* going towards a trust infrastructure.

I googled, but couldn't find anything - what are HV certificates?


/Per

-- 
Per Jessen, Zürich (0.6°C)


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



Re: [PHP] E-Mail Attachment Filename Encoding Problem

2009-02-17 Thread Manuel Lemos
on 02/17/2009 03:44 AM Edmund Hertle said the following:
> 2009/2/16 Richard Heyes 
> 
>>> I'm already using pear Mail_Mime.
>> [Ducks and runs off]
>>
>> --
>> Richard Heyes
>>
>> HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
>> http://www.rgraph.org (Updated February 14th)
>>
> 
> Can someone explain to me why pear mail_mime is not a good idea to use? I
> noticed some comments like that a few times but no explanation

The PHP world is very pragmatic. If it works for you, it should be good
enough. Otherwise, you may need to look for something else.

-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

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

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



Re: [PHP] Re: Simple Search Logic Issue...

2009-02-17 Thread David Robley
Bastien Koert wrote:

> [snip]
>>
>>
>>
>> For example LIKE 'c' will only match a field that contains just 'c'
>>
>> LIKE '%c' will match a field starting with 'c' and containing any number
>> of characters
>>
>> [/snip]
>> Cheers
>> --
>> David Robley
>>
>> Make like a banana and split.
>> Today is Sweetmorn, the 46th day of Chaos in the YOLD 3175.
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> hate to do this at a late date, but %c will match anything ending in
> 'c'...'c%' will match anything starting in 'c'
> 
Um, of course that is exactly what I told my fingers to type, but somehow
they didn't listen to me :-)



Cheers
-- 
David Robley

... "I will not raise taxes on the middle class." -- Bill
Today is Pungenday, the 48th day of Chaos in the YOLD 3175. 


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



Re: [PHP] E-Mail Attachment Filename Encoding Problem

2009-02-17 Thread Richard Heyes
> The *other* white meat?

Sorry, no idea what that means.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated February 14th)

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



Re: [PHP] E-Mail Attachment Filename Encoding Problem

2009-02-17 Thread Paul Scott

On Tue, 2009-02-17 at 10:30 +, Richard Heyes wrote:
> > The *other* white meat?
> 
> Sorry, no idea what that means.
> 

Cats are the other white meat. Sorry have flu, may be delirious

-- Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] Apache odd behavior

2009-02-17 Thread Michael A. Peters

Paul M Foster wrote:
> On Mon, Feb 16, 2009 at 08:34:22PM +, Stuart wrote:

>
> FWIW, I've been doing computers since before the CP/M days
> (pre-pre-DOS), so I do know the difference between absolute and relative
> paths.
>
> I'm a little doubtful about the browser specifying things like the URLs
> for links within a HTML page. However, this would explain why there are
> separate entries for image fetches in the Apache logs, occurring after
> the main page has been requested. Do you have some reference for this?
> I'd like to read more about the server-client interaction in depth.

The client requests the web page. The server sends the web page.
After the client gets the web page it then parses the web page and 
requests any inline elements, such as images, style sheets, iframes, 
etc. - which is why you can have images in different servers etc.


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



Re: [PHP] Opinions Please, Describing PHP as Web Framework of C and C++

2009-02-17 Thread Thodoris



2009/2/16 Thodoris :
  

In addition to this there is an API for C that can be used to code web
applications and it is known as CGI (it is provided by many languages)



CGI is a protocol not an API and has no specific connection to C.

-Stuart

  


I stand corrected on  this.

But what I meant is that it actually is a protocol that many languages 
are providing APIs to use it and one of them is C.


Thanks for the observation Stuart.

--
Thodoris



Re: [PHP] Opinions Please, Describing PHP as Web Framework of C and C++

2009-02-17 Thread Thodoris



I didn't mention that it was a C specific framework, I just said IMO
it was similar to a framework for the web. It's an opinion so I can't
be "wrong". In my opinion earlier versions of PHP *could* (not should
but could) be described as a framework in essence, however I wouldn't
say that anymore since it has evolved so much. In your opinion I may
be completely wrong but that's the idea of an opinion.

Besides, if you cross reference your description of a framework:
"basically because when you use a framework (or API or whatever label
you choose to use  for describing it)  in a language it just abstracts
some aspects of the language making it "easier" to code".

With the description of the original PHP:
"It had Perl-like variables, automatic interpretation of form
variables and HTML embedded syntax. The syntax itself was similar to
that of Perl, albeit much more limited, simple, and somewhat
inconsistent."

Then surely what is described is just a way of abstracting parts of
the language to make it "easier" to code.

2009/2/16 Thodoris :



I'd personally say that PHP was originally intended to essentially be
a framework for the web, but has since evolved in to its own language.
It's just my opinion though...





Well you can see that some basic facts from PHP history can prove you wrong:

http://www.php.net/manual/en/history.php.php

Actually PHP started as a set of perl scripts and then was rewritten in C as
a form interpreter.

Of course you could always think what you want even if it is not a fact and
the fact is that it's purpose was never to become a C or C++  API for web
applications.

Not to mention that there is a difference between a framework and an API.

--
Thodoris




Keep this on the list please

--
Thodoris


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



Re: [PHP] Re: Sorting times (SOLVED before tedds crappy SOLVED)

2009-02-17 Thread Jochem Maas
Shawn McKenzie schreef:
> tedd wrote:
>> At 9:56 AM +0100 2/16/09, Jochem Maas wrote:
>>> for any reasonable number of items my tests show tedd's version
>>> pisses on McKenzies from a great height (note that I actually
>>> optimized Mckenzies variant by halfing the number of calls to
>>> strtotime()).
>> ROTFLOL.   <-- I seldom say that!
> 
> Haha!  Yes, I was trolling and got a good one from Jochem!  I would say
> ROTFLMAO!
>> From a great height!!! Now that's funny!
> 
> Too funny.  I'll have to remember to work this in to some conversation
> today at work.  ;-)

fair play, well taken :-) glad we got it sorted out ;-)

> 
>>> I added a third variant, as a sort of control, which runs pretty
>>> much on par with tedd's version but uses rather less LOC
>>> (tedd you might like it as a little example of using array_multisort(),
>>> i.e. a way of avoiding writing the double foreach loop in this case)
>> The speed of the sort doesn't matter at all. The maximum number of data
>> that needed to be sorted in my problem would have been 126 (18 different
>> times for 7 days).
>>
>> I only presented part of the problem here. It was a distilled version of
>> the problem I was working on, which was to allow people to enter times
>> that they were available for tutoring in two hour chunks.
>>
>> So, a person might say they were available from 7:00 am to 9:00 am AND
>> also state that they were available from 7:30 am to 9:30 am, which was a
>> "no-no".
>>
>> Having two loops allowed me to check after converting to seconds AND
>> sorting to see if there were any overlaps. In such case I simply deleted
>> the offending data from the array before converting everything back into
>> normal time (min:sec).
>>
>> Re this post -- all I needed was a push in the right direction. I was
>> thinking about sorting, but I didn't even consider converting everything
>> to seconds and then sorting.
>>
>> That's really all I needed AND another reason why this list is so great!
>> Not only did I get a push in the right direction, but I got a good laugh
>> out of it -- "from great heights" indeed. :-)
>>
>> Thanks and Cheers,
>>
>> tedd
>>
> 
> 


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



Re: [PHP] E-Mail Attachment Filename Encoding Problem

2009-02-17 Thread Paul Scott

On Tue, 2009-02-17 at 10:19 +, Richard Heyes wrote:
> There's no reason not to use it - it works for a good many people. And
> a few cats too.

The *other* white meat?

-- Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] E-Mail Attachment Filename Encoding Problem

2009-02-17 Thread Richard Heyes
> Can someone explain to me why pear mail_mime is not a good idea to use? I
> noticed some comments like that a few times but no explanation

There's no reason not to use it - it works for a good many people. And
a few cats too.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated February 14th)

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



Re: [PHP] Full versus relative URLs

2009-02-17 Thread Stuart
2009/2/17 Paul M Foster :
> On Mon, Feb 16, 2009 at 08:49:06PM +, Stuart wrote:
>
>> 2009/2/16 Paul M Foster :
>
> 
>
>> >
>> > Agreed. But here's the real reason, in my case. We develop the pages on
>> > an internal server, which has the URL http://pokey/mysite.com. When we
>> > move the pages to the live server at mysite.com, all the URLs would have
>> > to be rewritten. Ugh.
>>
>> My advice would be to stop coding and sort this out as soon as
>> possible.
>
> You think? ;-}
>
>> If your development server has a different layout to your
>> live server you're simply asking for trouble, especially since you're
>> using a front controller pattern (as evidenced in another thread).
>
> Not so much. We've structured our backups and live servers this way for
> a number of years without incident. Paqes for clients are normally
> statically built in Dreamweaver, with possibly a modicum of PHP to
> handle forms. Internal company pages are built by me and reside only on
> internal servers. This is the first client project where we're using a
> front controller, etc.

Not encountering a problem for "a number of years" does not mean
you're not going to have problems in the future. I know a lot of
people who don't backup their data, some who justify it by asserting
that they've not had a problem so far.

Maintaining identical development, staging and live environments is
one of the key components of reliable, repeatable and streamlined
development, testing and deployment, but if you're happy with what
you've got then by all means continue as before. I was just offering a
best practice suggestion that would solve your current problem and
likely some you'll encounter in the future.

>> It's simple to fix this. Add a hosts entry for mysite.local pointing
>> at pokey's IP. Change the server software so it has a virtual host for
>> mysite.local pointed at the mysite.com directory in the existing web
>> rooot.
>
> Which works up until the point where you go live with the site, and
> forget to revert the hosts file, so you can't get to the live site. And
> after you do revert the hosts file, you again have the same problem with
> the base URL for the production site being different from the
> development/backup site.
>
> Virtual hosting is beyond my Apache expertise, and again, would mask
> live sites we host.

No it wouldn't. If you care to read exactly what I wrote, you put the
development site under mysite.local rather than mysite.com. It won't
mask or hide the live site and it won't have any negative impact when
you put it live unless you've used the domain name in links.

> In addition, pokey's IP is not exactly fixed. It's served up by DHCP
> from an internal DHCP server. It's generally the same, but I wouldn't
> want to rely on that in a hosts file.

Most DHCP servers can reserve an IP address for a specific MAC address
such that that IP always gets given to that NIC.

>> This is not difficult and will allow you to solve both of the problems
>> you are currently asking this list about.
>
> Actually, Ashley's  tag solution resolves the problem. However,
> I've moved on and dropped the front controller concept for this project.
> Instead, I'm opting for a snippet of PHP at the beginning of every
> "static" page built in DW which calls in the values necessary to
> populate the sidebars of the pages.

That's completely up to you, I'm just trying to help.

> Really, Stuart, you should try not to be so annoyed at people who don't
> appear to know as much as you believe you do. ;-}

I'm not annoyed, I'm mildly frustrated. You did not respond to my
initial suggestion in the other thread but continued to discuss the
problem with others. I apologise if my tone came across as annoyed,
but it's polite to respond to others when they communicate with you.

Good day to you sir ;-)

-Stuart

-- 
http://stut.net/

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



Re: [PHP] Opinions Please, Describing PHP as Web Framework of C and C++

2009-02-17 Thread Thodoris



I didn't mention that it was a C specific framework, I just said IMO
it was similar to a framework for the web. It's an opinion so I can't
be "wrong". In my opinion earlier versions of PHP *could* (not should
but could) be described as a framework in essence, however I wouldn't
say that anymore since it has evolved so much. In your opinion I may
be completely wrong but that's the idea of an opinion.
  


I think that this is what you said:

I prefer calling PHP as Web Framework of C and C++


Btw opinions and personal styles are always welcome.



Besides, if you cross reference your description of a framework:
"basically because when you use a framework (or API or whatever label
you choose to use  for describing it)  in a language it just abstracts
some aspects of the language making it "easier" to code".
  


That's my point meaning that PHP is not exactly abstracting C as other 
frameworks happen to abstract PHP.



With the description of the original PHP:
"It had Perl-like variables, automatic interpretation of form
variables and HTML embedded syntax. The syntax itself was similar to
that of Perl, albeit much more limited, simple, and somewhat
inconsistent."
  


That of course was PHP and you probably have a point.


Then surely what is described is just a way of abstracting parts of
the language to make it "easier" to code.

  


This was mentioned about a framework not PHP of course since PHP is 
abstracting parts of any other language.


--
Thodoris


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



[PHP] ssh2_tunnel

2009-02-17 Thread Gevorg Harutyunyan
Hi,

Could you please give me short sample of ssh2_tunnel usage.
The only sample that I found was manual sample and I can not understood how
it works.

-- 
Best Regards,
Gevorg Harutyunyan


Re: [PHP] Apache odd behavior

2009-02-17 Thread Virgilio Quilario
> I'm submitting a url like this:
>
> http://mysite.com/index.php/alfa/bravo/charlie/delta
>
> The index.php calls has code to decode the url segments
> (alfa/bravo/charlie/delta). It determines that the controller is alfa,
> the method is bravo, and converts charlie and delta to $_GET['charlie']
> = 'delta'. It verifies that the controller and method exist, and calls
> the controller and method.
>
> This works fine. The right controller gets called and the right method,
> and the GET parameter looks like it should. The method sets some
> variables and then calls a render() function to render the page, which
> is in the doc root of the site.
>
> The page does get rendered, but without the stylesheet, and none of the
> graphics show up. Why? Because, according to the logs, Apache appears to
> be looking for the images and everything else in the directory
> index.php/alfa/bravo/charlie/delta, which of course doesn't exist.
>
> No, I don't have an .htaccess file with RewriteEngine on. Apache figures
> out that index.php is the file to look for in the original URL, but
> can't figure out that everything else is relative to that file, not the
> entire URL.
>
> This method is in use in at least one other MVC framework. What am I
> doing wrong?
>

hi Paul,

to make your css and images work, do something like this



and



the slash at the start tells the browser to start looking from the root.

good luck.

Virgil
http://www.jampmark.com

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



Re: [PHP] XSLTProcessor help

2009-02-17 Thread Siegfried Gipp
On Monday, 16. February 2009 11:49:23 Tom Sparks wrote:
> help, when I include 
> the XSLTProcessor only strips the XML tags and outputs the text see result

That is the xsl default behaviour. You need templates to do anything other 
with xml elements than just digging deeper.

This is somewhat like a built-in default template. For example you may think 
of this template as beeing built-in (until you write your own):




And for text (and attributes) you have something like this as "built-inb":




Additionaly, sometimes, if you _don't_ want that default behaviour on standard 
text, you need a template for this. So to avoid getting arbitrary text, you 
could add a template like this:



You may add this template to just copy the elements:






Sometimes this is called the "identity copy" or "identity template". I hope 
i'm correct here, just cited from memory :)



signature.asc
Description: This is a digitally signed message part.


Re: [PHP] Apache odd behavior

2009-02-17 Thread Stuart
2009/2/17 Paul M Foster :
> On Mon, Feb 16, 2009 at 08:34:22PM +, Stuart wrote:
>
> 
>
>> This is your problem, you're not understanding where the paths are
>> being resolved. Apache has absolutely no involvement in resolving
>> relative paths in your HTML files to absolute URLs. The browser does
>> this. All you need to do is use absolute URLs and everything will work
>> fine. By absolute, in case you don't know, I mean starting with a /
>> and being "from" the document root in the web server.
>
> FWIW, I've been doing computers since before the CP/M days
> (pre-pre-DOS), so I do know the difference between absolute and relative
> paths.

FWIW I've been "doing" computers for a long time also, and am well
aware of CP/M. Based on what you said it didn't appear that you did
know the difference, but I apologise for the mistake. I'm sure if you
look at the URLs being requested by the browser it should be pretty
clear that it's simply adding the paths you have in your HTML to the
end of the existing URL. The fact that you didn't appear to have seen
that informed my assumption.

> I'm a little doubtful about the browser specifying things like the URLs
> for links within a HTML page. However, this would explain why there are
> separate entries for image fetches in the Apache logs, occurring after
> the main page has been requested. Do you have some reference for this?
> I'd like to read more about the server-client interaction in depth.

I couldn't find any references so I wrote a quick overview of what the
process is. Note that this is over-simplified but should get the basic
process across.

* Browser connects to the HTTP server on www.google.com and requests /

* Server resolves / to a resource, commonly an HTML file, PHP script
or whatever, processes it if necessary and sends the output back to
the browser.

* Browser receives the HTML content, parses it, builds a list of
referenced URLs (images, scripts, stylesheets, etc)

* Browser normalises each referenced URL according to a fairly simple
set of rules...

If the URL is not already in the form scheme://...
If the URL does not start with a /
// The URL is relative to the current location
If current_url ends with /
URL = current_url + URL
Else
URL = dirname(current_url) + '/' + URL
Fi
Else
// The URL is absolute on the current domain
// current_domain is everything needed to hit the same 
web server,
so scheme://[[username]:passw...@]domain.com
URL = current_domain + URL
Fi
Else
// URL is already absolute, including the scheme, domain name, 
etc
Fi

* Browser then (usually) fires off a couple of threads to request the
additional URLs, renders the page and executes any scripts it
contains.

The server has absolutely no involvement in resolving referenced URLs
to complete URLs - this is all done by the browser. HTTP is stateless
to the extreme, meaning that each request gets a single resource, even
if they're done through the same connection.

Hope that makes it clearer.

>> For example, if you have a tag like arse and
>> arse.php is in the same directory as index.php you need to change it
>> to arse.
>>
>> Another example... if you have crack
>> where crack.php is in the subdirectory somedir beneath where index.php
>> is you need to change the tag to > href="/somedir/crack.php">crack.
>>
>> You need to apply this to all URLs in your code, including
>> stylesheets, images and javascript references. This should not be a
>> difficult concept to grasp, so maybe I'm not explaining it right. If
>> so please explain what you understand by what I'm saying and I can
>> alter it to be more helpful.
>
> Here's the issue I have with this: normally I build pages on the fly
> with PHP. However, on this particular project, my wife is building the
> pages in Dreamweaver. And, as I mentioned before, while in development,
> the pages reside on an internal server, like this:
>
> http://pokey/example.com
>
> That is, pokey is an internal Debian machine where all our client sites
> reside as backups in the /var/www directory. So as far as pokey is
> concerned, the pages are at:
>
> /var/www/example.com
>
> but we see it as:
>
> http://pokey/example.com
>
> Dreamweaver has a very brain dead way of handling templates, resultant
> pages, and the internal page links. And while my wife is very savvy,
> her Windows-weenie-Dreamweaver way of handling links is to click on a
> button which opens a dialog box, in which she finds the image, and
> clicks "Okay".
>
> This is all fine while the pages are on the development server. (Well,
> not really, since Dreamweaver regularly hacks up image links in
> non-intuitive ways.) But when they get uploaded to the production server

Re: [PHP] E-Mail Attachment Filename Encoding Problem

2009-02-17 Thread Richard Heyes
> Cats are the other white meat. Sorry have flu, may be delirious

You haven't been around any birds recently have you?

-- 
(A concerned) Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated February 14th)

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



Re: [PHP] Opinions Please, Describing PHP as Web Framework of C and C++

2009-02-17 Thread Virgilio Quilario
> Recently we had some serious discussion on local boards.
>
> I prefer calling PHP as Web Framework of C and C++
>
> if you had a time for this fruitless discussion. Please send your opinions.
>

PHP is a server side scripting language for the Web using a C like
language structure and conventions. The engine is built with C that is
true but it is the engine that interprets the scripts not C.
C has nothing to do with the operations of PHP engine.
It is merely a code which is used to generate machine codes for the PHP engine.

Good luck with your "fruitless" discussion as you like to call it.

Virgil
http://www.jampmark.com

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



[PHP] display_errors and error_reporting not enough?

2009-02-17 Thread Argon
Hi;
I want to enable error messages while I'm testing or developing.
I use php 5.2.4 on ubuntu server.
These two lines does only print notices.



When I make something wrong like syntax error; I get blank pages.
Is there something else which I don't know?
Here is the phpinfo();
http://77.79.86.103/phpinfo.php
Googling brings only these two and variations of error_reporting parameters.

-- 

cat


Re: [PHP] Full versus relative URLs

2009-02-17 Thread Virgilio Quilario
> Here's a question related to my last post. When specifying a link in a
> HTML file (like to the css or an image file), there are two ways of
> doing it. One is to simply include the relative path to the file
> (relative to the doc root), like:
>
> /graphics/my_portrait.gif
>
> Or you can include the full URL, like:
>
> http://example.com/graphics/my_portrait.gif
>
> My casual observation seems to indicate that the former will load faster
> than the latter. But has anyone done any benchmarking on it?
>

Hi Paul,

There is no difference in speed.
The difference is in manageability.
Copying the scripts to another domain and you're using full url for
your src and href when referring to local images or css or pages, will
give you trouble and you must change all of them to your new domain.

Virgil
http://www.jampmark.com

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



Re: [PHP] display_errors and error_reporting not enough?

2009-02-17 Thread Virgilio Quilario
> I want to enable error messages while I'm testing or developing.
> I use php 5.2.4 on ubuntu server.
> These two lines does only print notices.
>
>ini_set('display_errors', 1);
>   error_reporting(E_ALL);
> ?>
>
> When I make something wrong like syntax error; I get blank pages.
> Is there something else which I don't know?
> Here is the phpinfo();
> http://77.79.86.103/phpinfo.php
> Googling brings only these two and variations of error_reporting parameters.
>

hi,

find the errors in your apache error log.
also see "error_log" in PHP manual for details.

virgil
http://www.jampmark.com

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



Re: [PHP] display_errors and error_reporting not enough?

2009-02-17 Thread Richard Heyes
> When I make something wrong like syntax error; I get blank pages.

Because the PHP code is not running (because of the syntax error), and
thus not setting the error reporting as desired. You'll need to aither
use a .htaccess file (if you're running Apache) or make the changes in
your php.ini file (and restart your web server). Either way you won't
be able to use the constants (which you use only in a PHP script. IIRC
the correct directive would be:

error_reporting 2047

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.org (Updated February 14th)

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



[PHP] Re: PDO DBLIB does not support transaction

2009-02-17 Thread Jo�o C�ndido de Souza Neto
I´ve just solved it by myself by creating methods which executes "BEGIN 
TRANSACTION", "COMMIT TRANSACTION" and "ROLLBACK TRANSACTION" directly.


""João Cândido de Souza Neto""  escreveu na 
mensagem news:1f.00.36931.96bba...@pb1.pair.com...
> Hi,
>
> I´m using PDO dblib to connect to a MSSQL server and now I figured out 
> that this driver does not support transaction.
>
> Anyone here know any solution for this case?
>
> Thanks in advance.
> -- 
> João Cândido de Souza Neto
> 



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



[PHP] Re: ssh2_tunnel

2009-02-17 Thread Colin Guthrie

'Twas brillig, and Gevorg Harutyunyan at 17/02/09 11:55 did gyre and gimble:

Could you please give me short sample of ssh2_tunnel usage.
The only sample that I found was manual sample and I can not understood how
it works.


Not sure this is the right list for this kind of question, so perhaps 
you can give some example?


If I were to take a guess, I'd suggest something like the following.

Say you want to access an HTTP server at your office but it is behind a 
firewall. You can SSH to your office via the command "ssh 
m...@my.office.com" When inside the office you can access your webserver 
via "http://private.office.com/";.


If you wanted to access the office web server on your local machine you 
would do:


ssh -L 8080:private.office.com:80 m...@my.office.com

Then you would point your browser at:
http://localhost:8080/

And you should see your office website.

Col


--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


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



[PHP] LOOKING FOR PHP DEVELOPERS IN NYC

2009-02-17 Thread Dreamstaff

Required Qualifications:
- Bachelor's degree in Computer Science or equivalent (Desirable)
- 3+ years Web development experience (PHP, HTML, AJAX, CSS, Linux, etc.).
- 3+ years working with a web-based MVC framework
- 3+ years experience using and operating in a LAMP environment.
- 3+ years experience with data modeling and database management systems.
- Experience optimizing dynamic Web sites for search engines.
- Systems and networking experience in Linux and Windows environments.
- Understanding of cross-browser and platform compatibility requirements.
- Good problem solving, organizational, interpersonal and team skills.
- Good written and verbal communication skills. Attention to details.
- Experience with Flash/Flex development and design.

To apply for this position, please submit your resume with the subject:
PHP-NY to h...@dreamstaffing.com  

-- 
View this message in context: 
http://www.nabble.com/LOOKING-FOR-PHP-DEVELOPERS-IN-NYC-tp22058200p22058200.html
Sent from the PHP - General mailing list archive at Nabble.com.


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



Re: [PHP] Re: for the security minded web developer - secure way to login?

2009-02-17 Thread Andrew Ballard
On Tue, Feb 17, 2009 at 3:11 AM, Per Jessen  wrote:
> Colin Guthrie wrote:
>
>> I appreciate that https doesn't provide "trust" by default, but
>> ultimately that's how Joe Bloggs public has been told to deal with it
>> "look for the padlock" etc. etc. to be sure that your session is
>> secure blah blah.
>
> Yeah.  Which is probably because all of the intricacies are way beyond
> Joe Bloggs, so the issue was cut down to something about "trust".
>
>> Now with the HV certs the UI also has the company
>> name in the URL and this *is* going towards a trust infrastructure.
>
> I googled, but couldn't find anything - what are HV certificates?
>
>
> /Per
>
> --
> Per Jessen, Zürich (0.6°C)
>

Perhaps "EV" (Extended Validation) certificates? These are the ones
that get extra special treatment in the browser because the CA is
supposed to go beyond merely verifying that the URL domain matches the
certificate by making additionally validating that the certificate
belongs to a real entity whose identity they have verified. They also
cost the most.

Andrew

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



Re: [PHP] Apache odd behavior

2009-02-17 Thread Paul M Foster
On Tue, Feb 17, 2009 at 12:27:58PM +, Stuart wrote:

> 2009/2/17 Paul M Foster :
> > On Mon, Feb 16, 2009 at 08:34:22PM +, Stuart wrote:
> >
> > 
> >
> >> This is your problem, you're not understanding where the paths are
> >> being resolved. Apache has absolutely no involvement in resolving
> >> relative paths in your HTML files to absolute URLs. The browser does
> >> this. All you need to do is use absolute URLs and everything will work
> >> fine. By absolute, in case you don't know, I mean starting with a /
> >> and being "from" the document root in the web server.
> >
> > FWIW, I've been doing computers since before the CP/M days
> > (pre-pre-DOS), so I do know the difference between absolute and relative
> > paths.
> 
> FWIW I've been "doing" computers for a long time also, and am well
> aware of CP/M. Based on what you said it didn't appear that you did
> know the difference, but I apologise for the mistake. I'm sure if you
> look at the URLs being requested by the browser it should be pretty
> clear that it's simply adding the paths you have in your HTML to the
> end of the existing URL. The fact that you didn't appear to have seen
> that informed my assumption.

Well, the only way I know this is to look at the Apache logs. I was
getting a lot of 3xx and 4xx errors (which don't show up directly in the
browser), and looking at the requests, it appears that the browser is
indeed dictating the place to find images, etc., based on the odd URL.

> 
> > I'm a little doubtful about the browser specifying things like the URLs
> > for links within a HTML page. However, this would explain why there are
> > separate entries for image fetches in the Apache logs, occurring after
> > the main page has been requested. Do you have some reference for this?
> > I'd like to read more about the server-client interaction in depth.
> 
> I couldn't find any references so I wrote a quick overview of what the
> process is. Note that this is over-simplified but should get the basic
> process across.
> 
> * Browser connects to the HTTP server on www.google.com and requests /
> 
> * Server resolves / to a resource, commonly an HTML file, PHP script
> or whatever, processes it if necessary and sends the output back to
> the browser.
> 
> * Browser receives the HTML content, parses it, builds a list of
> referenced URLs (images, scripts, stylesheets, etc)
> 
> * Browser normalises each referenced URL according to a fairly simple
> set of rules...
> 
>   If the URL is not already in the form scheme://...
>   If the URL does not start with a /
>   // The URL is relative to the current location
>   If current_url ends with /
>   URL = current_url + URL
>   Else
>   URL = dirname(current_url) + '/' + URL
>   Fi
>   Else
>   // The URL is absolute on the current domain
>   // current_domain is everything needed to hit the
>   same web server,
> so scheme://[[username]:passw...@]domain.com
>   URL = current_domain + URL
>   Fi
>   Else
>   // URL is already absolute, including the scheme, domain
>   name, etc
>   Fi
> 
> * Browser then (usually) fires off a couple of threads to request the
> additional URLs, renders the page and executes any scripts it
> contains.
> 
> The server has absolutely no involvement in resolving referenced URLs
> to complete URLs - this is all done by the browser. HTTP is stateless
> to the extreme, meaning that each request gets a single resource, even
> if they're done through the same connection.
> 
> Hope that makes it clearer.

Thanks for the summary.



> >
> > So specifying absolute links might be a bit much. I'm not happy with the
> > way DW handles this stuff, but I have to strike a balance between my
> > vim-handcoding-command-line method and my wife's
> > click-and-drag-gotta-be-GUI method.
> 
> We've covered this in the other thread. I can't speak for DW since
> I've only ever used it as a text editor, and even then only when
> forced, but I would be surprised if you couldn't tell it to generate
> absolute URLs. Something I do know is that you can set it up to
> automatically deploy to a separate virtual host on your development
> server, but based on the other thread you've already made a decision
> on how to solve your problem.

I leave Dreamweaver issues to my wife. She maintains she can manually
type in the link URLs, but that's really not a good ongoing paradigm.
Now, if Dreamweaver had a config setting that said, "Make all URLs
absolute", I'd say that's the best resolution.

Paul

-- 
Paul M. Foster

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



Re: [PHP] Full versus relative URLs

2009-02-17 Thread Paul M Foster
On Tue, Feb 17, 2009 at 11:22:32AM +, Stuart wrote:

> 2009/2/17 Paul M Foster :



> 
> Maintaining identical development, staging and live environments is
> one of the key components of reliable, repeatable and streamlined
> development, testing and deployment, but if you're happy with what
> you've got then by all means continue as before. I was just offering a
> best practice suggestion that would solve your current problem and
> likely some you'll encounter in the future.

All agreed. That is the safest alternative. Will I do it that way? Not
so much. Yes, I know I reap the consequences.



> 
> Most DHCP servers can reserve an IP address for a specific MAC address
> such that that IP always gets given to that NIC.

Actually, that's what happens in this case. But I could change that IP
one day and forget to hack the hosts file. I prefer to treat it as
non-fixed.



> 
> > Really, Stuart, you should try not to be so annoyed at people who don't
> > appear to know as much as you believe you do. ;-}
> 
> I'm not annoyed, I'm mildly frustrated. You did not respond to my
> initial suggestion in the other thread but continued to discuss the
> problem with others. I apologise if my tone came across as annoyed,
> but it's polite to respond to others when they communicate with you.

All this because I didn't answer you on another thread? Wow. I typically
don't reply to suggestions whose nature I'm already aware of as an
alternative. Sorry about that.

Paul

-- 
Paul M. Foster

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



Re: [PHP] XSLTProcessor help

2009-02-17 Thread Tom Sparks
I have stopped XSLT from rendering out all the text
but I am no further a long getting XSL stylescript  to work
I have been reading w3schools (http://www.w3schools.com/xsl/default.asp )
and XML 1.1 bible 3rd edition ( 
http://www.amazon.com/XML-Bible-Elliotte-Rusty-Harold/dp/0764549863 )
I am at a lost still!!
--cut here--

http://www.w3.org/1999/XSL/Transform";>






vehicle: 



vehicle: 





---cut here--

 tom_a_sparks


Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html





From: Siegfried Gipp 
To: php-general@lists.php.net
Sent: Tuesday, 17 February, 2009 10:12:11 PM
Subject: Re: [PHP] XSLTProcessor help


On Monday, 16. February 2009 11:49:23 Tom Sparks wrote:
> help, when I include 
> the XSLTProcessor only strips the XML tags and outputs the text see result
That is the xsl default behaviour. You need templates to do anything other with 
xml elements than just digging deeper.
This is somewhat like a built-in default template. For example you may think of 
this template as beeing built-in (until you write your own):



And for text (and attributes) you have something like this as "built-inb":



Additionaly, sometimes, if you _don't_ want that default behaviour on standard 
text, you need a template for this. So to avoid getting arbitrary text, you 
could add a template like this:

You may add this template to just copy the elements:





Sometimes this is called the "identity copy" or "identity template". I hope i'm 
correct here, just cited from memory :)


  Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find out 
more

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



Re: [PHP] Apache odd behavior

2009-02-17 Thread Stuart
2009/2/17 Paul M Foster :
> Well, the only way I know this is to look at the Apache logs. I was
> getting a lot of 3xx and 4xx errors (which don't show up directly in the
> browser), and looking at the requests, it appears that the browser is
> indeed dictating the place to find images, etc., based on the odd URL.

If you don't already have it get Firefox. Once you have that google
for the livehttpheaders extension. Using that you can see exactly what
the browser is asking the server for, including all headers.

-Stuart

-- 
http://stut.net/

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



Re: [PHP] Re: ssh2_tunnel

2009-02-17 Thread Jochem Maas
Colin Guthrie schreef:
> 'Twas brillig, and Gevorg Harutyunyan at 17/02/09 11:55 did gyre and
> gimble:

lol.

>> Could you please give me short sample of ssh2_tunnel usage.
>> The only sample that I found was manual sample and I can not
>> understood how
>> it works.
> 
> Not sure this is the right list for this kind of question, so perhaps
> you can give some example?
> 

http://php.net/ssl2_tunnel

it's a php function :-)
and I don't think the docs can explain it's usage any more simply
than they do .. if someone doesn't grok it they need to STFW and
learn what ssh tunnelling is (or wait until you explain it :-)).

> If I were to take a guess, I'd suggest something like the following.
> 
> Say you want to access an HTTP server at your office but it is behind a
> firewall. You can SSH to your office via the command "ssh
> m...@my.office.com" When inside the office you can access your webserver
> via "http://private.office.com/";.
> 
> If you wanted to access the office web server on your local machine you
> would do:
> 
> ssh -L 8080:private.office.com:80 m...@my.office.com
> 
> Then you would point your browser at:
> http://localhost:8080/
> 
> And you should see your office website.
> 
> Col
> 
> 


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



Re: [PHP] Full versus relative URLs

2009-02-17 Thread Michael A. Peters

Virgilio Quilario wrote:

> The difference is in manageability.
> Copying the scripts to another domain and you're using full url for
> your src and href when referring to local images or css or pages, will
> give you trouble and you must change all of them to your new domain.

which takes about 3 seconds to do with sed.

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



[PHP] PHP AS an FTP server

2009-02-17 Thread Michael Kubler

Hi,
This is probably a bit stupid, but I've been having issues getting any 
of the good FTP servers running on my Ubuntu 6.06 (LTS) box.
I've tried Pro-FTP, Pure-FTP, and briefly installed some others, but the 
versions available for my distro don't seem to support MySQL (or I'm 
simply doing something wrong).


Anyway, I had the thought that the FTP server won't be used much, as I 
mainly use SSH, however I need to be able to give other people access, 
which is why I'm wondering if there are any PHP scripts that can be used 
AS an FTP server. That is, I'd setup Apache to accept on the standard 
FTP port(s), and get it to point everything to a PHP script, which I 
could then use to pull user/pass details each of which would have their 
own directories, allowing each user to access a sym-link to their 
domain(s) log file, website directory, and anything else.


Has someone already got a script that does this (at least accepting FTP 
connections), or is this a crazy idea that's just not possible?
Should I just compile the latest version of some FTP server, and try and 
configure that to do what I want instead?


Thanks.
--

Michael Kubler
*G*rey *P*hoenix *P*roductions 



Re: [PHP] PHP AS an FTP server

2009-02-17 Thread Thodoris



Hi,
This is probably a bit stupid, but I've been having issues getting any 
of the good FTP servers running on my Ubuntu 6.06 (LTS) box.
I've tried Pro-FTP, Pure-FTP, and briefly installed some others, but 
the versions available for my distro don't seem to support MySQL (or 
I'm simply doing something wrong).


AFAIK in most distros the ftp servers come without mysql (or database) 
authentication support. If this is what is happening in your case you 
need to compile the ftp server from source adding a configuration time 
option to enable the database support.




Anyway, I had the thought that the FTP server won't be used much, as I 
mainly use SSH, however I need to be able to give other people access, 
which is why I'm wondering if there are any PHP scripts that can be 
used AS an FTP server. That is, I'd setup Apache to accept on the 
standard FTP port(s), and get it to point everything to a PHP script, 
which I could then use to pull user/pass details each of which would 
have their own directories, allowing each user to access a sym-link to 
their domain(s) log file, website directory, and anything else.


In case you have ssh enabled you may use the sftp subsystem that openssh 
supports if it fits your needs. It's more secure than plain ftp but you 
still have to add local user accounts which is a bad idea imo.


You may use PHP to upload files using the http (and not the ftp) 
protocol by making a project that authenticates the user provides him 
the ability to upload, delete and download files using forms.


There has to be something already written that implements such a 
procedure in case you don't want to code this by yourself. You may 
google to find whatever fits your needs.




Has someone already got a script that does this (at least accepting 
FTP connections), or is this a crazy idea that's just not possible?
Should I just compile the latest version of some FTP server, and try 
and configure that to do what I want instead?


I suggest that since you need ftp access it would be much better if you 
could configure an ftp server instead of writing something on your own.
The vsftp daemon is a good solution to your problem written including 
advanced security features but I don't know  if it supports mysql 
authentication. On the other hand pro-ftpd does support modular 
authentication (mysql, ldap etc) if you compile the proper module.




Thanks.


--
Thodoris


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



Re: [PHP] display_errors and error_reporting not enough?

2009-02-17 Thread Thodoris



When I make something wrong like syntax error; I get blank pages.



Because the PHP code is not running (because of the syntax error), and
thus not setting the error reporting as desired. You'll need to aither
use a .htaccess file (if you're running Apache) or make the changes in
your php.ini file (and restart your web server). Either way you won't
be able to use the constants (which you use only in a PHP script. IIRC
the correct directive would be:

error_reporting 2047

  


In other words try to set:
display_errors=On
error_reporting = E_ALL

in your php.ini which is:
/etc/php5/apache2/php.ini

As far as I can see from you phpinfo page.

So that you don't need to set it in every script during runtime as you 
mentioned.


--
Thodoris



Re: [PHP] Full versus relative URLs

2009-02-17 Thread Lewis Wright
But that's where mistakes are often made. It also means you need to
maintain a different live version to that of your development version.
If find it much easier to have relative paths and then there's no
build process needed to go live, I can just upload it.

2009/2/17 Michael A. Peters :
> Virgilio Quilario wrote:
>
>> The difference is in manageability.
>> Copying the scripts to another domain and you're using full url for
>> your src and href when referring to local images or css or pages, will
>> give you trouble and you must change all of them to your new domain.
>
> which takes about 3 seconds to do with sed.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP] display_errors and error_reporting not enough?

2009-02-17 Thread Jim Lucas
Thodoris wrote:
> 
>>> When I make something wrong like syntax error; I get blank pages.
>>> 
>>
>> Because the PHP code is not running (because of the syntax error), and
>> thus not setting the error reporting as desired. You'll need to aither
>> use a .htaccess file (if you're running Apache) or make the changes in
>> your php.ini file (and restart your web server). Either way you won't
>> be able to use the constants (which you use only in a PHP script. IIRC
>> the correct directive would be:
>>
>> error_reporting 2047
>>
>>   
> 
> In other words try to set:
> display_errors=On
> error_reporting = E_ALL
> 
> in your php.ini which is:
> /etc/php5/apache2/php.ini
> 
> As far as I can see from you phpinfo page.
> 
> So that you don't need to set it in every script during runtime as you
> mentioned.
> 

I would look at doing this only for a testing area, but not for a production 
area.

If they are one in the same, then you could setup to different sub domains, one 
for testing and one for production.

They can point to the same DOCUMENT_ROOT for that matter, just have different 
running configurations.

-- 
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] Full versus relative URLs

2009-02-17 Thread Jim Lucas
Lewis Wright wrote:
> But that's where mistakes are often made. It also means you need to
> maintain a different live version to that of your development version.
> If find it much easier to have relative paths and then there's no
> build process needed to go live, I can just upload it.
> 
> 2009/2/17 Michael A. Peters :
>> Virgilio Quilario wrote:
>>
>>> The difference is in manageability.
>>> Copying the scripts to another domain and you're using full url for
>>> your src and href when referring to local images or css or pages, will
>>> give you trouble and you must change all of them to your new domain.
>> which takes about 3 seconds to do with sed.
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> 

for that matter, you could use variables to specify the relative path to make 
it absolute within each of the production and dev environments.

-- 
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

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



[PHP] php cli memory leak error

2009-02-17 Thread Thodoris

Hi gang,
   I am trying to run a simple PHP script using the cli and I get a 
weird memory leak error. The script goes like this:


#! /usr/local/bin/php


The problem is that when I run the script I get this error:
Script:  './bcom.php'
/usr/ports/lang/php5/work/php-5.2.8/main/main.c(2015) :  Freeing 
0x2871F2A8 (43 bytes), script=./bcom.php

=== Total 1 memory leaks detected ===

This is hosted on a FreeBSD 7 machine with:
PHP 5.2.8 with Suhosin-Patch 0.9.6.3 (cli)

Anyone knows what is happening ??
I have to mention that the array is printed as expected.

--
Thodoris


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



Re: [PHP] Full versus relative URLs

2009-02-17 Thread Thodoris



I know it's been said before, but beware of relying on this value just
for the sole purpose of deciding where things are located, as without a
bit of error checking on it, it can be used for injection attacks and
what-not, although, sadly, I forget the exact post recently that had the
link that explained this issue on PHP_SELF.




Alternatively, $_SERVER['PHP_SELF']) could be switch()ed for known
values, and $path be set accordingly with hardcoded values.

  

Didn't notice this thread passing from the list. I will look into it.

But sometimes you need to detect where something is located and that's 
the point of the whole conversation. If you hardcode the values then you 
need to change them while renaming or moving files and directories


So what someone should do to accomplish such a behavior? Without being 
vulnerable to injection attacks of course.


--
Thodoris



Re: [PHP] PHP AS an FTP server

2009-02-17 Thread APseudoUtopia
On Tue, Feb 17, 2009 at 10:53 AM, Michael Kubler  wrote:
> Hi,
> This is probably a bit stupid, but I've been having issues getting any of
> the good FTP servers running on my Ubuntu 6.06 (LTS) box.
> I've tried Pro-FTP, Pure-FTP, and briefly installed some others, but the
> versions available for my distro don't seem to support MySQL (or I'm simply
> doing something wrong).
>
> Anyway, I had the thought that the FTP server won't be used much, as I
> mainly use SSH, however I need to be able to give other people access, which
> is why I'm wondering if there are any PHP scripts that can be used AS an FTP
> server. That is, I'd setup Apache to accept on the standard FTP port(s), and
> get it to point everything to a PHP script, which I could then use to pull
> user/pass details each of which would have their own directories, allowing
> each user to access a sym-link to their domain(s) log file, website
> directory, and anything else.
>
> Has someone already got a script that does this (at least accepting FTP
> connections), or is this a crazy idea that's just not possible?
> Should I just compile the latest version of some FTP server, and try and
> configure that to do what I want instead?
>
> Thanks.
> --
>

Although possible, that's probably not a good idea for numerous reasons.

I'd strongly recommend using vsFTPd. I've used it for years and never
had any problem with it.
http://vsftpd.beasts.org

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



Re: [PHP] Full versus relative URLs

2009-02-17 Thread Thodoris





for that matter, you could use variables to specify the relative path to make 
it absolute within each of the production and dev environments.

  


Another possible solution I can think is building configuration files 
that could include the paths and parse them to find the path every time 
you need it. This conf files would be different between the two machines 
and you will only need to upload the source files without consideration 
since the directories will actually inside the conf files.


A database table that would store the paths could always be an 
alternative that you could perhaps load into the session to avoid overhead.


--
Thodoris



[PHP] Re: XSLTProcessor help

2009-02-17 Thread Colin Guthrie

'Twas brillig, and Tom Sparks at 17/02/09 15:17 did gyre and gimble:

I have stopped XSLT from rendering out all the text
but I am no further a long getting XSL stylescript  to work
I have been reading w3schools (http://www.w3schools.com/xsl/default.asp )
and XML 1.1 bible 3rd edition ( 
http://www.amazon.com/XML-Bible-Elliotte-Rusty-Harold/dp/0764549863 )
I am at a lost still!!


It looks more or less OK to me...

Infact I tried it via the command line:

My XML:

Hellooo


The XSL is yours from the previous post:

$ xsltproc test.xsl test.xml




vehicle: Hellooo


vehicle: Hellooo


Works fine.

Are you sure you are not doing something odd in the calling code? e.g. 
make sure you are calling transformToXML() properly. Perhaps slap all 
your files somewhere so we can download and test for you.


Col

--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


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



Re: [PHP] display_errors and error_reporting not enough?

2009-02-17 Thread Thodoris



Thodoris wrote:
  

When I make something wrong like syntax error; I get blank pages.



Because the PHP code is not running (because of the syntax error), and
thus not setting the error reporting as desired. You'll need to aither
use a .htaccess file (if you're running Apache) or make the changes in
your php.ini file (and restart your web server). Either way you won't
be able to use the constants (which you use only in a PHP script. IIRC
the correct directive would be:

error_reporting 2047

  
  

In other words try to set:
display_errors=On
error_reporting = E_ALL

in your php.ini which is:
/etc/php5/apache2/php.ini

As far as I can see from you phpinfo page.

So that you don't need to set it in every script during runtime as you
mentioned.




I would look at doing this only for a testing area, but not for a production 
area.

If they are one in the same, then you could setup to different sub domains, one 
for testing and one for production.

They can point to the same DOCUMENT_ROOT for that matter, just have different 
running configurations.

  


Totally agree on that since Jim has a very good point.

You shouldn't leave error reporting active in a production domain 
because it reveals a great deal of information about your code making 
you site vulnerable to attacks.

I suggested that assuming it is a testing-development domain.

The less someone knows about how things work the more secure your site 
becomes.


--
Thodoris



Re: [PHP] php cli memory leak error

2009-02-17 Thread Jim Lucas
Thodoris wrote:
> Hi gang,
>I am trying to run a simple PHP script using the cli and I get a
> weird memory leak error. The script goes like this:
> 
> #! /usr/local/bin/php
>  // Get command line options
> $options = getopt("f:d:o:");
> 
> // Print them out
> print_r($options);
> 
> // Clear the array
> unset($options);
> ?>
> 
> The problem is that when I run the script I get this error:
> Script:  './bcom.php'
> /usr/ports/lang/php5/work/php-5.2.8/main/main.c(2015) :  Freeing
> 0x2871F2A8 (43 bytes), script=./bcom.php
> === Total 1 memory leaks detected ===
> 
> This is hosted on a FreeBSD 7 machine with:
> PHP 5.2.8 with Suhosin-Patch 0.9.6.3 (cli)
> 
> Anyone knows what is happening ??
> I have to mention that the array is printed as expected.
> 

how are you call it?  What arguments are you passing?  etc...

Show us your command line params...

-- 
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] php cli memory leak error

2009-02-17 Thread Thodoris



Thodoris wrote:
  

Hi gang,
   I am trying to run a simple PHP script using the cli and I get a
weird memory leak error. The script goes like this:

#! /usr/local/bin/php


The problem is that when I run the script I get this error:
Script:  './bcom.php'
/usr/ports/lang/php5/work/php-5.2.8/main/main.c(2015) :  Freeing
0x2871F2A8 (43 bytes), script=./bcom.php
=== Total 1 memory leaks detected ===

This is hosted on a FreeBSD 7 machine with:
PHP 5.2.8 with Suhosin-Patch 0.9.6.3 (cli)

Anyone knows what is happening ??
I have to mention that the array is printed as expected.




how are you call it?  What arguments are you passing?  etc...

Show us your command line params...

  


I am calling it from the command line like this:

./bcom.php -f test -d test -o test

:-)

But it really doesn't matter because it seems to leak even when calling 
it without passing options.


--
Thodoris



Re: [PHP] E-Mail Attachment Filename Encoding Problem

2009-02-17 Thread Bastien Koert
On Tue, Feb 17, 2009 at 7:28 AM, Richard Heyes  wrote:

> > Cats are the other white meat. Sorry have flu, may be delirious
>
> You haven't been around any birds recently have you?
>
> --
> (A concerned) Richard Heyes
>
> HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
> http://www.rgraph.org (Updated February 14th)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Never met a pussy I didn't like :-P

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Opinions Please, Describing PHP as Web Framework of C and C++

2009-02-17 Thread Shawn McKenzie
Virgilio Quilario wrote:
>> Recently we had some serious discussion on local boards.
>>
>> I prefer calling PHP as Web Framework of C and C++
>>
>> if you had a time for this fruitless discussion. Please send your opinions.
>>
> 
> PHP is a server side scripting language for the Web using a C like
> language structure and conventions. The engine is built with C that is
> true but it is the engine that interprets the scripts not C.
> C has nothing to do with the operations of PHP engine.
> It is merely a code which is used to generate machine codes for the PHP 
> engine.
> 
> Good luck with your "fruitless" discussion as you like to call it.
> 
> Virgil
> http://www.jampmark.com

I prefer calling C and C++ as Framework of Assembly language.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Opinions Please, Describing PHP as Web Framework of C and C++

2009-02-17 Thread Thodoris



Virgilio Quilario wrote:
  

Recently we had some serious discussion on local boards.

I prefer calling PHP as Web Framework of C and C++

if you had a time for this fruitless discussion. Please send your opinions.

  

PHP is a server side scripting language for the Web using a C like
language structure and conventions. The engine is built with C that is
true but it is the engine that interprets the scripts not C.
C has nothing to do with the operations of PHP engine.
It is merely a code which is used to generate machine codes for the PHP engine.

Good luck with your "fruitless" discussion as you like to call it.

Virgil
http://www.jampmark.com



I prefer calling C and C++ as Framework of Assembly language.

  


Hahaha that was a good one Shawn. I almost fall of the chair :-) .

--
Thodoris



Re: [PHP] php cli memory leak error

2009-02-17 Thread Jim Lucas
Thodoris wrote:
> 
>> Thodoris wrote:
>>  
>>> Hi gang,
>>>I am trying to run a simple PHP script using the cli and I get a
>>> weird memory leak error. The script goes like this:
>>>
>>> #! /usr/local/bin/php
>>> >> // Get command line options
>>> $options = getopt("f:d:o:");
>>>
>>> // Print them out
>>> print_r($options);
>>>
>>> // Clear the array
>>> unset($options);
>>> ?>
>>>
>>> The problem is that when I run the script I get this error:
>>> Script:  './bcom.php'
>>> /usr/ports/lang/php5/work/php-5.2.8/main/main.c(2015) :  Freeing
>>> 0x2871F2A8 (43 bytes), script=./bcom.php
>>> === Total 1 memory leaks detected ===
>>>
>>> This is hosted on a FreeBSD 7 machine with:
>>> PHP 5.2.8 with Suhosin-Patch 0.9.6.3 (cli)
>>>
>>> Anyone knows what is happening ??
>>> I have to mention that the array is printed as expected.
>>>
>>> 
>>
>> how are you call it?  What arguments are you passing?  etc...
>>
>> Show us your command line params...
>>
>>   
> 
> I am calling it from the command line like this:
> 
> ./bcom.php -f test -d test -o test
> 
> :-)
> 
> But it really doesn't matter because it seems to leak even when calling
> it without passing options.
> 

seems to work fine here.

What are your php.ini (memory related) settings?

run:

/usr/local/bin/php --ini

and get the location of the php.ini file that is getting used.  Check our the 
memory settings in that file.



-- 
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] Opinions Please, Describing PHP as Web Framework of C and C++

2009-02-17 Thread Robert Cummings
On Tue, 2009-02-17 at 21:05 +0200, Thodoris wrote:
> > Virgilio Quilario wrote:
> >   
> >>> Recently we had some serious discussion on local boards.
> >>>
> >>> I prefer calling PHP as Web Framework of C and C++
> >>>
> >>> if you had a time for this fruitless discussion. Please send your 
> >>> opinions.
> >>>
> >>>   
> >> PHP is a server side scripting language for the Web using a C like
> >> language structure and conventions. The engine is built with C that is
> >> true but it is the engine that interprets the scripts not C.
> >> C has nothing to do with the operations of PHP engine.
> >> It is merely a code which is used to generate machine codes for the PHP 
> >> engine.
> >>
> >> Good luck with your "fruitless" discussion as you like to call it.
> >>
> >> Virgil
> >> http://www.jampmark.com
> >> 
> >
> > I prefer calling C and C++ as Framework of Assembly language.
> >
> >   
> 
> Hahaha that was a good one Shawn. I almost fall of the chair :-) .

What's so funny? Assembly is just a framework for microcode.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] Opinions Please, Describing PHP as Web Framework of C and C++

2009-02-17 Thread Jim Lucas
Robert Cummings wrote:
> On Tue, 2009-02-17 at 21:05 +0200, Thodoris wrote:
>>> Virgilio Quilario wrote:
>>>   
> Recently we had some serious discussion on local boards.
>
> I prefer calling PHP as Web Framework of C and C++
>
> if you had a time for this fruitless discussion. Please send your 
> opinions.
>
>   
 PHP is a server side scripting language for the Web using a C like
 language structure and conventions. The engine is built with C that is
 true but it is the engine that interprets the scripts not C.
 C has nothing to do with the operations of PHP engine.
 It is merely a code which is used to generate machine codes for the PHP 
 engine.

 Good luck with your "fruitless" discussion as you like to call it.

 Virgil
 http://www.jampmark.com
 
>>> I prefer calling C and C++ as Framework of Assembly language.
>>>
>>>   
>> Hahaha that was a good one Shawn. I almost fall of the chair :-) .
> 
> What's so funny? Assembly is just a framework for microcode.
> 
> Cheers,
> Rob.

So, what is the level that actually polarizes the sectors on the hard drive?

Anything more abstract then that is then an API right?

-- 
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

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



RE: [PHP] Opinions Please, Describing PHP as Web Framework of C and C++

2009-02-17 Thread Boyd, Todd M.
> -Original Message-
> From: Jim Lucas [mailto:li...@cmsws.com]
> Sent: Tuesday, February 17, 2009 1:14 PM
> To: Robert Cummings
> Cc: t...@kinetix.gr; Shawn McKenzie; php-general@lists.php.net
> Subject: Re: [PHP] Opinions Please, Describing PHP as Web Framework of
> C and C++
> 
> Robert Cummings wrote:
> > On Tue, 2009-02-17 at 21:05 +0200, Thodoris wrote:
> >>> Virgilio Quilario wrote:
> >>>
> > Recently we had some serious discussion on local boards.
> >
> > I prefer calling PHP as Web Framework of C and C++
> >
> > if you had a time for this fruitless discussion. Please send
your
> opinions.
> >
> >
>  PHP is a server side scripting language for the Web using a C
like
>  language structure and conventions. The engine is built with C
> that is
>  true but it is the engine that interprets the scripts not C.
>  C has nothing to do with the operations of PHP engine.
>  It is merely a code which is used to generate machine codes for
> the PHP engine.
> 
>  Good luck with your "fruitless" discussion as you like to call
it.
> 
>  Virgil
>  http://www.jampmark.com
> 
> >>> I prefer calling C and C++ as Framework of Assembly language.
> >>>
> >>>
> >> Hahaha that was a good one Shawn. I almost fall of the chair :-) .
> >
> > What's so funny? Assembly is just a framework for microcode.
> >
> > Cheers,
> > Rob.
> 
> So, what is the level that actually polarizes the sectors on the hard
> drive?
> 
> Anything more abstract then that is then an API right?

It's all just a neat wrapper for exchanging electron positions.


// Todd

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



Re: [PHP] php cli memory leak error

2009-02-17 Thread Thodoris



seems to work fine here.

What are your php.ini (memory related) settings?

run:

/usr/local/bin/php --ini

and get the location of the php.ini file that is getting used.  Check our the 
memory settings in that file.



  


Some general options:
max_input_time = 60
max_execution_time = 120
memory_limit = 128M

and the last one I have just noticed (that is why it reports the leak):

report_memleaks = On

In case I set this to Off it just stops bugging me. But is there a 
memory leak?

And if yes should I report this as a bug ?

--
Thodoris



Re: [PHP] Opinions Please, Describing PHP as Web Framework of C and C++

2009-02-17 Thread Andrew Ballard
On Tue, Feb 17, 2009 at 2:12 PM, Robert Cummings  wrote:
> On Tue, 2009-02-17 at 21:05 +0200, Thodoris wrote:
>> > Virgilio Quilario wrote:
>> >
>> >>> Recently we had some serious discussion on local boards.
>> >>>
>> >>> I prefer calling PHP as Web Framework of C and C++
>> >>>
>> >>> if you had a time for this fruitless discussion. Please send your 
>> >>> opinions.
>> >>>
>> >>>
>> >> PHP is a server side scripting language for the Web using a C like
>> >> language structure and conventions. The engine is built with C that is
>> >> true but it is the engine that interprets the scripts not C.
>> >> C has nothing to do with the operations of PHP engine.
>> >> It is merely a code which is used to generate machine codes for the PHP 
>> >> engine.
>> >>
>> >> Good luck with your "fruitless" discussion as you like to call it.
>> >>
>> >> Virgil
>> >> http://www.jampmark.com
>> >>
>> >
>> > I prefer calling C and C++ as Framework of Assembly language.
>> >
>> >
>>
>> Hahaha that was a good one Shawn. I almost fall of the chair :-) .
>
> What's so funny? Assembly is just a framework for microcode.
>
> Cheers,
> Rob.

I guess a computer would be a framework for data processing. :-)

Andrew

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



Re: [PHP] Opinions Please, Describing PHP as Web Framework of C and C++

2009-02-17 Thread Robert Cummings
On Tue, 2009-02-17 at 14:23 -0500, Andrew Ballard wrote:
> On Tue, Feb 17, 2009 at 2:12 PM, Robert Cummings  wrote:
> > On Tue, 2009-02-17 at 21:05 +0200, Thodoris wrote:
> >> > Virgilio Quilario wrote:
> >> >
> >> >>> Recently we had some serious discussion on local boards.
> >> >>>
> >> >>> I prefer calling PHP as Web Framework of C and C++
> >> >>>
> >> >>> if you had a time for this fruitless discussion. Please send your 
> >> >>> opinions.
> >> >>>
> >> >>>
> >> >> PHP is a server side scripting language for the Web using a C like
> >> >> language structure and conventions. The engine is built with C that is
> >> >> true but it is the engine that interprets the scripts not C.
> >> >> C has nothing to do with the operations of PHP engine.
> >> >> It is merely a code which is used to generate machine codes for the PHP 
> >> >> engine.
> >> >>
> >> >> Good luck with your "fruitless" discussion as you like to call it.
> >> >>
> >> >> Virgil
> >> >> http://www.jampmark.com
> >> >>
> >> >
> >> > I prefer calling C and C++ as Framework of Assembly language.
> >> >
> >> >
> >>
> >> Hahaha that was a good one Shawn. I almost fall of the chair :-) .
> >
> > What's so funny? Assembly is just a framework for microcode.
> >
> > Cheers,
> > Rob.
> 
> I guess a computer would be a framework for data processing. :-)

I think what you all are missing is that physics is just a framework for
reality.

:B

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] Opinions Please, Describing PHP as Web Framework of C and C++

2009-02-17 Thread Thodoris





What's so funny? Assembly is just a framework for microcode.

Cheers,
Rob.



So, what is the level that actually polarizes the sectors on the hard drive?

Anything more abstract then that is then an API right?

  


I guess it abstracts a level but I can hardly say that microcode is 
actually a programming language and assembly as well. Since API is a 
Programming Interface it was to do with a programming language.


So I have the feeling that the discretion is made on what it actually is 
a programming language.


On the other hand the framework is usually use to describe an 
abstraction of the same language. That is why I don't feel right saying 
that PHP is actually a C framework. But probably I feel right saying 
Zend is a PHP framework.


My problem I guess is not the abstraction itself which happens to exist 
in all software and hardware technology but what you abstract each time 
and what term you choose to use.


An example that comes in mind is about networks. You can say that the 
http protocol is a framework of underlying tcp protocol although it is 
comes as an abstraction.


--
Thodoris



[PHP] PLEASE help, this is driving me crazy - is saveHTML() etc not UTF-8 capable?

2009-02-17 Thread mike
Pardon the messy code, but I got this working like a charm. Then I
went to try it on some Russian content and it broke. The inbound was
utf-8 encoded Russian characters, output was something else
unintelligible.

I found a PHP bug from years ago that sounded related but the user had
a workaround.

Note that it does not appear that any of the functions break the
encoding - it is the ->saveHTML() that doesn't seem to work (I also
tried saveXML() and it did not work either?

I am totally up for changing out using php's DOM and using another
library, basically I just want to traverse the DOM and pick out all  and  and possibly any other external references in the
documents so I can run them through some link examination and such. I
figured I may have to fall back to a regexp, but PHP's DOM was so good
with even partial and malformed HTML, I was excited at how easy this
was...

$dom = new domDocument;
@$dom->loadHTML($string);
$dom->preserveWhiteSpace = false;
$links = $dom->getElementsByTagName('a');
foreach($links as $tag) {
$before = $tag->getAttribute('href');
$after = strip_chars($before);
$after = map_url($after);
$after = fix_link($after);
if($after != false) {
echo "\tBEFORE: $before\n";
echo "\tAFTER : $after\n\n";
$tag->removeAttribute('href');
$tag->setAttribute('href', $after);
}
}
return $dom->saveHTML();
}

I tried things like this:

new DomDocument('1.0', 'UTF-8');

as well as encoding options for $dom like $dom->encoding = 'utf-8' or
something (I tried so many variations I cannot remember anymore)

Anyone have any ideas?

As long as it can read in the string (which is and should always be
UTF-8) and spit out UTF-8, I can make sure any of my functions are
UTF-8 safe that handle the data...

Thanks

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



Re: [PHP] Opinions Please, Describing PHP as Web Framework of Cand C++

2009-02-17 Thread Shawn McKenzie
Robert Cummings wrote:
> On Tue, 2009-02-17 at 14:23 -0500, Andrew Ballard wrote:
>> On Tue, Feb 17, 2009 at 2:12 PM, Robert Cummings  
>> wrote:
>>> On Tue, 2009-02-17 at 21:05 +0200, Thodoris wrote:
> Virgilio Quilario wrote:
>
>>> Recently we had some serious discussion on local boards.
>>>
>>> I prefer calling PHP as Web Framework of C and C++
>>>
>>> if you had a time for this fruitless discussion. Please send your 
>>> opinions.
>>>
>>>
>> PHP is a server side scripting language for the Web using a C like
>> language structure and conventions. The engine is built with C that is
>> true but it is the engine that interprets the scripts not C.
>> C has nothing to do with the operations of PHP engine.
>> It is merely a code which is used to generate machine codes for the PHP 
>> engine.
>>
>> Good luck with your "fruitless" discussion as you like to call it.
>>
>> Virgil
>> http://www.jampmark.com
>>
> I prefer calling C and C++ as Framework of Assembly language.
>
>
 Hahaha that was a good one Shawn. I almost fall of the chair :-) .
>>> What's so funny? Assembly is just a framework for microcode.
>>>
>>> Cheers,
>>> Rob.
>> I guess a computer would be a framework for data processing. :-)
> 
> I think what you all are missing is that physics is just a framework for
> reality.
> 
> :B
> 
> Cheers,
> Rob.
And of course math is a framework for physics!

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Full versus relative URLs

2009-02-17 Thread PJ
Dotan Cohen wrote:
>>> So put it all in one place:
>>>
>>> >> include "path.inc";
>>> print"";
>>> ?>
>>>
>>> Full URLs don't break when users save the pages to disk.
>> That would be fine if the pages weren't being crafted in Dreamweaver,
>> where inserting links like that is a pain.
>>
>
> For that you'd have to ask on the Dreamweaver list. I don't really
> like those tools.
>
I hope I'm not out of place here, but I have a problem that seems to be
related.
I am using some include statements for page headers with the pages in
various directories on the site. The problem is this... if I put
relative statements in the page (header.php) like ../images/file.jpg and
../file.php etc, if the page into which I include header.php is not in
the top level directory, the links do not work and I have to copy
header.php to header1.php and change the references to /images otherwise
images are not displayed and links to not work in href.

e.g.:
1.  top level file books.php
include ("lib/db1.php");// Connect to database
include ("header1.php");

2. subdirectory: /authors/a.php
include "../header.php";

I thought that using referencing the top level of the directory tree
(../) would work form anywhere within the tree?
Am I the victim of my own misconceptions here?
TIA to set me straight.
-- 

Phil Jourdan --- p...@ptahhotep.com
http://www.ptahhotep.com
http://www.chiccantine.com

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



Re: [PHP] Opinions Please, Describing PHP as Web Framework of C and C++

2009-02-17 Thread Michael A. Peters

Robert Cummings wrote:



I think what you all are missing is that physics is just a framework for
reality.


I think you are missing that reality is just a construct of strawberry 
fields forever.


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



Re: [PHP] Opinions Please, Describing PHP as Web Framework of Cand C++

2009-02-17 Thread Robert Cummings
On Tue, 2009-02-17 at 13:40 -0600, Shawn McKenzie wrote:
> Robert Cummings wrote:
> > On Tue, 2009-02-17 at 14:23 -0500, Andrew Ballard wrote:
> >> On Tue, Feb 17, 2009 at 2:12 PM, Robert Cummings  
> >> wrote:
> >>> On Tue, 2009-02-17 at 21:05 +0200, Thodoris wrote:
> > Virgilio Quilario wrote:
> >
> >>> Recently we had some serious discussion on local boards.
> >>>
> >>> I prefer calling PHP as Web Framework of C and C++
> >>>
> >>> if you had a time for this fruitless discussion. Please send your 
> >>> opinions.
> >>>
> >>>
> >> PHP is a server side scripting language for the Web using a C like
> >> language structure and conventions. The engine is built with C that is
> >> true but it is the engine that interprets the scripts not C.
> >> C has nothing to do with the operations of PHP engine.
> >> It is merely a code which is used to generate machine codes for the 
> >> PHP engine.
> >>
> >> Good luck with your "fruitless" discussion as you like to call it.
> >>
> >> Virgil
> >> http://www.jampmark.com
> >>
> > I prefer calling C and C++ as Framework of Assembly language.
> >
> >
>  Hahaha that was a good one Shawn. I almost fall of the chair :-) .
> >>> What's so funny? Assembly is just a framework for microcode.
> >>>
> >>> Cheers,
> >>> Rob.
> >> I guess a computer would be a framework for data processing. :-)
> > 
> > I think what you all are missing is that physics is just a framework for
> > reality.
> > 
> > :B
> > 
> > Cheers,
> > Rob.
> And of course math is a framework for physics!

Math describes physics but doesn't implement it. UML versus the code
itself. That's not quite the same.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] Opinions Please, Describing PHP as Web Framework of C and C++

2009-02-17 Thread Robert Cummings
On Tue, 2009-02-17 at 11:48 -0800, Michael A. Peters wrote:
> Robert Cummings wrote:
> 
> > 
> > I think what you all are missing is that physics is just a framework for
> > reality.
> 
> I think you are missing that reality is just a construct of strawberry 
> fields forever.

Carl Sagan once said something like "to make an apple pie you must first
invent the universe". It follows that the invention of reality must come
before the strawberry :)

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



[PHP] function array problem

2009-02-17 Thread Ashley Sheridan
I've had a bit of a problem with a function I'm using for a form.
Essentially, the function looks like this:

function addEvent($values = Array('name' => '', 'venue' => '',
'description' => '', 'errors' => Array()))
{
// code here displays the form
}

The function is used to both display an empty form, and the form
populated with values again should there be any validation errors.

Now this works fine when the form has been filled out and there are
errors present, as I can call the function with the correct array
values. However, when I call the function with no arguments (intending
the function to populate the $values array itself) all it does is
present me with an empty array. A print_r($values) just returns
Array( ), no key values defined.

I altered the function to this:

function addEvent($values = Array())
{
if(count($values) == 0)
{
$values = Array('name' => '', 'venue' => '', 'description' =>
'', 'errors' => Array());
}
// code here displays the form
}

then all works as intended. Question is, am I being dense, or is there a
reason why this shouldn't work?


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Full versus relative URLs

2009-02-17 Thread Michael A. Peters

PJ wrote:




I hope I'm not out of place here, but I have a problem that seems to be
related.
I am using some include statements for page headers with the pages in
various directories on the site. The problem is this... if I put
relative statements in the page (header.php) like ../images/file.jpg and
../file.php etc, if the page into which I include header.php is not in
the top level directory, the links do not work and I have to copy
header.php to header1.php and change the references to /images otherwise
images are not displayed and links to not work in href.

e.g.:
1.  top level file books.php
include ("lib/db1.php");// Connect to database
include ("header1.php");

2. subdirectory: /authors/a.php
include "../header.php";

I thought that using referencing the top level of the directory tree
(../) would work form anywhere within the tree?
Am I the victim of my own misconceptions here?
TIA to set me straight.


Easy to solve.

ini_set("include_path", 
"/srv/domain/phpinclude:/srv/domain/record_include:/srv/domain/process_include");


Then just call it without path - IE

include('foo.inc');

php will first look for foo.inc in /srv/domain/phpinclude, then in 
/srv/domain/record_include, etc.


make directories for your includes, preferably outside the web root, and 
define your include path at the top of your script.


I personally don't like to have . as part of my include path, and 
relative include paths (id somedir/foo.inc) are IMHO an even worse practice.


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



Re: [PHP] Full versus relative URLs

2009-02-17 Thread Dotan Cohen
> > Alternatively, $_SERVER['PHP_SELF']) could be switch()ed for known
> > values, and $path be set accordingly with hardcoded values.
>> Didn't notice this thread passing from the list. I will look into it.
>
> But sometimes you need to detect where something is located and that's the
> point of the whole conversation. If you hardcode the values then you need to
> change them while renaming or moving files and directories
>
> So what someone should do to accomplish such a behavior? Without being
> vulnerable to injection attacks of course.
>

It's not vulnerable to injection in the sense that the attacker could
not redirect the links to his site. At a maximum he could disable the
links, but he could not redirect them. That's why I mean by hardcoded.

-- 
Dotan Cohen

http://what-is-what.com
http://gibberish.co.il

א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
ا-ب-ت-ث-ج-ح-خ-د-ذ-ر-ز-س-ش-ص-ض-ط-ظ-ع-غ-ف-ق-ك-ل-م-ن-ه‍-و-ي
А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я
а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я
ä-ö-ü-ß-Ä-Ö-Ü


Re: [PHP] Full versus relative URLs

2009-02-17 Thread Dotan Cohen
> Easy to solve.
>
> ini_set("include_path",
> "/srv/domain/phpinclude:/srv/domain/record_include:/srv/domain/process_include");
>
> Then just call it without path - IE
>
> include('foo.inc');
>
> php will first look for foo.inc in /srv/domain/phpinclude, then in
> /srv/domain/record_include, etc.
>
> make directories for your includes, preferably outside the web root, and
> define your include path at the top of your script.
>
> I personally don't like to have . as part of my include path, and relative
> include paths (id somedir/foo.inc) are IMHO an even worse practice.
>

I did not know that his was possible. Thanks!

-- 
Dotan Cohen

http://what-is-what.com
http://gibberish.co.il

א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
ا-ب-ت-ث-ج-ح-خ-د-ذ-ر-ز-س-ش-ص-ض-ط-ظ-ع-غ-ف-ق-ك-ل-م-ن-ه‍-و-ي
А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я
а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я
ä-ö-ü-ß-Ä-Ö-Ü


Re: [PHP] PHP AS an FTP server

2009-02-17 Thread Ashley Sheridan
On Tue, 2009-02-17 at 18:54 +0200, Thodoris wrote:
> > Hi,
> > This is probably a bit stupid, but I've been having issues getting any 
> > of the good FTP servers running on my Ubuntu 6.06 (LTS) box.
> > I've tried Pro-FTP, Pure-FTP, and briefly installed some others, but 
> > the versions available for my distro don't seem to support MySQL (or 
> > I'm simply doing something wrong).
> 
> AFAIK in most distros the ftp servers come without mysql (or database) 
> authentication support. If this is what is happening in your case you 
> need to compile the ftp server from source adding a configuration time 
> option to enable the database support.
> 
> >
> > Anyway, I had the thought that the FTP server won't be used much, as I 
> > mainly use SSH, however I need to be able to give other people access, 
> > which is why I'm wondering if there are any PHP scripts that can be 
> > used AS an FTP server. That is, I'd setup Apache to accept on the 
> > standard FTP port(s), and get it to point everything to a PHP script, 
> > which I could then use to pull user/pass details each of which would 
> > have their own directories, allowing each user to access a sym-link to 
> > their domain(s) log file, website directory, and anything else.
> 
> In case you have ssh enabled you may use the sftp subsystem that openssh 
> supports if it fits your needs. It's more secure than plain ftp but you 
> still have to add local user accounts which is a bad idea imo.
> 
> You may use PHP to upload files using the http (and not the ftp) 
> protocol by making a project that authenticates the user provides him 
> the ability to upload, delete and download files using forms.
> 
> There has to be something already written that implements such a 
> procedure in case you don't want to code this by yourself. You may 
> google to find whatever fits your needs.
> 
> >
> > Has someone already got a script that does this (at least accepting 
> > FTP connections), or is this a crazy idea that's just not possible?
> > Should I just compile the latest version of some FTP server, and try 
> > and configure that to do what I want instead?
> 
> I suggest that since you need ftp access it would be much better if you 
> could configure an ftp server instead of writing something on your own.
> The vsftp daemon is a good solution to your problem written including 
> advanced security features but I don't know  if it supports mysql 
> authentication. On the other hand pro-ftpd does support modular 
> authentication (mysql, ldap etc) if you compile the proper module.
> 
> >
> > Thanks.
> 
> -- 
> Thodoris
> 
> 
I used vsftp for several FTP systems at work, and bar a few problems
(errors on my part!) they work just fine. I've even got PHP talking to
various Bash scripts to manage users and permissions for the FTP, and,
touch wood, everything works well.

I wouldn't really agree that allowing local users to FTP in is a bad
idea. I'm using just that method for my systems. The users, etc are only
ever created through a web interface, which forces certain rules on
usernames, which as far as I see it, is the only problem. As long as the
vsftpd.conf file is configured correctly and securely, the whole thing
will remain pretty tight.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] function array problem

2009-02-17 Thread Bastien Koert
On Tue, Feb 17, 2009 at 3:10 PM, Ashley Sheridan
wrote:

> I've had a bit of a problem with a function I'm using for a form.
> Essentially, the function looks like this:
>
> function addEvent($values = Array('name' => '', 'venue' => '',
> 'description' => '', 'errors' => Array()))
> {
>// code here displays the form
> }
>
> The function is used to both display an empty form, and the form
> populated with values again should there be any validation errors.
>
> Now this works fine when the form has been filled out and there are
> errors present, as I can call the function with the correct array
> values. However, when I call the function with no arguments (intending
> the function to populate the $values array itself) all it does is
> present me with an empty array. A print_r($values) just returns
> Array( ), no key values defined.
>
> I altered the function to this:
>
> function addEvent($values = Array())
> {
>if(count($values) == 0)
>{
>$values = Array('name' => '', 'venue' => '', 'description' =>
> '', 'errors' => Array());
>}
>// code here displays the form
> }
>
> then all works as intended. Question is, am I being dense, or is there a
> reason why this shouldn't work?
>
>
> Ash
> www.ashleysheridan.co.uk
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

i tend to do

function addEvent($values='')
{
  if (!is_array($values))
 {
   $values = Array('name' => '', 'venue' => '', 'description' =>'',
'errors' => Array());
 }
  //rest of the code

}



-- 

Bastien

Cat, the other other white meat


Re: [PHP] function array problem

2009-02-17 Thread Ashley Sheridan
On Tue, 2009-02-17 at 15:13 -0500, Bastien Koert wrote:
> On Tue, Feb 17, 2009 at 3:10 PM, Ashley Sheridan
> wrote:
> 
> > I've had a bit of a problem with a function I'm using for a form.
> > Essentially, the function looks like this:
> >
> > function addEvent($values = Array('name' => '', 'venue' => '',
> > 'description' => '', 'errors' => Array()))
> > {
> >// code here displays the form
> > }
> >
> > The function is used to both display an empty form, and the form
> > populated with values again should there be any validation errors.
> >
> > Now this works fine when the form has been filled out and there are
> > errors present, as I can call the function with the correct array
> > values. However, when I call the function with no arguments (intending
> > the function to populate the $values array itself) all it does is
> > present me with an empty array. A print_r($values) just returns
> > Array( ), no key values defined.
> >
> > I altered the function to this:
> >
> > function addEvent($values = Array())
> > {
> >if(count($values) == 0)
> >{
> >$values = Array('name' => '', 'venue' => '', 'description' =>
> > '', 'errors' => Array());
> >}
> >// code here displays the form
> > }
> >
> > then all works as intended. Question is, am I being dense, or is there a
> > reason why this shouldn't work?
> >
> >
> > Ash
> > www.ashleysheridan.co.uk
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> i tend to do
> 
> function addEvent($values='')
> {
>   if (!is_array($values))
>  {
>$values = Array('name' => '', 'venue' => '', 'description' =>'',
> 'errors' => Array());
>  }
>   //rest of the code
> 
> }
> 
> 
> 
It's a shame really, because to me it just seems darn messy to have to
perform a check inside the function itself and initialise variables
there. Putting such initialisations inside the parentheses seems more
elegant. :(


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] function array problem

2009-02-17 Thread Andrew Ballard
On Tue, Feb 17, 2009 at 3:10 PM, Ashley Sheridan
 wrote:
> I've had a bit of a problem with a function I'm using for a form.
> Essentially, the function looks like this:
>
> function addEvent($values = Array('name' => '', 'venue' => '',
> 'description' => '', 'errors' => Array()))
> {
>// code here displays the form
> }
>
> The function is used to both display an empty form, and the form
> populated with values again should there be any validation errors.
>
> Now this works fine when the form has been filled out and there are
> errors present, as I can call the function with the correct array
> values. However, when I call the function with no arguments (intending
> the function to populate the $values array itself) all it does is
> present me with an empty array. A print_r($values) just returns
> Array( ), no key values defined.
>
> I altered the function to this:
>
> function addEvent($values = Array())
> {
>if(count($values) == 0)
>{
>$values = Array('name' => '', 'venue' => '', 'description' =>
> '', 'errors' => Array());
>}
>// code here displays the form
> }
>
> then all works as intended. Question is, am I being dense, or is there a
> reason why this shouldn't work?
>
>
> Ash
> www.ashleysheridan.co.uk
>
>

It seems to work OK for me. I typically use your altered format or the
form that Bastien posted (except I usually default the parameters to
null rather than an empty string) though.

 '', 'venue' => '',
'description' => '', 'errors' => Array()))
{
   // code here displays the form
   print_r($values);
}

addEvent();

?>


X-Powered-By: PHP/5.2.0
Content-type: text/html

Array
(
[name] =>
[venue] =>
[description] =>
[errors] => Array
(
)

)


Andrew

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



Re: [PHP] function array problem

2009-02-17 Thread Andrew Ballard
On Tue, Feb 17, 2009 at 3:29 PM, Ashley Sheridan
 wrote:
> On Tue, 2009-02-17 at 15:13 -0500, Bastien Koert wrote:
>> On Tue, Feb 17, 2009 at 3:10 PM, Ashley Sheridan
>> wrote:
>>
>> > I've had a bit of a problem with a function I'm using for a form.
>> > Essentially, the function looks like this:
>> >
>> > function addEvent($values = Array('name' => '', 'venue' => '',
>> > 'description' => '', 'errors' => Array()))
>> > {
>> >// code here displays the form
>> > }
>> >
>> > The function is used to both display an empty form, and the form
>> > populated with values again should there be any validation errors.
>> >
>> > Now this works fine when the form has been filled out and there are
>> > errors present, as I can call the function with the correct array
>> > values. However, when I call the function with no arguments (intending
>> > the function to populate the $values array itself) all it does is
>> > present me with an empty array. A print_r($values) just returns
>> > Array( ), no key values defined.
>> >
>> > I altered the function to this:
>> >
>> > function addEvent($values = Array())
>> > {
>> >if(count($values) == 0)
>> >{
>> >$values = Array('name' => '', 'venue' => '', 'description' =>
>> > '', 'errors' => Array());
>> >}
>> >// code here displays the form
>> > }
>> >
>> > then all works as intended. Question is, am I being dense, or is there a
>> > reason why this shouldn't work?
>> >
>> >
>> > Ash
>> > www.ashleysheridan.co.uk
>> >
>> >
>> > --
>> > PHP General Mailing List (http://www.php.net/)
>> > To unsubscribe, visit: http://www.php.net/unsub.php
>> >
>> >
>>
>> i tend to do
>>
>> function addEvent($values='')
>> {
>>   if (!is_array($values))
>>  {
>>$values = Array('name' => '', 'venue' => '', 'description' =>'',
>> 'errors' => Array());
>>  }
>>   //rest of the code
>>
>> }
>>
>>
>>
> It's a shame really, because to me it just seems darn messy to have to
> perform a check inside the function itself and initialise variables
> there. Putting such initialisations inside the parentheses seems more
> elegant. :(
>
>
> Ash
> www.ashleysheridan.co.uk

To each their own. I think having an array (especially nested arrays)
embedded in the parameter list of a function declaration like that
looks kind of ugly, but that's just me.

Andrew

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



Re: [PHP] function array problem

2009-02-17 Thread Ashley Sheridan
On Tue, 2009-02-17 at 15:19 -0500, Andrew Ballard wrote:
> On Tue, Feb 17, 2009 at 3:10 PM, Ashley Sheridan
>  wrote:
> > I've had a bit of a problem with a function I'm using for a form.
> > Essentially, the function looks like this:
> >
> > function addEvent($values = Array('name' => '', 'venue' => '',
> > 'description' => '', 'errors' => Array()))
> > {
> >// code here displays the form
> > }
> >
> > The function is used to both display an empty form, and the form
> > populated with values again should there be any validation errors.
> >
> > Now this works fine when the form has been filled out and there are
> > errors present, as I can call the function with the correct array
> > values. However, when I call the function with no arguments (intending
> > the function to populate the $values array itself) all it does is
> > present me with an empty array. A print_r($values) just returns
> > Array( ), no key values defined.
> >
> > I altered the function to this:
> >
> > function addEvent($values = Array())
> > {
> >if(count($values) == 0)
> >{
> >$values = Array('name' => '', 'venue' => '', 'description' =>
> > '', 'errors' => Array());
> >}
> >// code here displays the form
> > }
> >
> > then all works as intended. Question is, am I being dense, or is there a
> > reason why this shouldn't work?
> >
> >
> > Ash
> > www.ashleysheridan.co.uk
> >
> >
> 
> It seems to work OK for me. I typically use your altered format or the
> form that Bastien posted (except I usually default the parameters to
> null rather than an empty string) though.
> 
>  
> function addEvent($values = Array('name' => '', 'venue' => '',
> 'description' => '', 'errors' => Array()))
> {
>// code here displays the form
>print_r($values);
> }
> 
> addEvent();
> 
> ?>
> 
> 
> X-Powered-By: PHP/5.2.0
> Content-type: text/html
> 
> Array
> (
> [name] =>
> [venue] =>
> [description] =>
> [errors] => Array
> (
> )
> 
> )
> 
> 
> Andrew
That's quite odd then! I might have to try it on another server, could
be my main one is having a hissy fit?!


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] function array problem

2009-02-17 Thread Ashley Sheridan
On Tue, 2009-02-17 at 15:21 -0500, Andrew Ballard wrote:
> On Tue, Feb 17, 2009 at 3:29 PM, Ashley Sheridan
>  wrote:
> > On Tue, 2009-02-17 at 15:13 -0500, Bastien Koert wrote:
> >> On Tue, Feb 17, 2009 at 3:10 PM, Ashley Sheridan
> >> wrote:
> >>
> >> > I've had a bit of a problem with a function I'm using for a form.
> >> > Essentially, the function looks like this:
> >> >
> >> > function addEvent($values = Array('name' => '', 'venue' => '',
> >> > 'description' => '', 'errors' => Array()))
> >> > {
> >> >// code here displays the form
> >> > }
> >> >
> >> > The function is used to both display an empty form, and the form
> >> > populated with values again should there be any validation errors.
> >> >
> >> > Now this works fine when the form has been filled out and there are
> >> > errors present, as I can call the function with the correct array
> >> > values. However, when I call the function with no arguments (intending
> >> > the function to populate the $values array itself) all it does is
> >> > present me with an empty array. A print_r($values) just returns
> >> > Array( ), no key values defined.
> >> >
> >> > I altered the function to this:
> >> >
> >> > function addEvent($values = Array())
> >> > {
> >> >if(count($values) == 0)
> >> >{
> >> >$values = Array('name' => '', 'venue' => '', 'description' =>
> >> > '', 'errors' => Array());
> >> >}
> >> >// code here displays the form
> >> > }
> >> >
> >> > then all works as intended. Question is, am I being dense, or is there a
> >> > reason why this shouldn't work?
> >> >
> >> >
> >> > Ash
> >> > www.ashleysheridan.co.uk
> >> >
> >> >
> >> > --
> >> > PHP General Mailing List (http://www.php.net/)
> >> > To unsubscribe, visit: http://www.php.net/unsub.php
> >> >
> >> >
> >>
> >> i tend to do
> >>
> >> function addEvent($values='')
> >> {
> >>   if (!is_array($values))
> >>  {
> >>$values = Array('name' => '', 'venue' => '', 'description' =>'',
> >> 'errors' => Array());
> >>  }
> >>   //rest of the code
> >>
> >> }
> >>
> >>
> >>
> > It's a shame really, because to me it just seems darn messy to have to
> > perform a check inside the function itself and initialise variables
> > there. Putting such initialisations inside the parentheses seems more
> > elegant. :(
> >
> >
> > Ash
> > www.ashleysheridan.co.uk
> 
> To each their own. I think having an array (especially nested arrays)
> embedded in the parameter list of a function declaration like that
> looks kind of ugly, but that's just me.
> 
> Andrew
> 
You kidding? Nested arrays is what makes me get up in the morning!


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Full versus relative URLs

2009-02-17 Thread Stuart
2009/2/17 PJ :
> Dotan Cohen wrote:
 So put it all in one place:

 >>> include "path.inc";
 print"";
 ?>

 Full URLs don't break when users save the pages to disk.
>>> That would be fine if the pages weren't being crafted in Dreamweaver,
>>> where inserting links like that is a pain.
>>>
>>
>> For that you'd have to ask on the Dreamweaver list. I don't really
>> like those tools.
>>
> I hope I'm not out of place here, but I have a problem that seems to be
> related.
> I am using some include statements for page headers with the pages in
> various directories on the site. The problem is this... if I put
> relative statements in the page (header.php) like ../images/file.jpg and
> ../file.php etc, if the page into which I include header.php is not in
> the top level directory, the links do not work and I have to copy
> header.php to header1.php and change the references to /images otherwise
> images are not displayed and links to not work in href.
>
> e.g.:
> 1.  top level file books.php
> include ("lib/db1.php");// Connect to database
> include ("header1.php");
>
> 2. subdirectory: /authors/a.php
> include "../header.php";
>
> I thought that using referencing the top level of the directory tree
> (../) would work form anywhere within the tree?
> Am I the victim of my own misconceptions here?
> TIA to set me straight.

Personally I always include files relative to my current location
using the following...

include dirname(__FILE__).'/lib/db1.php';

That way it doesn't matter how INI vars are set up and I don't need to
fanny around with setting them at runtime.

-Stuart

-- 
http://stut.net/

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



Re: [PHP] function array problem

2009-02-17 Thread Lewis Wright
What about:


function addEvent($values='')
{
!is_array($values) && $values = Array('name' => '', 'venue' => '',
'description' =>'',
'errors' => Array());

 //rest of the code

}

It's nice and sort.

2009/2/17 Ashley Sheridan :
> On Tue, 2009-02-17 at 15:21 -0500, Andrew Ballard wrote:
>> On Tue, Feb 17, 2009 at 3:29 PM, Ashley Sheridan
>>  wrote:
>> > On Tue, 2009-02-17 at 15:13 -0500, Bastien Koert wrote:
>> >> On Tue, Feb 17, 2009 at 3:10 PM, Ashley Sheridan
>> >> wrote:
>> >>
>> >> > I've had a bit of a problem with a function I'm using for a form.
>> >> > Essentially, the function looks like this:
>> >> >
>> >> > function addEvent($values = Array('name' => '', 'venue' => '',
>> >> > 'description' => '', 'errors' => Array()))
>> >> > {
>> >> >// code here displays the form
>> >> > }
>> >> >
>> >> > The function is used to both display an empty form, and the form
>> >> > populated with values again should there be any validation errors.
>> >> >
>> >> > Now this works fine when the form has been filled out and there are
>> >> > errors present, as I can call the function with the correct array
>> >> > values. However, when I call the function with no arguments (intending
>> >> > the function to populate the $values array itself) all it does is
>> >> > present me with an empty array. A print_r($values) just returns
>> >> > Array( ), no key values defined.
>> >> >
>> >> > I altered the function to this:
>> >> >
>> >> > function addEvent($values = Array())
>> >> > {
>> >> >if(count($values) == 0)
>> >> >{
>> >> >$values = Array('name' => '', 'venue' => '', 'description' =>
>> >> > '', 'errors' => Array());
>> >> >}
>> >> >// code here displays the form
>> >> > }
>> >> >
>> >> > then all works as intended. Question is, am I being dense, or is there a
>> >> > reason why this shouldn't work?
>> >> >
>> >> >
>> >> > Ash
>> >> > www.ashleysheridan.co.uk
>> >> >
>> >> >
>> >> > --
>> >> > PHP General Mailing List (http://www.php.net/)
>> >> > To unsubscribe, visit: http://www.php.net/unsub.php
>> >> >
>> >> >
>> >>
>> >> i tend to do
>> >>
>> >> function addEvent($values='')
>> >> {
>> >>   if (!is_array($values))
>> >>  {
>> >>$values = Array('name' => '', 'venue' => '', 'description' =>'',
>> >> 'errors' => Array());
>> >>  }
>> >>   //rest of the code
>> >>
>> >> }
>> >>
>> >>
>> >>
>> > It's a shame really, because to me it just seems darn messy to have to
>> > perform a check inside the function itself and initialise variables
>> > there. Putting such initialisations inside the parentheses seems more
>> > elegant. :(
>> >
>> >
>> > Ash
>> > www.ashleysheridan.co.uk
>>
>> To each their own. I think having an array (especially nested arrays)
>> embedded in the parameter list of a function declaration like that
>> looks kind of ugly, but that's just me.
>>
>> Andrew
>>
> You kidding? Nested arrays is what makes me get up in the morning!
>
>
> Ash
> www.ashleysheridan.co.uk
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP] PHP AS an FTP server

2009-02-17 Thread j's php general
On Wed, Feb 18, 2009 at 4:24 AM, Ashley Sheridan
 wrote:

> I used vsftp for several FTP systems at work, and bar a few problems
> (errors on my part!) they work just fine. I've even got PHP talking to
> various Bash scripts to manage users and permissions for the FTP, and,
> touch wood, everything works well.
>
> I wouldn't really agree that allowing local users to FTP in is a bad
> idea. I'm using just that method for my systems. The users, etc are only
> ever created through a web interface, which forces certain rules on
> usernames, which as far as I see it, is the only problem. As long as the
> vsftpd.conf file is configured correctly and securely, the whole thing
> will remain pretty tight.
>
>
> Ash
> www.ashleysheridan.co.uk
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

A couple months back we were able to configure ProFTPd with MySQL
support to allow our forum users to login and upload files. Although
users login using credentials from MySQL they are somewhat chrooted to
a single user with very limited capabilities and no shell of course.

This opens up the possibility of working with the users from PHP.

With a bit of creativity this link can help you get started
http://www.howtoforge.com/proftpd_mysql_virtual_hosting

-
http://www.lampadmins.com

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



Re: [PHP] function array problem

2009-02-17 Thread Ashley Sheridan
On Tue, 2009-02-17 at 20:35 +, Lewis Wright wrote:
> What about:
> 
> 
> function addEvent($values='')
> {
> !is_array($values) && $values = Array('name' => '', 'venue' => '',
> 'description' =>'',
> 'errors' => Array());
> 
>  //rest of the code
> 
> }
> 
> It's nice and sort.
> 
> 2009/2/17 Ashley Sheridan :
> > On Tue, 2009-02-17 at 15:21 -0500, Andrew Ballard wrote:
> >> On Tue, Feb 17, 2009 at 3:29 PM, Ashley Sheridan
> >>  wrote:
> >> > On Tue, 2009-02-17 at 15:13 -0500, Bastien Koert wrote:
> >> >> On Tue, Feb 17, 2009 at 3:10 PM, Ashley Sheridan
> >> >> wrote:
> >> >>
> >> >> > I've had a bit of a problem with a function I'm using for a form.
> >> >> > Essentially, the function looks like this:
> >> >> >
> >> >> > function addEvent($values = Array('name' => '', 'venue' => '',
> >> >> > 'description' => '', 'errors' => Array()))
> >> >> > {
> >> >> >// code here displays the form
> >> >> > }
> >> >> >
> >> >> > The function is used to both display an empty form, and the form
> >> >> > populated with values again should there be any validation errors.
> >> >> >
> >> >> > Now this works fine when the form has been filled out and there are
> >> >> > errors present, as I can call the function with the correct array
> >> >> > values. However, when I call the function with no arguments (intending
> >> >> > the function to populate the $values array itself) all it does is
> >> >> > present me with an empty array. A print_r($values) just returns
> >> >> > Array( ), no key values defined.
> >> >> >
> >> >> > I altered the function to this:
> >> >> >
> >> >> > function addEvent($values = Array())
> >> >> > {
> >> >> >if(count($values) == 0)
> >> >> >{
> >> >> >$values = Array('name' => '', 'venue' => '', 'description' =>
> >> >> > '', 'errors' => Array());
> >> >> >}
> >> >> >// code here displays the form
> >> >> > }
> >> >> >
> >> >> > then all works as intended. Question is, am I being dense, or is 
> >> >> > there a
> >> >> > reason why this shouldn't work?
> >> >> >
> >> >> >
> >> >> > Ash
> >> >> > www.ashleysheridan.co.uk
> >> >> >
> >> >> >
> >> >> > --
> >> >> > PHP General Mailing List (http://www.php.net/)
> >> >> > To unsubscribe, visit: http://www.php.net/unsub.php
> >> >> >
> >> >> >
> >> >>
> >> >> i tend to do
> >> >>
> >> >> function addEvent($values='')
> >> >> {
> >> >>   if (!is_array($values))
> >> >>  {
> >> >>$values = Array('name' => '', 'venue' => '', 'description' =>'',
> >> >> 'errors' => Array());
> >> >>  }
> >> >>   //rest of the code
> >> >>
> >> >> }
> >> >>
> >> >>
> >> >>
> >> > It's a shame really, because to me it just seems darn messy to have to
> >> > perform a check inside the function itself and initialise variables
> >> > there. Putting such initialisations inside the parentheses seems more
> >> > elegant. :(
> >> >
> >> >
> >> > Ash
> >> > www.ashleysheridan.co.uk
> >>
> >> To each their own. I think having an array (especially nested arrays)
> >> embedded in the parameter list of a function declaration like that
> >> looks kind of ugly, but that's just me.
> >>
> >> Andrew
> >>
> > You kidding? Nested arrays is what makes me get up in the morning!
> >
> >
> > Ash
> > www.ashleysheridan.co.uk
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
That would make it look a little bit neater than what I already have,
might go with that.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] PLEASE help, this is driving me crazy - is saveHTML() etc not UTF-8 capable?

2009-02-17 Thread Nathan Nobbe
On Tue, Feb 17, 2009 at 12:40 PM, mike  wrote:

> Pardon the messy code, but I got this working like a charm. Then I
> went to try it on some Russian content and it broke. The inbound was
> utf-8 encoded Russian characters, output was something else
> unintelligible.
>
> I found a PHP bug from years ago that sounded related but the user had
> a workaround.
>
> Note that it does not appear that any of the functions break the
> encoding - it is the ->saveHTML() that doesn't seem to work (I also
> tried saveXML() and it did not work either?
>
> I am totally up for changing out using php's DOM and using another
> library, basically I just want to traverse the DOM and pick out all  href> and  and possibly any other external references in the
> documents so I can run them through some link examination and such. I
> figured I may have to fall back to a regexp, but PHP's DOM was so good
> with even partial and malformed HTML, I was excited at how easy this
> was...
>
>$dom = new domDocument;
>@$dom->loadHTML($string);
>$dom->preserveWhiteSpace = false;
>$links = $dom->getElementsByTagName('a');
>foreach($links as $tag) {
>$before = $tag->getAttribute('href');
>$after = strip_chars($before);
>$after = map_url($after);
>$after = fix_link($after);
>if($after != false) {
>echo "\tBEFORE: $before\n";
>echo "\tAFTER : $after\n\n";
>$tag->removeAttribute('href');
>$tag->setAttribute('href', $after);
>}
>}
>return $dom->saveHTML();
> }
>
> I tried things like this:
>
> new DomDocument('1.0', 'UTF-8');
>
> as well as encoding options for $dom like $dom->encoding = 'utf-8' or
> something (I tried so many variations I cannot remember anymore)
>
> Anyone have any ideas?
>
> As long as it can read in the string (which is and should always be
> UTF-8) and spit out UTF-8, I can make sure any of my functions are
> UTF-8 safe that handle the data...


from the manual on DOM,

*Note*: DOM extension uses UTF-8 encoding. Use
utf8_encode()and
utf8_decode()  to work
with texts in ISO-8859-1 encoding or
Iconvfor other encodings.

-nathan


[PHP] How should I ....--its a date/timestamp issue

2009-02-17 Thread Terion Miller
What are your suggestions folks on how to go about setting a date on a form
so that a user can not set a start date prior to the current days date?
I've been looking around php.net but is it a javascript thing in the
validation I should be dealing with, basically as it is I have a form and a
user can select a start date, but they should not be able to select a date
that is past, currently the start date form is a drop down (a very long drop
down) I would like to use one of those nifty calendar popups but am not sure
(aka..wasn't able to figure out) how to send the date to the db fields as
they are...
guidance on this would be great ..how would you do it?
thanks guys and gals
Terion


Re: [PHP] Full versus relative URLs

2009-02-17 Thread PJ
Michael A. Peters wrote:
> PJ wrote:
>
>>>
>> I hope I'm not out of place here, but I have a problem that seems to be
>> related.
>> I am using some include statements for page headers with the pages in
>> various directories on the site. The problem is this... if I put
>> relative statements in the page (header.php) like ../images/file.jpg and
>> ../file.php etc, if the page into which I include header.php is not in
>> the top level directory, the links do not work and I have to copy
>> header.php to header1.php and change the references to /images otherwise
>> images are not displayed and links to not work in href.
>>
>> e.g.:
>> 1.  top level file books.php
>> include ("lib/db1.php");// Connect to database
>> include ("header1.php");
>>
>> 2. subdirectory: /authors/a.php
>> include "../header.php";
>>
>> I thought that using referencing the top level of the directory tree
>> (../) would work form anywhere within the tree?
>> Am I the victim of my own misconceptions here?
>> TIA to set me straight.
> Easy to solve.
I neglected to mention, although, it must be fairly obvious that I'm
fairly new to all this ["newbie" but not virgin :-) ]
Comments below -->
> ini_set("include_path",
> "/srv/domain/phpinclude:/srv/domain/record_include:/srv/domain/process_include");
>
1. Where to I put it?
2. srv = ? domain = ? phpinclude = ? record, process... = ? server, but
like what? a url?
>
> Then just call it without path - IE
>
> include('foo.inc');
>
> php will first look for foo.inc in /srv/domain/phpinclude, then in
> /srv/domain/record_include, etc.
>
> make directories for your includes, preferably outside the web root,
> and define your include path at the top of your script.
>
> I personally don't like to have . as part of my include path, and
> relative include paths (id somedir/foo.inc) are IMHO an even worse
> practice.
What do you suggest as a better prctice?

-- 

Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com


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



Re: [PHP] function array problem

2009-02-17 Thread Shawn McKenzie
Andrew Ballard wrote:
> On Tue, Feb 17, 2009 at 3:10 PM, Ashley Sheridan
>  wrote:
>> I've had a bit of a problem with a function I'm using for a form.
>> Essentially, the function looks like this:
>>
>> function addEvent($values = Array('name' => '', 'venue' => '',
>> 'description' => '', 'errors' => Array()))
>> {
>>// code here displays the form
>> }
>>
>> The function is used to both display an empty form, and the form
>> populated with values again should there be any validation errors.
>>
>> Now this works fine when the form has been filled out and there are
>> errors present, as I can call the function with the correct array
>> values. However, when I call the function with no arguments (intending
>> the function to populate the $values array itself) all it does is
>> present me with an empty array. A print_r($values) just returns
>> Array( ), no key values defined.
>>
>> I altered the function to this:
>>
>> function addEvent($values = Array())
>> {
>>if(count($values) == 0)
>>{
>>$values = Array('name' => '', 'venue' => '', 'description' =>
>> '', 'errors' => Array());
>>}
>>// code here displays the form
>> }
>>
>> then all works as intended. Question is, am I being dense, or is there a
>> reason why this shouldn't work?
>>
>>
>> Ash
>> www.ashleysheridan.co.uk
>>
>>
> 
> It seems to work OK for me. I typically use your altered format or the
> form that Bastien posted (except I usually default the parameters to
> null rather than an empty string) though.
> 
>  
> function addEvent($values = Array('name' => '', 'venue' => '',
> 'description' => '', 'errors' => Array()))
> {
>// code here displays the form
>print_r($values);
> }
> 
> addEvent();
> 
> ?>
> 
> 
> X-Powered-By: PHP/5.2.0
> Content-type: text/html
> 
> Array
> (
> [name] =>
> [venue] =>
> [description] =>
> [errors] => Array
> (
> )
> 
> )
> 
> 
> Andrew

Works great for me also: PHP 5.2.4-2ubuntu5.5 with Suhosin-Patch 0.9.6.2


-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] How should I ....--its a date/timestamp issue

2009-02-17 Thread Paul M Foster
On Tue, Feb 17, 2009 at 03:55:16PM -0600, Terion Miller wrote:

> What are your suggestions folks on how to go about setting a date on a form
> so that a user can not set a start date prior to the current days date?
> I've been looking around php.net but is it a javascript thing in the
> validation I should be dealing with, basically as it is I have a form and a
> user can select a start date, but they should not be able to select a date
> that is past, currently the start date form is a drop down (a very long drop
> down) I would like to use one of those nifty calendar popups but am not sure
> (aka..wasn't able to figure out) how to send the date to the db fields as
> they are...
> guidance on this would be great ..how would you do it?
> thanks guys and gals
> Terion

Broadly, you're either going to have to limit their choices going in to
the form (limit the choices in the drop-down box), or validate it
afterwards and generate an error message if it's wrong.

I've never seen one of those calendar gizmos that wasn't Javascript,
except maybe for Ashley's (mentioned in another thread). And even at
that, a PHP one won't be selectable the way you want unless you put
radio buttons next to all the dates. And after all that, you'd still
have to do some pre-processing of it to limit selections to current date
and later.

Paul

-- 
Paul M. Foster

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



Re: [PHP] Full versus relative URLs

2009-02-17 Thread Michael A. Peters

PJ wrote:

Michael A. Peters wrote:

PJ wrote:


I hope I'm not out of place here, but I have a problem that seems to be
related.
I am using some include statements for page headers with the pages in
various directories on the site. The problem is this... if I put
relative statements in the page (header.php) like ../images/file.jpg and
../file.php etc, if the page into which I include header.php is not in
the top level directory, the links do not work and I have to copy
header.php to header1.php and change the references to /images otherwise
images are not displayed and links to not work in href.

e.g.:
1.  top level file books.php
include ("lib/db1.php");// Connect to database
include ("header1.php");

2. subdirectory: /authors/a.php
include "../header.php";

I thought that using referencing the top level of the directory tree
(../) would work form anywhere within the tree?
Am I the victim of my own misconceptions here?
TIA to set me straight.

Easy to solve.

I neglected to mention, although, it must be fairly obvious that I'm
fairly new to all this ["newbie" but not virgin :-) ]
Comments below -->

ini_set("include_path",
"/srv/domain/phpinclude:/srv/domain/record_include:/srv/domain/process_include");


1. Where to I put it?
2. srv = ? domain = ? phpinclude = ? record, process... = ? server, but
like what? a url?


/srv/domain/phpinclude is just an example directory path.

/var/www or /usr/www are other common examples.

If your server is Windows, I don't have any experience with how php sees 
windows file paths, but I believe it still uses a unix like forward 
slash syntax.



Then just call it without path - IE

include('foo.inc');

php will first look for foo.inc in /srv/domain/phpinclude, then in
/srv/domain/record_include, etc.

make directories for your includes, preferably outside the web root,
and define your include path at the top of your script.

I personally don't like to have . as part of my include path, and
relative include paths (id somedir/foo.inc) are IMHO an even worse
practice.

What do you suggest as a better prctice?


I make application specific directories for include files, and put all 
include files into that application specific directory (application mean 
web application). Sometimes I have more than one if it is a big web 
application.


Doing it that way allows me to include the same files with several 
webapps on the same server, lets me move the php files around etc. 
without needing to worry about moving the include files, because the 
directory where they are served from is part of the include path.


It makes upgrading web apps a lot easier - often times you can leave the 
individual php files alone, it's the include files that get updated. So 
when you are developing a new improved version of your web app, you can 
just upload the new directory to your production server and change one 
line in the actual php file (where you define the include_path) and your 
web app is updated - making it cake to roll back a week later if you 
find you need to.


Separate the pages that are actually served from the pages that are 
included. It makes a lot of things easier down the road.







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



Re: [PHP] PHP AS an FTP server

2009-02-17 Thread rwlists
I have used PureFTPd for quite some time and have had nothing but success
with features and security.  I use MySQL soon to migrate to PostgreSQL for
the authentication.  It supports quota, bandwidth throttling etc

Randall Wiggins


On Wed, 18 Feb 2009 04:37:04 +0800, "j's php general"
 wrote:
> On Wed, Feb 18, 2009 at 4:24 AM, Ashley Sheridan
>  wrote:
> 
>> I used vsftp for several FTP systems at work, and bar a few problems
>> (errors on my part!) they work just fine. I've even got PHP talking to
>> various Bash scripts to manage users and permissions for the FTP, and,
>> touch wood, everything works well.
>>
>> I wouldn't really agree that allowing local users to FTP in is a bad
>> idea. I'm using just that method for my systems. The users, etc are only
>> ever created through a web interface, which forces certain rules on
>> usernames, which as far as I see it, is the only problem. As long as the
>> vsftpd.conf file is configured correctly and securely, the whole thing
>> will remain pretty tight.
>>
>>
>> Ash
>> www.ashleysheridan.co.uk
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> 
> A couple months back we were able to configure ProFTPd with MySQL
> support to allow our forum users to login and upload files. Although
> users login using credentials from MySQL they are somewhat chrooted to
> a single user with very limited capabilities and no shell of course.
> 
> This opens up the possibility of working with the users from PHP.
> 
> With a bit of creativity this link can help you get started
> http://www.howtoforge.com/proftpd_mysql_virtual_hosting
> 
> -
> http://www.lampadmins.com
> 
>

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



Re: [PHP] Full versus relative URLs

2009-02-17 Thread PJ
Michael A. Peters wrote:
> PJ wrote:
>> Michael A. Peters wrote:
>>> PJ wrote:
>>>
 I hope I'm not out of place here, but I have a problem that seems
 to be
 related.
 I am using some include statements for page headers with the pages in
 various directories on the site. The problem is this... if I put
 relative statements in the page (header.php) like
 ../images/file.jpg and
 ../file.php etc, if the page into which I include header.php is not in
 the top level directory, the links do not work and I have to copy
 header.php to header1.php and change the references to /images
 otherwise
 images are not displayed and links to not work in href.

 e.g.:
 1.  top level file books.php
 include ("lib/db1.php");// Connect to database
 include ("header1.php");

 2. subdirectory: /authors/a.php
 include "../header.php";

 I thought that using referencing the top level of the directory tree
 (../) would work form anywhere within the tree?
 Am I the victim of my own misconceptions here?
 TIA to set me straight.
>>> Easy to solve.
>> I neglected to mention, although, it must be fairly obvious that I'm
>> fairly new to all this ["newbie" but not virgin :-) ]
>> Comments below -->
>>> ini_set("include_path",
>>> "/srv/domain/phpinclude:/srv/domain/record_include:/srv/domain/process_include");
>>>
>>>
>> 1. Where to I put it?
>> 2. srv = ? domain = ? phpinclude = ? record, process... = ? server, but
>> like what? a url?
>
> /srv/domain/phpinclude is just an example directory path.
>
> /var/www or /usr/www are other common examples.
>
> If your server is Windows, I don't have any experience with how php
> sees windows file paths, but I believe it still uses a unix like
> forward slash syntax.
my server is FreeBSD 7.0

My situation is this: I am evolving www.ptahhotep.com from pure HTML to
php-mysql-css (not an easy task for a newbie :-) )
The challenge is to set up the web site on my local server and then move
it all to my web host.
Unless I am mistaken, I am pretty sure I have no access to the setup
files for apache, mysql or anything else. So, I don't think I can use
the ini_set() function.
Therefore, I am limited to the document root & subdirectories.
So, I still don't understand how the include statement should be
formulated so that when I include a file it will be included from
anywhere in the direcctory tree.
>
>>> Then just call it without path - IE
>>>
>>> include('foo.inc');
>>>
>>> php will first look for foo.inc in /srv/domain/phpinclude, then in
>>> /srv/domain/record_include, etc.
>>>
>>> make directories for your includes, preferably outside the web root,
>>> and define your include path at the top of your script.
>>>
>>> I personally don't like to have . as part of my include path, and
>>> relative include paths (id somedir/foo.inc) are IMHO an even worse
>>> practice.
>> What do you suggest as a better prctice?
>
> I make application specific directories for include files, and put all
> include files into that application specific directory (application
> mean web application). Sometimes I have more than one if it is a big
> web application.
>
> Doing it that way allows me to include the same files with several
> webapps on the same server, lets me move the php files around etc.
> without needing to worry about moving the include files, because the
> directory where they are served from is part of the include path.
>
> It makes upgrading web apps a lot easier - often times you can leave
> the individual php files alone, it's the include files that get
> updated. So when you are developing a new improved version of your web
> app, you can just upload the new directory to your production server
> and change one line in the actual php file (where you define the
> include_path) and your web app is updated - making it cake to roll
> back a week later if you find you need to.
>
> Separate the pages that are actually served from the pages that are
> included. It makes a lot of things easier down the road.
>
>>
>
>


-- 

Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com


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



Re: [PHP] Full versus relative URLs

2009-02-17 Thread PJ
Stuart wrote:
> 2009/2/17 PJ :
>   
>> Dotan Cohen wrote:
>> 
> So put it all in one place:
>
>  include "path.inc";
> print"";
> ?>
>
> Full URLs don't break when users save the pages to disk.
>   
 That would be fine if the pages weren't being crafted in Dreamweaver,
 where inserting links like that is a pain.

 
>>> For that you'd have to ask on the Dreamweaver list. I don't really
>>> like those tools.
>>>
>>>   
>> I hope I'm not out of place here, but I have a problem that seems to be
>> related.
>> I am using some include statements for page headers with the pages in
>> various directories on the site. The problem is this... if I put
>> relative statements in the page (header.php) like ../images/file.jpg and
>> ../file.php etc, if the page into which I include header.php is not in
>> the top level directory, the links do not work and I have to copy
>> header.php to header1.php and change the references to /images otherwise
>> images are not displayed and links to not work in href.
>>
>> e.g.:
>> 1.  top level file books.php
>> include ("lib/db1.php");// Connect to database
>> include ("header1.php");
>>
>> 2. subdirectory: /authors/a.php
>> include "../header.php";
>>
>> I thought that using referencing the top level of the directory tree
>> (../) would work form anywhere within the tree?
>> Am I the victim of my own misconceptions here?
>> TIA to set me straight.
>> 
>
> Personally I always include files relative to my current location
> using the following...
>
> include dirname(__FILE__).'/lib/db1.php';
>   
Could you clarify, please? I don't understand. And example, perhaps?
my entry in books.php is

NOTE: Does it matter what
> That way it doesn't matter how INI vars are set up and I don't need to
> fanny around with setting them at runtime.
>
> -Stuart
- 

Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com


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



[PHP] SNMP Documentation and Features

2009-02-17 Thread Randall Wiggins


Has anyone here had much experience with the SNMP module?  

I started working with it a few weeks ago to find the documentation,
configuration and features lacking. I figure its a low priority module for
Zend and would like to get some help documenting things that are missing
and maybe even taking a crack at the module source if anyone has enough C
experince to dig into ucd/net snmp. 

Randall Wiggins
http://www.zonedzero.com/
 

Re: [PHP] Re: XSLTProcessor help

2009-02-17 Thread Tom Sparks
- Original Message 

From: Colin Guthrie 
Sent: Wednesday, 18 February, 2009 3:40:41 AM

'Twas brillig, and Tom Sparks at 17/02/09 15:17 did gyre and gimble:
> I have stopped XSLT from rendering out all the text
> but I am no further a long getting XSL stylescript  to work
> I have been reading w3schools (http://www.w3schools.com/xsl/default.asp )
> and XML 1.1 bible 3rd edition ( 
> http://www.amazon.com/XML-Bible-Elliotte-Rusty-Harold/dp/0764549863 )
> I am at a lost still!!

>It looks more or less OK to me...

>Infact I tried it via the command line:

>My XML:
>
>Hellooo


>The XSL is yours from the previous post:

>$ xsltproc test.xsl test.xml

>
>
>
>vehicle: Hellooo
>
>
>vehicle: Hellooo
>

>Works fine.

>Are you sure you are not doing something odd in the calling code? e.g. make 
>sure you are calling transformToXML() properly. Perhaps slap all your files 
>>somewhere so we can download and test for you.
I have no where to put it yet, it is also a semi-private

i am using XAMPP for windows specs
 + Apache 2.2.11
  + MySQL 5.1.30 (Community Server)
  + PHP 5.2.8 + PEAR (Support for PHP 4 has been discontinued)
  + PHP-Switch win32 1.0 (use "php-switch.bat" in the xampp main directory) 
  + XAMPP Control Version 2.5 from www.nat32.com
  + XAMPP Security 1.0
  + SQLite 2.8.15
  + OpenSSL 0.9.8i
  + phpMyAdmin 3.1.1
  + ADOdb 4.990
  + Mercury Mail Transport System v4.52
  + FileZilla FTP Server 0.9.29
  + Webalizer 2.01-10
  + Zend Optimizer 3.3.0 
  + eAccelerator 0.9.5.3 für PHP 5.2.8 (but not activated in the php.ini)

I have also got domi.class.php (http://domi.sourceforge.net/ )
but is not needed with the comment sections
I am calling code by vehicle.php?id=1
there is a 1.xml in ./../vehicles/ from where the php file is

the code is bellow
-cut here
Render('./../xsl/vehicle.xsl');

//   $xslDoc = new DOMDocument();
//   $xslDoc->load("./../xsl/vehicle.xsl");

//   $xmlDoc = new DOMDocument();
//   $xmlDoc->load("./../vehicles/".$id.".xml");

//   $proc = new XSLTProcessor();
//   $proc->importStylesheet($xslDoc);
//   echo $proc->transformToXML($xmlDoc);

?>
cut here

 
tom_a_sparks

Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html 


  Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find out 
more

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



Re: [PHP] Full versus relative URLs

2009-02-17 Thread Michael A. Peters

PJ wrote:


my server is FreeBSD 7.0

My situation is this: I am evolving www.ptahhotep.com from pure HTML to
php-mysql-css (not an easy task for a newbie :-) )
The challenge is to set up the web site on my local server and then move
it all to my web host.
Unless I am mistaken, I am pretty sure I have no access to the setup
files for apache, mysql or anything else. So, I don't think I can use
the ini_set() function.


I suspect it will still work - I use xen based hosting now so I have 
complete control, but ini_set worked when I used shared hosting, at 
least for setting the php include directory.


Good luck with your project.

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



[PHP] PHPers: help KDE wiki, please!

2009-02-17 Thread Dotan Cohen
KDE really needs a developer with PHP experience to sort out some
issues with their wiki:
http://aseigo.blogspot.com/2009/02/php-helper-for-userbase.html

I anyone could donate the time, KDE and myself personally would
appreciate it. Thanks!

-- 
Dotan Cohen

http://what-is-what.com
http://gibberish.co.il

א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
ا-ب-ت-ث-ج-ح-خ-د-ذ-ر-ز-س-ش-ص-ض-ط-ظ-ع-غ-ف-ق-ك-ل-م-ن-ه‍-و-ي
А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я
а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я
ä-ö-ü-ß-Ä-Ö-Ü


[PHP] PHP strategy -- pass complex parameters by value or by reference?

2009-02-17 Thread Clancy
I have a function to process a data file.  This process opens the file, and 
then calls
another function to process each entry.  This function in turn calls another 
function to
process each line of the entry.  A set of fairly complex arrays specifies how 
all the
possible types of entries and lines should be processed, and each function 
passes sections
of these arrays to the next function.

Is it better to pass the parameters by value, in which case they have to be 
copied into
yet more memory when the function is called, or to pass by reference, which I 
suspect may
involve additional overhead every time they are accessed?

And is it better to combine several specifications arrays into one more complex 
array, and
pass a single parameter, or to pass them individually as half a dozen different
parameters?

I suspect that I am probably asking a "how long is a piece of string?" type of 
question,
but are there any general rules which are applicable to this type of situation?

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



Re: [PHP] PHPers: help KDE wiki, please!

2009-02-17 Thread Chris

Dotan Cohen wrote:

KDE really needs a developer with PHP experience to sort out some
issues with their wiki:
http://aseigo.blogspot.com/2009/02/php-helper-for-userbase.html

I anyone could donate the time, KDE and myself personally would
appreciate it. Thanks!


Aren't you a php developer? ;)

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


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



Re: [PHP] How should I ....--its a date/timestamp issue

2009-02-17 Thread Ashley Sheridan
On Tue, 2009-02-17 at 17:16 -0500, Paul M Foster wrote:
> On Tue, Feb 17, 2009 at 03:55:16PM -0600, Terion Miller wrote:
> 
> > What are your suggestions folks on how to go about setting a date on a form
> > so that a user can not set a start date prior to the current days date?
> > I've been looking around php.net but is it a javascript thing in the
> > validation I should be dealing with, basically as it is I have a form and a
> > user can select a start date, but they should not be able to select a date
> > that is past, currently the start date form is a drop down (a very long drop
> > down) I would like to use one of those nifty calendar popups but am not sure
> > (aka..wasn't able to figure out) how to send the date to the db fields as
> > they are...
> > guidance on this would be great ..how would you do it?
> > thanks guys and gals
> > Terion
> 
> Broadly, you're either going to have to limit their choices going in to
> the form (limit the choices in the drop-down box), or validate it
> afterwards and generate an error message if it's wrong.
> 
> I've never seen one of those calendar gizmos that wasn't Javascript,
> except maybe for Ashley's (mentioned in another thread). And even at
> that, a PHP one won't be selectable the way you want unless you put
> radio buttons next to all the dates. And after all that, you'd still
> have to do some pre-processing of it to limit selections to current date
> and later.
> 
> Paul
> 
> -- 
> Paul M. Foster
> 
What about just accepting any date in to the system, and defaulting to
the current date if any numptys/users try to set one before?

Do something maybe like this (untested)

$userDate = strtotime($_REQUEST['date']);
$startDate = ($userDate < time())?time():$userDate;

>From there, you can use the timestamp how you wish.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] PLEASE help, this is driving me crazy - is saveHTML() etc not UTF-8 capable?

2009-02-17 Thread mike
i tried that kind of stuff - it did not seem to work.

i will try again... if anyone has any ideas i.e. "use iconv to convert
to A, then use DOM stuff, then use iconv to move it back to UTF8..."
etc. i am all ears.


On Tue, Feb 17, 2009 at 12:46 PM, Nathan Nobbe  wrote:
> On Tue, Feb 17, 2009 at 12:40 PM, mike  wrote:
>>
>> Pardon the messy code, but I got this working like a charm. Then I
>> went to try it on some Russian content and it broke. The inbound was
>> utf-8 encoded Russian characters, output was something else
>> unintelligible.
>>
>> I found a PHP bug from years ago that sounded related but the user had
>> a workaround.
>>
>> Note that it does not appear that any of the functions break the
>> encoding - it is the ->saveHTML() that doesn't seem to work (I also
>> tried saveXML() and it did not work either?
>>
>> I am totally up for changing out using php's DOM and using another
>> library, basically I just want to traverse the DOM and pick out all > href> and  and possibly any other external references in the
>> documents so I can run them through some link examination and such. I
>> figured I may have to fall back to a regexp, but PHP's DOM was so good
>> with even partial and malformed HTML, I was excited at how easy this
>> was...
>>
>>$dom = new domDocument;
>>@$dom->loadHTML($string);
>>$dom->preserveWhiteSpace = false;
>>$links = $dom->getElementsByTagName('a');
>>foreach($links as $tag) {
>>$before = $tag->getAttribute('href');
>>$after = strip_chars($before);
>>$after = map_url($after);
>>$after = fix_link($after);
>>if($after != false) {
>>echo "\tBEFORE: $before\n";
>>echo "\tAFTER : $after\n\n";
>>$tag->removeAttribute('href');
>>$tag->setAttribute('href', $after);
>>}
>>}
>>return $dom->saveHTML();
>> }
>>
>> I tried things like this:
>>
>> new DomDocument('1.0', 'UTF-8');
>>
>> as well as encoding options for $dom like $dom->encoding = 'utf-8' or
>> something (I tried so many variations I cannot remember anymore)
>>
>> Anyone have any ideas?
>>
>> As long as it can read in the string (which is and should always be
>> UTF-8) and spit out UTF-8, I can make sure any of my functions are
>> UTF-8 safe that handle the data...
>
> from the manual on DOM,
>
> Note: DOM extension uses UTF-8 encoding. Use utf8_encode() and utf8_decode()
> to work with texts in ISO-8859-1 encoding or Iconv for other encodings.
>
> -nathan
>
>

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



Re: [PHP] PHPers: help KDE wiki, please!

2009-02-17 Thread Dotan Cohen
> Aren't you a php developer? ;)
>

No, just a hobbyist who likes to tinker :)
Hopefully by this time 2011 I will be a mechanical engineer, though!

-- 
Dotan Cohen

http://what-is-what.com
http://gibberish.co.il

א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
ا-ب-ت-ث-ج-ح-خ-د-ذ-ر-ز-س-ش-ص-ض-ط-ظ-ع-غ-ف-ق-ك-ل-م-ن-ه‍-و-ي
А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я
а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я
ä-ö-ü-ß-Ä-Ö-Ü


Re: [PHP] PHP strategy -- pass complex parameters by value or by reference?

2009-02-17 Thread Daevid Vincent
Not sure if you need to worry about it so much. PHP5 does a "copy on
write" (and a default pass by reference) basically. And references are
more like unix symlinks than C pointers. 

http://us3.php.net/manual/en/language.references.php
http://bytes.com/groups/php/769586-copy-write-semantic
http://blog.libssh2.org/index.php?/archives/51-Youre-being-lied-to..html

I suspect your nested functions call overhead is more expensive than
accessing your variables/arrays and you might consider in-lining it
more.
http://www.hudzilla.org/phpbook/read.php/18_1_3

But then again, this seems to contradict this theory a bit in newer PHP
versions:
http://www.webhostingtalk.com/showthread.php?t=538076
http://www.garfieldtech.com/blog/magic-benchmarks
http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=php&lang2=php


On Wed, 2009-02-18 at 10:53 +1100, Clancy wrote:

> I have a function to process a data file.  This process opens the file, and 
> then calls
> another function to process each entry.  This function in turn calls another 
> function to
> process each line of the entry.  A set of fairly complex arrays specifies how 
> all the
> possible types of entries and lines should be processed, and each function 
> passes sections
> of these arrays to the next function.
> 
> Is it better to pass the parameters by value, in which case they have to be 
> copied into
> yet more memory when the function is called, or to pass by reference, which I 
> suspect may
> involve additional overhead every time they are accessed?
> 
> And is it better to combine several specifications arrays into one more 
> complex array, and
> pass a single parameter, or to pass them individually as half a dozen 
> different
> parameters?
> 
> I suspect that I am probably asking a "how long is a piece of string?" type 
> of question,
> but are there any general rules which are applicable to this type of 
> situation?
> 




  1   2   >