[PHP] PHP/MySQL difficulties on WindowsXP

2004-04-09 Thread bronto
Hello;

We are having a miserable time with MySQL on a Windows/IIS server with PHP. 
Here's the version numbers:

MySQL 3.23.58-nt
PHP 4.35
Windows XP (although we previously experienced the same problems w/ Server
2000), 1gb RAM

The site is for academics to submit scientific papers (data) for their
organization.  In addition to submitting data, they can browse and search the
database.

The problem is that one or more times per day, they whole thing grinds to a
halt.  Not sure that the server is completely locking up, but response times
are so slow it might was well be.  Restarting MySQL corrects the problem, but
that may be a symptom rather than the disease.  At one time we had IIS running
on one server and MySQL on another.  In this configuration, the IIS server
would lock up, and reloading MySQL on *that* machine fixed the problem,
according to my administrator.  That server was remote, and the admin drove out
to it to observe and noted that there were virtual RAM errors - running out -
which motivated us to move it to the XP box in the office.

There's really not much complicated going on here.  The paper submission engine
is session based, and some data is stuffed into session variables until it can
be validated in later steps, then saved to the database.  I've optimized the
queries as much as possible, checked that MySQL connections are being closed
and result resources freed, and php session variables unset and the session
destroyed when appropriate.

We're stuck, and the client is getting upset.

Ideas?

TIA

Rob

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



[PHP] Looking for a comprehensive PHP tutorial

2004-04-09 Thread Ash..
Hi,

I am looking for a comprehensive handholder tutorial, that introduces the
various aspects
of PHP, step by step and let's u see the big picture.
I have come across tons of PHP learnware which is like how to do this and
how to do that.
But that still doesn't introduce the language to the beginner in an orderly
manner.
Any suggestions, links, will be greatly appreciated.

Or, if someone (experienced in PHP) thinks we must come up with such a
comprehensive tutorial, we can perhaps team up ;)
Ash

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



[PHP] Can't copy a variable from one session to another?

2004-04-09 Thread Scott Bronson
My web site currently uses 2 sessions: mine (SBSESSID) and
SquirrelMail's (SQMSESSID).  They work perfectly on their own.  
However, I would like to allow the user to move from my area to
SquirrelMail without re-entering a password.  Therefore, I need to copy
the password from my session to SquirrelMail's.  I've been struggling with
this for most of the night but this is the closest I've come:

tst.php:

?php
error_reporting(E_NONE);  // suppress spurious cookie errors
header(content-type: text/plain);

/// set up original session, then close it
session_name(SESS1);
session_start();
print_r(session_name());
echo   . print_r($_SESSION,true) . \n;
session_write_close();
session_unset();

// print new session, retrieve secret key, then close it.
session_name(SESS2);
session_start();
print_r(session_name());
echo   . print_r($_SESSION,true) . \n;
$secret = $_SESSION['password'];
session_write_close();
session_unset();

// open old session. it should exactly match the original.
session_name(SESS1);
session_start();
print_r(session_name());
echo   . print_r($_SESSION,true) . \n;
?


When I run this after filling in the sessions, I get:

  SESS1 Array
  (
[squirrel] = mail
  )

  SESS2 Array
  (
[squirrel] = mail
  )

  SESS1 Array
  (
[squirrel] = mail
  )

What's happening?  The second time I call session_start(), instead of
getting SESS2 like I asked for, I'm just getting SESS1 again.  Even if I
call error_reporting(E_ALL), I don't get any relevant error messages.  Why
won't session_start() open the named session?

When I replace the two calls to session_write_close() with
session_destroy(), I get this:

SESS1 Array
(
[squirrel] = mail
)

SESS2 Array
(
[password] = whoa
)

SESS1 Array
(
)

Which is correct, except that it destroys the sessions!  So close and yet
so far.

Does anybody know how I can do this?  I'm stumped.  Thanks!

- Scott


To duplicate exactly what I did here, create 2 more scripts:

s1.php:

  ?php
  session_name(SESS1);
  session_start();
  $_SESSION[squirrel] = mail;
  print_r($_SESSION);
  ?


s2.php:

  ?php
  session_name(SESS2);
  session_start();
  $_SESSION[password] = whoa;
  print_r($_SESSION);
  ?

Now, open s1.php in your web browser.  Then open s2. php.  Finally, open
tst.php.

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



Re: [PHP] Looking for a comprehensive PHP tutorial

2004-04-09 Thread Andy B
www.php.net/manual/ might help

- Original Message - 
From: Ash.. [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, April 09, 2004 5:34 AM
Subject: [PHP] Looking for a comprehensive PHP tutorial


 Hi,

 I am looking for a comprehensive handholder tutorial, that introduces the
 various aspects
 of PHP, step by step and let's u see the big picture.
 I have come across tons of PHP learnware which is like how to do this
and
 how to do that.
 But that still doesn't introduce the language to the beginner in an
orderly
 manner.
 Any suggestions, links, will be greatly appreciated.

 Or, if someone (experienced in PHP) thinks we must come up with such a
 comprehensive tutorial, we can perhaps team up ;)
 Ash

 -- 
 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



[PHP] Forwarding to another PHP page

2004-04-09 Thread Ash..
Hello,

Thanks John (Holmes) for the clue on form-param-reading. Simple one, but
shows I got a lot of basics to learn yet.

Here I have another doubt I cant resist asking help for.

What are the various ways of forwarding to another page. I tried header()..
based on an example I found it in, but it doesnt work if I have done an
include before calling the header. What are the other alternatives of
forwarding. (I tried searching the PHP manual, but didnt find any clue. Nor
did I come across any learn material which seemed to deal with this.)
Thanks for all help,
Ash

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



[PHP] Re: Forwarding to another PHP page

2004-04-09 Thread Andy Ladouceur
Ash.. wrote:

Hello,

Thanks John (Holmes) for the clue on form-param-reading. Simple one, but
shows I got a lot of basics to learn yet.
Here I have another doubt I cant resist asking help for.

What are the various ways of forwarding to another page. I tried header()..
based on an example I found it in, but it doesnt work if I have done an
include before calling the header. What are the other alternatives of
forwarding. (I tried searching the PHP manual, but didnt find any clue. Nor
did I come across any learn material which seemed to deal with this.)
Thanks for all help,
Ash
There are no other PHP methods for forwarding to another page. The 
header function will not work if any text (This includes spaces, 
linebreaks, etc.) has been output to the page. One way to circumvent 
this is using PHP's output buffer functions.
http://ca2.php.net/ob_start

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


[PHP] Re: Looking for a comprehensive PHP tutorial

2004-04-09 Thread Andy Ladouceur
Ash.. wrote:

Hi,

I am looking for a comprehensive handholder tutorial, that introduces the
various aspects
of PHP, step by step and let's u see the big picture.
I have come across tons of PHP learnware which is like how to do this and
how to do that.
But that still doesn't introduce the language to the beginner in an orderly
manner.
Any suggestions, links, will be greatly appreciated.
Or, if someone (experienced in PHP) thinks we must come up with such a
comprehensive tutorial, we can perhaps team up ;)
Ash
http://www.oreillynet.com/pub/ct/29

OnLAMP's PHP Foundations tutorials are a great place to start. It's 
about as orderly as one could ask for. Start from the bottom. ;)

Andy

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


RE: [PHP] Forwarding to another PHP page

2004-04-09 Thread Vincent Jansen
It should work even if you included something

You probably have spaces outside the ?php tags

You could use output buffering to prevent this from happening

Vincent

-Original Message-
From: Ash.. [mailto:[EMAIL PROTECTED] 
Sent: vrijdag 9 april 2004 11:53
To: [EMAIL PROTECTED]
Subject: [PHP] Forwarding to another PHP page


Hello,

Thanks John (Holmes) for the clue on form-param-reading. Simple one, but
shows I got a lot of basics to learn yet.

Here I have another doubt I cant resist asking help for.

What are the various ways of forwarding to another page. I tried
header().. based on an example I found it in, but it doesnt work if I
have done an include before calling the header. What are the other
alternatives of forwarding. (I tried searching the PHP manual, but didnt
find any clue. Nor did I come across any learn material which seemed to
deal with this.) Thanks for all help, Ash

-- 
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] Looking for a comprehensive PHP tutorial

2004-04-09 Thread Ralph G
Check these out:

http://www.juicystudio.com/tutorial/php/index.asp

http://www.scit.wlv.ac.uk/~jphb/sst/php/

-Original Message-
From: Ash.. [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 09, 2004 2:35 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Looking for a comprehensive PHP tutorial

Hi,

I am looking for a comprehensive handholder tutorial, that introduces the
various aspects
of PHP, step by step and let's u see the big picture.
I have come across tons of PHP learnware which is like how to do this and
how to do that.
But that still doesn't introduce the language to the beginner in an orderly
manner.
Any suggestions, links, will be greatly appreciated.

Or, if someone (experienced in PHP) thinks we must come up with such a
comprehensive tutorial, we can perhaps team up ;)
Ash

-- 
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] Forwarding to another PHP page

2004-04-09 Thread John W. Holmes
From: Ash.. [EMAIL PROTECTED]

 Thanks John (Holmes) for the clue on form-param-reading. Simple one, but
 shows I got a lot of basics to learn yet.

You're welcome. :)

 Here I have another doubt I cant resist asking help for.

 What are the various ways of forwarding to another page. I tried
header()..
 based on an example I found it in, but it doesnt work if I have done an
 include before calling the header. What are the other alternatives of
 forwarding. (I tried searching the PHP manual, but didnt find any clue.
Nor
 did I come across any learn material which seemed to deal with this.)

header() is the only way you're going to redirect with PHP. Alternatives
include a JavaScript redirection or a meta-refresh header.

Think of it this way, though. header() will work so long as there is no
_output_ to the browser. You can include files, but there just can't be any
_output_. Now, if you really need to redirect to another page, you should
know this before any output. There's no reason to show the user anything and
then redirect to another page. You may need to change the logic in your
scripts, but that's how things are supposed to work.

---John Holmes...

PS: Someone will undoubtedly mention output buffering, which is a hack to
allow header() to work even if there is output. Just learn to do it the
right way. :)

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



RE: [PHP] Forwarding to another PHP page

2004-04-09 Thread Vincent Jansen
PS: Someone will undoubtedly mention output buffering, which is a hack
to allow header() to work even if there is output. Just learn to do it
the right way. :)

That would be me then :)

-- 
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] Use PHP to copy MySQL tables

2004-04-09 Thread Jochem Maas
it maybe too much work, but FirebirdDB + PHP5 allows the use of 
ibase_backup()  ibase_restore() - very nifty.

otherwise maybe take a look at the phpMyAdmin source for how they handle 
such thing -

Robb Kerr wrote:

Is there an easy way to create an HTML page that uses PHP to copy selected
MySQL tables to backup copies on the same MySQL server? I want to create an
administration page for my client to be able to backup their database
whenever they see fit. But, I can't give them direct access to the MySQL
server and don't want them backing up to their hard drive. I prefer to
simply copy the tables to backup versions on the server so that if
problems arise, I can log into the server and simply copy the backups to
the originals.
Thanx in advance.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Sorting through an array

2004-04-09 Thread Jamie
I have an array of song artists and songs indexed by an id, i need a way of
taking out all the artists names. However as there are multiple lines for
each artist i have come accross a problem when only displaying the artist
once. Another problem is that the artists are not grouped together so i need
to store the artists that i have already passed and havent been matched so i
can check the next artist.

I know it sounds confusing, but i hope you understand what i mean! Any help
would be appreciated.

Jamie

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



[PHP] security on shared servers

2004-04-09 Thread Andy B
hi...

im writing this admin system for a website and need to have it write system
logs to its own log files... the only problem i can really see is that its
on a shared webserver and all files are restricted to your own domain/vhost
dirs (whatever those happen to be). the admin wont let anybody put syslogs
anywhere outside there vhost section of the server and .htaccess support is
disabled and wont be able to be turned on (so i cant deny browser requests
to a certain dir). anybody have any idea how i can protect the admin syslogs
this program has to create (that way browsers cant download the logs)??

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



Re: [PHP] Forwarding to another PHP page

2004-04-09 Thread John Nichel
Ash.. wrote:
Hello,

