php-general Digest 10 Feb 2007 23:01:36 -0000 Issue 4619

Topics (messages 248702 through 248717):

Re: JS prompt  -> php [become 0T]
        248702 by: Ryan A
        248706 by: Colin Guthrie

Any Internal search engine in PHP?
        248703 by: Chris Carter
        248707 by: Jay Blanchard
        248710 by: tedd

Recommend a PHP Framework
        248704 by: Goh Yong Kwang
        248705 by: Miles Thompson

Re: Multi lingual pages
        248708 by: tedd

Re: base64-encoding in cookies?
        248709 by: Jon Anderson
        248717 by: Fletcher Mattox

Re: Http Client in PHP connecting to a Digest authenticated server
        248711 by: Manuel Lemos

Re: graphical form validation
        248712 by: Manuel Lemos

PHP or Bridge (card game)
        248713 by: pub
        248714 by: Stephen Johnson
        248715 by: Roman Neuhauser
        248716 by: Kenn Murrah

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Hey Colin,
Thanks for replying.

I guess this has sidelined from php a bit now... so have added a OT in the 
subject line.

Anyway, this is how I get the values from a select or a text box:

var selectBox = document.forms[0].lang;        user_input = 
selectBox.options[selectBox.selectedIndex].value;
    var textBox   = document.forms[0].sec_name;    user_section = textBox.value;

kindly show me how to get the value from a javascript prompt box, 
the force is with me but the JS DOM is from the dark side :D

Cheers!
R

Colin Guthrie <[EMAIL PROTECTED]> wrote: Ryan A wrote:
> Quick question (and hopefully a simple one)
> 
> I have a link on a page, when the client clicks that link it should
> show them a JS prompt and ask for their name (so far I have done
> this)
> 
> When they write their name, I want that data to be sent to my php
> script via AJAX (yes?) so the page does not reload or anything....
> (actually, how can i reload the page to reflect the change?)
> 
> I have googled but I see whole ajax classes and what not, I dont know
> if I am using the correct keywords or what...  you would happen to
> have a working piece of code that you could share with me.. would
> you?

You don't need any Ajax here.

All you need is to take the value entered into the js box and use normal
javascript commands to store this value in a cookie. This cookie will be
sent automatically to your PHP script the next time a user requests a
page from your server.

If you want to provide immediate visual feedback, you can use standard
DOM methods to insert the users name into the page where you want.

No need for any fancy Web 2.0 nonsense here..... move along, nothing to
see... ;)

Disclaimer: this may not work for your needs but I cannot see why not
from the info given :)

Col.

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




------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
 
---------------------------------
Everyone is raving about the all-new Yahoo! Mail beta.

--- End Message ---
--- Begin Message ---
Ryan A wrote:
> Hey Colin,
> Thanks for replying.
> 
> I guess this has sidelined from php a bit now... so have added a OT in the 
> subject line.
> 
> Anyway, this is how I get the values from a select or a text box:
> 
> var selectBox = document.forms[0].lang;        user_input = 
> selectBox.options[selectBox.selectedIndex].value;
>     var textBox   = document.forms[0].sec_name;    user_section = 
> textBox.value;
> 
> kindly show me how to get the value from a javascript prompt box, 
> the force is with me but the JS DOM is from the dark side :D


I think you just do 'var value = prompt("Give Me a Value:", "Value");'

Also, it is generally more portable to give any element that you wish to
access an id attribute in HTML and use the
document.getElementById('myid') method. This is the preferred method
(and infact libraries like prototype will give you even nicer functions
like $('myid') to do this).

PS this is is not yet touching on DOM methods ;)

Col

--- End Message ---
--- Begin Message ---
Hi,

I had been trying some search engines for internal searches within my
website. I tried google co-op which failed as the results were showing on
supplemental index. The one provided by cpanel does not show more than 2-3
URLs in results. Please advice if you know about any php based search engine
that can index my pages internally. Certainly an open source one.

