php-general Digest 20 Aug 2006 05:35:51 -0000 Issue 4303
Topics (messages 240898 through 240912):
Re: dynamic variable usage
240898 by: Hiren Parmar
240904 by: Hiren Parmar
Re: OT alternate website authentication methods
240899 by: tedd
Re: Dhtml/javasript layer tips or software (0.T)
240900 by: Robert Cummings
240902 by: tedd
240906 by: Ryan A
240907 by: Ryan A
240908 by: Ryan A
Re: e-Commerce password standards?
240901 by: tedd
Re: dynamic case statements?
240903 by: Richard Lynch
Shopping cart
240905 by: Ryan A
240909 by: Larry Garfield
Re: Session issues
240910 by: Richard Lynch
Re: Creating User Friendly URLS [SOLVED]
240911 by: Dave M G
number list
240912 by: Bigmark
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 ---
hi,
I think this will make more clearance about the problem..
actully i want to compare 2 files which has all most same variable's but the
values are diffrant .... for e.g.
1 file has username="abc" and other has username = "bcd" ...
my actul code is like ...
my first file contains ... file1.php
php Code:
1. <?php
2. DEFINE <http://www.php.net/define>('_EZ_USERNAME','Username');
3. DEFINE <http://www.php.net/define>('_EZ_PASSWORD','Password');
4. ?>
my second file contains ... file2.php
php Code:
1. <?php
2. DEFINE <http://www.php.net/define>('_EZ_USERNAME','Gebruikersnaam');
3. DEFINE <http://www.php.net/define>('_EZ_PASSWORD','Wachtwoord');
4. ?>
and third file has code like ...
php Code:
1. function comp_file ($Filename){
2. include( $Filename);
3.
4. $fpEng = "/file1.php";
5. $lines = file <http://www.php.net/file>($fpEng);
6. foreach ($lines as $line_num => $line) {
7. $line = str_replace
<http://www.php.net/str_replace>("<?php","",$line);
8. $line = trim <http://www.php.net/trim>($line);
9. if ($line == ""){
10. next <http://www.php.net/next>($lines);
11. }
12. elseif($line == "?>"){
13. next <http://www.php.net/next>($lines);
14. }
15. else {
16. $line = str_replace
<http://www.php.net/str_replace>("DEFINE('","",$line);
17. $line = str_replace
<http://www.php.net/str_replace>("','",",",$line);
18. $line = str_replace
<http://www.php.net/str_replace>("');","",$line);
19. list <http://www.php.net/list>($fieldNm,
$caption) = explode <http://www.php.net/explode>(",", $line );
20. /*$$fieldNm = $fieldNm;
21. $tmp = $fieldNm ;
22. //eval($fieldNm)
23. eval("\$tmp = \"$tmp\";");*/
24. echo <http://www.php.net/echo> $caption ;
25. echo <http://www.php.net/echo>
'<input name="<?php echo $fieldNm ;?>" value="<?php //here i want
value form($Filenamefile ) ; ?>" type="text" size="70">' ;
26. }
27. }
28. }
29. comp_file(file2.php);
so now when i do read file2 i got $caption = 'UserName' ... and $fieldNm =
'_EZ_USERNAME' by using this $fieldNm ' s value i want to use the variable
of file2 ....
i think this will help you more in help me out
On 8/19/06, Hiren Parmar <[EMAIL PROTECTED]> wrote:
Hi ,
i have one problem regarding variable's access ...
i hv defined some varibale like
DEFINE('_xx_USERNAME','Username');
in one file ...
and in another file , i got this variable (_xx_USERNAME) as a value of
another variable ... like
$filedValue = '_xx_USERNAME' ;
now , the problem is i want the value of _xx_USERNAME in the second file
...
that is *Username*... by using variable $filedValue ...
how could i do this ?
--
Hiren Parmar
--
http://www.i3brains.com/
--
Hiren Parmar
--
http://www.i3brains.com/
--- End Message ---
--- Begin Message ---
Hi ,
i have one problem regarding variable's access ...
i hv defined some varibale like
DEFINE('_xx_USERNAME','Username');
in one file ...
and in another file , i got this variable (_xx_USERNAME) as a value of
another variable ... like
$filedValue = '_xx_USERNAME' ;
now , the problem is i want the value of _xx_USERNAME in the second file ...
that is *Username*... by using variable $filedValue ...
how could i do this ?
--
Hiren Parmar
--
http://www.i3brains.com/
--- End Message ---
--- Begin Message ---
At 2:08 PM -0700 8/18/06, Chris W. Parker wrote:
I'd be interested in hearing your thoughts as well as any links for
further reading.
Chris.
Chris:
I've done a little on this, see:
http://xn--ovg.com/captcha
The main problem in all visual security measures is dealing with the
disabled. To draw an image or to see the typical CAPTCHA is simply
not possible. That's one of the reasons I wrote an audio CAPTCHA.
To bad someone hasn't found another way.
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
On Sat, 2006-08-19 at 08:09 -0700, Ryan A wrote:
>
> Just need to figure out how to change the cells
> background color when the hint is shown and change it
> back when the hint is hidden again.
Just set the bckground colour of the <div> that contains the hint.
<div style="background: #0000ff; padding: 15px;">
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
Just need to figure out how to change the cells
background color when the hint is shown and change it
back when the hint is hidden again.
Thanks!
Ryan
Use the DOM, Luke.
Or, use a style switcher, like:
http://www.sperling.com/examples/styleswitch/
Using css is a good way to accomplish this.
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
> > Just need to figure out how to change the cells
> > background color when the hint is shown and change
> it
> > back when the hint is hidden again.
> Just set the bckground colour of the <div> that
> contains the hint.
>
> <div style="background: #0000ff; padding: 15px;">
DUH! Of course... am totally duh! this week, 9 hour
working days and 4 company meetings + 2 presentations.
Thanks again,
Ryan
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--- End Message ---
--- Begin Message ---
--- tedd <[EMAIL PROTECTED]> wrote:
> >Just need to figure out how to change the cells
> >background color when the hint is shown and change
> it
> >back when the hint is hidden again.
> >
> >Thanks!
> >Ryan
>
> Use the DOM, Luke.
>
> Or, use a style switcher, like:
>
> http://www.sperling.com/examples/styleswitch/
>
> Using css is a good way to accomplish this.
>
> tedd
If I'm Luke, who are you?
Yoda? ;D
Thanks for the tip, I have already used the tip that
Rob gave me, so for now am happy and wont touch
anything!
cheers!
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--- End Message ---
--- Begin Message ---
--- tedd <[EMAIL PROTECTED]> wrote:
> >Just need to figure out how to change the cells
> >background color when the hint is shown and change
> it
> >back when the hint is hidden again.
> >
> >Thanks!
> >Ryan
>
> Use the DOM, Luke.
>
> Or, use a style switcher, like:
>
> http://www.sperling.com/examples/styleswitch/
>
> Using css is a good way to accomplish this.
>
> tedd
If I'm Luke, who are you?
Yoda? ;D
Thanks for the tip, I have already used the tip that
Rob gave me, so for now am happy and wont touch
anything!
cheers!
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--- End Message ---
--- Begin Message ---
At 2:45 PM -0500 8/18/06, Richard Lynch wrote:
I've searched some of the obvious candidates, found nothing much, and
am in the process of determining at least some of the basic "rules"
for other similar sites.
Richard:
I'm sure you Googled for this, but "password strength" brought up
some interesting results. The most interesting/informative for me was:
http://www.securitystats.com/tools/password.php
I think the site is a bit dated, but it's good information.
To force your users to have a "secure" password, you could provide
tools to help them, such as a password generator (one that would suit
your security concerns) or provide a "strength meter" and then only
accept those with the appropriate strengths.
I have code, but some might refer to it as kiddy-script caliber.
Please let me know if I can help.
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
On Fri, August 18, 2006 11:58 am, Tom Cruickshank wrote:
> Would anyone know if it's possible to have dynamic case
> statements?
Almost for sure...
I *know* you can use switch(true) and put *ANY* expression you want
for a case.
switch (true) {
case $temp === 'status':
$theform->status();
break;
case $temp:
$theform->form($temp);
break;
}
> Theform = new form();
>
> $temp = $_POST['var1'];
> switch ($temp) {
> case "status":
> $theform->status();
> break;
>
> case $temp:
> $theform->form($temp);
> break;
> }
This, however, is probably better handled with a 'default:' instead of
case $temp...
> This keeps giving me Call to undefined method form::form() in
> /usr/local/www/data-dist/form.php on line 38
Then your class form probably does not have a function named form...
In fact, if it does, then in PHP4 that was the constructor, so you
probably can't use that for ANYTHING other than saying:
new form;
And form() gets called on 'new' and only on 'new'
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
Hey,
I have been long enough on this list to know this
shopping cart question comes up real often and
irritates a lot of folks, but sorry, I have checked
google and hotscripts and it has come down to a
recommendation from YOU guys as they are SOOOOO many
options out there with each cart most of which i will
never need.
Feel free to mention commercial products as I have
been looking at them too, but if i go in for a
commercial solution I will have to cut somewhere else
as this is for myself and i'm starting out...budgets
low and am trying to do everything myself, but dont
have time to make this myself.
Will be selling spare parts.
I dont want a cart to do a million things, just around
10 :)
1. Admin panel where i enter quantity and it keeps
track of inventry
2. Should be *fast* (php+mysql solution)
3.Intergrate with paypal+2checkout anything more is a
bonus
4. Easy to "template"
5. Calculates shipping (not vital, but bonus if it
does)
6. Should be able to give discounts based on price and
accept discount codes.
7. Should offer the "customers who bought this also
bought" feature
8. Easy to maintain
OSC is the first cart that comes to mind, followed by
Zen, xcart (xcart out of my budget though)
Am leaning towards OSC for the price but its got an
overload of bulk and speed problems...
Please recommend, even a link to any site and a "go to
that f***ing site" (the = of a "RTFM") would be
appreciated.
Thanks!
Ryan
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--- End Message ---
--- Begin Message ---
OSCommerce is crap. Don't bother.
<obligatory plug>
The Drupal CMS has a complete suite of ecommerce modules that work with it.
I've not worked with it recently, but if you just need a straightforward
shopping cart it should be fine.
http://drupal.org/
http://drupal.org/project/ecommerce
All GPLed.
</obligatory plug>
On Saturday 19 August 2006 10:37, Ryan A wrote:
> Hey,
> I have been long enough on this list to know this
> shopping cart question comes up real often and
> irritates a lot of folks, but sorry, I have checked
> google and hotscripts and it has come down to a
> recommendation from YOU guys as they are SOOOOO many
> options out there with each cart most of which i will
> never need.
>
> Feel free to mention commercial products as I have
> been looking at them too, but if i go in for a
> commercial solution I will have to cut somewhere else
> as this is for myself and i'm starting out...budgets
> low and am trying to do everything myself, but dont
> have time to make this myself.
>
> Will be selling spare parts.
>
> I dont want a cart to do a million things, just around
> 10 :)
>
> 1. Admin panel where i enter quantity and it keeps
> track of inventry
> 2. Should be *fast* (php+mysql solution)
> 3.Intergrate with paypal+2checkout anything more is a
> bonus
> 4. Easy to "template"
> 5. Calculates shipping (not vital, but bonus if it
> does)
> 6. Should be able to give discounts based on price and
> accept discount codes.
> 7. Should offer the "customers who bought this also
> bought" feature
> 8. Easy to maintain
>
> OSC is the first cart that comes to mind, followed by
> Zen, xcart (xcart out of my budget though)
>
> Am leaning towards OSC for the price but its got an
> overload of bulk and speed problems...
>
> Please recommend, even a link to any site and a "go to
> that f***ing site" (the = of a "RTFM") would be
> appreciated.
>
> Thanks!
> Ryan
>
> ------
> - The faulty interface lies between the chair and the keyboard.
> - Creativity is great, but plagiarism is faster!
> - Smile, everyone loves a moron. :-)
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
--
Larry Garfield AIM: LOLG42
[EMAIL PROTECTED] ICQ: 6817012
"If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called an idea,
which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the possession
of every one, and the receiver cannot dispossess himself of it." -- Thomas
Jefferson
--- End Message ---
--- Begin Message ---
If the problem is that their browser is not accepting the cookies,
then turning on trans-sid will fix it -- as the session ID is then
passed in the URL as GET argument.
Only problem there is that users are more likely to forward a link
that exposes their session ID to somebody else, so unless you are
careful about logging them out after a time-out and re-authenticating
whenever they do something crucial, they can end up leaking their own
privacy.
On Fri, August 18, 2006 11:25 am, Dave Goodchild wrote:
> Does enabling transparent session ids solve the cookie issue? I
> visited
> plenty of sites that use cookies and sessions on the same setup and
> none
> caused the same issue.
>
> On 18/08/06, Richard Lynch <[EMAIL PROTECTED]> wrote:
>>
>> Configure the problem browser to prompt you when it gets a cookie.
>>
>> You'll probably find that it's rejecting the cookies, so it's not
>> preserving the state of the session, so you get a new session every
>> page hit.
>>
>> On Thu, August 17, 2006 12:35 pm, Dave Goodchild wrote:
>> > Hi all, I am currently writing a web application that has a
>> 3-stage
>> > form
>> > process as part of its functionality. The values passed in are
>> placed
>> > in the
>> > session array after validation and once the user has completed and
>> > supplied
>> > all required values the relevant session values are inserted into
>> the
>> > database. I have tested it on three different machines in FF, IE
>> and
>> > Opera
>> > and all expected values were entered ok.
>> >
>> > However, a remote user has started testing and all values are
>> blank,
>> > suggesting the session is not being populated. I noticed it at
>> their
>> > office
>> > last week when data values were not showing up when the user went
>> back
>> > one
>> > page (ie fields are pre-populated with existing session values).
>> >
>> > Anyone had this problem before?
>> >
>> > --
>> > http://www.web-buddha.co.uk
>> > http://www.projectkarma.co.uk
>> >
>>
>>
>> --
>> Like Music?
>> http://l-i-e.com/artists.htm
>>
>>
>>
>
>
> --
> http://www.web-buddha.co.uk
> http://www.projectkarma.co.uk
>
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
PHP List,
Thank you to everyone who helped out.
I'm happy to report that the issue is solved, mainly with the help of my
local LUG. I am getting nice friendly URLs, so mod_rewrite seems to be
working.
The solution was almost entirely to do with getting Apache working. Once
I had the URLs correctly pointing to my index.php file, then
manipulating $_SERVER['REQUEST_URI'] was a snap.
The trickiest part for me was that on my own Apache server, mod_rewrite
was not enabled.
In any case, for my own reference as well as others, although the path
to the answer was a little stumbly, here are the steps that I think
ultimately lead to getting everything to work. This is entirely to do
with setting up Apache to handle friendly URLS, but hopefully will be of
use to PHP developers.
1. # sudo a2enmod rewrite
2. Confirm that the "rewrite.load" file is in /etc/apache2/mods-enabled
Currently I have the following files in that directory:
cgi.load php5.conf php5.load rewrite.load
3. # sudo gedit /etc/apache2/sites-available/default
Find where it says:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
And change "AllowOverride None" to "AllowOverride all". (I noticed that
"None" was in upper case, and "all" was lowercase. Don't know if case is
important, but this is the way that it worked for me).
Some sites said to edit /etc/apache2/sites-enabled/000-default, or
sometimes "default-000", but they are just symlinks to
/etc/apache2/sites-available/default (at least in my case).
4. # sudo gedit /etc/apache2/httpd.conf
Add the following lines:
<IfModule mod_rewrite.c>
RewriteEngine On
</IfModule>
No other editing of httpd.conf was necessary, despite some sites that
said to use "LoadModule".
It should be noted, though, that even though mod-rewrite is working, it
isn't listed when I run "/usr/sbin/apache2 -l". I don't know if that's
odd behaviour or not, just that it seemed like it was supposed to be
listed there.
5. Reload the apache modules and restart Apache.
# sudo /etc/init.d/apache2 force-reload
# sudo /etc/init.d/apache2 restart
6. Create an .htaccess file (if there isn't one already) in the
directory where one wants to create "user friendly URLS", and add the
following:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php
These rules say that if the file or directory named in the URL is real,
then go there. Otherwise, go to the index file for processing. At least
that's what it seems to do. I didn't write it, so I can't assure anyone
of the correctness of the syntax.
It should be noted, though, that even though mod-rewrite is working, it
isn't listed when I run "/usr/sbin/apache2 -l". I don't know if that's
odd behaviour or not, just that it seemed like it was supposed to be
listed there.
If anyone can see problems in the above, or if I've misunderstood some
part, please let me know.
Thanks to the PHP list for their ever-present help and support.
--
Dave M G
--- End Message ---
--- Begin Message ---
Hi, can anyone help me with this at all.
i have a table leaderboard with username points etc and can echo the scores
in asc order ok but what i want is to grab the scores and display a users
position using their session ID.
So if the scores are for example:
36 user3
22 user1
18 user4
12 user2
How do i show user 1's position on the leaderboard on their user login page.
here are the fields in table 'leaderboard'
ID
user_id
username
points
comp_id
email
--- End Message ---