Thanks John (Holmes) for the clue on form-param-reading. Simple one, but
shows I got a lot of basics to learn yet.
Here I have another doubt I cant resist asking help for.

What are the various ways of forwarding to another page. I tried header()..
based on an example I found it in, but it doesnt work if I have done an
include before calling the header. What are the other alternatives of
forwarding. (I tried searching the PHP manual, but didnt find any clue. Nor
did I come across any learn material which seemed to deal with this.)
Thanks for all help,
Ash
The header() function will still work after calling include() or 
require() as long as those files being pulled in don't have any output 
to the browser.  You can also forward with JavaScript.

--
***
*  _  __   __  __   _  * John  Nichel *
* | |/ /___ __ \ \/ /__ _ _| |__ ___  __ ___ _ __  * 716.856.9675 *
* | ' / -_) _` \ \/\/ / _ \ '_| / /(_-_/ _/ _ \ '  \ * 737 Main St. *
* |_|\_\___\__, |\_/\_/\___/_| |_\_\/__(_)__\___/_|_|_|* Suite #150   *
*  |___/   * Buffalo, NY  *
* http://www.KegWorks.com[EMAIL PROTECTED] * 14203 - 1321 *
***
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] security on shared servers

2004-04-09 Thread John W. Holmes
From: Andy B [EMAIL PROTECTED]

 im writing this admin system for a website and need to have it write
system
 logs to its own log files... the only problem i can really see is that its
 on a shared webserver and all files are restricted to your own
domain/vhost
 dirs (whatever those happen to be). the admin wont let anybody put syslogs
 anywhere outside there vhost section of the server and .htaccess support
is
 disabled and wont be able to be turned on (so i cant deny browser requests
 to a certain dir). anybody have any idea how i can protect the admin
syslogs
 this program has to create (that way browsers cant download the logs)??

You don't have access to anything outside of the webroot? If /home/user/www/
is your webroot, then write them to /home/user/. If you're saying you can't
do that and they have to be put under the webroot, then give them .php
extensions and make the first line

?php exit(); ?

Then they can't be viewed through the browser, but PHP can still read them
(fopen, etc) or they can be opened with text editors.

---John Holmes...

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



Re: [PHP] security on shared servers

2004-04-09 Thread Andy B
 You don't have access to anything outside of the webroot? If
/home/user/www/
 is your webroot, then write them to /home/user/. If you're saying you
can't
 do that and they have to be put under the webroot, then give them .php
 extensions and make the first line

 ?php exit(); ?

 Then they can't be viewed through the browser, but PHP can still read them
 (fopen, etc) or they can be opened with text editors.

 ---John Holmes...

ok heres what i found out: the place where the admin service is supposed to
go at doesnt have mysql/php high enough versions to run it so i had to
temporarly move it (the admin service) to another site server with some
people that i know... the server where the actual admin service will be
running at doesnt have /home/user/www/ setup... instead it has public_html/
and a symlink to htdocs... since the server where it is supposed to be
running at has /home/user/www access and there is an apache-access.log file
outside of www i was just wondering if its possible to have error_log() or
syslog() be able to write a log file on a different site  or something like
that

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



[PHP] Call to undefined function: dbase_open()

2004-04-09 Thread Joukje
Hi, 

I tried to open a dbf with, but I got an error message:
Call to undefined function: dbase_open().
PHP was compiled (on linux) with the option enable-dbase. Does anyone
have an idea of what's wrong?

Joukje

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



RE: [PHP] Call to undefined function: dbase_open()

2004-04-09 Thread Jay Blanchard
[snip]
I tried to open a dbf with, but I got an error message:
Call to undefined function: dbase_open().
PHP was compiled (on linux) with the option enable-dbase. Does anyone
have an idea of what's wrong?
[/snip]

Have you run phpinfo() to make sure the option is in?

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



Re: [PHP] Call to undefined function: dbase_open()

2004-04-09 Thread John Nichel
Joukje wrote:
Hi, 

I tried to open a dbf with, but I got an error message:
Call to undefined function: dbase_open().
PHP was compiled (on linux) with the option enable-dbase. Does anyone
have an idea of what's wrong?
Joukje

When you look at a phpinfo() on that server, do you see the enable-dbase 
option in the ./configure string?  And is it listed further down that page?

--
***
*  _  __   __  __   _  * John  Nichel *
* | |/ /___ __ \ \/ /__ _ _| |__ ___  __ ___ _ __  * 716.856.9675 *
* | ' / -_) _` \ \/\/ / _ \ '_| / /(_-_/ _/ _ \ '  \ * 737 Main St. *
* |_|\_\___\__, |\_/\_/\___/_| |_\_\/__(_)__\___/_|_|_|* Suite #150   *
*  |___/   * Buffalo, NY  *
* http://www.KegWorks.com[EMAIL PROTECTED] * 14203 - 1321 *
***
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Problem running sql stored in the database

2004-04-09 Thread Ryan A
Hi,
I am getting 2 values from a form:

$client_id and $client_name (for understanding: client_id = '12'
name='ryan')

when the client submits the form:
1. I run a query in my php script inserts this data into the db,assigns a
C_ID.

2. The query also checks if I have a stored sql statement for this C_ID
2a. If YES it tries to execute the query (if NO, execution stops here, all
is well)

3.The stored SQL is usually something like insert into
tester('$client_id','$client_name')

Heres where the problems coming in, it seems to be doing everything as it
should except when
I check the database I see that it has inserted:
$client_id  $client_name  into the fields instead of 12  ryan

The above should explain everything but if you want the code I can post it.

Kindly reply.

Thanks,
-Ryan

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



Re: [PHP] Problem running sql stored in the database

2004-04-09 Thread Richard Harb
Not quite sure what you mean...

So I assume the data was written into the worng fields.

If that is the case you could modify your insert query:
INSERT INTO table (id, name) VALUES ('$id', '$name')

hth
Richard

Friday, April 9, 2004, 4:11:05 PM, you wrote:

 Hi,
 I am getting 2 values from a form:

 $client_id and $client_name (for understanding: client_id = '12'
 name='ryan')

 when the client submits the form:
 1. I run a query in my php script inserts this data into the db,assigns a
 C_ID.

 2. The query also checks if I have a stored sql statement for this C_ID
 2a. If YES it tries to execute the query (if NO, execution stops here, all
 is well)

 3.The stored SQL is usually something like insert into
 tester('$client_id','$client_name')

 Heres where the problems coming in, it seems to be doing everything as it
 should except when
 I check the database I see that it has inserted:
 $client_id  $client_name  into the fields instead of 12  ryan

 The above should explain everything but if you want the code I can post it.

 Kindly reply.

 Thanks,
 -Ryan

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



Re: [PHP] Problem running sql stored in the database

2004-04-09 Thread Ryan A
Hey Richard,
Thanks for replying.


 If that is the case you could modify your insert query:
 INSERT INTO table (id, name) VALUES ('$id', '$name')

No, thats not the problem, its inserting the text $id and $name instead
of the
values the variables hold.

Ideas?

Thanks,
-Ryan




  Hi,
  I am getting 2 values from a form:

  $client_id and $client_name (for understanding: client_id = '12'
  name='ryan')

  when the client submits the form:
  1. I run a query in my php script inserts this data into the db,assigns
 a
  C_ID.

  2. The query also checks if I have a stored sql statement for this C_ID
  2a. If YES it tries to execute the query (if NO, execution stops here,
 all
  is well)

  3.The stored SQL is usually something like
 insert into
  tester('$client_id','$client_name')

  Heres where the problems coming in, it seems to be doing everything as
 it
  should except when
  I check the database I see that it has inserted:
  $client_id  $client_name  into the fields instead of 12  ryan

  The above should

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



Re: [PHP] Problem running sql stored in the database

2004-04-09 Thread John W. Holmes
From: Ryan A [EMAIL PROTECTED]

 2. The query also checks if I have a stored sql statement for this C_ID
 2a. If YES it tries to execute the query (if NO, execution stops here,
all
 is well)

 3.The stored SQL is usually something like insert into
 tester('$client_id','$client_name')

 Heres where the problems coming in, it seems to be doing everything as it
 should except when
 I check the database I see that it has inserted:
 $client_id  $client_name  into the fields instead of 12  ryan

 The above should explain everything but if you want the code I can post
it.

You have to eval() the code from the database to get the variables replaced
(or use a regex).

?php
$name = 'John';
$str = file_get_contents('test.txt'); //Reads Hello $name
eval('$str = ' . $str . ';');
echo $str;
?

or

?php
$name = 'John';
$str = file_get_contents('test.txt'); //Reads Hello $name
$str = preg_replace('/\$([a-zA-Z_]\w+)/e','$\1;',$str);
echo $str;
?

---John Holmes..

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



Re: [PHP] Problem running sql stored in the database

2004-04-09 Thread Jason Wong
On Friday 09 April 2004 22:24, Ryan A wrote:

  If that is the case you could modify your insert query:
  INSERT INTO table (id, name) VALUES ('$id', '$name')

 No, thats not the problem, its inserting the text $id and $name instead
 of the
 values the variables hold.

Don't use single quotes.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Do Miami a favor.  When you leave, take someone with you.
*/

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



Re: [PHP] Problem running sql stored in the database

2004-04-09 Thread John Nichel
Jason Wong wrote:
On Friday 09 April 2004 22:24, Ryan A wrote:


If that is the case you could modify your insert query:
INSERT INTO table (id, name) VALUES ('$id', '$name')
No, thats not the problem, its inserting the text $id and $name instead
of the
values the variables hold.


Don't use single quotes.

$sql = INSERT INTO table (id, name) VALUES ( ' . $id . ', ' . $name 
. ')

--
***
*  _  __   __  __   _  * John  Nichel *
* | |/ /___ __ \ \/ /__ _ _| |__ ___  __ ___ _ __  * 716.856.9675 *
* | ' / -_) _` \ \/\/ / _ \ '_| / /(_-_/ _/ _ \ '  \ * 737 Main St. *
* |_|\_\___\__, |\_/\_/\___/_| |_\_\/__(_)__\___/_|_|_|* Suite #150   *
*  |___/   * Buffalo, NY  *
* http://www.KegWorks.com[EMAIL PROTECTED] * 14203 - 1321 *
***
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] \n doesnt work in error_log and windows?

2004-04-09 Thread Andy B
i have this sort of a log string:
error_log(\n.$date.:.$_SESSION['username'].:Logged in:normal login\n,
3, $LogPath.admin.log);

problem is when it writes the entry in a file the first one shows up fine
but when you get 2 or more in it then it either strings the lines together
(the second entry will start on the same line as the one before it) so i
added the \n at the front of it to force the next one to the next line...
this works but now there is a blank space before each entry and its
annoying... how to fix??

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



Re: [PHP] Problem running sql stored in the database

2004-04-09 Thread John W. Holmes
From: John Nichel [EMAIL PROTECTED]

  Don't use single quotes.
 

 $sql = INSERT INTO table (id, name) VALUES ( ' . $id . ', ' . $name
 . ')

awww, come on... someone besides me had to understand wtf Ryan was
blabbering about, right

;) ;) ;)

---John Holmes...

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



RE: [PHP] \n doesnt work in error_log and windows?

2004-04-09 Thread Jay Blanchard
[snip]
i have this sort of a log string:
error_log(\n.$date.:.$_SESSION['username'].:Logged in:normal
login\n,
3, $LogPath.admin.log);

problem is when it writes the entry in a file the first one shows up
fine
but when you get 2 or more in it then it either strings the lines
together
(the second entry will start on the same line as the one before it) so i
added the \n at the front of it to force the next one to the next
line...
this works but now there is a blank space before each entry and its
annoying... how to fix??
[/snip]

Since this is Windows try \r\n at the EOL

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



Re: [PHP] Problem running sql stored in the database

2004-04-09 Thread Ryan A

 You have to eval() the code from the database to get the variables
 replaced
 (or use a regex).

 ?php
 $name = 'John';
 $str = file_get_contents('test.txt'); //Reads Hello $name
 eval('$str = ' . $str . ';');
 echo $str;
 ?



Hi John,
That didn't work (eval  i dont know regex well enough so dont use them), I
visited the online manual for eval and see that we are on the right track
but I am screwing up somewhere...(as usual)

rather than explain it over and over and confuse everyone, heres the code i
am using:

* * * * * *  code * * * * *  *