Thanks,

Chris
-- 
View this message in context: 
http://www.nabble.com/Any-Internal-search-engine-in-PHP--tf3205175.html#a8900320
Sent from the PHP - General mailing list archive at Nabble.com.

--- End Message ---
--- Begin Message ---
[snip]
I had been trying some search engines for internal searches within my
website. I tried google co-op which failed as the results were showing
on
supplemental index. The one provided by cpanel does not show more than
2-3
URLs in results. Please advice if you know about any php based search
engine
that can index my pages internally. Certainly an open source one.
[/snip]

Have you tried SourceForge? They have several PHP based search engines.

--- End Message ---
--- Begin Message ---
At 4:39 AM -0800 2/10/07, Chris Carter wrote:
Hi,

I had been trying some search engines for internal searches within my
website. I tried google co-op which failed as the results were showing on
supplemental index. The one provided by cpanel does not show more than 2-3
URLs in results. Please advice if you know about any php based search engine
that can index my pages internally. Certainly an open source one.

Thanks,

Chris

Chris:

This isn't a php solution, but it works for me and it's simple:

http://sperling.com/examples/search/

hth's

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

--- End Message ---
--- Begin Message ---
Hi,

I am now mulling over writing my PHP web application from scratch or to use 
some kind of framework to organize my code.

For Java, Struts and Spring come to mind. But for PHP, there are numerous 
frameworks and I can't figure out which one to use.

I would like to describe my constraints as dictated by my server setup 
(using a free hosted account, so not a lot of flexibility):

* PHP 5
* Safe mode on
* No database (not even MySQL)
* No shell/SSH login to run commands
* Server running on Linux
* Only allowed to upload my PHP files via FTP or Web browser
* Only allowed to upload files to my account home directory, which is 
document root
* Not allowed to tweak the PHP installation

So given the above constraints, most likely I need a simple framework that
* Comes in a bunch of PHP files and classes that I can just upload together 
with my other PHP/HTML files
* No additional configuration on the server side
* No change required for the PHP installation such as PEAR installation, 
modification of php.ini or installation of extension

Any framework that fits the constraints? Let me know.

Thanks.
---
Goh Yong Kwang
Singapore
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Most frameworks rely on a dtabase, but have a look at this:

http://toys.lerdorf.com/archives/38-The-no-framework-PHP-MVC-framework.html




--- End Message ---
--- Begin Message ---
At 2:19 PM -0500 2/9/07, Robert Cummings wrote:

> Yes, of course. Maintaining such a site without rewriting urls would
be a nightmare. When I said that those sites are "redirecting" users, I was thinking about response headers.

Why do you need to rewrite URLs?

Cheers,
Rob.


Forgive me, I've seemed to have lost the direction of this thread with respect to the subject line. If what you are talking about is multilingual characters appearing in url's, then Rob is correct to question.

URL's are currently (and have been for several years) multilingual. The IDNS WG developed PUNYCODE to do 7-bit to 8-bit encoding to include all Unicode code points.

If you are running Windows/Opera 9 or Mac/Safari, you can see multilingual characters actually appear in the URL -- like this for example:

xn--w4h.com

However, for most browsers, the fear of homographic attack has forced them show PUNYCODE instead.

Cheers,

tedd

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

--- End Message ---
--- Begin Message ---
Myron Turner wrote:
Jon Anderson wrote:
Fletcher Mattox wrote:

