php-general Digest 8 Oct 2005 21:21:15 -0000 Issue 3726

Topics (messages 223759 through 223776):

Re: Global unavailable?
        223759 by: Oliver Grätz

Re: Non-Javascript PHP Onsubmit function?
        223760 by: Oliver Grätz
        223763 by: Jasper Bryant-Greene
        223775 by: Oliver Grätz

Re: Dynamic sub directory listing without redirect
        223761 by: Oliver Grätz
        223762 by: Greg Donald
        223764 by: Philip Hallstrom
        223766 by: Jim Moseby

$B"##P#C%=%U%H0BCMHNGd"#6H3&=i%7%9%F%`(B
        223765 by: ybpqwiyosg1

Re: Linux/PHP and Windows/MSSQL
        223767 by: Frank M. Kromann

Re: How do I POST data with headers & make the browser     follow?
        223768 by: Ragnar
        223769 by: Ragnar

mysqli's equivalence to mysql_result
        223770 by: The Gimper

ICQ
        223771 by: Al Hafoudh
        223772 by: Torgny Bjers
        223774 by: Niels Ganser

Does flock over nfs work with linux kernel > 2.6.12 ?
        223773 by: kyle

per user php.ini
        223776 by: James Benson

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:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
Problem not reproducable. Test case used:

-------------------------------
a.inc.php:

<?php
$a = 123;

-------------------------------
b.inc.php:

<?php
require 'a.inc.php';
class b {
     function test() {
         global $a;
         echo $a;
     }
}

-------------------------------
t.php:

<?php
require 'b.inc.php';

$x=new b();
$x->test();

-------------------------------
Command line: php t.php
Output: 123


I used PHP-5.1 RC1. No problem whatsoever. Such problems shouldn't arise
in new versions since they are touching very basic concepts that didn't
change.

AllOLLi
____________
"You see, Mr. President: The worlds hates America. And for good reason.
(I wont bother going into details)"
[24 319]

--- End Message ---
--- Begin Message ---
zzapper schrieb:
> Hi,
> I'd like to have a non-Javascript based general purpose "Are you quite Sure?" 
> PHP form submitter,
> conventionally done using the Javascript Onsubmit Event.
> 
> One way would be to store all the Form Variables in hidden fields generated 
> by a foreach $_POST 
> but anyone have anything simpler?

How about the user saying "no"? You would have to return to the form
page and repopulate the form with the data. So not storing the data in a
usable format is not an option.

Here's a dirty hack:
How about displaying the same form in a hidden DIV?
OK, that one was cruel...

A better one:
You could fetch the RAW post data and store it in the session.
Problems arise when there's more than one window open!
Use a unique ID for the form.

Best solution: Use the hidden fields!


AllOLLi

____________
Sidney: "Are you sure you don't wanna stay for dinner."
Eric: "I'd love to but... I gotta save the world."
[Alias 402]

--- End Message ---
--- Begin Message ---
Oliver Grätz wrote:
zzapper schrieb:

Hi,
I'd like to have a non-Javascript based general purpose "Are you quite Sure?" 
PHP form submitter,
conventionally done using the Javascript Onsubmit Event.

One way would be to store all the Form Variables in hidden fields generated by a foreach $_POST but anyone have anything simpler?


How about the user saying "no"? You would have to return to the form
page and repopulate the form with the data. So not storing the data in a
usable format is not an option.

Here's a dirty hack:
How about displaying the same form in a hidden DIV?
OK, that one was cruel...

A better one:
You could fetch the RAW post data and store it in the session.
Problems arise when there's more than one window open!
Use a unique ID for the form.

Best solution: Use the hidden fields!

I disagree. Best solution: Don't use a confirmation thing, provide the ability to undo changes instead. That way you don't piss off the advanced users who KNOW what they're doing, but you still allow the less advanced users to undo changes they "accidentally" make.

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

--- End Message ---
--- Begin Message ---
Jasper Bryant-Greene schrieb:
> I disagree. Best solution: Don't use a confirmation thing, provide the 
> ability to undo changes instead. That way you don't piss off the 
> advanced users who KNOW what they're doing, but you still allow the less 
> advanced users to undo changes they "accidentally" make.

Oh, changing the concept was on the menu? Me too,please ;-)

OLLi

--- End Message ---
--- Begin Message ---
http://httpd.apache.org/docs/2.0/misc/rewriteguide.html

AllOLLi