if($sql_exists == 0){} // first checked if there was any sql associated with
this
else{$cust_qry=stripslashes($o_sql);

echo $i2co_order_number; // Testing to see if this variable holds a value,
it does.

eval('$i2co_order_number = '.$i2co_order_number.';'); // even tried
putting cust_qry without success

$cust_result = mysql_query($cust_qry);
if(!$cust_result){echo 'Error (S1) running your optional custom SQL
statement.'.mysql_error();}

* * * * * *  code * * * * *  *

comments? suggestions?

Thanks,
-Ryan A

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



Re: [PHP] \n doesnt work in error_log and windows?

2004-04-09 Thread Andy B
everything works now tnx


- Original Message - 
From: Jay Blanchard [EMAIL PROTECTED]
To: Andy B [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, April 09, 2004 10:45 AM
Subject: RE: [PHP] \n doesnt work in error_log and windows?


[snip]
i have this sort of a log string:
error_log(\n.$date.:.$_SESSION['username'].:Logged in:normal
login\n,
3, $LogPath.admin.log);

problem is when it writes the entry in a file the first one shows up
fine
but when you get 2 or more in it then it either strings the lines
together
(the second entry will start on the same line as the one before it) so i
added the \n at the front of it to force the next one to the next
line...
this works but now there is a blank space before each entry and its
annoying... how to fix??
[/snip]

Since this is Windows try \r\n at the EOL

-- 
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] Serializing objects and storing them is sessions [fixed]

2004-04-09 Thread Kelly Hallman
Apr 9 at 1:44am, Jason Giangrande wrote:
 Jason Giangrande wrote:
  I'm having a problem unserializing objects that are passed from page to 
  page with sessions.  Registered globals is disabled so I am using the 
  $_SESSION array to store session variable
  
  When I var_dump() $_SESSION it appears to be a string representation of 
  the object.  However, when I try to unserialize() it and store it in 
  $auth the value is bool(false) and not an object.
  
  Can anyone tell me what I am doing wrong?
 
 Don't I feel stupid now.  I have solved my problem.  I had written a
 __sleep() function that I had forgotten about, and as it turns out, it
 was breaking things.  Not really sure why.  It was just creating the
 array of object properties to be serialized.  Commenting it out fixes
 the problem I was having.

You shouldn't serialize() objects prior to assign to a session variable.  
The default session handler automatically serializes the data. Assigning a
serialized object value to a session just adds redundancy and overhead. 

The only caveat: the class must be defined prior to session_start(), for
the same reason a class needs to be defined prior to unserializing.
http://www.php.net/manual/en/language.oop.serialization.php

--Kelly

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



Re: [PHP] Serializing objects and storing them is sessions [fixed]

2004-04-09 Thread Jason Giangrande
Kelly Hallman wrote:
Apr 9 at 1:44am, Jason Giangrande wrote:

Jason Giangrande wrote:

I'm having a problem unserializing objects that are passed from page to 
page with sessions.  Registered globals is disabled so I am using the 
$_SESSION array to store session variable

When I var_dump() $_SESSION it appears to be a string representation of 
the object.  However, when I try to unserialize() it and store it in 
$auth the value is bool(false) and not an object.

Can anyone tell me what I am doing wrong?
Don't I feel stupid now.  I have solved my problem.  I had written a
__sleep() function that I had forgotten about, and as it turns out, it
was breaking things.  Not really sure why.  It was just creating the
array of object properties to be serialized.  Commenting it out fixes
the problem I was having.


You shouldn't serialize() objects prior to assign to a session variable.  
The default session handler automatically serializes the data. Assigning a
serialized object value to a session just adds redundancy and overhead. 
Actually, only if you create the session with session_register() are 
they serialized automatically.  If you simply assign an object to the 
$_SESSION array it must be serialized manually.

--
Jason Giangrande [EMAIL PROTECTED]
http://www.giangrande.org
http://www.dogsiview.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Looking for a comprehensive PHP tutorial

2004-04-09 Thread -{ Rene Brehmer }-
I've been recommended the book PHP Developer's Cookbook by several PHP 
developers ... there's a new version of it out (3rd edition I believe) at 
the end of this month ... thus I haven't bought it yet...

FWIW

Rene

At 10:34 09-04-2004, Ash.. wrote:
Hi,

I am looking for a comprehensive handholder tutorial, that introduces the
various aspects
of PHP, step by step and let's u see the big picture.
I have come across tons of PHP learnware which is like how to do this and
how to do that.
But that still doesn't introduce the language to the beginner in an orderly
manner.
Any suggestions, links, will be greatly appreciated.
Or, if someone (experienced in PHP) thinks we must come up with such a
comprehensive tutorial, we can perhaps team up ;)
Ash
--
Rene Brehmer
aka Metalbunny
~ If you don't like what I have to say ... don't read it ~

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums @ http://forums.metalbunny.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] ** SOLVED** Problem running sql stored in the database

2004-04-09 Thread Ryan A
Ok, got it solved after going through all the examples at the online manual
for eval()

Heres the final code (case you are interested):

if($sql_exists == 0){}else{$cust_qry=$o_sql;
eval(\$cust_qry = \$cust_qry\;);
$cust_result = mysql_query($cust_qry);


Cheers,
-Ryan

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



Re: [PHP] Forwarding to another PHP page

2004-04-09 Thread -{ Rene Brehmer }-
At 11:59 09-04-2004, John W. Holmes wrote:
From: Ash.. [EMAIL PROTECTED]

 What are the various ways of forwarding to another page. I tried
header()..
 based on an example I found it in, but it doesnt work if I have done an
 include before calling the header. What are the other alternatives of
 forwarding. (I tried searching the PHP manual, but didnt find any clue.
Nor
 did I come across any learn material which seemed to deal with this.)
header() is the only way you're going to redirect with PHP. Alternatives
include a JavaScript redirection or a meta-refresh header.
I prefer having a meta-refresh header in my template. Since the template is 
shared across multiple scripts, some needs to forward, some don't I use a 
$forward variable that contains the URL to forward to, and simply check if 
it's set or not in the template header...

Something like:

head
?php
if (isset($forward)) {
  echo(META HTTP-EQUIV=\Refresh\ CONTENT=\0; URL=$forward\\r\n);
}
?
...
/head
the \r\n is probably irrelevant in HTML headers, but force of habit from 
doing MIME headers...

naturally there's possible variation to this according to the actual 
project ... but it's how I do it ...

Rene

--
Rene Brehmer
aka Metalbunny
~ If you don't like what I have to say ... don't read it ~

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums @ http://forums.metalbunny.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] ATTN: List Admins

2004-04-09 Thread Ryan A
Please take out these two addresses:

Information Desk [EMAIL PROTECTED]
Advance Credit Suisse Bank [EMAIL PROTECTED]

everytime we post to the list we get their damn autoresponders.

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



Re: [PHP] ^%$! Download accelerators

2004-04-09 Thread Raditha Dissanayake
Brian Dunning wrote:

I've been using the following code for some time to deliver electronic 
downloads of purchased software products -

  header('Content-Type: '.$file_row['content_type']);
  header('Content-Disposition: filename='.$file_row[filename].'');
  $size = filesize('../../store/files/'.$file_row['filename']);
  header('Content-Length: '.$size);
  header('Content-Transfer-Encoding: base64');
  readfile('../../store/files/'.$file_row['filename']);
looks good but don't know why you are using base64 it would increase the 
file size by upto 1/3 in some cases.

But once in a blue moon, someone complains that they didn't get their 
file and they always seem to be using some download accelerator 
software. Does anyone have any experience with these? Anything I can 
do to make the above code more robust? Note that it's been working 
great for a long time.


You don't need to support broken clients , but then by the same token 
you wouldn't need to support IE :-)  you might want to share some infor 
about what these download software is.

One guess is that they are using resume  which may not be fully 
supported on your system.



--
Raditha Dissanayake.
-
http://www.radinks.com/print/upload.php
SFTP, FTP and HTTP File Upload solutions 

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


Re: [PHP] Problem running sql stored in the database

2004-04-09 Thread John Nichel
John W. Holmes wrote:
From: John Nichel [EMAIL PROTECTED]

Don't use single quotes.

$sql = INSERT INTO table (id, name) VALUES ( ' . $id . ', ' . $name
. ')


awww, come on... someone besides me had to understand wtf Ryan was
blabbering about, right
;) ;) ;)

---John Holmes...
I have blabbering turned off today.  :o ;)

--
***
*  _  __   __  __   _  * John  Nichel *
* | |/ /___ __ \ \/ /__ _ _| |__ ___  __ ___ _ __  * 716.856.9675 *
* | ' / -_) _` \ \/\/ / _ \ '_| / /(_-_/ _/ _ \ '  \ * 737 Main St. *
* |_|\_\___\__, |\_/\_/\___/_| |_\_\/__(_)__\___/_|_|_|* Suite #150   *
*  |___/   * Buffalo, NY  *
* http://www.KegWorks.com[EMAIL PROTECTED] * 14203 - 1321 *
***
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] ATTN: List Admins

2004-04-09 Thread Andy B
i just blocked them whatever they are but still dont need any strange stuff
going on...

somebody might want to check into a pandasoft autoresponder that keeps
answering my messages saying that the list couldnt accept them and it was
deleted and blocked because i have a virus?? i had people try sending me
viruses lately but last i knew i dont have one...so i sort of blocked that
one too...


- Original Message - 
From: Ryan A [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, April 09, 2004 11:19 AM
Subject: [PHP] ATTN: List Admins


 Please take out these two addresses:

 Information Desk [EMAIL PROTECTED]
 Advance Credit Suisse Bank [EMAIL PROTECTED]

 everytime we post to the list we get their damn autoresponders.

 -- 
 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



[PHP] test

2004-04-09 Thread Strogg
test


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.655 / Virus Database: 420 - Release Date: 08/04/2004

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



Re: [PHP] Problem running sql stored in the database

2004-04-09 Thread Ryan A

On 4/9/2004 5:22:12 PM, John Nichel ([EMAIL PROTECTED]) wrote:
 John W. Holmes wrote:
  From: John Nichel [EMAIL PROTECTED]
 
 Don't use single quotes.
 
 
 $sql = INSERT INTO table (id, name) VALUES ( ' . $id . ', ' . $name
 . ')
 
 
  awww, come on... someone besides me had to understand wtf Ryan was
  blabbering about, right
 
  ;) ;) ;)
 
  ---John Holmes...
 
 I have blabbering turned off today.  :o ;)

Happy to see I bring so much intelligent conversation to the list :-p
Cheers,
-Ryan

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



[PHP] Need help

2004-04-09 Thread Strogg
Hi,
Am working through a PHP Book (I am a noob), and it appears to fall over on
the first tutorial.
Any ideas where I can get help?


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.655 / Virus Database: 420 - Release Date: 08/04/2004

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



RE: [PHP] Beginner Question

2004-04-09 Thread jon roig
Doesn't the Apple Developer Tools disk have all that stuff?

http://developer.apple.com/tools/

-- jon

---
jon roig
web developer
email: [EMAIL PROTECTED]
phone: 888.230.7557