In terms of the behavior, I think it makes total sense. The only case where it would ever bite you is yours (which is rare because most people wouldn't mix perl and PHP in the same system).

I'm not going to get into the middle of the base64 argument, but I don't think that mixing perl and php is rare. I've seen the mix occasionally crop up up this list, and I know from myself. I've been using Perl for 10 years and PHP for only 2.5. It's inevitable that I'll choose Perl for certain uses and that I'll call the Perl as cgi from pages scripted in PHP. Then there are things which I've already got written in Perl that I also call as cgi from PHP pages. Or operations that are not compiled into all installs of PHP and are standard with Perl, like fork(), and there's nothing you can do about it because you don't have control over the installation. Each language has its strengths. What's true of Perl, I think is probably true of Python as well. There are lots of programmers and web sties that must mix Python and PHP.
I should have qualified my argument. I believe that mixing languages is likely to be _relatively_ rare compared with PHP-only systems. I have absolutely no hard evidence to back that up other than my own experience - I've seen only a few hundred sites, which is obviously a very small sample next to the probably millions of sites running PHP.

Of those few hundred sites, I'm the only one that directly mixes languages that I've seen. (I'm in sort of the same boat as you - I also started out with perl about 10 years ago, and started moving on to PHP around the PHP 4.0 era. I also regularly write python and C, among others.)

jon

--- End Message ---
--- Begin Message ---
Robert Cummings writes:

> But isn't the sender and receiver usually one and the same. I mean your
> PHP application is usually what set the cookie in the first place. Then
> you receive it in the very same PHP application. 

No!  Not in this case.  The first sentence in my original message was:

        "A campus web server (not under my control) returns an
        authentication string in a cookie named AUTH."

Rob, is this why you are giving me such a hard time?  Do you think I
wrote the code which set the cookie?

The application which originated the cookie runs on a computer across
campus, and was written by our ITS department.  I work in the CS
department.  I have no access to that application.  I don't even know
which language it is written in.  Given this information, would you be
comfortable asking ITS to change their code just to make my application
happy?  I wouldn't.

> > Also, keep in mind that in my case the sender is a third party over
> > whom I have no control.  Given a spec like this, I prefer cooperation
> > between sender and receiver rather than a decision by fiat made by the
> > programming language.
> 
> Ah, so you have a mixed language environment. Well you can use the
> header() function to send the cookie header yourself. 

As I keep trying to say, I am not sending the cookie.  I do not have
that option.

> This allows you
> control over the sending. You can also use  apache_request_headers() to
> get full control over the incoming request headers.

Ah.  Interesting.  I was not aware of that function.  Thanks.

> > Oh.  One more thought.  If you wish to argue that PHP does provide
> > for both cases with $_COOKIE and $_SERVER['HTTP_COOKIE'], then I will
> 
> I'm not aware of a $_SERVER['HTTP_COOKIE'] field. Perhaps you meant
> $GLOBALS['HTTP_COOKIE_VARS']? If so, it is identical to $_COOKIE with
> $GLOBALS['HTTP_COOKIE_VARS'] being deprecated.

$_SERVER fields are dependent on your http server.  My server (apache)
provides HTTP_COOKIE.  Perhaps yours does not?

> > grudgingly agree with you.  See we can agree. :)  In that case, all I ask
> > is for a little documentation.  Is the distinction in these two variables
> > documented somewhere?  I have looked and looked and have come up empty.
> > I am asking this question with humility and sincerity.  I am asking it
> > because I honestly wish to learn.  I think you have misjudged my motives
> > and my character.
> 
> http://www.php.net/manual/en/function.header.php
> http://www.php.net/manual/en/function.apache-response-headers.php

Thanks for the pointers, but my request is for documentation of the fact
that $COOKIE has been urldecoded().  Do you know where that documentation
lives?

Say, I just noticed RFC 2965.  It essentially agrees with the Netscape
document on this matter, but it words it a little more clearly:

        The VALUE is opaque to the user agent and may be anything the
        origin server chooses to send, possibly in a server-selected
        printable ASCII encoding. 

The server is in control.  The encoding, if any, is decided by the server.
No question about it.  In my case, the server decided not to encode.

In my opinion, PHP has done me a disservice by "decoding" (corrupting)
that value, putting it in the $_COOKIE variable and then not clearly
documenting it.

Does anyone else see my point here, or am I way off base here?

Fletcher

--- End Message ---
--- Begin Message ---
Hello,

on 02/09/2007 04:49 PM Manish Marathe said the following:
> Hello,
> 
> I have seen some implementations of Server in php implementing HTTP Digest
> Authentication but I have not seen any guidelines on HTTP Client connecting
> to a specific host, and using the "realm", the username and password to get
> authenticated and thereby do something like download files etc.

Take a look at this HTTP client class:

http://www.phpclasses.org/httpclient

It supports Digest authentication via the SASL class library

http://www.phpclasses.org/sasl


-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

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

--- End Message ---
--- Begin Message ---
Hello,

on 02/08/2007 11:27 AM Ross said the following:
> Does anyone know of a form validation class available that gives
> 
> (i) feedback in a graphical way like this (the ticks and crosses)
> 
> http://forums.oscommerce.com/index.php?act=Reg&coppa_user=0&termsread=1&coppa_pass=1

Yes, you may want to try this forms generation and validation class. It
lets you assign CSS classes or styles that are used to render the inputs
when they are invalid.

http://www.phpclasses.org/formsgeneration

It may not be obvious, but you can assign invalid CSS styles that make a
custom icon appear in the input margins. Take a look at this example
page. It does not do exactly what I said but you can change the invalid
CSS style to make it work like that.

http://www.meta-language.net/forms-examples.html?example=test_form

Here you can also watch a video with audio comments explaining how it works:

http://www.phpclasses.org/browse/package/1/video/1/section/example-form.html


> (ii) Is dynamic..for example I have a checkbox
> do you own a car?. If I tick 'no' nothing happens. If I tick yes two new 
> fields ask for the year and model.

I think you can achieve this with hidden divs and some Javascript
connected to the checkbox button.

The class above has a feature named SubForm validation that can also be
helpful for this. It lets you define a sub-set of a form that is
validated depending on the submit button that is used.


> I do not mind if this is a paid class or a free but some suggestions would 
> be nice.

If you are not sure how to do it, I can help you as I am the developer
of the class. I mean I can teach you how to hook the fish, but will not
fish for you. If you need paid consultancy on this class, I can also
recommend several capable developers willing to do it.

-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

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

--- End Message ---
--- Begin Message ---
To all PHP experts,

Do any of you also know how to play bridge?
If yes, which do you think is harder to learn, PHP or bridge?

Thanks.

--- End Message ---
--- Begin Message ---
What an odd question....

Personally PHP makes much more sense to me then the many variations of
bridge...



<?php
/*

Stephen Johnson c | eh
The Lone Coder

http://www.ouradoptionblog.com
Join our journey of adoption

http://www.thelonecoder.com
[EMAIL PROTECTED]

continuing the struggle against bad code

*/ 
?>


> From: pub <[EMAIL PROTECTED]>
> Date: Sat, 10 Feb 2007 13:19:02 -0800
> To: PHP General List <php-general@lists.php.net>
> Subject: [PHP] PHP or Bridge (card game)
> 
> To all PHP experts,
> 
> Do any of you also know how to play bridge?
> If yes, which do you think is harder to learn, PHP or bridge?
> 
> Thanks.
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
# [EMAIL PROTECTED] / 2007-02-10 13:19:02 -0800:
> Do any of you also know how to play bridge?
> If yes, which do you think is harder to learn, PHP or bridge?

I don't play bridge, but both things are languages.  Presumably the one
with bigger grammar is more complicated.  But syntax is just one axis.
I guess you cannot build new cards by grouping existing ones for bridge,
it has a fixed set of words.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991

--- End Message ---
--- Begin Message ---
pub wrote:
which do you think is harder to learn, PHP or bridge?

Well, PHP *can* be a lot more complicated, but at least it's more or less predictable, and I've RARELY had a bridge partner that played the game predictably and consistently ....

kennM

--- End Message ---

Reply via email to