--- End Message ---
--- Begin Message ---
On 10/7/05, Terence <[EMAIL PROTECTED]> wrote:
> Hi List,
>
> I am trying to allow dynamic URL's for my users to remember similiar to:
>
> www.mysite.com/joesoap
>
> So I want to use "joesoap" in a PHP script to pick up the user's details
> from a MySQL database. If the "joesoap" does not exist in the table
> I will handle that.
>
> So basically I have one file www.mysite.com/index.php which should do
> all the processing.
>
> I have tried with the apache .htaccess mod_rewrite, however when I echo
> $_SERVER['PHP_SELF'] I can't detect the "joesoap". It returns /index.php.
>
> Of course the easiest way is to do something like
> www.mysite.com/index.php?username=joesoap
> but that is too long and complicated for our users. As we have thousands
> of users, I don't want to create actual directories.
>
> Furthermore can this be done too (without a joesoap file):
> www.mysite.com/joesoap?show_extra_details=yes
>
> Any advice/links would be much appreciated. If I am barking up the wrong
> tree throw me a bone please.

mod_rewrite can handle this easy enough:

RewriteEngine on
RewriteRule ^([a-z].*) /index.php?username=$1 [L,qsappend]
RewriteRule ^$ /index.php [L,qsappend]

$_GET[ 'username' ] will be available in your index.php when you pass
a url like:
www.mysite.com/joesoap

This can be expanded for more variables/matches by adding more
matching groups to the regex. ^([a-z].*)/([a-z].*) and so forth.


--
Greg Donald
Zend Certified Engineer
MySQL Core Certification
http://destiney.com/

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

I am trying to allow dynamic URL's for my users to remember similiar to:

www.mysite.com/joesoap

So I want to use "joesoap" in a PHP script to pick up the user's details from a MySQL database. If the "joesoap" does not exist in the table
I will handle that.

So basically I have one file www.mysite.com/index.php which should do all the processing.

I have tried with the apache .htaccess mod_rewrite, however when I echo $_SERVER['PHP_SELF'] I can't detect the "joesoap". It returns /index.php.

Of course the easiest way is to do something like
www.mysite.com/index.php?username=joesoap
but that is too long and complicated for our users. As we have thousands of users, I don't want to create actual directories.

Furthermore can this be done too (without a joesoap file):
www.mysite.com/joesoap?show_extra_details=yes

Any advice/links would be much appreciated. If I am barking up the wrong tree throw me a bone please.

If you are using apache, add this to your VirtualHost section for www.mysite.com:

  ForceType  application/x-httpd-php
  Action application/x-httpd-php /script-to-handle-every-request.php

Then in your document root, put a file named script-to-handle-every-request.php and do whatever you want.

You'll probably want to start by looking at $_SERVER[PATH_INFO] and go from there.

I do this to make urls easier to remember for our sales guys so they don't have to remember that www.mysite.com:8001 is their sales demo site. Instead they can remember salesdemo.mysite.com/philip and it redirects them.

good luck!

-philip

--- End Message ---
--- Begin Message ---