-Original Message-
From: rob [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 08, 2004 10:31 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Beginner Question


I am a newcomer to PHP and I am looking for an intsallation package
similar to to FoxPro for MAC OSX 10.2.(Ie intsall appache, MY SQL and
Latest version of PHP) Does anyone know where I may find one? Thanks RB

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


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.644 / Virus Database: 412 - Release Date: 3/26/2004
 
  

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.644 / Virus Database: 412 - Release Date: 3/26/2004
 

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



RE: [PHP] Looking for a comprehensive PHP tutorial

2004-04-09 Thread jon roig
People always mock me when I mention it, but I really dig the Learn in
24 Hours books.

-- jon



-Original Message-
From: -{ Rene Brehmer }- [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 09, 2004 9:12 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Looking for a comprehensive PHP tutorial


I've been recommended the book PHP Developer's Cookbook by several PHP

developers ... there's a new version of it out (3rd edition I believe)
at 
the end of this month ... thus I haven't bought it yet...

FWIW

Rene

At 10:34 09-04-2004, Ash.. wrote:
Hi,

I am looking for a comprehensive handholder tutorial, that introduces 
the various aspects of PHP, step by step and let's u see the big 
picture. I have come across tons of PHP learnware which is like how to

do this and how to do that.
But that still doesn't introduce the language to the beginner in an
orderly
manner.
Any suggestions, links, will be greatly appreciated.

Or, if someone (experienced in PHP) thinks we must come up with such a 
comprehensive tutorial, we can perhaps team up ;) Ash

-- 
Rene Brehmer
aka Metalbunny

~ If you don't like what I have to say ... don't read it ~

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums @ http://forums.metalbunny.net/

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


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.644 / Virus Database: 412 - Release Date: 3/26/2004
 
  

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.644 / Virus Database: 412 - Release Date: 3/26/2004
 

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



[PHP] Re: Need help

2004-04-09 Thread Strogg
This the script that is falling over.
It calculates everything correct until the amount reaches £1,000, and then
it falls over and reads only the 1 before the comma, and then outputs the
price to be paid as £1.18 (£1 + the taxrate (0.175 rounded up))

?
  echo pOrder Processed at ;
  echo date(H:i, jS F);
  echo br;
  echo pYou ordered:;
  echo br;
  echo $tyreqty. Tyresbr;
  echo $oilqty. Bottles of Oilbr;
  echo $sparkqty. Spark Plugs;
  $totalqty = 0;
  $totalamount = 0.00;
  define(TYREPRICE, 100);
  define(OILPRICE, 10);
  define(SPARKPRICE, 5);
  $totalqty = $tyreqty + $oilqty + $sparkqty;
  $totalamount = $tyreqty * TYREPRICE
 + $oilqty * OILPRICE
 + $sparkqty * SPARKPRICE;
  $totalamount = number_format($totalamount, 2);
  echo br\n;
  echo Items Ordered: .$totalqty.br\n;
  echo Subtotal:  £.$totalamount.br\n;
  $taxrate = 0.175;  //local tax rate in UK is 17.5%
  $totalamount = $totalamount * (1 + $taxrate);
  $totalamount = number_format($totalamount, 2);
  echo Total Including Tax:  £.$totalamount.br\n;
?





---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.655 / Virus Database: 420 - Release Date: 08/04/2004

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



Re: [PHP] Need help

2004-04-09 Thread Daniel Clark
www.phpbuilder.com  has some wonderful articles for beginners and advanced.

 Hi,
 Am working through a PHP Book (I am a noob), and it appears to fall over
 on
 the first tutorial.
 Any ideas where I can get help?

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



[PHP] php/div question...

2004-04-09 Thread bruce
hi...

a php question.

i'm trying to figure out how to create a quick/sample app that will show how
to set up a few buttons/links that can change colors. ideally, i'd like to
be able to have a few pages, and have the buttons/links at the top of the
page.

if i select a button/link i'd like to be able to change the color of the
button/link, such that when i go to another page, the link/button maintains
the color.


ie:

page1.php
 button/link1  button/link2

 link to change button1

 link to page1  link to page2

page2.php
 button/link1  button/link2

 link to change button2

 link to page1  link to page2

if the user selects the link to change button1 on page 1, the color
bounces between two colors. if the user changes the color in page1, and then
selects the link to goto page2, page2 will show the button/link1 with the
changed color

hope this makes sense i'm just looking for a really simple/basic way of
doing this...

thanks for any pointers/assistance...

regards,

bruce

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



RE: [PHP] php/div question...

2004-04-09 Thread Jay Blanchard
[snip]
regards,
[/snip]

Click button.
Open CSS file and rewrite with new color.
Close CSS file.
Page reloads with new color.

Since the CSS has be re-written all of the pages will now show the new
colors where applicable. You could store color variables in a session
for each individual user.

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



Re: [PHP] Need help

2004-04-09 Thread Burhan Khalid
Strogg wrote:

Hi,
Am working through a PHP Book (I am a noob), and it appears to fall over on
the first tutorial.
Any ideas where I can get help?
Try the book/author/publisher website?

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


Re: [PHP] Smarty Summary was Re: [PHP] smarty

2004-04-09 Thread Justin Patrin
Jochem Maas wrote:

Chris de Vidal wrote:

Jochem Maas said:

1. 'Template Engine' - you can justifyably call PHP a template engine


Correct.  Seems that Smarty is, for the most part, redundant (see my last
post called PHP makes a great templating engine (Was: smarty)).
I was not intending to pronounce Smarty redundant; on the contrary if 
anything - but thats not the point...


but I think calling Smarty a template engine confuses the issue - it
would be clearer call it something like 'Presentation Component' which
encapsulates output caching, output string transformation, markup
generation, presentation logic security  seperation of (code  possibly
human) tasks. viewing it as a component means viewing it as a tool,
tools are used when appropriate and according to their capabilities and
the scope of the job at hand. in principle a sizeable proportion of all
the.


Tool.  Look at it as just another tool.  I was seeing it as a must have
because I was somewhat ignorant of PHP's native capabilities.  It adds
complexity and does indeed slow down your program (the Smarty class must
load on every page) so keep those in mind.  On the other hand, you're


the Smarty core is smaller than, for example, PEAR::QuickForm (if you 
use all the plugins its about 40% larger) - and PEAR::QuickForm is 
usually used with a Renderer (e.g. Smarty!!), think of it like this: how 
much do you charge per hour, what does an extra CPU cost  how much, if 
any, time does Smarty save you. (besides which I think its quite easy to 
develop something in Smarty which does what QuickForm does but more 
transparently and with alot less hassle - IMHO).

Code is code; it might not be perfect but it might scratch an itch.

almost forced to separate business and presentation and you gain caching


Smarty does force that at all; you have to make the distinction and 
apply liberal self-restraint.

(though native PHP options or Zend are available).  So it's a weighty
decision.  But it is a good tool.


Realise that Smarty (usually) only re-compiles the template if it 
changes. The compiled template are full of generated PHP - there is 
little overhead in including that.

if you use a native PHP option then:
a, what is Smarty? (not important!)
b, what are the chances that your output code/module/class/etc will
not employ similar solutions to something like Smarty? because broadly 
speaking



3. 'Lock In'


I believe Lock In is a big problem unless you document well.  For
instance, my supervisor is probably going to choose ASP.NET (don't ask
why) for our next project.  But all along, I plan to document it well in
case we hit a stumbling block.  With a bit of effort and the source 
code I
can port it to PHP.  I've even toyed with the idea of keeping a
fully-functional copy written in PHP while he's working in ASP.NET ;-) 
But I've got better things to do.


Limitations are often purely percieved rather than actual


I believe that's why I chose Smarty for my last project.  I thought PHP
limited me to keeping business logic mixed with presentation logic, but
it's hardly the case.


and funnily enough Smarty is actually a pretty good example of a 
possible PHP based solution to the problem logic seperation.

When you consider that it's just another tool in your box, it works 
well. It's not the only way to let designers design and programmers 
program
(Jochem is a big believer in CSS for that).  Just think of it as another


PLEASE WORLD: GET BEHIND CSS, AND FREE CONTENT FROM STYLE ON THE CLIENT.
why because it allows the structrully mark-uped to be display more 
flexibly, for diff. display, aural readers, braille etc. removing the 
styling definitions it also allows you to specify different markup.
I want to. I so want to, but I can never get it to make the layout as I 
want it. I want to take a div and make it vertically or horizontally 
centered in another divif you figure out how to do it with dynamic 
sizes that is easy and works on all the major browsers, let me know. 
I've tried for hours, looks on I don't know how many websites, and I 
still couldn't do it. I went back to tables because it's just so easy. 
CSS makes my life very hard...it doesn't seem to have the basics needed 
to create an entire layout.

That said, I do use lots of CSS for styling (font sizes, colors, images, 
printable pages, etc.), but fill-page styling via CSS is just beyond my 
reach.

Ever written a print version of a page? why bother when all you need do 
  is specify alternative stylesheet(s) to use for print media.

Ever heard you page say 'IMAGE' 'TABLE'  'DATA CELL' 50 odd times as a 
blind persons screen reader trys to make sense of your pretty new 
data-driven creation... where the f*** is the menu?! did you know there 
is even an extensive specification for markup of aural media (e.g. tone 
of voice, male/female, speed etc etc)

In my little world I have officially declared a Good Thing. of course
it leaves the problem of how to manage all those stylesheets 

[PHP] Re: Use PHP to copy MySQL tables

2004-04-09 Thread Justin Patrin
Robb Kerr wrote:

Is there an easy way to create an HTML page that uses PHP to copy selected
MySQL tables to backup copies on the same MySQL server? I want to create an
administration page for my client to be able to backup their database
whenever they see fit. But, I can't give them direct access to the MySQL
server and don't want them backing up to their hard drive. I prefer to
simply copy the tables to backup versions on the server so that if
problems arise, I can log into the server and simply copy the backups to
the originals.
Thanx in advance.
Well, here's what I would suggesteven though it's Linux specific (or 
at least mysql specific).

`mysqldump -uusername -ppassword -Q database  /tmp/backup.sql`;
`mysql -uusername -ppassword backupDatabase  /tmp/backup.sql`;
Or, if you feel like it, you can not to the file redirection and open a 
pipe to send the SQL back...

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


[PHP] Re: Sorting through an array

2004-04-09 Thread Justin Patrin
Jamie wrote:

I have an array of song artists and songs indexed by an id, i need a way of
taking out all the artists names. However as there are multiple lines for
each artist i have come accross a problem when only displaying the artist
once. Another problem is that the artists are not grouped together so i need
to store the artists that i have already passed and havent been matched so i
can check the next artist.
I know it sounds confusing, but i hope you understand what i mean! Any help
would be appreciated.
Jamie
Here's a real wasy way:

$artists = array();
foreach($songs as $song) {
  $artists[$song['artist']] = $song['artist'];
}
You'll only ever get one of each artist. Enjoy :-)

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


Re: [PHP] PHP - Basic Auth - Cpanel

2004-04-09 Thread Hernan Marino
This is a problem I had with my onw control panel for letting logged
in users use phpmyAdmin.
I just setted in the redirection script the $_SERVER['PHP_AUTH_USER']
and $_SERVER['PHP_AUTH_PW'] so the popup dont show up. But if cpanel
dont use PHP, and just passwd file with an .htaccess file, NO WAY to
accomplish what you want. I've spent hours trying to figure it out.
I also tried to set some vars in the HTTP headers and then redirect
using mod_rewrite of apache, and nothing, no way.

Please, let us know if you find the solution. Thanks a lot!

H Marino


On Fri, 9 Apr 2004 01:12:25 +0200, Ryan A wrote:
  My questions:
  How do I know where to send the data? (eg: which is the
authenticating
  file?)
  Do I pass it as a GET or a POST or what? URL encode?

 You need to tell the browser to use the log in credentials, this is
done
 by redirecting the browser to http://username:[EMAIL PROTECTED]/.

 However this does not work with IE with the latest security patch
 installed, I think. It forbids to set username and password in a
url.

Yep, had that problem. MS always to the rescue to complicate and screw
up
set standards.
Any work arounds on how to do it if the person is running IE with the
latest
patch?

Cheers,
-Ryan

--
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



[PHP] Re: Need help

2004-04-09 Thread Justin Patrin
Strogg wrote:

This the script that is falling over.
It calculates everything correct until the amount reaches £1,000, and then
it falls over and reads only the 1 before the comma, and then outputs the
price to be paid as £1.18 (£1 + the taxrate (0.175 rounded up))
?
  echo pOrder Processed at ;
  echo date(H:i, jS F);
  echo br;
  echo pYou ordered:;
  echo br;
  echo $tyreqty. Tyresbr;
  echo $oilqty. Bottles of Oilbr;
  echo $sparkqty. Spark Plugs;
  $totalqty = 0;
  $totalamount = 0.00;
  define(TYREPRICE, 100);
  define(OILPRICE, 10);
  define(SPARKPRICE, 5);
  $totalqty = $tyreqty + $oilqty + $sparkqty;
  $totalamount = $tyreqty * TYREPRICE
 + $oilqty * OILPRICE
 + $sparkqty * SPARKPRICE;
  $totalamount = number_format($totalamount, 2);
  echo br\n;
  echo Items Ordered: .$totalqty.br\n;
  echo Subtotal:  £.$totalamount.br\n;
  $taxrate = 0.175;  //local tax rate in UK is 17.5%
  $totalamount = $totalamount * (1 + $taxrate);
  $totalamount = number_format($totalamount, 2);
  echo Total Including Tax:  £.$totalamount.br\n;
?




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.655 / Virus Database: 420 - Release Date: 08/04/2004
Here's your problem:

$totalamount = number_format($totalamount, 2);

That creates a string with a comma in it. When you try to read it as a 
number again, the comma screws it up. Wait to do the number_format until 
 you output like this:

echo Subtotal:  £.number_format($totalamount, 2).br\n;
...
echo Total Including Tax:  £.number_format($totalamount, 2).br\n;
In other words, instead of assigning the number formatted string back to 
$totalamount, format it only on output.

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


[PHP] Understanding sessions

2004-04-09 Thread Todd Cary
I am trying to understand sessions are done with php.  My learning 
script has the following:

  session_start();
  if (isset($_SESSION['firstname'])) {
$_SESSION['firstname'] = 'Todd';
  } else {
$_SESSION['firstname'] = 'Nobody';
  }
  echo SESSION:  . $_SESSION['firstname'] . br;
  echo 'SID: ' . SID . 'br';
  echo 'br /a href=page_2.php?' . SID . 'page 2/a';
SID is always empty.  What have I missed?

Todd

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


Re: [PHP] Understanding sessions

2004-04-09 Thread John W. Holmes
From: Todd Cary [EMAIL PROTECTED]

 I am trying to understand sessions are done with php.  My learning
 script has the following:

session_start();
if (isset($_SESSION['firstname'])) {
  $_SESSION['firstname'] = 'Todd';
} else {
  $_SESSION['firstname'] = 'Nobody';
}

echo SESSION:  . $_SESSION['firstname'] . br;
echo 'SID: ' . SID . 'br';
echo 'br /a href=page_2.php?' . SID . 'page 2/a';

 SID is always empty.  What have I missed?

Session IDs are normally carried in cookies. If the cookie was set
successfully, then SID is not set because it's not needed. Turn off cookies
and try this code.

---John Holmes...

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



Re: [PHP] Understanding sessions

2004-04-09 Thread Daniel Clark
Todd,

I think you want the session_id() function.

http://us3.php.net/manual/en/function.session-id.php


 I am trying to understand sessions are done with php.  My learning
 script has the following:

session_start();
if (isset($_SESSION['firstname'])) {
  $_SESSION['firstname'] = 'Todd';
} else {
  $_SESSION['firstname'] = 'Nobody';
}

echo SESSION:  . $_SESSION['firstname'] . br;
echo 'SID: ' . SID . 'br';
echo 'br /a href=page_2.php?' . SID . 'page 2/a';

 SID is always empty.  What have I missed?

 Todd

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



[PHP] php frame/session update question...

2004-04-09 Thread bruce
how would i use frames to update a session var...

i'm considering using frames as a way of updating a session var. i'd like to
allow the user to select a link, have the link update a session var, and
then return the user to the same frame on the same page...

any examples/etc...

thanks

bruce

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



[PHP] Store e-mail in DB

2004-04-09 Thread MadHD
Hi,
i'm searching some script that can read e-mails with attachments from an
account pop3 and that store them in a db.
Someone can help me?
Thanks, Heber.

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



Re: [PHP] Understanding sessions

2004-04-09 Thread Todd Cary
If I use session_id(), I do get a value.  However, I have 
session_use_cookies = 0 and I do not have a value for SID.  Is that correct?

Todd

Daniel Clark wrote:

Todd,

I think you want the session_id() function.

http://us3.php.net/manual/en/function.session-id.php



I am trying to understand sessions are done with php.  My learning
script has the following:
  session_start();
  if (isset($_SESSION['firstname'])) {
$_SESSION['firstname'] = 'Todd';
  } else {
$_SESSION['firstname'] = 'Nobody';
  }
  echo SESSION:  . $_SESSION['firstname'] . br;
  echo 'SID: ' . SID . 'br';
  echo 'br /a href=page_2.php?' . SID . 'page 2/a';
SID is always empty.  What have I missed?

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


Re: [PHP] Understanding sessions

2004-04-09 Thread Todd Cary
Daniel -

As suggested, if I turn off cookies in my browser, then SID is set.  So 
the directive in php.ini does not cause the use of cookies to be 
completely turned off?

Another question envolves the use of the back button.  My client wants 
the use of the back button to be turned off for security reasons for 
some pages.  His preference is to have a page expire if it is arrived on 
by pressing the back button.  Can this be done with sessions?

Again, many thanks for your help as I go through the learning curve.  In 
the past, I used my DB for storing sessions.

Todd

Daniel Clark wrote:

Todd,

I think you want the session_id() function.

http://us3.php.net/manual/en/function.session-id.php



I am trying to understand sessions are done with php.  My learning
script has the following:
  session_start();
  if (isset($_SESSION['firstname'])) {
$_SESSION['firstname'] = 'Todd';
  } else {
$_SESSION['firstname'] = 'Nobody';
  }
  echo SESSION:  . $_SESSION['firstname'] . br;
  echo 'SID: ' . SID . 'br';
  echo 'br /a href=page_2.php?' . SID . 'page 2/a';
SID is always empty.  What have I missed?

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


Re: [PHP] Understanding sessions

2004-04-09 Thread Daniel Clark
I'm not certain.

I normally use session variables to store and hold login username or order
state.

e.g. $_SESSION['username']


 If I use session_id(), I do get a value.  However, I have
 session_use_cookies = 0 and I do not have a value for SID.  Is that
 correct?

 Todd

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



Re: [PHP] Understanding sessions

2004-04-09 Thread Daniel Clark
 As suggested, if I turn off cookies in my browser, then SID is set.  So
 the directive in php.ini does not cause the use of cookies to be
 completely turned off?


My understanding is the php.ini sessions.save_path(?) is for PHP to have a
temp directory to write session information on the server.   Our course
the client's browser has a cookie set or in the URL.   The session
information on the client and server must then match, else it was forged.



 Another question envolves the use of the back button.  My client wants
 the use of the back button to be turned off for security reasons for
 some pages.  His preference is to have a page expire if it is arrived on
 by pressing the back button.  Can this be done with sessions?

No, I don't see how with sessions.   Some of the displayed browser options
that can be turned off with Javascript.   However there is still hot keys
for many of those functions.

I'd keep track of the current page, and if a back button was pressed,
have that page expire and display a message don't go backwards :-)

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



Re: [PHP] Serializing objects and storing them is sessions [fixed]

2004-04-09 Thread Kelly Hallman
Apr 9 at 11:12am, Jason Giangrande wrote:
  You shouldn't serialize() objects prior to assign to a session variable.  
  The default session handler automatically serializes the data. Assigning a
  serialized object value to a session just adds redundancy and overhead. 
 
 Actually, only if you create the session with session_register() are 
 they serialized automatically.  If you simply assign an object to the 
 $_SESSION array it must be serialized manually.

When writing the above response, I had noted the documentation mentioned
something to this effect. I believe this is incorrect or ambiguous.

Try it without serializing, it works.

After running some tests, I can't speculate on the exact operation, as it
appears that the session handler may be 'manually' serializing any objects
before serializing the session data, as opposed to this being inherent in
the handler's serializing of the session data.

The point is, it's not necessary to manually serialize() the object.  
Regardless of the semantics, it happens transparently. Advantageous
because then you can just access the object directly via the session
variable, without needing to convert it in and out every time.

-- 
Kelly Hallman

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



Re: [PHP] Understanding sessions

2004-04-09 Thread Curt Zirzow
* Thus wrote Todd Cary ([EMAIL PROTECTED]):
 If I use session_id(), I do get a value.  However, I have 
 session_use_cookies = 0 and I do not have a value for SID.  Is that correct?

SID is controlled by session.use_trans_sid

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] Re: Hiding email address from Robots ??

2004-04-09 Thread Gerben
you could make it more difficult when you replace the href=... with
href=#. the only problem now is that people without javascript can's use
it.
you can make the onClick part (almost)impossible to harvest by putting
part(s) of the adres into a variable somewhere else in the html-code
like this:

scriptvar nospam = 'mail'/script
a href=#
onclick=location.href='mai'+'lto:'+nospam+unescape('%40')+'domain.com';
return false;mail#x40;do!--make it difficult--main#x2e;com/a

the weakest link is now the part between the a an /a


Curt Zirzow [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 * Thus wrote Gerben ([EMAIL PROTECTED]):
  just google for it. there are several PHP classes that do that for you.
  try something like:
  a href=mail-at-domain-dot-com
  onclick=location.href='mai'+'lto:'+'mail'+unescape('%40')+'domain.com';
  return false;mail#x40;do!--make it difficult--main#x2e;com/a

 Only problem is anything obscured can pretty much be found
   /(\w+).*(at|@).*(\w+).*(\.|dot).*(\w+)/

 Even javascript could be rendered then captured. It all depends on
 the persons dedication on finding them.


 Curt
 --
 I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] Serializing objects and storing them is sessions [fixed]

2004-04-09 Thread Jason Giangrande
Kelly Hallman wrote:
Apr 9 at 11:12am, Jason Giangrande wrote:

You shouldn't serialize() objects prior to assign to a session variable.  
The default session handler automatically serializes the data. Assigning a
serialized object value to a session just adds redundancy and overhead. 
Actually, only if you create the session with session_register() are 
they serialized automatically.  If you simply assign an object to the 
$_SESSION array it must be serialized manually.


When writing the above response, I had noted the documentation mentioned
something to this effect. I believe this is incorrect or ambiguous.
Try it without serializing, it works.
After retesting, it seems you are correct.  I guess the same bad 
__sleep() code that was causing the object not to unserialize at all was 
also preventing automatic serialization.  However; it does not seem to 
harm anything if serialize() and unserialize() are called manually on an 
object.  It's just extra code that doesn't do anything, and therefore, 
can be removed.

--
Jason Giangrande [EMAIL PROTECTED]
http://www.giangrande.org
http://www.dogsiview.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] No Back Button in forms

2004-04-09 Thread James E Hicks III
On Friday 09 April 2004 02:14 pm, Daniel Clark wrote:
  Another question envolves the use of the back button.  My client wants
  the use of the back button to be turned off for security reasons for
  some pages.  His preference is to have a page expire if it is arrived on
  by pressing the back button.  Can this be done with sessions?

I put the following in my authenticate.php which is included at the top of 
every page.

if ($_POST['form_id'] != ''){
mysql_select_db(form_authentication);
$query = select count(*) as valid_form from form_id where form_id = 
'.$_POST['form_id'].';
extract(mysql_fetch_array(mysql_query($query)));
if ( $valid_form  1 ){
include(warn_doubleclick.php);
exit;
} else {
mysql_select_db(form_authentication);
$query = delete from form_id where form_id = '.$_POST['form_id'].';
mysql_query($query);
}
}

function create_form_id(){
mysql_select_db(form_authentication);
$new_form_id = uniqid(rand(),1);
$query = insert into form_id values ( '$new_form_id' );
mysql_query($query);
$form_field = input type=\hidden\ name=\form_id\ 
value=\$new_form_id\;
return $form_field;
}

Then inside every form that I want to protect from back button or 
double-clicking of the submit button I echo the results of create_form_id 
into.

?php
echo form action=\.$_SERVER['PHP_SELF'].\ method=\POST\;
echo input type=\text\ name=\test\;
echo create_form_id();
echo /form;
?

Here is an example warn_doubleclick.php that you can edit to your taste.

?php
include(header.php);
echo (BRBRh2You have double clicked the submit button titledb);
echo ($_POST['submit']./b or attempted to process this form twice./h2);
echo (BRBRa href=index.phpReturn to Program/a);
echo (/body/html);
?

Here is the SQL to create necessary DB and table.

CREATE DATABASE form_authentication;
CREATE TABLE form_id (
  form_id varchar(50) NOT NULL default ''
) TYPE=MyISAM;

James Hicks

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



[PHP] Re: Store e-mail in DB

2004-04-09 Thread Michelle Konzack
Am 2004-04-09 19:18:18, schrieb MadHD:
Hi,
i'm searching some script that can read e-mails with attachments from an
account pop3 and that store them in a db.
Someone can help me?
Thanks, Heber.

Use fetchmail to get the Mails and forward ist to procmail. 
Here you install a filter like