> -----Original Message-----
> From: Terence [mailto:[EMAIL PROTECTED]
> Sent: Friday, October 07, 2005 11:19 PM
> To: [email protected]
> Subject: [PHP] Dynamic sub directory listing without redirect
> 
> 
> Hi List,
> 
> I am trying to allow dynamic URL's for my users to remember 
> similiar to:
> 
> www.mysite.com/joesoap
> 
> So I want to use "joesoap" in a PHP script to pick up the 
> user's details 
> from a MySQL database. If the "joesoap" does not exist in the table
> I will handle that.
> 
> So basically I have one file www.mysite.com/index.php which should do 
> all the processing.
> 
> I have tried with the apache .htaccess mod_rewrite, however 
> when I echo 
> $_SERVER['PHP_SELF'] I can't detect the "joesoap". It returns 
> /index.php.
> 
> Of course the easiest way is to do something like
> www.mysite.com/index.php?username=joesoap
> but that is too long and complicated for our users. As we 
> have thousands 
> of users, I don't want to create actual directories.
> 
> Furthermore can this be done too (without a joesoap file):
> www.mysite.com/joesoap?show_extra_details=yes
> 
> Any advice/links would be much appreciated. If I am barking 
> up the wrong 
> tree throw me a bone please.
> 
> Thanks alot
> Terence

Hi Terence,

I would handle this in a custom 404 error script.  Essentially, just have
the 404 page parse out the "joesoap", check the database to see if its
valid, and act accordingly.

JM

--- End Message ---
--- Begin Message --- PCユーザーにお得な情報を一方的に配信させていただきましたことお詫びいたします
このメールは送信専用メールアドレスから配信されています。ご返信いただいてもお答えできませんのでご了承ください。
ご質問等のある方はhttp://www.11279.com/のお問い合わせからご連絡ください。
配信停止希望の方は下記 配信停止よりお願いします。

〜〜〜配信停止〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜
samurai_madoguti_samurai○yahoo.co.jp
                     (注)○を@にして送信してください。
〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜




_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄

VL版専門店 
          ソフト 侍 【完全後払い】消費税・送料無料

業界初!!プライスカットシステム採用!!
千円単位以下はすべてカット!思い切って斬り捨てちゃいますから!
1万円以上ご利用からプライス斬り!しちゃいます!!
なんで1万円以下は・・・・残念。



    ↓↓↓↓↓ご来店はココ↓↓↓↓↓

          http://www.11279.com/


でも1本からでも送料は無料!(日本国内のみ)
お客様のご来店を心よりお待ち申し上げております。
PCユーザーにご利用いただく為、スタッフ一同一層努力して参ります。

■□■プライスカットシステム■□■□■□■□■□■□■□■□■□■

<<例>>    一万円〜二万円でも  10.000円
         二万円〜三万円でも  20.000円
       三万円〜四万円でも  30.000円
       四万円〜五万円でも  40.000円
       五万円以上も同じ
            (各万円台での千円単位以下斬り捨てます)
                   購入価格一万円以上が適用となります

■□■□■□■□■□■□■□■□■□■■□■□■□■□■□■

当店のVL版は
大手企業・廃校などから買付しているのですが
社内・校内で複製が許可されているメディアでして
すでに複製済み在庫販売となっております。
正規版と内容的にはほぼ変わりません。
●ユーザー登録はできません(認証等は問題ありません)●
○共有など追加分があるものもありますのでお問い合わせください○


_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄_/ ̄



ご来店はココ→→→→→→http://www.11279.com/



〜〜〜配信停止〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜
samurai_madoguti_samurai○yahoo.co.jp
                     (注)○を@にして送信してください。
〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜


このメールは送信専用メールアドレスから配信されています。ご返信いただいてもお答えできませんのでご了承ください。
ご質問等のある方はhttp://www.11279.com/のお問い合わせからご連絡ください。


                                      インターネットVL版専門店 ソフト侍
--- End Message ---
--- Begin Message ---

> On Thu, October 6, 2005 8:29 pm, Rick Emery wrote:
> > Knowing that I'm not the only one to want to connect to Microsoft SQL
> > Server on Windows from PHP and Apache on Linux, I'm seeking advice.
> 
> You may want to consider using the Sybase drivers if they are
> available as up-to-date RPMs.
> 
> Last time I checked, several years ago, they worked better/faster than
> the mssql drivers.
> 

The Sybase extension can be linked agains the commercial Sybase libs or
the same FreeTDS lib used for the mssql extension, so there is not a big
difference there. The mssql extension implements about twice as many
functions as the sybase extension.

- Frank

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

just to stop and everyone from getting a heart attack right this instant
what I am doing with cURL and the multiple pages attempt is not much
more scary than any other "person leaves credit card info on form" 
script you come across.

The server that I am re-sending the data to is our own and I know what 
i am sending and where, so it's not like I am toying around sending peoples
creditcard info to some dodgy location.

So what's happening is nothing other than peoples data being re-sent
by the server that belongs to us to a know and trusted source.
Since the data comes in via the checkout form already it is not any "less"
secure than usual.

The main issue for me was that I did not want to store the credit card
details for the second step of the processing.

Anyway, to stop me lamenting and clear this up I am not passing credit card
info around any places that are not verified or trustworthy and was merely
looking for a way to pass this information along without having to store
them on my end before the go across to the payment gateway.

I'll have another look at what I could do differently in this case. 
Usually I wouldn't to deal with an issue like this as payment information
would go straight to the payment gateway (handled there, processed there,
stored there) but in this case there was an inbetween step, which I didn't
know how to solve.

Thanks for the input.



> --- Ursprüngliche Nachricht ---
> Von: "Richard Lynch" <[EMAIL PROTECTED]>
> An: "Ragnar" <[EMAIL PROTECTED]>
> Kopie: [email protected]
> Betreff: Re: [PHP] How do I POST data with headers & make the browser    
> follow?
> Datum: Fri, 7 Oct 2005 15:56:09 -0500 (CDT)
> 
> On Thu, October 6, 2005 4:52 am, Ragnar wrote:
> Everything you are trying to do with the cURL, multiple pages, and
> whatnot scares the bejesus out of me...
> 
> Especially that you seem to be passing people's credit card numbers
> around in this manner. [shudder]
 

-- 
NEU: Telefon-Flatrate fürs dt. Festnetz! GMX Phone_Flat: 9,99 Euro/Mon.*
Für DSL-Nutzer. Ohne Providerwechsel! http://www.gmx.net/de/go/telefonie

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

basically what I am working on is integrating a step inbetween the checkout
and the payment gateway processing.

The cardholder information is checked for enrolment in the first step, if
the cardholder is enrolled he will need to authenticate himself by password
(this is where the 2nd page comes in) if the authentication is successfull
he is forwarded to the 3rd page where the payment gateway processing takes
place.

It's like any other online payment integration i have done before but this
time there is this extra step required due to Visa's and Mastercards new
security feature.

I didn't see an issue with passing this information along since it's already
used in the verification of the cardholder which also requires
the card number.

I do require the payment info again on page 3 to pass it along to the 
payment gateway, but didn't want to store it on my end for that.

What I gather from Richards answer earlier that the difference between
$_POST, $_GET or $_COOKIE, $_SESSION is almost irrelevant, I might
as well store the detail in a session to be able to use them on page
3 it seems.





> Is this what happens:
>
> 1. User enters payment data
> 2. XML check that payment data is OK
> 3. redirection to a page (on another site?), where for some reason the
> payment data is required again (why?).
>
> This sounds like a mixture of two ways of implementing online payments.
> Forgive me if I'm telling you what you already know, but in general I
> believe things work as follows:
> 
> 1 The whole process from payment to verification takes place on the 
> payment
> provider's server
> or
> 2.  the whole thing takes place on your server, with some inline (XML in
> this case) communication with your payment provider to verify the card
> details.
>
> You seem to be doing a bit of both, or have I misunderstood?
> Why do you need the payment details on the third page? If you don't 
> actually
> need them, then the security problem goes away, and you can use the 
> session
> object or whatever to persist the customer data.

> Does this help?

-- 
NEU: Telefon-Flatrate fürs dt. Festnetz! GMX Phone_Flat: 9,99 Euro/Mon.*
Für DSL-Nutzer. Ohne Providerwechsel! http://www.gmx.net/de/go/telefonie

--- End Message ---
--- Begin Message ---
Hello if i just want to recive ONE result from mysql i used to use:
echo mysql_result($result, 0);

Are there any equivalence to this in mysqli? Or what should i use to only 
recive ONE result, for example when i query with LIMIT 1.

-------------------------------------------------
FREE E-MAIL IN 1 MINUTE!
 - [EMAIL PROTECTED] - http://www.pc.nu

--- End Message ---
--- Begin Message ---
is it possible to connect to icq,  send messages and etc? thanx

--- End Message ---
--- Begin Message ---
Al Hafoudh wrote:

> is it possible to connect to icq,  send messages and etc? thanx


It should be possible, since PHP has full socket support. I googled a
bit and then checked the PHP Resource Index, and found the following:
http://php.resourceindex.com/Complete_Scripts/Instant_Messaging/ which
doesn't give us the information we're looking for, so I'd suggest taking
a look at the Perl libraries for ICQ/AIM and other IM clients that you
can probably adapt to PHP without too much work. Check www.cpan.org for
this.

Regards,
Torgny

--- End Message ---
--- Begin Message ---
> so I'd suggest taking a look at the Perl libraries for ICQ/AIM and 
> other IM clients that you can probably adapt to PHP without too much
> work. Check www.cpan.org for this.

Or "sniff" the traffic of a "normal" ICQ client and learn the protocol 
that way. Alternatively you could search for a library, I'm quite sure 
there are some out there. Try "liboscar", "libicq" or "libaim"..

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

from php function manual. I found:
flock() will not work on NFS and many other networked file systems. Check
your operating system documentation for more details.

And from http://nfs.sourceforge.net/#section_d:

flock()/BSD locks act only locally on Linux NFS clients prior to 2.6.12. Use
fcntl()/POSIX locks to ensure that file locks are visible to other clients.
........
The NFS client in 2.6.12 provides support for flock()/BSD locks on NFS files
by emulating the BSD-style locks in terms of POSIX byte range locks. Other
NFS clients that use the same emulation mechanism, or that use fcntl()/POSIX
locks, will then see the same locks that the Linux NFS client sees.

So, does it means that flock over nfs with several clients should work if
the nfs clients are all using kernel > 2.6.12?

Thanks,
Kyle

--- End Message ---
--- Begin Message --- Hey everyone, probably missed the bit in the manual but my current webhost allows uploading of my own php.ini to my home dir, my question is how to do this?

My guess would be to set the ./configure line to something like --with-config-file-path=/home/*/public_html

but I dont wanna re-compile if im wrong, can anyone tell me?

Using apache-1.3.33, php-4.4.0

Many thanks,
James Benson.

--- End Message ---

Reply via email to