:0 ci
* ^To.*(MadHD)
| /your/path/to/your/program [ --some-options-possible ]

I have curently around 4,7 Million E-Mails in my postgresql...
And each month around 120.000 more !

Oh yes, I do the job from a BASH-Script and put it into the 
postgresql with a commandline tool. 

Oh yes, before processing I use 

:0 fh
| formail -f -I Received: -I Envelope-to: -I Delivered-to: -I Return-Path:

To kill the unneccesary Headers... and protect my Download-E-Mails 
to become not SPAM'ed, because my postgresql is world readable.

Oh yes, Attachments are unpacked and saved with the Mesage-ID and 
an enhancement on a seperat Web-Server.

Greetings
Michelle

-- 
Registered Linux-User #280138 with the Linux Counter, http://counter.li.org/ 

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



Re: [PHP] Understanding sessions

2004-04-09 Thread Justin Patrin
Daniel Clark wrote:
As suggested, if I turn off cookies in my browser, then SID is set.  So
the directive in php.ini does not cause the use of cookies to be
completely turned off?


My understanding is the php.ini sessions.save_path(?) is for PHP to have a
temp directory to write session information on the server.   Our course
the client's browser has a cookie set or in the URL.   The session
information on the client and server must then match, else it was forged.



Another question envolves the use of the back button.  My client wants
the use of the back button to be turned off for security reasons for
some pages.  His preference is to have a page expire if it is arrived on
by pressing the back button.  Can this be done with sessions?


No, I don't see how with sessions.   Some of the displayed browser options
that can be turned off with Javascript.   However there is still hot keys
for many of those functions.
I'd keep track of the current page, and if a back button was pressed,
have that page expire and display a message don't go backwards :-)
That works, but only if the browser requests a new copy of the page. 
Accorind got browser specs, they should display the cached copy. You can 
try setting no caching headers and meta tags and see if that helps.



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


[PHP] Finding value in multi-dimensional array

2004-04-09 Thread Verdon Vaillancourt
Hi, being somewhat of a noob, I hope I'm using the right language to phrase
this question...

In a project I am working with, I have a multi-dimensional array in session
when a user logs in. Visually, it looks something like this...

OBJ_user
username = value
isAdmin = value
modSettings =  contacts = array
news = array
listings = firstname = value
lastname = value
active = value
phone = value
gallery = array
anothermod = array
userID = value
js = value


I'm trying to check the value of active for an if() statement and can't seem
to figure out the correct syntax to get it to work. I've tried

if($_SESSION[OBJ_user]-modSettings[listings]-active == 1) {
then do something;
} else {
then do something else;
}

if($_SESSION[OBJ_user][modSettings][listings][active]) {
then do something;
} else {
then do something else;
}

if($_SESSION[OBJ_user][modSettings][listings][active] == 1) {
then do something;
} else {
then do something else;
}

and none of them work even though I know the session value is there.

Any advice as to what I'm doing wrong?

Thanks,
verdon

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



[PHP] Re: Finding value in multi-dimensional array

2004-04-09 Thread Andy Ladouceur
Verdon Vaillancourt wrote:
Hi, being somewhat of a noob, I hope I'm using the right language to phrase
this question...
In a project I am working with, I have a multi-dimensional array in session
when a user logs in. Visually, it looks something like this...
OBJ_user
username = value
isAdmin = value
modSettings =  contacts = array
news = array
listings = firstname = value
lastname = value
active = value
phone = value
gallery = array
anothermod = array
userID = value
js = value
I'm trying to check the value of active for an if() statement and can't seem
to figure out the correct syntax to get it to work. I've tried
if($_SESSION[OBJ_user]-modSettings[listings]-active == 1) {
then do something;
} else {
then do something else;
}
if($_SESSION[OBJ_user][modSettings][listings][active]) {
then do something;
} else {
then do something else;
}
if($_SESSION[OBJ_user][modSettings][listings][active] == 1) {
then do something;
} else {
then do something else;
}
and none of them work even though I know the session value is there.

Any advice as to what I'm doing wrong?

Thanks,
verdon
The second of your three attempts should work fine, as should the third. 
Are you certain the actual value of active isn't 0? Try echoing the 
value of it to the screen, or do a print_r($_SESSION['OBJ_user']) to 
check the values and structure of the whole multidimensional array.

Andy

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


Re: [PHP] Finding value in multi-dimensional array

2004-04-09 Thread Richard Harb
do a print_r() for the structure. -- print_r($_SESSION[OBJ_user]);
and look at the page source.

at each level ...
if is says array refer to it with ['property']
if obj (stdClass or otherwise) use - that arrow thingy

I am not sure what the arrows in you desc mean, whether it's key/value
pair of the array or hints to it being an object's property.

hth

Richard

Friday, April 9, 2004, 9:43:36 PM, you wrote:

 Hi, being somewhat of a noob, I hope I'm using the right language to phrase
 this question...

 In a project I am working with, I have a multi-dimensional array in session
 when a user logs in. Visually, it looks something like this...

 OBJ_user
 username = value
 isAdmin = value
 modSettings =  contacts = array
 news = array
 listings = firstname = value
 lastname = value
 active = value
 phone = value
 gallery = array
 anothermod = array
 userID = value
 js = value


 I'm trying to check the value of active for an if() statement and can't seem
 to figure out the correct syntax to get it to work. I've tried

 if($_SESSION[OBJ_user]-modSettings[listings]-active == 1) {
 then do something;
 } else {
 then do something else;
 }

 if($_SESSION[OBJ_user][modSettings][listings][active]) {
 then do something;
 } else {
 then do something else;
 }

 if($_SESSION[OBJ_user][modSettings][listings][active] == 1) {
 then do something;
 } else {
 then do something else;
 }

 and none of them work even though I know the session value is there.

 Any advice as to what I'm doing wrong?

 Thanks,
 verdon

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



Re: [PHP] Finding value in multi-dimensional array

2004-04-09 Thread Verdon Vaillancourt
Sorry, my example was poor :) Thanks for the print_r tip. When added to the
bottom of the page,

print_r($_SESSION[OBJ_user]);

Prints...

phpws_user Object
(
[user_id] = 5
[username] = agent
[password] = 77abcd5cb2ef4a366c2749ea9931c79e
[email] = [EMAIL PROTECTED]
[admin_switch] = 1
[deity] = 
[groups] = Array
(
)

[modSettings] = Array
(
[listings] = Array
(
[active] = 1
[first_name] = Agent
[last_name] = Guy
)

)

[permissions] = Array
(
[MOD_debug] = 1
)

[groupPermissions] =
[groupModSettings] =
[error] = Array
(
)

[temp_var] = 
[last_on] = 1081527610
[js_on] = 1
[user_settings] =
[group_id] = 
[group_name] =
[description] =
[members] = 
)

So, should my reference be...

if($_SESSION[OBJ_user][modSettings][listings]-active == 1)

That didn't seem to work, but if it should, perhaps I need to look somewhere
else?

Thanks,
Verdon



On 4/9/04 4:06 PM, Richard Harb [EMAIL PROTECTED] wrote:

 do a print_r() for the structure. -- print_r($_SESSION[OBJ_user]);
 and look at the page source.
 
 at each level ...
 if is says array refer to it with ['property']
 if obj (stdClass or otherwise) use - that arrow thingy
 
 I am not sure what the arrows in you desc mean, whether it's key/value
 pair of the array or hints to it being an object's property.
 
 hth
 
 Richard
 
 Friday, April 9, 2004, 9:43:36 PM, you wrote:
 
 Hi, being somewhat of a noob, I hope I'm using the right language to phrase
 this question...
 
 In a project I am working with, I have a multi-dimensional array in session
 when a user logs in. Visually, it looks something like this...
 
 OBJ_user
 username = value
 isAdmin = value
 modSettings =  contacts = array
 news = array
 listings = firstname = value
 lastname = value
 active = value
 phone = value
 gallery = array
 anothermod = array
 userID = value
 js = value
 
 
 I'm trying to check the value of active for an if() statement and can't seem
 to figure out the correct syntax to get it to work. I've tried
 
 if($_SESSION[OBJ_user]-modSettings[listings]-active == 1) {
 then do something;
 } else {
 then do something else;
 }
 
 if($_SESSION[OBJ_user][modSettings][listings][active]) {
 then do something;
 } else {
 then do something else;
 }
 
 if($_SESSION[OBJ_user][modSettings][listings][active] == 1) {
 then do something;
 } else {
 then do something else;
 }
 
 and none of them work even though I know the session value is there.
 
 Any advice as to what I'm doing wrong?
 
 Thanks,
 verdon
 
 
 
 
 
 

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



Re: [PHP] Finding value in multi-dimensional array

2004-04-09 Thread Richard Harb
No problem ..
Let's see:
if($_SESSION['OBJ_user']-modSettings['listings']['active'] == '1') {

That should be it ...

Sidenote: use single quotes whenever the string needn't be evaluated
(i.e. is a variable itself) you save a couple cycles every time.

hth
Richard


Friday, April 9, 2004, 10:32:25 PM, you wrote:

 Sorry, my example was poor :) Thanks for the print_r tip. When added to the
 bottom of the page,

 print_r($_SESSION[OBJ_user]);

 Prints...

 phpws_user Object
 (
 [user_id] = 5
 [username] = agent
 [password] = 77abcd5cb2ef4a366c2749ea9931c79e
 [email] = [EMAIL PROTECTED]
 [admin_switch] = 1
 [deity] = 
 [groups] = Array
 (
 )

 [modSettings] = Array
 (
 [listings] = Array
 (
 [active] = 1
 [first_name] = Agent
 [last_name] = Guy
 )

 )

 [permissions] = Array
 (
 [MOD_debug] = 1
 )

 [groupPermissions] =
 [groupModSettings] =
 [error] = Array
 (
 )

 [temp_var] = 
 [last_on] = 1081527610
 [js_on] = 1
 [user_settings] =
 [group_id] = 
 [group_name] =
 [description] =
 [members] = 
 )

 So, should my reference be...

 if($_SESSION[OBJ_user][modSettings][listings]-active == 1)

 That didn't seem to work, but if it should, perhaps I need to look somewhere
 else?

 Thanks,
 Verdon

snipped

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



[PHP] Re: Forwarding to another PHP page

2004-04-09 Thread Jason Barnett
Ash.. wrote:

Hello,

Thanks John (Holmes) for the clue on form-param-reading. Simple one, but
shows I got a lot of basics to learn yet.
Here I have another doubt I cant resist asking help for.

What are the various ways of forwarding to another page. I tried header()..
based on an example I found it in, but it doesnt work if I have done an
include before calling the header. What are the other alternatives of
forwarding. (I tried searching the PHP manual, but didnt find any clue. Nor
did I come across any learn material which seemed to deal with this.)
Thanks for all help,
Ash
There are lots and lots of ways to pass information from one web page to 
another, and like a lot of other things the best way to go depends on 
what you want to do.  For a lot of purposes sending information via post 
(hidden form fields) and get (as part of url) form variables are a good 
way to send information.  If you're looking for alternative ways to send 
information, start looking into streams (which are in the php manual).

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


Re: [PHP] Can't copy a variable from one session to another?

2004-04-09 Thread Scott Bronson
After talking with some folks on IRC, it sounds like this
is effectively impossible??

I'd just like to check -- is it really impossible in PHP to
copy a variable from one session to another?  I don't mind
subtle trickery.

Thanks,

- Scott




On Fri, 9 Apr 2004 02:37:05 -0700 (PDT)
Scott Bronson [EMAIL PROTECTED] wrote:

 My web site currently uses 2 sessions: mine (SBSESSID) and
 SquirrelMail's (SQMSESSID).  They work perfectly on their own.  
 However, I would like to allow the user to move from my area to
 SquirrelMail without re-entering a password.  Therefore, I need to copy
 the password from my session to SquirrelMail's.  I've been struggling with
 this for most of the night but this is the closest I've come:
 
 tst.php:
 
 ?php
 error_reporting(E_NONE);  // suppress spurious cookie errors
 header(content-type: text/plain);
 
 /// set up original session, then close it
 session_name(SESS1);
 session_start();
 print_r(session_name());
 echo   . print_r($_SESSION,true) . \n;
 session_write_close();
 session_unset();
 
 // print new session, retrieve secret key, then close it.
 session_name(SESS2);
 session_start();
 print_r(session_name());
 echo   . print_r($_SESSION,true) . \n;
 $secret = $_SESSION['password'];
 session_write_close();
 session_unset();
 
 // open old session. it should exactly match the original.
 session_name(SESS1);
 session_start();
 print_r(session_name());
 echo   . print_r($_SESSION,true) . \n;
 ?
 
 
 When I run this after filling in the sessions, I get:
 
   SESS1 Array
   (
 [squirrel] = mail
   )
 
   SESS2 Array
   (
 [squirrel] = mail
   )
 
   SESS1 Array
   (
 [squirrel] = mail
   )
 
 What's happening?  The second time I call session_start(), instead of
 getting SESS2 like I asked for, I'm just getting SESS1 again.  Even if I
 call error_reporting(E_ALL), I don't get any relevant error messages.  Why
 won't session_start() open the named session?
 
 When I replace the two calls to session_write_close() with
 session_destroy(), I get this:
 
 SESS1 Array
 (
 [squirrel] = mail
 )
 
 SESS2 Array
 (
 [password] = whoa
 )
 
 SESS1 Array
 (
 )
 
 Which is correct, except that it destroys the sessions!  So close and yet
 so far.
 
 Does anybody know how I can do this?  I'm stumped.  Thanks!
 
 - Scott
 
 
 To duplicate exactly what I did here, create 2 more scripts:
 
 s1.php:
 
   ?php
   session_name(SESS1);
   session_start();
   $_SESSION[squirrel] = mail;
   print_r($_SESSION);
   ?
 
 
 s2.php:
 
   ?php
   session_name(SESS2);
   session_start();
   $_SESSION[password] = whoa;
   print_r($_SESSION);
   ?
 
 Now, open s1.php in your web browser.  Then open s2. php.  Finally, open
 tst.php.
 
 -- 
 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] Can't copy a variable from one session to another?

2004-04-09 Thread Robert Cummings
On Fri, 2004-04-09 at 18:40, Scott Bronson wrote:
 After talking with some folks on IRC, it sounds like this
 is effectively impossible??
 
 I'd just like to check -- is it really impossible in PHP to
 copy a variable from one session to another?  I don't mind
 subtle trickery.

If they're both on the same server then there's nothing stopping you
from loading Suirrel mail's session data in the other application and
nothing stopping you from hacking squirrel mail to load the other
session's data. Since both are on the same server, BOTH session IDs
should be available to your script if they are using cookies. If;
however, they are using URL rewriting, then there is more trickery,
either way it IS possible. Even if they're on seprate servers it is
possible via certain tricks.

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.  |
`'

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



Re: [PHP] ATTN: List Admins

2004-04-09 Thread -{ Rene Brehmer }-
I'll second that ... keep getting this in response from them:

Thank you !!

Your message has been received; we will treat your message and get back to 
you as soon as possible.

Besides the fact that mailman more or less makes this list useless for me 
... this is just another annoyance...

Rene

At 16:19 09-04-2004, Ryan A wrote:
Please take out these two addresses:

Information Desk [EMAIL PROTECTED]
Advance Credit Suisse Bank [EMAIL PROTECTED]
everytime we post to the list we get their damn autoresponders.
--
Rene Brehmer
aka Metalbunny
~ If you don't like what I have to say ... don't read it ~

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums @ http://forums.metalbunny.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] regular expressions

2004-04-09 Thread René Fournier
I'm trying to 'clean up' some text that is extracted from a web 
directory, and I need to use (I think) preg_replace or ereg_replace, 
etc. I've read a bunch of tutorials, but none of them seem to cover the 
particular thing I want to do. Here's an example of text I need to 
process:

-

J.  Smith   ( More Info )
map
driving directions
add to My Directory
update or remove
Did you go to High School with J.  Smith?
 
B. Dixon   ( More Info )
map
driving directions
add to My Directory
update or remove
Did you go to High School with B. Dixon?

M.  Jones   ( More Info )
map
driving directions
add to My Directory
update or remove
Did you go to High School with M.  Jones?

-

The above is a string. I want to eliminate, for example, all the lines 
that say Did you... ?, but I don't know how to refer to them because 
they are each a little different (because of the name). I know regular 
expressions can do this, but I can't seem to wrap my mind around the 
necessary arguments... This being my first foray into regex. I've 
written feeble stuff like:

$result = ereg_replace(Did you go\[a-zA-Z]\?,,$result);

But of course it doesn't work. Any ideas?  Thanks.

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


RE: [PHP] Looking for a comprehensive PHP tutorial

2004-04-09 Thread -{ Rene Brehmer }-
I've got a Lean C++ in 24 hours which has only proven useless to me ... 
and that's after nearly 20 years programming in nearly all other 
programming languages... so I basically don't like them ... the Learn ... 
in 21 days seems alot better written ... both series are by Sams btw

Rene

At 16:38 09-04-2004, jon roig wrote:
People always mock me when I mention it, but I really dig the Learn in
24 Hours books.
-- jon
--
Rene Brehmer
aka Metalbunny
~ If you don't like what I have to say ... don't read it ~

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums @ http://forums.metalbunny.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] regular expressions

2004-04-09 Thread Richard Harb
Saturday, April 10, 2004, 2:02:04 AM, you wrote:

 I'm trying to 'clean up' some text that is extracted from a web 
 directory, and I need to use (I think) preg_replace or ereg_replace,
 etc. I've read a bunch of tutorials, but none of them seem to cover the
 particular thing I want to do. Here's an example of text I need to 
 process:

 -

 J.  Smith   ( More Info )
 map
 driving directions
 add to My Directory
 update or remove

 Did you go to High School with J.  Smith?

snipped

without further ado:
$str = your stuff here;
$what = array(/\r\nupdate or remove/, /\r\nDid you go.*\?\r\n/i);
$with = array('', '');

echo preg_replace($what, $with, $str);

hth
Richard

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



[PHP] Store e-mail in DB

2004-04-09 Thread Michelle Konzack

Am 2004-04-09 19:18:18, schrieb MadHD:
Hi,
i'm searching some script that can read e-mails with attachments from an
account pop3 and that store them in a db.
Someone can help me?
Thanks, Heber.

Use fetchmail to get the Mails and forward ist to procmail. 
Here you install a filter like

:0 ci
* ^To.*(MadHD)
| /your/path/to/your/program [ --some-options-possible ]

I have curently around 4,7 Million E-Mails in my postgresql...
And each month around 120.000 more !

Oh yes, I do the job from a BASH-Script and put it into the 
postgresql with a commandline tool. 

Oh yes, before processing I use 

:0 fh
| formail -f -I Received: -I Envelope-to: -I Delivered-to: -I Return-Path:

To kill the unneccesary Headers... and protect my Download-E-Mails 
to become not SPAM'ed, because my postgresql is world readable.

Oh yes, Attachments are unpacked and saved with the Mesage-ID and 
an enhancement on a seperat Web-Server.

Greetings
Michelle

-- 
Registered Linux-User #280138 with the Linux Counter, http://counter.li.org/ 

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



Re: [PHP] ATTN: List Admins

2004-04-09 Thread Elfyn McBratney
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

[postmaster@ added to Cc:]

Hello,

On Saturday 10 Apr 2004 00:39, -{ Rene Brehmer }- wrote:
 I'll second that ... keep getting this in response from them:

 Thank you !!

 Your message has been received; we will treat your message and get back to
 you as soon as possible.

 Besides the fact that mailman more or less makes this list useless for me
 ... this is just another annoyance...

 Rene

 At 16:19 09-04-2004, Ryan A wrote:
 Please take out these two addresses:
 
 Information Desk [EMAIL PROTECTED]
 Advance Credit Suisse Bank [EMAIL PROTECTED]
 
 everytime we post to the list we get their damn autoresponders.

Yes, postmaster, please do.  The spam mennaces hit me 10+ times on every post 
i make to php-general@ (yes, only three or four today :)

Thanks,
Elfyn

- -- 
Elfyn McBratney, EMCB
mailto:[EMAIL PROTECTED]
http://www.emcb.co.uk/

PGP Key ID: 0x456548B4
PGP Key Fingerprint:
  29D5 91BB 8748 7CC9 650F  31FE 6888 0C2A 4565 48B4

When I say something, I put my name next to it. -- Isaac Jaffee

 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 
 ~  Linux london 2.6.5-emcb-241 #2 i686 GNU/Linux  ~ 
 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAd1HXaIgMKkVlSLQRAgKbAJ9e+ZnqP9f9iass0XkMjsxuxeWtcACgqdRU
WJRs+1YJWPcdvy1LvkJ6uVg=
=Q5Ir
-END PGP SIGNATURE-

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



Re: [PHP] Serializing objects and storing them is sessions [fixed]

2004-04-09 Thread Kelly Hallman
Apr 9 at 2:49pm, Jason Giangrande wrote:
 Kelly Hallman wrote:
  Try it without serializing, it works.
 
 After retesting, it seems you are correct.  I guess the same bad 
 __sleep() code that was causing the object not to unserialize at all was 
 also preventing automatic serialization.

For some reason, if I include a __sleep() method in an object, PHP
segfaults on me...so I couldn't tell you anything about that :) Argh!

 However; it does not seem to harm anything if serialize() and
 unserialize() are called manually on an object.  It's just extra code
 that doesn't do anything, and therefore, can be removed.

In my testing, I tried to create an array with a value that was an object. 
I serialized that, and the object was not serialized and that key did not 
appear in the returned serialized representation of that array.

I don't know the default session handler's internals, but if you look at a
session file that it creates, it seems to serialize the $_SESSION array. 
If any of the values are objects, they appear to be serialized as well.

Given the above facts, my guess is that the handler actually goes through
and serializes any session variables that are objects (or perhaps any
values !is_scalar()), then serializes the entire $_SESSION array.

If that is the case, my original claim that a session variable that was
serialized would then be serialized again is probably untrue. The reason
being that the serialized session variable would be a scalar value and the
asession handler would not serialize it again.

So you're correct, it's the same difference. The only downside I can see 
to serializing it yourself is that you've got to always unserialize it 
before you can do anything with it. Then, you'd also need to reserialize 
it and store the result back into that session variable.

If you just let the session handler do the serialization then you can use 
that object directly and any changes would not require reassignment.

$User = $_SESSION['User'];
$User-loggedin = true;

versus

$User = unserialize($_SESSION['User']);
$User-loggedin = true;
$_SESSION['User'] = serialize($User);

Of course, the first example could also be written as:
$_SESSION['User']-loggedin = true;

I always assumed that serialize would just serialize objects that were
within an array, and that the session handler was merely doing something
like serialize($_SESSION); So I learned something about serialize() and
the session handler's behavior in regards to how it deals with objects. 

-- 
Kelly Hallman

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



[PHP] Fwd: failure notice

2004-04-09 Thread Elfyn McBratney
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hello PHP group :)

The qmail alias for ezmlm-postmaster seems broken.  Please see the below 
message (apologies if I should have sent this elsewhere)

Elfyn

- --  Forwarded Message  --

Subject: failure notice
Date: Saturday 10 Apr 2004 00:47
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]

Hi. This is the qmail-send program at pb1.pair.com.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.

[EMAIL PROTECTED]:
That is not a valid email address.

- --- Below this line is a copy of the message.

Return-Path: [EMAIL PROTECTED]
Received: (qmail 1390 invoked by uid 1010); 10 Apr 2004 00:47:50 -
Delivered-To: [EMAIL PROTECTED]
Delivered-To: [EMAIL PROTECTED]
Received: (qmail 1334 invoked from network); 10 Apr 2004 00:47:50 -
Received: from unknown (HELO smtp-out4.blueyonder.co.uk) (195.188.213.7)
  by pb1.pair.com with SMTP; 10 Apr 2004 00:47:50 -
Received: from london.i.emcb.co.uk ([62.30.188.142]) by
 smtp-out4.blueyonder.co.uk with Microsoft SMTPSVC(5.0.2195.5600); Sat, 10
 Apr 2004 01:47:50 +0100
From: Elfyn McBratney [EMAIL PROTECTED]
Organization: EMCB
To: [EMAIL PROTECTED]
Subject: Re: [PHP] ATTN:  List Admins
Date: Sat, 10 Apr 2004 01:45:59 +
User-Agent: KMail/1.6.1
Cc: -{ Rene Brehmer }- [EMAIL PROTECTED],
 [EMAIL PROTECTED]
References: [EMAIL PROTECTED]
 [EMAIL PROTECTED] In-Reply-To:
 [EMAIL PROTECTED]
MIME-Version: 1.0
Content-Disposition: inline
Content-Type: Text/Plain;
  charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Message-Id: [EMAIL PROTECTED]
Return-Path: [EMAIL PROTECTED]
X-OriginalArrivalTime: 10 Apr 2004 00:47:51.0429 (UTC)
 FILETIME=[73C24B50:01C41E95]

=2DBEGIN PGP SIGNED MESSAGE-
Hash: SHA1

[postmaster@ added to Cc:]

Hello,

On Saturday 10 Apr 2004 00:39, -{ Rene Brehmer }- wrote:
 I'll second that ... keep getting this in response from them:

 Thank you !!

 Your message has been received; we will treat your message and get back to
 you as soon as possible.

 Besides the fact that mailman more or less makes this list useless for me
 ... this is just another annoyance...

 Rene

 At 16:19 09-04-2004, Ryan A wrote:
 Please take out these two addresses:
 
 Information Desk [EMAIL PROTECTED]
 Advance Credit Suisse Bank [EMAIL PROTECTED]
 
 everytime we post to the list we get their damn autoresponders.

Yes, postmaster, please do.  The spam mennaces hit me 10+ times on every po=
st=20
i make to php-general@ (yes, only three or four today :)

Thanks,
Elfyn

- -- 
Elfyn McBratney, EMCB
mailto:[EMAIL PROTECTED]
http://www.emcb.co.uk/

PGP Key ID: 0x456548B4
PGP Key Fingerprint:
  29D5 91BB 8748 7CC9 650F  31FE 6888 0C2A 4565 48B4

When I say something, I put my name next to it. -- Isaac Jaffee

 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 
 ~  Linux london 2.6.5-emcb-241 #2 i686 GNU/Linux  ~ 
 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAd1S/aIgMKkVlSLQRAm9rAJ9RNC3Qy+GxWs4Y+sxWDlUyp90vGgCeLDa0
D0UVtFnZUUfJmrMjxKWXlbs=
=1F4n
-END PGP SIGNATURE-

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



Re: [PHP] What does MAX_FILE_SIZE do?

2004-04-09 Thread Raditha Dissanayake
Richard Davey wrote:

Hello Ben,

Friday, April 9, 2004, 3:36:04 AM, you wrote:

BR Well, is there actually a way to do this or a way to check the filesize
BR and send a nice message to the user that the file is over the 
BR limit--other than just some error being thrown?

Not until it gets to the server, no. JavaScript can't read local
filesystem files, Java I believe can - but you can't rely on people
having it installed (I don't for example), even Flash has no local
file access abilities (thank goodness).
 

shamless plug: http://www.radinks.com/upload/ - Rad Upload can impose 
file size limitations before a single byte is transfered. Yes it's java 
- but you can have your web page in such a way so that the java plug in 
auto installs for people who do not have it.



--
Raditha Dissanayake.
-
http://www.radinks.com/print/upload.php
SFTP, FTP and HTTP File Upload solutions 

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


[PHP] The Smarty Aftermath

2004-04-09 Thread Justin French
In the aftermath of the Smarty debate (which turned from intelligent to 
stupid very quickly), I decided to look closely at templating again 
(though not smarty), and I've found one are where these excel in 
comparison to PHP.

Textpattern [1] is a gamma release CMS/blog tool which uses XML 
templating very effectively -- and I can't see an easy way to reproduce 
this with straight PHP.

txp:foo a='cat' b='dog' c='mouse'something/txt:foo might translate 
to the following PHP code:
?=tag_foo(array('a'='cat','b'='dog','c'='mouse'),'something'); ? OR
?=tag_foo('cat','dog','mouse','something'); ?

Easy enough, except this is where the XHTML wins:
For the PHP versions, the template designer must have an in-depth 
knowledge of the functions.  He/she must get the parameters in the 
right order, know which ones have default values, etc etc.  Making a 
mistake will generate errors and break code.

The XHTML version on the other hand doesn't ask any more or less of the 
designer than XHTML does.  I can switch the order of the arguments, 
leave some out, etc etc, leaving the hard work to the PHP function on 
the other end to sort it all out.

So, my question is:

Am I missing something in regards to PHP's functions that would give us 
some more simplicity?  The closest I can think of is to pass the 
attributes in any order using 'attr=value', then using funct_get_args() 
to sort it all out:
?=tag_foo('b=dog','a=cat','content=something','c=mouse')?

But this is STILL less intuitive than:
txp:foo b='dog' a='cat' c='mouse'something/txt:foo
Any ideas?  John

---
Justin French
http://indent.com.au
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Finding value in multi-dimensional array - Solved

2004-04-09 Thread Verdon Vaillancourt
Hi,

Thanks much to Richard and Andy for the input :)  This one did the job...

if($_SESSION['OBJ_user']-modSettings['listings']['active'] == '1') {

I'm still not entirely sure I understand the syntax ;)

verdon


 From: Richard Harb [EMAIL PROTECTED]
 Date: Fri, 9 Apr 2004 22:49:44 +0200

 Let's see:
 if($_SESSION['OBJ_user']-modSettings['listings']['active'] == '1') {
 
 That should be it ...
 
 Sidenote: use single quotes whenever the string needn't be evaluated
 (i.e. is a variable itself) you save a couple cycles every time.
 


 phpws_user Object
 (
   [user_id] = 5
   [username] = agent
   [password] = 77abcd5cb2ef4a366c2749ea9931c79e
   [email] = [EMAIL PROTECTED]
 
   [modSettings] = Array
   (
   [listings] = Array
   (
   [active] = 1
   [first_name] = Agent
   [last_name] = Guy
   )
 
   )
 
   [error] = Array
   (
   )
 
   [temp_var] = 
   [last_on] = 1081527610
   [js_on] = 1
   [user_settings] =
 )
 
 

On 4/9/04 4:06 PM, Richard Harb [EMAIL PROTECTED] wrote:

 do a print_r() for the structure. -- print_r($_SESSION[OBJ_user]);
 and look at the page source.
 
 at each level ...
 if is says array refer to it with ['property']
 if obj (stdClass or otherwise) use - that arrow thingy
 

 
 Friday, April 9, 2004, 9:43:36 PM, you wrote:
 
 Hi, being somewhat of a noob, I hope I'm using the right language to phrase
 this question...
 
 In a project I am working with, I have a multi-dimensional array in session
 when a user logs in. Visually, it looks something like...

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



[PHP] require_once '../config.php'; doesn't work?

2004-04-09 Thread Mike Zornek
Is it true I can't include a file up a dir like this:

require_once '../config.php';

This seems to work though:

require_once 'settings/db.php';

Strange.

~ Mike
-
Mike Zornek
Web Designer, Media Developer, Programmer and Geek
Personal site: http://MikeZornek.com
New Project: http://WebDevWiki.com

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



Re: [PHP] require_once '../config.php'; doesn't work?

2004-04-09 Thread Jason Giangrande
Mike Zornek wrote:
Is it true I can't include a file up a dir like this:

require_once '../config.php';
You should be able to include a file up one (or more) directories.  Are 
you sure it's only up one directory from were your script is being 
called from?

This seems to work though:

require_once 'settings/db.php';

Strange.
--
Jason Giangrande [EMAIL PROTECTED]
http://www.giangrande.org
http://www.dogsiview.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] require_once '../config.php'; doesn't work?

2004-04-09 Thread Richard Harb
Depends on where the executed script is located ...
And it always depends on the script that is called - if you give a
relative path like you did here.

if the script you called would be
http://www.example.com/news/2004-04-10/mypage.php

then config.php would have to be in /news

if your layout is like:
/   (root)
|-settings/
|-news/
  |-2004-04-10/

and you call a script in root then db.php would be included, but not
if called from the dir news ...

You could either prepend something (like $_SERVER['DOCUMENT_ROOT']) or
you define something like
define ('MY_SETTINGS_DIR', '/usr/local/www/settings');
so the path will be absolute ...

or you could write some function that calculates the relative path to
root no matter where the script you called resides in - and prepend
that string then ...

or 

hth

Richard


Saturday, April 10, 2004, 4:36:31 AM, you wrote:

 Is it true I can't include a file up a dir like this:

 require_once '../config.php';

 This seems to work though:

 require_once 'settings/db.php';

 Strange.

 ~ Mike
 -
 Mike Zornek
 Web Designer, Media Developer, Programmer and Geek
 Personal site: http://MikeZornek.com
 New Project: http://WebDevWiki.com




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



Re: [PHP] require_once '../config.php'; doesn't work?

2004-04-09 Thread Marek Kilimajer
Mike Zornek wrote:
Is it true I can't include a file up a dir like this:

require_once '../config.php';

This seems to work though:

require_once 'settings/db.php';

Strange.

Both works as long as other settings permit it - file permission and 
owner, safe mode restrictions

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


Re[2]: [PHP] Serializing objects and storing them is sessions [fixed]

2004-04-09 Thread Tom Rogers
Hi,

Saturday, April 10, 2004, 10:51:20 AM, you wrote:
KH Apr 9 at 2:49pm, Jason Giangrande wrote:
 Kelly Hallman wrote:
  Try it without serializing, it works.
 
 After retesting, it seems you are correct.  I guess the same bad 
 __sleep() code that was causing the object not to unserialize at all was
 also preventing automatic serialization.

KH For some reason, if I include a __sleep() method in an object, PHP
KH segfaults on me...so I couldn't tell you anything about that :) Argh!


Is your __sleep() function returning the array required by serialization ?

-- 
regards,
Tom

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



Re: [PHP] Beginner Question

2004-04-09 Thread Kris J. Hagel
On Thu, 2004-04-08 at 22:30, rob wrote:
 I am a newcomer to PHP and I am looking for an intsallation package similar
 to to FoxPro for MAC OSX 10.2.(Ie intsall appache, MY SQL and Latest version
 of PHP) Does anyone know where I may find one?
 Thanks RB

Try http://www.serverlogistics.com

They have packaged installers for Apache, MySQL and PHP with Preference
Panes you can drop in to control the Apache and MySQL processes if you
want them.

Kris

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



Re: [PHP] Beginner Question-Solution-packages

2004-04-09 Thread rob
On 10/4/04 1:37 AM, jon roig [EMAIL PROTECTED] wrote:

Thank you for your help! Php and mysql ship on MAC OSX servers but not on on
the normal machines.
Apple provides support for these two at
http://developer.apple.com/internet/opensource/osdb.html for help on MySQL
on MAC OSX including step by step instructions on how to install it.
Assistance with PHP is found at
http://developer.apple.com/internet/opensource/php.html including help on
how to install it.
I have not found integrated packages for Macs like FoxPro but the above
links will get you up and running.
Marc Linnage has a standalone installer for the latest release of PHP for
OSX at http://www.entropy.ch/software/macosx/php/- very easy to install for
beginners.
I had trouble installing MySQL(from MySQL.com) but found the server
logistics package a breeze at http://www.serverlogistics.com/mysql.php
Once again thks for pointing me to the developer section at Apple
RB

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



Re[2]: [PHP] Serializing objects and storing them is sessions [fixed]

2004-04-09 Thread Kelly Hallman
Apr 10 at 1:39pm, Tom Rogers wrote:
 Is your __sleep() function returning the array required by serialization?

Since you mentioned it, I tried returning an array and it did not
segfault, thought it was initially unclear what the array was for.

After reading over most of the documentation about serializing objects for
the Nth time, I finally found this sentence, which I didn't recall:

It can clean up the object and is supposed to return an array with the 
names of all variables of that object that should be serialized.

I guess that's pretty clear, but it's not the first time I missed a
half-sentence in the manual that provided a very key bit of information.  
It doesn't help that this is the only mention within serveral full pages
related to the topic of serializing objects.

I think must seems more apropos than supposed to considering the
result/consequence... It's probably just my older version of PHP, but a
segfault seems like a pretty extreme error message :)

Thanks for pointing me in the right direction! It's so much easier to find
the explanation when you already have the answer

--Kelly

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