Re: [PHP] Please unsubscribe

2011-10-10 Thread Jim Lucas
On 10/10/2011 8:26 AM, Joao Coelho wrote:
 I have been sending emails to this list to unsubscribe and i still receive 
 emails.
 

To unsubscribe, visit: http://www.php.net/unsub.php



-- 
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/
http://www.bendsource.com/

C - (541) 408-5189
O - (541) 323-9113
H - (541) 323-4219

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



[PHP] Re: Oi , Portas/ Hello, Ports

2011-10-10 Thread Jim Giner

QI.VOLMAR QI qi.vol...@gmail.com wrote in message 
news:cab7l6ey9rkfwtmprpe0fk3doo5s1c5jyhpnbt5rjj0f_eb5...@mail.gmail.com...
 Alguem sabe se, e como eu posso trabalhar com as portas do computador com
 php no windows?

 Do someone know if, and how, I could work with Computer logical ports with
 PHP on Windows?

 ex: shell_exec('cat /dev/usbmon0 | hexdump'); - Linux


If you mean use php to interrogate a port I would think the answer is No. 
Computer port=client; PHP=server. 



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



[PHP] Re: files outside of documentRoot

2011-10-08 Thread Jim Giner
Access files for use in the running script? Or access files meaning 
executing a script? 



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



[PHP] Secure data management

2011-10-04 Thread Jim Giner
I thought I knew how to do this.

I have a form that collects some data fields.  My script checks if magic 
quotes are off and (since they are) executes addslashes on each input 
field.  Then I run a query to INSERT these 'slashed' vars into the database. 
But when I go to phpadmin on my site the table does not contain any slashes.

Where are they going? 



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



Re: [PHP] Secure data management

2011-10-04 Thread Jim Giner

Stuart Dallas stu...@3ft9.com wrote in message 
news:da8b3499-4d11-4053-9834-68b34d030...@3ft9.com...
1. Why are you using addslashes?

2. MySQL will strip one level of backslashes.
*


I thought you were supposed to do an addslashes to protect your appl from 
malicious d/e.

Did not know that mysql drops the slashes. 



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



[PHP] Re: php.ini setting

2011-10-03 Thread Jim Giner


 ?php
 if (get_magic_quotes_gpc()) {
 $process = array($_GET, $_POST, $_COOKIE, $_REQUEST);
 while (list($key, $val) = each($process)) {
 foreach ($val as $k = $v) {
 unset($process[$key][$k]);
 if (is_array($v)) {
 $process[$key][stripslashes($k)] = $v;
 $process[] = $process[$key][stripslashes($k)];
 } else {
 $process[$key][stripslashes($k)] = stripslashes($v);
 }
 }
 }
 unset($process);
 }
 ?

 I know it is not the answer you are looking for, but it does work, and 
 used by thousands of coders.

 Stephen

Thanks for the code sample - a little more complex than I've ever used.  Can 
you explain something for me?

The first unset line - what is it doing?  If it is removing the item from 
the $process array, then how can you then reference the value ($v) in the 
very next line?  I must be missing something.

Also - I don't see the need to be stripping slashes from the $k 
(keys/indices?) elements.  What am I missing there?

As I said - the lines are a something new to me and I may not be 
interpreting what is going on here.  Basically I see that you are processing 
all of the arrays (GET,POST, etc) at once, doing each one in turn.  For each 
one, you then get down to the values returned to the script as a $k/$v pair 
which you then check to see if it is in itself an array.(although you ask if 
$v is an array, while I would have thought you'd ask if $k was an array). 
Once you get to the basest element you remove the slashes.

Thanks again - still waiting on my host company to get back to me - they've 
escalated the problem of not being able to turn the quotes off.  Hmmm 



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



Re: [PHP] Re: php.ini setting

2011-10-03 Thread Jim Giner

Richard Quadling rquadl...@gmail.com wrote in message 
news:CAKUjMCVwFos-=swewaoyxw2ukvhkwaueh6dahptycj-4wud...@mail.gmail.com...
On 3 October 2011 14:30, Jim Giner jim.gi...@albanyhandball.com wrote:
 Thanks for the code sample - a little more complex than I've ever used. 
 Can
 you explain something for me?

 The first unset line - what is it doing? If it is removing the item from
 the $process array, then how can you then reference the value ($v) in the
 very next line? I must be missing something.

 Also - I don't see the need to be stripping slashes from the $k
 (keys/indices?) elements. What am I missing there?

 As I said - the lines are a something new to me and I may not be
 interpreting what is going on here. Basically I see that you are 
 processing
 all of the arrays (GET,POST, etc) at once, doing each one in turn. For 
 each
 one, you then get down to the values returned to the script as a $k/$v 
 pair
 which you then check to see if it is in itself an array.(although you ask 
 if
 $v is an array, while I would have thought you'd ask if $k was an array).
 Once you get to the basest element you remove the slashes.


**
Thank you Richard for your effort, but I had the jist of all of this.  What 
I don't get is the points I asked about.  Can you answer the questions I 
mentioned? 



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



Re: [PHP] php.ini setting

2011-10-02 Thread Jim Giner
Spoke to quickly - still having issues.  While the .ini file in each of my 
appl. folders has magic quotes set to Off, my scripts are still escaping my 
input - obviously following the server's .ini file settings.  Waiting for my 
hosters to get back to me. 



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



[PHP] php.ini setting

2011-10-01 Thread Jim Giner
I'm trying to set magic quotes Off as my reading tells me that it's not good 
to have it defaulted to On.

My ISP has this setting (from PHPINFO call):

magic_quotes_gpc on

From reading the php.net manual I found this line

php_flag magic_quotes_gpc on

which it says to place in the .htaccess file.

I downloaded that file from my server's public_html folder, edited it to put 
in the above line (which now says Off) and re-uploaded it.  Boom! My 
server no longer works - I get Internal Server Error The server 
encountered an internal error or misconfiguration.

If I re-edit my .htaccess, remove the line and re-upload, everything works 
fine.

So - what am I mis-interpreting about how to accomplish this task? 



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



Re: [PHP] php.ini setting

2011-10-01 Thread Jim Giner

Stephen stephe...@rogers.com wrote in message 
news:4e874606.2030...@rogers.com...

 http://php.net/manual/en/security.magicquotes.disabling.php

 Stephen

That tells me nothing new. 



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



Re: [PHP] php.ini setting

2011-10-01 Thread Jim Giner

Mike Mackintosh mike.mackint...@angrystatic.com wrote in message 
news:52ea6b9e-ef12-44d3-bd31-72984e5e5...@angrystatic.com...

Have you tried:
ini_set('magic_quotes_gpc', false);=

I'm trying to set it directly and not have to incl in every script I write. 



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



Re: [PHP] php.ini setting

2011-10-01 Thread Jim Giner
Solved.

Had to have my host provider put a copy of php.ini in my public_html and 
then I made the magic quotes setting change.

Interesting - running a phpinfo command still shows the setting as On 
becuase it returns the server's settigns, NOT my individual folder setting.



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



Re: [PHP] using passthru or system() even and passing the $_FILES array

2011-09-28 Thread Jim Lucas
On 9/28/2011 12:07 AM, Anton Heuschen wrote:
 Good day,
 
 I have a question and something that either does not work, or I have not
 gotten it to work the way I want to.
 
 I have a start page, which is a form, that takes 2 text fields and also a
 Attachment field. Then it calls the first page, which is supposed to spawn
 of a call to another page (I want to get the page to open server side see,
 to allow the user to close the window, and the process continues in the
 background) ...so I use either passthru or have now tried system().
 
 The problem is that I can pass my 2 text fields as arguments to the call but
 I have a problem in accessing and using $_FILES now to handle the file
 defined.
 
 I have tried to pass it to a $_SESSION[FILES] , I have even tried to
 serialize the whole array and pass it also as argument and build a array on
 called php page, etc, but it does not seem to do anything, or handle the
 file?
 
 
 As further example, this is on the first page opened from the Form :
 
 = php file 1 calling to file 2 =
 
 session_start();
 $_SESSION[FILES] = $_FILES;
 session_write_close();
 
 $email  =   $_REQUEST['email'];
 $actionDate =   $_REQUEST['actiondate'];
 $files  =   serialize($_FILES);
 $command = '/usr/bin/php -f /var/www/details/Write.php '.$email.'
 '.$actionDate.' '.$files.'  php.log';
 system($command,$return);

At this point I would suggest that you echo $command before trying to execute 
it.

I think you might find that you are trying to pass characters that the cli are
miss interpreting.


 
 
 
 =
 
 then in my called file
 
 
  Write.php =
 
 session_start();
 $FILES = $_SESSION['FILES'];
 
 $files1 = $FILES[coms1_attachfile];
 $filename1 = $files1;
 
 ==

First, since you are calling this from the cli, their is no point in using
session_start().  session_start() has to do with running it in a web server not
from the cli.

Secondly, in file 1 you are using serialize() to package the $_FILES array.  Yet
in file 2 you are not using unserialize() to extract the data from the package.

I would suggest reading here http://php.net/manual/en/features.commandline.php
to get a better understanding of how to access the arguments that you are
passing on the cli.


 
 $filename1 should now be recognized file name from a file provided in the
 first form, and if statement then runs the file to process to read the file,
 it seems here the process either does not get any file (so filename is never
 true) or the file process have no file to work with.

I'm curious as to what your initial HTML form looks like.

 
 
 So I am not really sure how passthru/system works with things like arrays
 and sessions and $_FILES array etc
 

arrays, not via the cli argument list
serialized arrays, sure, but you have to escape any special chars that might
mess things up.
sessions, does not exist
$_FILES, no direct access

Jim

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



Re: [PHP] Curl cost

2011-09-28 Thread Jim Lucas
On 9/28/2011 1:28 AM, muad shibani wrote:
 what are the costs of using PHP Curl to show another websites on my site as
 stumbleon do ..
 traffic, memory or what?
 

That isn't how stumbleupon does it.  You might want to take a closer look at the
HTML to see how they do what they do.

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



Re: [PHP] Curl cost

2011-09-28 Thread Jim Lucas
On 9/28/2011 9:05 AM, Daniel Brown wrote:
 On Wed, Sep 28, 2011 at 11:54, Jim Lucas li...@cmsws.com wrote:

 That isn't how stumbleupon does it.  You might want to take a closer look at 
 the
 HTML to see how they do what they do.
 
 He said stumbleON, actually.  Looks like they simply aggregate
 some of your personal social networking data into a single-sign-on
 dashboard presentation.  Certainly no service I'd use, but I suppose
 for some it has its merits.
 

I saw that, but @ss-umed it was a typo.  My bad.

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



Re: [PHP] book quest

2011-09-28 Thread Jim Lucas
On 9/28/2011 3:26 PM, Bastien Koert wrote:
 On Wed, Sep 28, 2011 at 6:20 PM, Kirk Bailey kbai...@howlermonkey.net wrote:
 The best book for a beginner? No, don't tell me php.net, I hear that one
 already, and while it is indeed good, I want something in a dead tree
 edition I can canny around and smoke as needed.

 --
 end

 Very Truly yours,
 - Kirk Bailey,
   Largo Florida

   kniht
  +-+
  | BOX |
  +-+
   think


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


 
 I had great success with Wrox PHP Programming and PHP Essentials by
 Julie C. Meloni
 
 The latter is dated, but was clearly written.
 

PHP Essentials (first edition) by Julie C. Meloni was the first book about PHP
that I ever bought.  I did not find it very useful.

The second book was Core PHP First Edition by Leon Atkinson.  It was more like
an encyclopedia/dictionary with some decent examples.

Around 2001 I started participating the general mailing list.  I haven't bought
another book on PHP since.  PHP.net manual, the php-general mailing list and the
wonderful members of this list, and Google have provided answers for all the
questions I have ever needed to ask since.

Jim Lucas

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



Re: [PHP] What would you like to see in most in a text editor?

2011-09-14 Thread Jim Giner
But why?
Brad Huskins brad.husk...@gmail.com wrote in message 
news:66.b1.08893.200a0...@pb1.pair.com...

 I am aiming to build something that is almost as easy to use as Notepad.




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



Re: [PHP] Stop PHP execution on client connection closed

2011-09-14 Thread Jim Lucas
On 9/14/2011 1:04 AM, Marco Lanzotti wrote:
 Il 13/09/2011 20:58, Alex Nikitin ha scritto:
 Correction on Marco's post. You can absolutely stop a mysql query
 
 I know I can stop a query, but I don't know how to realize HTTP client
 has closed connection during query execution.
 
 My query count how many records match selected fields in a 50M records
 table.
 Any query field is indexed and innodb uses 20GB of RAM to store data and
 indexes, but some queries take about 30 seconds to run.
 When user changes filters and asks for a new count, the old queries
 continue to run using DB resurces unnecessarily.
 
 Bye,
 Marco

Well, from the sounds of that, you really do not have an easy option.

Here is my suggestion.

In your initial script, you could add a unique value to your SQL statement.

You SQL would be something like...

SELECT ... FROM ... WHERE ... AND (1=1 OR 'unique value');

add 'unique value' to your session data and then, when the person changes the
selected fields and starts to execute another query, first, you could search to
see if an SQL statement is running that has your unique value in it.  if it
cannot find a matching statement, simply execute the SQL query.  If it does find
an SQL statement that matches the unique value, kill it, then issue your SQL
statement.

Read the following to figure out how to find your unique process:
http://dev.mysql.com/doc/refman/5.0/en/show-processlist.html

Read the following to find out how to kill your processes:
http://dev.mysql.com/doc/refman/5.0/en/kill.html

But, it does seem like it would be possible.

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



Re: [PHP] Stop PHP execution on client connection closed

2011-09-13 Thread Jim Lucas
On 9/12/2011 7:40 AM, Marco Lanzotti wrote:
 Hi all, I'm new in the list and I already have a question for you.
 I'm running an heavy query on my DB in a PHP script called by AJAX.
 Because client often abort AJAX connection to ask a new query, I need to
 stop query because DB will be too loaded.
 When AJAX connection is aborted, PHP script doesn't stop until it send
 some output to client, so I need to wait query execution to know client
 aborted connection.
 How can I abort query (or script) when AJAX connection is aborted?
 
 Thank you,
 Marco
 
 

You cannot stop a DB query.

What this means is PHP will not be able to do anything else until the db has
finished its step and handed data back to the processing script.  At that point,
you can check to see if the connection is still active and take appropriate 
action.

Jim Lucas

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



Re: [PHP] Stop PHP execution on client connection closed

2011-09-13 Thread Jim Lucas
On 9/13/2011 11:58 AM, Alex Nikitin wrote:
 On Tue, Sep 13, 2011 at 11:44 AM, Jim Lucas li...@cmsws.com wrote:
 
 On 9/12/2011 7:40 AM, Marco Lanzotti wrote:
 Hi all, I'm new in the list and I already have a question for you.
 I'm running an heavy query on my DB in a PHP script called by AJAX.
 Because client often abort AJAX connection to ask a new query, I need to
 stop query because DB will be too loaded.
 When AJAX connection is aborted, PHP script doesn't stop until it send
 some output to client, so I need to wait query execution to know client
 aborted connection.
 How can I abort query (or script) when AJAX connection is aborted?

 Thank you,
 Marco



 You cannot stop a DB query.

 What this means is PHP will not be able to do anything else until the db
 has
 finished its step and handed data back to the processing script.  At that
 point,
 you can check to see if the connection is still active and take appropriate
 action.

 Jim Lucas

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


 Correction on Marco's post. You can absolutely stop a mysql query, it is
 done with a large amount of success at Facebook for example, where they have
 very strict query execution rules, e.g. if your query takes too long to run,
 it is killed. However unless you are dealing with enormous data sets, or
 very very slow mysql server, this is not worth the tremendous amount of
 trouble you would have to go through. And if you are dealing with enormous
 data sets or slow servers, it would be far more beneficial to address those
 issue then to implement the query killing thing.
 
 MySQL commands in question are:
 SHOW PROCESSLIST;
 KILL [thread];
 
 You can also hook into if you really wanted to with some C through the API,
 but again, it is far more trouble than most people need, and problems often
 lay else-where (for example inefficient query or bad database design or
 matching on non-indexed cols etc...) A query that ties together 3 tables and
 pulls 80-90k rows @10 columns shouldn't take more than 0.25 sec to execute,
 maybe a second for the whole operation from connect to result, if your mysql
 server is one hop away (i.e. they are on the same switch), the tcp hand
 shake can take up to 100ms, plus you need to get the process list, traverse
 it for your query, and send a kill command. I'm going to guess that the kill
 process will take longer to connect, list, parse and kill, then it will take
 the query to finish and return data...
 
 What is your data set like, what are you trying to accomplish by this other
 than complicating your code?
 
 Also yes, AJAX is your friend (avoid pulling large or any data sets if you
 can), as well as some query and database optimization, and caching ;)
 
 
 
 --
 The trouble with programmers is that you can never tell what a programmer is
 doing until it’s too late.  ~Seymour Cray
 

My statement still stands.

 What this means is PHP will not be able to do anything else until the db
 has finished its step and handed data back to the processing script.


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



Re: [PHP] What would you like to see in most in a text editor?

2011-09-13 Thread Jim Lucas
On 9/13/2011 5:23 PM, tamouse mailing lists wrote:
 On Tue, Sep 13, 2011 at 3:35 PM, Robert Cummings rob...@interjinn.com wrote:
 I'm a big fan of editors that work in the terminal.
 
 You'll get my emacs when you pry it out of my cold dead hands.
 

+1

mg too



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



Re: [PHP] What would you like to see in most in a text editor?

2011-09-13 Thread Jim Lucas

On 9/13/2011 7:11 PM, Brad Huskins wrote:

Oh geez. Didn't mean to start a flame war...


Quit fanning it then... :)



On 09/13/2011 08:56 PM, James Yerge wrote:

On 09/13/2011 08:40 PM, Jim Lucas wrote:

On 9/13/2011 5:23 PM, tamouse mailing lists wrote:

On Tue, Sep 13, 2011 at 3:35 PM, Robert
Cummingsrob...@interjinn.com wrote:

I'm a big fan of editors that work in the terminal.

You'll get my emacs when you pry it out of my cold dead hands.


+1

mg too





I'd have to go agree with the exception of s/emacs/vi/ :P






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



Re: [PHP] Dreaded Premature end of script headers

2011-08-26 Thread Jim Lucas

On 8/26/2011 4:49 PM, tamouse mailing lists wrote:

On Fri, Aug 26, 2011 at 6:48 PM, tamouse mailing lists
tamouse.li...@gmail.com  wrote:

On Fri, Aug 26, 2011 at 1:42 PM, Geoff Shangge...@quitelikely.com  wrote:

I put this into Google and got this:
http://htmlfixit.com/cgi-tutes/tutorial_Common_Web_dev_error_messages_and_what_they_mean.php#premature



Yeah, I saw that too. I do know the mechanism that is happening. I
just can't figure out where the problem is without inserting print
statements.


Presumably, you are calling this cron job with some process which runs the
PHP script through a URL on your webserver.


Yes, that is correct. Using curl to launch the script via the web server.


1.  Modify the script so that it does actually output something, thereby
making the error go away.



When the script starts, it prints a banner with the script name and
date/time stamp. When it completes, it is supposed to print aggregate
results, time spent. I know it's encountering this problem before it
reaches the end as not all the data gets processed. I can't tell where
it is stopping though. If I put it in debug mode, it prints out a lot
of data from the beginning of the script, and never encounters this
problem.


2.  Run the script directly with PHP instead of via your webserver.  E.g.:
php -fyourscriptname


The way the script is designed, it depends on some $_SERVER values,
which wouldn't be set if running directly from the shell.



Again, I want to say that this script does NOT fail in dev, test and
stage, only production.



Well, you might have to go about this the long way. I suggest you cut 
larger sections of code out until you get a working script.  Then start 
putting it back together.


Jim Lucas

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



Re: [PHP] Problem with inserting numbers...

2011-08-11 Thread Jim Lucas
On 8/10/2011 6:22 PM, Jason Pruim wrote:
 So here I am attempting to generate some numbers to be inserted into a 
 database... eventually they will make up a phone number (Which I've emailed 
 about before and know about the bad ideas with it.. But it's the customer :)) 
 
 Here is the code I am working with:
 
 ?PHP
 function number_pad($number,$n) {
 return str_pad((int) $number,$n,0,STR_PAD_LEFT);
 }
 
 $SQL = SELECT * FROM Test WHERE `areacode` = '907' AND `prefix` = '200' 
 LIMIT 5;
 
 $result = mysql_query($SQL);
 //$num = ;
 //foreach ($result as $key = $value) {
 //echo $key . - . $value . - . number_pad($num, 4) . BR;
 //$num++;
 //}
 
 while ($num != 1) {
 while($row = mysql_fetch_assoc($result)) {
 $padnum = number_pad($num, 4);
 echo $row['areacode'] . - . $row['prefix'] . - . $padnum . BR;
 $num++;
 }
 
 
 }
 
 ?
 
 basically all I'm trying to do is generate the last 4 digits starting at  
 and going up to . for testing purposes I'm just echoing back but will 
 eventually insert the complete number back into the database as a 7 digit 
 string.
 
 The error I'm getting is:
 
 Fatal error: Maximum execution time of 30 seconds exceeded in 
 /home/pruimpho/public_html/jason/dev/clients/flewid/Phone/config/phoneareacodes.php
  on line25
 
 which is where the second while starts...
 
 Does anyone know a better way to do this? 
 
 I'm off to finish searching google while waiting for some good news :)
 
 Thanks Everyone!
 
 
 Jason Pruim
 pru...@gmail.com
 
 
 

Jason,

Here is my rendition of what you should do.

?PHP

$SQL = SELECT  areacode, prefix
FROMTest
WHERE   `areacode` = '907'
AND `prefix` = '200';

$result = mysql_query($SQL);

$values = '';

while( $row = mysql_fetch_assoc($result) ) {
  foreach ( range(0, ) AS $n ) {
$values .= $row['areacode'] . '-' . $row['prefix'] . '-' .
   str_pad($n, 4, '0', STR_PAD_LEFT);
  }
}

echo $values;

?

It will be much faster if you build the complete string in memory then echo out
the built string.

Jim Lucas

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



Re: [PHP] Problem with inserting numbers...

2011-08-11 Thread Jim Lucas
On 8/11/2011 9:34 AM, Jason Pruim wrote:
 
 Hey Jim,
 
 Would that still hold true with inserting into a database which is the true 
 end of it? This is going to be a one time thing I'm doing and I'm trying to 
 make it a learning experience as I go since that's what everything should be 
 right?
 

Yes, taking one of your other emails, you would do something like this.

?PHP

$SQL = SELECT  areacode, prefix
FROMTest
WHERE   `areacode` = '907'
AND `prefix` = '200';

$result = mysql_query($SQL);

$values = '';

while( $row = mysql_fetch_assoc($result) ) {
  foreach ( range(0, ) AS $n ) {
$values .=  VALUES ('.
   sprintf('%03d-%03d-%04d', $row['areacode'], $row['prefix'], $n) .
   ');
  }
}
echo 'INSERT INTO Test (fullnumber) ' . $values;

?

You should see...

INSERT INTO Test (fullnumber) VALUES ('907-200-') VALUES ('907-200-0001')
VALUES ('907-200-0001') etc...

What this allows you to do is have one long string generated in memory then
inserted into the DB.  If you have any type of indexes on this table/column then
it would only require one re-indexing of the table for the single INSERT
statement vs 1 re-indexes for 1 separate INSERT statements.

Cuts the DB processing time down a lot.

Also, just so you know, if you place set_time_limit(0); at the top of the
script, it will allow the script to run as long as it needs to.

See: http://php.net/manual/en/function.set-time-limit.php

Jim Lucas

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



Re: [PHP] form handling

2011-08-11 Thread Jim Giner
I'm thinking that Chris means that he has a 'page' designed that utilizes 
two form tags for functionally different sets of input fields.  The answer 
Chris is that a page can have many forms and whether or not they trigger the 
same script upon submit or not doesn't matter.  Go ahead!

My sample html:

blah
blah
head
script
/script
style
/style
/head
body
form
inputs
/form
blah
blah
form
inputs
/form
/body
/html

If the two forms call the same script that's fine.  If not, that will work 
too.  Just realize that the inputs from one form will NOT be returned to the 
script when the submit is used from the other form. 



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



Re: [PHP] form handling

2011-08-11 Thread Jim Giner

Jim,

This is what I am trying to do. One submit button for both forms going
to the same destination.

The only reason I am doing this is because I can't figure out why my
ajax for my select menus is altering my tinyMCE textarea box.

Ultimately if I can figure out how to control the ajax within the div
container as I showed in a previous email I would be able to just use
one form. any ideas??

Thanks,

Chris


Chris,
By definition, a 'submit' button submits a form.  Not 2 forms.  Each form 
has to have it's own form. It is not feasible to submit two forms - since 
the conversation from your client pc is going to be garbled even if you 
could (JS?) do the second submit.  One transactiion is going to answer your 
client and then the other is going to wipe it out with its respone.


I don't think you have ot separate your forms becuase they are in separate 
divs.  I could be wrong - never tried it. 




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



Re: [PHP] using pg_query in a function not working

2011-08-05 Thread Jim Lucas
On 8/5/2011 12:08 PM, Marc Fromm wrote:
 
 I have to sql statements in functions to use in my code. Even though the echo 
 statements show the sql is valid the sql does not seem to execute and I get 
 the error, PHP Warning:  pg_fetch_object() expects parameter 1 to be 
 resource, boolean given in . . . line 154 . . .
 Line 154: while($val = pg_fetch_object($student))
 

$conn is not in scope

 
 Marc Fromm
 Information Technology Specialist II
 Financial Aid Department
 Western Washington University
 Phone: 360-650-3351
 Fax:   360-788-0251
 


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



[PHP] Re: testing

2011-08-04 Thread Jim Giner

Jim Giner jim.gi...@albanyhandball.com wrote in message 
news:6d.60.30104.5b968...@pb1.pair.com...
 Don't seem to be getting any feeds thru the newsgroup mirror(?).

Something's wrong.  My OE still cannot connect to the news server for this 
list, it continues to show unread messages are available, but it cannot 
download them.  Something has changed.  PLUS - this 'testing' msg of mine 
DOES show up - whassup with that? 



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



Re: [PHP] Re: testing

2011-08-04 Thread Jim Giner
 Aln...@ridersite.org  wrote:



 On 8/2/2011 5:18 PM, Jim Giner wrote:
 Don't seem to be getting any feeds thru the newsgroup mirror(?).



 This newsgroup has been a mess for almost a year now.

 One big problem is that the server only accepts a small number of
 connections,
 for just some mail clients, eg Thunderbird; but works for others.  My
 Thunderbird works flawlessly for numerous other newsgroups.

 I've posted 2 or 3 bug reports, no response!


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

 This newsgroup is actually a mailing list.

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk

 Oh, I thought news.php.net was a NNTP news server.  And,
 news://news.php.net:119/php.general was a newsgroup on the server.

 My mistake.


Mailing list, newsgroup, either one - something's changed in the last week 
or so to interrupt the smooth (or semi-smooth) functioning of it.  The only 
messages I'm seeing currently are the ones in this single topic.  Why is 
that??? 



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



Re: [PHP] Re: testing

2011-08-04 Thread Jim Giner
Sounds like time for me to move on.
Thanks for the info Dan.

All the talent on this group, and a bug like this (according to posts I've 
read) has been going on for years?

Daniel Brown danbr...@php.net wrote in message 
news:CAD9cneMicUmusc9Er7kOmLZKL_r-QORoYcMzGH5hQL=e4er...@mail.gmail.com...
On Thu, Aug 4, 2011 at 10:39, Jim Giner jim.gi...@albanyhandball.com 
wrote:

Actually, we haven't changed anything at all.  It's always been
temperamental, but it's always just been a small additional offering.
As Ash said, this is a mailing list, not a newsgroup.  The fact that
we offer a newsgroup interface at all is by all means eligible for
discontinuation, since only about six people use it in any given year.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/ 



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



Re: Re: [PHP] Re: testing

2011-08-04 Thread Jim Giner
Because I'm lazy.  I LIKE the newsgroup method - all my mail in one place: 
email, newsgroups together yet separate so that I can read the news postings 
when I have time, and the email is purely mine.
Tim Streater t...@clothears.org.uk wrote in message 
news:08.87.13433.b57ba...@pb1.pair.com...
On 04 Aug 2011 at 15:48, Jim Giner jim.gi...@albanyhandball.com wrote:

 Sounds like time for me to move on.
 Thanks for the info Dan.

Say Jim,

Why don't you pick it up as mail like the rest of us?

--
Cheers  --  Tim



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



Re: [PHP] Sending a message

2011-08-04 Thread Jim Lucas



On 8/5/2011 9:49 PM, wil prim wrote:

Ok so I have tried to create a sort of messaging system on my website and I have
run into some problems storing who the message is from, ill try to take you
through step by step what I am trying to do.


*step #1 *(messages.php):--This is where the member will view the recent
messages that have been posted
div id='messages'
?php
include 'connect.php';


session_start() should be called before anything else on the page is 
done.  move this to the first line after your opening ?php tag.

session_start();


First... from one of your other emails, you explain that by the time you 
get to this page, your user has already logged in.  But in the next 
line, you are AFAICT setting the $_SESSION['user'] to a null value.  Try 
commenting this line out and see what happens.



$_SESSION['user']=$user;
//store sql queries
$sql=SELECT * FROM entries;


You should change this a little.  I realize their isn't much to go wrong 
with this SQL statement, but you never know...

$result=mysql_query($sql, $con);


$result = mysql_query($sql, $con) OR
  die('SQL ERROR: '. mysql_errno($con) .'br /'. mysql_error($con));


$count=mysql_num_rows($result);
if ($count1){
echo 'There are no messages yet!';
}


I think you are missing an ELSE clause here...


while ($row=mysql_fetch_array($result)){
echo 'From: ' .$row['from'];
echo 'br/';
echo 'Subject: ' .$row['subject'];
echo 'br/';
echo 'Message: ' .$row['body'];
echo 'hr/';

}
?
/div

*Step #2* (create_message.php):-- This is where the user creates a new message

h2  Create new message/h2
table border='0' width='100%' cellpadding='3px' style='text-align: top;'
form method='post' action='insert_message.php'
tr width='100%' height='30%' style='margin-top: 0px;'
td  Subject/td
td  input type='text' name='subject' maxlength='30'/td
/tr
tr width='100%' height='30%'
td  Body/td
tdtextarea name='body' style='height: 200px; width: 400px;'/textarea/td
/tr
tr
td colspan='2' align='center'input type='submit' name='new_message'
value='Send!'/  /td
/tr
/form
/table

*Step #3 *(insert_message.php)-- this is where my problem is (trying to insert
$_SESSION['user'] into table ['from'])


This script is riddled with security issues and errors.

?php
include 'connect.php';


Again with the session_start() thing.  Move it to the top.

session_start();


Why do this?  Just use $_SESSION['user'] where you would use $user...

$user=$_SESSION['user'];


This is going to cause a NOTICE error.  Check out isset()

if ($_POST['new_message']){


You including this file for a second time.  Does it need to?

include 'connect.php';


Calling this a second time, just for good measure???  Remove it.

session_start();


Again, you are clearing your $_SESSION['user'] variable.

$_SESSION['user']=$user;


If you are going to assign the values to new variables, I would suggest 
tossing htmlspecialchars() around each one.

$body=$_POST['body'];
$subject=$_POST['subject'];
$date=' ';


Also, before you go using those variables above in your SQL below, you 
should wrap a call to mysql_real_escape_string() around them.

$sql=INSERT INTO `entries` (
`id` ,
`from` ,
`subject` ,
`body` ,
`date`
)
VALUES (
NULL , '$user', '$subject', '$body', '$date'
);


Refer to my suggestion about about adding the OR die() portion to the 
following command.

if (mysql_query($sql,$con)){
echo 'Inserted!';
echo $user;

}
else
echo 'Not Inserted';

}
?

Hope i dont piss anyone off with such a long message, I just really need help on
this.

Thanks!




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



[PHP] testing

2011-08-02 Thread Jim Giner
Don't seem to be getting any feeds thru the newsgroup mirror(?). 



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



[PHP] Re: testing

2011-08-02 Thread Jim Giner

Jim Giner jim.gi...@albanyhandball.com wrote in message 
news:6d.60.30104.5b968...@pb1.pair.com...
 Don't seem to be getting any feeds thru the newsgroup mirror(?).

Ok - this showed up in my OE newsgroup, but OE still shows 36 more messages 
in php.general that I haven't/can't seem to retrieve.  Is something wrong 
with the list-to-newgroup interface? 



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



Re: [PHP] Re: testing

2011-08-02 Thread Jim Giner
- Original Message - 
From: ad...@buskirkgraphics.com
To: 'Jim Giner' jim.gi...@albanyhandball.com; 
php-general@lists.php.net

Sent: Tuesday, August 02, 2011 6:01 PM
Subject: RE: [PHP] Re: testing


I was thinking the same thing I have none myself.



Your response did show up in my newsgroup.  But that's the first since the 
26th. 




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



Re: [PHP] I can't execute pf commands

2011-07-29 Thread Jim Lucas
On 7/28/2011 9:09 AM, Bulent Malik wrote:
 Hi
 
 I use php5.3 on freebsd
 
 I also use pf ( packet filter) on it.
 
 I need to execute pfctl in php script.  But I couldn't execute . I don't get
 any errors about that.
 
 Shell commands is allowed in  php.ini My 
 
 My script is below,
 
 
  shell_exec('pfctl -s nat');
 
 exec('pfctl -s nat');
 
 
 If I execute another command like this ; it works
 
 shell_exec('ls -l /var/tmp') ;
 
 What can the problem be ? 

Run the following command from your cli

which pfctl

If the results show, like mine does, that pfctl is in /sbin/pfctl then you will
not be able to run that command.  Your www doesn't have the /sbin/ folders in
its path.

Try this instead.

shell_exec('which pfctl') ;

If you get results, you should be able to execute it.

But, on the flip side, it re-writes /etc/pf.conf  and on my box, its permissions
are -rw---.  So, you can assume that nobody besides root will be able to
write to this file.

Now, if you go the route Shawn talked about, it will work.  Just be sure to
limit the sudoers to only allow the pfctl command and not all allow all commands
on your system.

Jim

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



Re: [PHP] Tree menu list in php

2011-07-26 Thread Jim Giner
Jasper Mulder lord_fa...@hotmail.com wrote in message 
news:snt106-w6527d1e82d0a3efe6f76f1f7...@phx.gbl...

 From: alekto.antarct...@gmail.com
 Date: Tue, 26 Jul 2011 19:20:58 +0200
 To: php-general@lists.php.net
 Subject: [PHP] Tree menu list in php

 Hi,
 is there a way to create a tree menu list only by using php/html/css?
 I found some, but they are all in JavaScript, do I have to make them by 
 using JavaScript or is there a way in php as well?


If by tree menu you mean to have a menu that interacts with the user and 
shows the branches, ie, sub-menus as the user clicks on items, then you 
can't do it with php obviously.   OTOH - if you just want a menu with 
indents and choices similar to an 'outline' , then sure you can do it with 
php/html/css.  But the JS ones are the sharpest ones.  There's several out 
there for free too! 



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



Re: [PHP] Re: PHP frameworks

2011-07-21 Thread Jim Lucas
On 7/21/2011 4:00 PM, Micky Hulse wrote:
 +1 for CI.
 
 If you search the group archives, a little while back I asked about
 micro PHP frameworks and got a ton of good replies.
 
 So folks, how'z about a PHP framework with a built-in admin interface?
 That would be pretty sweet. :)
 

So, what would said admin interface allow you to administrate?

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



Re: [PHP] Fwd: ezmlm warning

2011-07-20 Thread Jim Lucas
People, it isn't a problem with your mail server, it is a problem with the
lists.php.net IP address.  It got on another SPAM list.

I had to modify my SPAM filtering to allow it through a few years ago.
Currently it is listed on [1], and [2]

If I had to guess, qmail had an internal error and had to be restart.

1. http://www.mxtoolbox.com/SuperTool.aspx?action=blacklist%3a76.75.200.58
2. http://whatismyipaddress.com/blacklist-check

On 7/20/2011 2:00 AM, Tamara Temple wrote:
 Um... what's going on here? Why would google mail be bouncing??
 
 
 Begin forwarded message:
 
 From: php-general-h...@lists.php.net
 Date: July 20, 2011 1:08:54 AM CDT
 To: tamouse.li...@gmail.com
 Subject: ezmlm warning

 Hi! This is the ezmlm program. I'm managing the
 php-general@lists.php.net mailing list.

 I'm working for my owner, who can be reached
 at php-general-ow...@lists.php.net.


 Messages to you from the php-general mailing list seem to
 have been bouncing. I've attached a copy of the first bounce
 message I received.

 If this message bounces too, I will send you a probe. If the probe bounces,
 I will remove your address from the php-general mailing list,
 without further notice.


 I've kept a list of which messages from the php-general mailing list have
 bounced from your address.

 Copies of these messages may be in the archive.
 To retrieve a set of messages 123-145 (a maximum of 100 per request),
 send an empty message to:
   php-general-get.123_...@lists.php.net

 To receive a subject and author list for the last 100 or so messages,
 send an empty message to:
   php-general-in...@lists.php.net

 Here are the message numbers:

   313991

 --- Enclosed is a copy of the bounce message I received.

 Return-Path: 
 Received: (qmail 27040 invoked for bounce); 8 Jul 2011 09:23:10 -
 Date: 8 Jul 2011 09:23:10 -
 From: mailer-dae...@lists.php.net
 To: php-general-return-3139...@lists.php.net
 Subject: failure notice

 Hi. This is the qmail-send program at lists.php.net.
 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.

 tamouse.li...@gmail.com:
 76.75.200.58 failed after I sent the message.
 Remote host said: 550 Won't forward failure notice

 
 


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



Re: [PHP] chained select with ajax

2011-07-18 Thread Jim Lucas

On 7/17/2011 11:38 AM, Chris Stinemetz wrote:

Thanks all.

I am trying to create a cascading seletct with 3 menu choices.
For some reason my third select menu is not populating. It doesn't
seem like my ajax is correctly sending $_post values to the final
query in my PHP class I built.
By the time I make it to the final third select menu there are no choices.

Hopefully someone can find something I missed in the following code snippits.

Any help is greatly appreciated.

Please excuse the incorrect indentions. For some reason gmail changes it.

Thanks,

Chris


I have made a few assumptions in the following code... with that said

Well, without seeing more of your code, from what I can tell from what 
you provided, you are missing a few statements in your jQuery and you 
are using the wrong variables that jQuery is passing to your PHP.


Also, since I do not see you populating the #market SELECT field with 
jQuery, is it safe to assume that you are populating it when you create 
the page?


 script
 $(document).ready(function()
 {
   $(select#type).attr(disabled,disabled);
   $(select#store).attr(disabled,disabled);
   $(select#market).change(function()
   {

remove the following line, it is redundant

 $(select#type).attr(disabled,disabled);
 $(select#type).html(optionplease wait.../option);
 var id = $(select#market option:selected).attr('value');
 $.post(select_type.php, {id:id}, function(data)
 {
   $(select#type).removeAttr(disabled);
   $(select#type).html(data);
 });
   });
   $(select#type).change(function()
   {

remove the following line, it is redundant

 $(select#store).attr(disabled,disabled);
 $(select#store).html(optionplease wait.../option);

 var m_id = $(select#market option:selected).attr('value');
 var t_id = $(select#type option:selected).attr('value');
 $.post(select_store.php,
{market_id:m_id,type_id:t_id},
function(data)
{
  $(select#store).removeAttr(disabled);
  $(select#store).html(data);
});

   });
   $(form#select_form).submit(function()
   {
 var market = $(select#market option:selected).attr('value');
 var type = $(select#type option:selected).attr('value');
 var store = $(select#store option:selected).attr('value');
 if(market0  type0  store0)
 {
   var market = $(select#market option:selected).html();
   var type = $(select#type option:selected).html();
   var store = $(select#store option:selected).html();
   $(#result).html('your choices were: ' + market + ' , ' + type 
+ ' and ' + store);

 } else {
   $(#result).html(you must choose three options!);
 }
 return false;
   });
 });
 /script


 php class for populating select menus

 ?php
 class SelectList
 {
   protected $conn;
   public function __construct()
   {
 $this-DbConnect();
   }

   protected function DbConnect()
   {
 include db_config.php;
 $this-conn = mysql_connect($host,$user,$password)
   OR die(Unable to connect to the database);
 mysql_select_db($db,$this-conn)
 OR die(cannot select the database $db);
 return TRUE;
   }

   public function ShowMarket()
   {
 $sql = SELECT DISTINCT id_markets FROM store_list;
 $res = mysql_query($sql,$this-conn);
 $market = 'option value=0market.../option';
 while($row = mysql_fetch_array($res))
 {

you are using $row['id'] below, but you do not select it above...

   $market .= 'option value=' . $row['id'] . '' .
  $row['id_markets'] . '/option';
 }
 return $market;
   }

   public function ShowType()
   {
 $sql = SELECT DISTINCT store_type FROM store_list;
 $res = mysql_query($sql,$this-conn);
 $type = 'option value=0store type.../option';
 while($row = mysql_fetch_array($res))
 {

you are using $row['id'] below, but you do not select it above...

   $type .= 'option value=' . $row['id'] . '' .
$row['store_type'] . '/option';
 }
 return $type;
   }

   public function ShowStore()
   {
 $sql = SELECT store_name
 FROM   store_list

Are you suppose to be using the same $_POST variable for this select 
statement?


 WHERE  id_markets=$_POST[id]
 ANDstore_type=$_POST[id];

to work with the changes that I made above in the jQuery code, you will 
need to change the previous two lines to the following two lines of code


 WHERE  id_markets=$_POST['market_id']
 ANDstore_type=$_POST['type_id'];

That show fix most of your problems and get you headed down the rod to 
recovery...


 $res = mysql_query($sql,$this-conn);
 $Store = 'option value=0stores.../option';
 while($row = mysql_fetch_array($res))
 {

you are using $row['id'] below, but you do not select it above...

 $Store .= 'option value=' . $row['id'] . '' .
   $row['store_name'] . '/option';
 }
 

Re: [PHP] is_null() and is_string() reversed when using in switch case statements... [SOLVED]

2011-07-15 Thread Jim Lucas
On 7/14/2011 7:44 PM, Daevid Vincent wrote:
 Ah! Thanks Simon! That is exactly right. Doh! I should have thought of
 that... *smacks head*
 
 Here is the fruit of my labor (and your fix)...
 
 /**
  * Useful for debugging functions to see parameter names, etc.
  * Based upon http://www.php.net/manual/en/function.func-get-args.php#103296
  *
  * function anyfunc($arg1, $arg2, $arg3)
  * {
  *   debug_func(__FUNCTION__, '$arg1, $arg2, $arg3', func_get_args());
  *   //do useful non-debugging stuff
  * }
  *
  * @accesspublic
  * @returnstring
  * @param string $function_name __FUNCTION__ of the root function as
 passed into this function
  * @param string $arg_names the ',,,' encapsulated parameter list of
 the root function
  * @param array $arg_vals the result of func_get_args() from the root
 function passed into this function
  * @param boolean $show_empty_params (FALSE)
  * @authorDaevid Vincent
  * @date  2011-17-14
  * @see   func_get_args(), func_get_arg(), func_num_args()
  */
 function debug_func($function_name, $arg_names, $arg_vals,
 $show_empty_params=FALSE)
 {
 $params = array();
 echo $function_name.'(';
 $arg_names_array = explode(',', $arg_names);
 //var_dump($arg_names, $arg_names_array, $arg_vals );
 foreach($arg_names_array as $k = $parameter_name)
 {
$v = $arg_vals[$k];
//echo k = $parameter_name = $k and v = arg_vals[k] = $vbr\n;
 switch(true)
 {
   case is_string($v): if ($show_empty_params) $v = '.$v.'
 ; break;
   case is_null($v): if ($show_empty_params) $v = '{NULL}';
 break;
   case is_bool($v): $v = ($v) ? '{TRUE}' : '{FALSE}'; break;
   case is_array($v): (count($v)  10) ? $v =
 '['.implode(',',$v).']' : $v = '[ARRAY]'; break;
   case is_object($v): $v = '{CLASS::'.get_class($v).'}';
 break;
   case is_numeric($v): break;
 }
 
 if ($show_empty_params || $v) $params[$k] = trim($parameter_name).':
 '.$v;
 }
 echo implode(', ',$params).)br/\n;
 }
 
 
 

Can you give an example of where this might be useful?

Jim Lucas

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



Re: [PHP] PEAR Mail $obj-send()

2011-07-08 Thread Jim Lucas
On 7/8/2011 9:50 AM, Brian Smither wrote:
 A client has:
 PHP 5.3 on Win7x64 running a local web app that needs to send mail. 
 (This app was once hosted on a linux-based hosted space.) Apache 2.2 
 is installed but apparently not being used. I think the IIS service 
 is actually the web server that is engaged.
 
 During troubleshooting a wide range of problems, I discovered that 
 the PEAR Mail module needed to be installed. So I installed PEAR 
 (the PEAR Installer) and the Mail module with all dependencies. The 
 PEAR_ENV was added. The system was rebooted.
 
 A test php script instantiates the Mail class and the script proceeds 
 fine until the send() method is called. I get a browser with Waiting 
 for localhost for more than 60 seconds. (I used die(); to trace the 
 script. Instead of 'auth'= true, I used 'auth' = PLAIN as 
 suggested by a user comment on the Mail documentation page.)

Do you have a mail server running on localhost?

If the previous system was linux, then it was probably handing it off to
sendmail.  If you do not have a local MTA then you need to change the params so
it uses a remote mail server.

 
 I believe all the parameters are correct. The actual web app works - 
 except emailing.
 
 I added a firewall rule allowing outbound port 465 just for kicks.
 
 I can double-check for the PHP timeout setting but would PHP timeout 
 in this case (waiting for a socket??)?
 
 Any suggestions?
 
 
 
 
 


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



[PHP] Re: Self-whitelisting (WAS: Top Posting)

2011-07-06 Thread Jim Giner

George Langley george.lang...@shaw.ca wrote in message 
news:841bbd90-9cd4-4df5-9a38-ff61638f7...@shaw.ca...
On 2011-07-05, at 8:52 PM, Jim Giner wrote:

 Huh?  You have a problem with a person having a spam filter that requires
 one valid response to ensure that the mail from an address is from a real
 person ONE TIME ONLY?
--
I know that I do. I monitor our web site's registration system, and will get 
a number of notices from things like Boxbe, stating that they've delayed the 
email with the confirmation link that we send our clients, until we confirm 
receipt of their notice. But, this can be used against you, as they now know 
that your address is valid, and can in turn spam you!
*

But they can't spam me until they do make a response.  And if they are 
actually in-human (!) enough to go to that length (and I suspect that the 
laziness factor of a spammer will reduce that possibility), I can easily 
blacklist them  - which I have only had to do a couple of times in the last 
5-6 years.

Once a week I review my 'box trapper' queue to see what's been held up.  An 
average of 10 emails a day that never get to my inbox is a good thing in my 
book.  Or should I say never get to my 3 inboxes - pc,ipad,phone.
jg 



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



Re: [PHP] Re: Re: Top Posting

2011-07-06 Thread Jim Lucas
On 7/5/2011 7:52 PM, Jim Giner wrote:
 And what do you use to cut down on spam in your in-box? 

This is completely off topic, but here it goes...

When I received an email the other day from your mail server, I had created this
crazy ass reply to your automatic request for a reply.  But in turn, just sent
the email with the link showing that your mail server is a source of spam.

To answer your question, I use built in Postfix checks...

Here are my list of options:

reject_invalid_hostname,
reject_non_fqdn_hostname,
reject_non_fqdn_sender,
reject_non_fqdn_recipient,
reject_unknown_sender_domain,
reject_unknown_reverse_client_hostname,
reject_unknown_recipient_domain,
check_recipient_maps,
permit_mynetworks,
permit_sasl_authenticated,
reject_unauth_destination,
check_helo_access hash:/etc/postfix/helo_checks,
reject_invalid_helo_hostname,
reject_non_fqdn_helo_hostname,
reject_unknown_helo_hostname,
reject_rbl_client zen.spamhaus.org,
reject_rbl_client psbl.surriel.com,
reject_rbl_client korea.services.net,
permit

With the above settings, I REJECT 99.9% of all SPAM that tries to enter my box.

You are currently listed in my /etc/postfix/helo_checks file as

64.118.87.45REJECT Your mail server is a source of SPAM.  Fix it!


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



Re: [PHP] Constants in strings

2011-07-06 Thread Jim Giner
I LOVE the heredocs tool.  I only learned about it a couple of months ago - 
what a find!  It makes generating my html for my web pages so much 
easier and allows me to include my php vars within the html with much less 
confusion and simplifies the intermixing of html and php vars - no more 
single quote, double quote and dot stuff in an html tag.
Sure you have to put the closing tag in column 1 - a mere blip against the 
pros. 



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



Re: [PHP] Re: Re: Top Posting

2011-07-06 Thread Jim Giner
 You are currently listed in my /etc/postfix/helo_checks file as

 64.118.87.45 REJECT Your mail server is a source of SPAM.  Fix it!

My mail server is my isp's.  It is a shared server and not under my control. 
They are aware that is listed but cannot get to the bottom of why it is 
flagged.
Frankly, I don't know why you are getting mail from me - I'm not sending you 
any.

As for your solution to spam.  What is Postfix?



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



Re: [PHP] Re: Re: Top Posting

2011-07-06 Thread Jim Giner

Stuart Dallas stu...@3ft9.com wrote in message 
news:e73bd95e-0524-4743-92be-ae211b57e...@3ft9.com...
On 6 Jul 2011, at 20:03, Jim Giner jim.gi...@albanyhandball.com wrote:
 Frankly, I don't know why you are getting mail from me - I'm not sending 
 you
 any.

FFS and for the last time... THIS IS A MAILING LIST which you access through 
a newsgroup gateway. It is NOT a newsgroup!

-Stuart

Forgive me for not being a know-it-all.  I don't even know what FFS means.

On second thought - I don't need your forgiveness.  Perhaps you should 
utilize a newsgroup instead of getting all these emails in your inbox.  Much 
less mail to sort thru when you don't feel like handling php problems and 
stuff from morons like me. 



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



Re: Re: [PHP] Re: Re: Top Posting

2011-07-06 Thread Jim Giner

Tim Streater t...@clothears.org.uk wrote in message 
news:e5.d2.37602.f96b4...@pb1.pair.com...
On 06 Jul 2011 at 20:03, Jim Giner jim.gi...@albanyhandball.com wrote:
 As for your solution to spam.  What is Postfix?

Rather than rely on heuristics, I wrote a Bayesian filter for my e-mail app. 
Let the spammer, by sending you the mail, indicate what is spam and what is 
not.

--
Cheers  --  Tim

Tim,
Good for you - although I have no idea what you are saying.  :)
I believe the box trapper tool I utilize (from my ISP) is also letting the 
spammer define himself - but it's just a black box to me.
jg 



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



[PHP] Re: Installing PHP

2011-07-05 Thread Jim Giner
Thanks David!  The error log tells me that I have installed a version of PHP 
that is not thread-safe.  My bad - I mis-read the download page and did in 
fact acquire the wrong version.  Am beginning PHP install all over again!

David Robley robl...@aapt.net.au wrote in message 
news:b0.f0.00402.e9df2...@pb1.pair.com...

 If you are having problems starting apache, the first place to look is 
 your
 apache error log.





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



[PHP] Re: Installing PHP

2011-07-05 Thread Jim Giner
Eureka!

The whole problem was my unfamiliarity with the php download page.  To 
others - read the choices there very carefully (which I thought I did!) to 
be sure you get the thread-safe version.

Thanks to all who contributed, but David gets the kudos for telling me to 
check the error logs first. 



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



[PHP] Re: Top Posting

2011-07-05 Thread Jim Giner
outlook doesn't offer an option for that. 



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



[PHP] Re: Top Posting

2011-07-05 Thread Jim Giner
And besides - I'm sure there are PLENTY of people here who despise scrolling 
thru endless repeated paragraphs from a long list of posts just to get the 
the latest contribution to the topic.:)

This newgroup may have its rules, but if bottom-posting was such a wise and 
preferred method, why do millions of business users subscribe to a product 
such as Outlook, that top-posts by default, to conduct their daily business 
via emails flying back and forth with the latest post at the beginning so 
that readers don't have to re-hash old news unless they want to? 



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



Re: [PHP] Re: Top Posting

2011-07-05 Thread Jim Giner
not what he was asking for.
Curtis Maurand cur...@maurand.com wrote in message 
news:4e7755d57a7a032c39e44598f3660ac7.squir...@www.xyonet.com...



 Jim Giner wrote:
 outlook doesn't offer an option for
 that.

 ctrl-END gets you to the bottom of a message.

 



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



Re: [PHP] Re: Top Posting

2011-07-05 Thread Jim Giner
Actually business user do subscribe to use Outlook as their client.  It does 
not come with the OS, it is purchased on a per seat basis by every 
corporation using it in the form of a license.

On the other hand Outlook Express is available as part of the os, or is 
easily obtained for free.  It is not however the preferred 'business' client 
for those stuck on M$ products.

Paul M Foster pa...@quillandmouse.com wrote in message 
news:20110705152457.gk21...@quillandmouse.com...

 Business users don't subscribe to the Microsoft
 email client. 



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



Re: [PHP] Re: Top Posting

2011-07-05 Thread Jim Giner

Stuart Dallas stu...@3ft9.com wrote in message
 If you're looking for a sane reason why Microsoft software is popular in 
 the
 business world you're not going to find one. 

No - you missed my statement's point.  Not looking for anything - just 
saying it is what it is.  You won't find me defending M$ software designs - 
I was simply pointing out that the product is setup that way and nobody over 
the years has made any effort (?) to have it altered.  I wonder why. :)

 One final thing... you keep calling this a newsgroup. The PHP mailing 
 lists
 are mailing lists first, and a newsgroup second - that's kinda why they're
 called the PHP mailing lists.

It looks like all the newsgroups I've ever belonged to.  It acts like a 
newsgroup.  And - funny ha ha - its name begins with the word news, not 
mailing.  BTW - what does a mailing list look like?

AND - instead of coming down on people who top post, why not come down on 
the vast majority of people of DON'T post ONLY the pertinent part(s) of the 
past emails in their own response?  Cutting down on the amount of chaff in 
the postings here would certainly eliminate the biggest reluctance to having 
to bottom-post.  To scroll thru 60-100 lines of quoted and re-quoted text 
only to read a two line contribution is tedious and wasteful.

Let the new mantra be - Snip Your Posts!

PS - note the bottom post. 



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



Re: [PHP] Re: Top Posting

2011-07-05 Thread Jim Giner
Stuart Dallas stu...@3ft9.com wrote in message 
news:CAJgGj58OkZLiakMMo8qmuhg68BamYOi+TLNGyzze=iyppbj...@mail.gmail.com...
 Again, please include the list when replying!


But don't include the poster's email if you're replying to the list!
 



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



Re: [PHP] Re: Top Posting

2011-07-05 Thread Jim Giner
If you resisted sending what amounts to a duplicate email to the posters who 
are 'on' the list, you wouldn't have to deal with spam filters.  Don't 
understand the purpose of a reply all when in essence our replies are to the 
list wherein the topic originated.  Those on the list will surely see any 
and all posts without having another one in their inbox, won't they?
Richard Quadling rquadl...@gmail.com wrote in message 
news:CAKUjMCW9rcqZodVe7dx2R9Rew5bQ5-5xcHgHxMmtzqc_z=a...@mail.gmail.com...

 And Jim, your anti-spam measures are spamming me.

 So, I've blocked your anti-spam as spam.




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



Re: [PHP] Re: Top Posting

2011-07-05 Thread Jim Giner

Richard Quadling rquadl...@gmail.com wrote in message 
news:CAKUjMCVbhbXO=ngr1lnzo-6fdahdj-r8hc73b-esotfqg+k...@mail.gmail.com...

 But that is what reply-all is about.

 Person A sends an message to List B.

 I reply-all and Person A and List B get replies.

 Hmm.

A new level of complexity!  A person sends to the list, hoping for a 
response, but fails to subscribe to the list? 



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



Re: [PHP] Re: Top Posting

2011-07-05 Thread Jim Lucas
On 7/5/2011 9:11 AM, Richard Quadling wrote:
 And Jim, your anti-spam measures are spamming me.
 
 So, I've blocked your anti-spam as spam.

I noticed this the other day and I blocked him as well.

Maybe this is why his mail server IP is listed as a source of spam...

http://www.mxtoolbox.com/SuperTool.aspx?action=blacklist%3a64.118.87.45

Jim Lucas

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



Re: [PHP] Re: Top Posting

2011-07-05 Thread Jim Giner
It's certainly not spam - it's a spam filter offered by my ISP and works 
great.  The mail you are getting from it is a query asking you to reply if 
you are real and once you do, you'll never get the request again.

Jim Lucas li...@cmsws.com wrote in message 
news:4e134676.7090...@cmsws.com...
 On 7/5/2011 9:11 AM, Richard Quadling wrote:
 And Jim, your anti-spam measures are spamming me.

 So, I've blocked your anti-spam as spam.

 I noticed this the other day and I blocked him as well.

 Maybe this is why his mail server IP is listed as a source of spam...

 http://www.mxtoolbox.com/SuperTool.aspx?action=blacklist%3a64.118.87.45

 Jim Lucas 



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



Re: [PHP] Re: Top Posting

2011-07-05 Thread Jim Giner

Ashley Sheridan a...@ashleysheridan.co.uk wrote in message 
news:21e916f2-2a1f-4982-bc4d-9a574da92...@email.android.com...
I've seen fake messages do that before as a way of harvesting good live 
email addresses, so I regard all such messages spam now.

oh, well... 



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



Re: [PHP] Top Posting

2011-07-05 Thread Jim Giner
James Moe ji...@sohnen-moe.com wrote in message 
news:4e1353f3.6090...@sohnen-moe.com...

  I suspect one reason top posting is popular is that responders do not
 have to think about tidying up, just spit out a reply and move on. The
 result is a message that grows in size with every reply containing every
 useless bit since the thread began. It becomes quite a mess.

 - -- 
 James Moe


oh, so true. 



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



[PHP] Re: Re: Top Posting

2011-07-05 Thread Jim Giner
Huh?  You have a problem with a person having a spam filter that requires 
one valid response to ensure that the mail from an address is from a real 
person ONE TIME ONLY?

And what do you use to cut down on spam in your in-box? 



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



[PHP] Installing PHP

2011-07-04 Thread Jim Giner
Hi all,
(Hopefully I posted this in a place that can/will help me)

I got curious about running php / apache on my own laptop in order to help
my devl process, instead of writing, uploading and testing on my site.

Found a nice pair of docs from thesitewizard.com that appeared to be
pretty well-written instructions on installing each of these systems.  btw-
I'm running XpSp2.  Chose the Apache 2.0 and PHP 5.2 (thread-safe?) per the
recommendations.

Went thru all instructions step-by-step, testing all the way.  Apache
works - PHP doesn't.  When I bring up IE and type in localhost I get the
default apache page as I was told I should see.  When I type
localhost/test.php I get a windows dialog asking what program should run
the php script.

In debugging I went to a cmd windows and ran c:\php\php-cgi test.php and
got the expected result from my script - so PHP works.

End result - they each work separately, but php is not working under apache.

As part of the docs instructions I added the following code to the apache
conf file:

1 - I chose the configure apache to run php as an apache module.
2 - added LoadModule php5_module c:/php/php5apache2.dll as last one of
those lines
3 - added AddType application/x-httpd-php .php as the last of those lines
4 - added PHPIniDir c:/php as the last line of the conf file.

Upon adding these lines apache will no longer restart.  In fact adding any
ONE of these lines breaks Apache.

Ideas welcome.

And for those who still love the USofA, Happy Independence Day!





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



[PHP] Re: Installing PHP

2011-07-04 Thread Jim Giner
Shawn,
I added my php folder to the path but no change.

Shawn McKenzie nos...@mckenzies.net wrote in message 
news:4e11e7e7.6010...@mckenzies.net...


 You may need to add c:\php\ to the Windows path so that the Apache mod
 can find other files it may need. If you have mysql or other extensions
 enabled in php.ini, then they may be looking for another dll that is
 located in the php dir.



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



Re: [PHP] Would like to subscribe to this mailing list

2011-07-04 Thread Jim Lucas
On 7/3/2011 9:37 PM, Brian Dworkin wrote:
 I would like to subscribe to this mailing list please.
 
 Thanks.
 
 Sincerely,
 
 Brian Dworkin
 Managing Partner
 Bright Telecom
 201-892-9553 (mobile #)
 br...@brighttelecom.net
 http://www.brighttelecom.net
 
 

http://php.net/mailing-lists.php will get you started

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



Re: [PHP] I want to use POST when redirect via PHP Header function.

2011-06-30 Thread Jim Giner
Just as bottom posting (I know, it's in da rules) makes it rather difficult 
for humans to read thru a topic, scrolling thru ever-longer messages to get 
to the 'new' content.

Let's solve it for all by only posting your own content and let the sum of 
all the messages equate to the topic.  :)

Ashley Sheridan a...@ashleysheridan.co.uk wrote in message 
news:4ce7359b-95f0-4c51-8d23-078b4838f...@email.android.com...


Ps. Could people please avoid top posting, as it does make it rather 
difficult for the automated archive and some screen readers.
Thanks,
Ash
http://www.ashleysheridan.co.uk
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity. 



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



Re: [PHP] I want to use POST when redirect via PHP Header function.

2011-06-30 Thread Jim Giner
DON't get me started on the massacre of the English language on posting 
sites all over the internet!  It seems that people are so wrought up in 
their problem-of-the-moment that they don't realize that they are 
mis-spelling, mis-typing and mis-stating their problem(s) in their frantic 
posts.  :)

Jasper Mulder lord_fa...@hotmail.com wrote in message 
news:snt106-w65e964fcfdcf1ff338df0cf7...@phx.gbl...
Personally, I think that incorrect spelling is far more annoying than
the quoting; that is, if it does not originate from incapability due to 
English
(whether it be British or American) being not the native language, as
opposed to spelling errors because of vapidity.



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



Re: [PHP] Re: Php filter validate url

2011-06-27 Thread Jim Lucas
On 6/27/2011 8:25 AM, Plamen Ivanov wrote:
 On Mon, Jun 27, 2011 at 11:14 AM, Shawn McKenzie nos...@mckenzies.net wrote:
 On 06/27/2011 10:01 AM, Plamen Ivanov wrote:
 On Sun, Jun 26, 2011 at 5:44 PM, Shawn McKenzie nos...@mckenzies.net 
 wrote:

 On 06/26/2011 12:31 PM, Adam Tong wrote:
 Hi,

 I wanted tu use php filters for validation to avoid regular expresions.
 Is it possible that FILTER_VALIDATE_URL only checks if the string has
 http:// and do not check for the format domain.something?
 
 $url = 'http://wwwtestcom';
 $url = filter_var($url,FILTER_VALIDATE_URL);
 echo $url;
 -

 Or I am doing something wrong

 Thank you

 Unless I'm totally misunderstanding what you want (validate that a
 string starts with http://) try:

 if(strpos($url, 'http://') === 0) {
   //starts with http://
 } esle {
   // does not start with http://
 }

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

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


 Another possible solution could be:

 $ary = explode('://', $url);
 if (1 = count($ary)) {
 echo 'No schema specified!';
 } else {
 // Schema specified.
 // $ary[0] is the protocol
 $allowed = array('http', 'https');
 if (FALSE == in_array($ary[0], $allowed) {
 // Protocol not valid!
 exit(1); // or return FALSE; whatever...
 }
 // $ary[1] is the uri, validate with filter_var().
 }

 Hope this helps.

 May make more sense to use parse_url() than explode.

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

 
 http://php.net/manual/en/function.parse-url.php
 This function is not meant to validate the given URL...
 
 I would use parse_url() after URL validation.
 

Shawn meant to use parse_url() in place of your explode statement.  He didn't
say to use parse_url() as a method to validate the url.

He said it would make more sense to do the following.

Also, use strict type matching if you want to compare against boolean(FALSE)

$allowed = array('http', 'https');

$scheme = parse_url($url, PHP_URL_SCHEME);

if (FALSE === in_array($scheme, $allowed) {
  // Protocol not valid!
  exit(1); // or return FALSE; whatever...
}

Seems a little less muddy to me.

Jim Lucas

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



[PHP] Re: dropdown with two Sql query

2011-06-26 Thread Jim Giner
I don't even understand what the first two code blocks are saying.  Looks 
like html, but I have never seen it like that.  I also don't see the two 
fields you specifically mention to start in your first select statement - 
some other garbled names are there instead.  Are you sure you've copied this 
correctly?

asp kiddy aspki...@hotmail.com wrote in message 
news:snt106-w94d445760f0a991221ebed6...@phx.gbl...

In this table (tb_code_prmtn11_email) I have two field :
fld_email_id
 fld_name_email

It works here is a code


code
select name=email_adress_menu id=email_adress_menu  class=valid 
onchange=submit()
?php
  echo option selected=\selected\ value=''Choose your name/option;
  $req_email_adress_menu =   SELECT DISTINCT id_email, fld_name_email, 
fld_adresse_email FROM $table_db_email ORDER BY fld_name_email ;
  $rep_email_adress_menu =  mysql_query($req_email_adress_menu, $cnx) or 
die( mysql_error() ) ;

  while($show_email_adress_menu = mysql_fetch_assoc($rep_email_adress_menu)) 
{
echo 'option value='.$show_email_adress_menu['id_email'].'';
//if($primes==$show_email_adress_menu['fld_name_email']){echo  
selected;} //display to select an option
echo ''.$show_email_adress_menu['fld_name_email'].'  - 
'.$show_email_adress_menu['fld_adresse_email'].'/option';
  }
?
/select
-endcode



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



[PHP] Re: asynchronous launch of a script

2011-06-26 Thread Jim Giner
You mean - you want a second thread to run independently of your current 
running script?  A wonderful thing to do and helpful for long intenesive 
processes but do you really want to go thru the hassles of managing two 
processes?  Won't you have to verify the results of your offshoot and react 
to unexpected circumstances?  Otherwise, what are  you doing that would not 
require such complex management? 



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



Re: [PHP] Re: asynchronous launch of a script

2011-06-26 Thread Jim Lucas

On 6/26/2011 7:58 PM, Jim Giner wrote:

You mean - you want a second thread to run independently of your current
running script?  A wonderful thing to do and helpful for long intenesive
processes but do you really want to go thru the hassles of managing two
processes?  Won't you have to verify the results of your offshoot and react
to unexpected circumstances?  Otherwise, what are  you doing that would not
require such complex management?



Having an OpenBSD server I use a thing called nohup.

I have a shell script that starts/stops things for me

nohup /usr/bin/ssh -2 -N -f -L $L_IP:$L_PORT:$R_IP:$R_PORT 
root@localhost 1/dev/null


This starts a ssh tunnel port forwarding for me with a from and to port 
assignment.


But, one crucial thing you haven't told us is what OS you are trying to 
do this on.


Jim

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



Re: [PHP] Re: [PHP-DB] Re: radio form submission

2011-06-24 Thread Jim Giner
Call me backwards, but I prefer to keep my statements simple.  I would first 
obtain the POST value before trying to pull up an array element.

$stype=$_POST[''store_type'];
if (!isset($stype))
(handle missing radio button)
else
$st_name=$choices[$stype];

for me (and the next guy who has to look at the code) this is simpler to 
follow, IMHO. 



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



[PHP] this newsgroup and OE

2011-06-22 Thread Jim Giner
Perhaps someone can tell me the secret to getting problem-free access to the 
php newsgroups using OE.  I have two other newsgroup servers configured in 
OE which do not give me any difficulties at all.  My setup for news.php.net 
however gives me nothing but problems.  Inability to connect to messages, 
long delays during normal polling for new items that hangs up my normal mail 
traffic, etc.  Right now, OE indicates two new messages in the php.general 
list, but I cannot download them at this time because OE says it cannot 
connect (oops - just went to get the text of the message and now OE has been 
able to connect).

Some of the details of my config:
server name: php.new.net
port #: 119
timeouts: 30 secs.

nothing else in particular set up - same as my other working newsgroup 
accounts.

Thanks in advance. 



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



[PHP] Re: this newsgroup and OE

2011-06-22 Thread Jim Giner

Well - it's a secret until one asks I guess.  Thanks Shawn for the info.
Since you say it's been happening for years, I guess there's no hope for
resolution.

Can  you or someone else recommend a newsgroup client that functions better
with this group?

BTw - this is my second attempt to respond to you - the first hung in my 
outbox for 5 minutes. 



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



Re: [PHP] jQuery to PHP

2011-06-22 Thread Jim Lucas
On 6/22/2011 12:43 PM, Tim Streater wrote:
 On 22 Jun 2011 at 19:44, Ethan Rosenberg eth...@earthlink.net wrote: 
 
 I have a PHP program which will generate a chess board with a form in
 the program. I wish to fill the form by clicking one of the
 squares  in the chess board.  I am trying to use jQuery and Aja to do
 this.  The Ajax call works, but the value never gets into the form.
 
 So where is jq_test.php? And why do you seem to be referring to it both in 
 what looks like an ajax request (I've never ever looked at jquery, so I'm 
 guessing here) and also as the action of a form?
 
 --
 Cheers  --  Tim
 
 

The example script that he showed is jq_test.php   He could have left action=
and it would do the same thing.

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



Re: [PHP] help with an array if its possible!

2011-06-22 Thread Jim Lucas
On 6/22/2011 3:43 PM, Adam Preece wrote:
 Hi Gang!
 
 i have 2 assoc arrays from 2 querys, 
 
 first one is page categorys it consists of:
   id
   name
 
 second is pages
   name
   cat_id
 
 now, i am using smarty, so i pass arrays into the view. this i would like to 
 pass to the view and display within a html select element.
 
   select id=name
   option value=CAT_IDCAT NAME
   option disabled=disabledPAGE NAME ASSOCIATED TO THE 
 CAT NAME/option
   /option
   /select
 
 and i cannot think of how i can structure an array to pass in to achieve this 
 and/or is it even possible :-/.
 
 i hope this makes sense.
 
 i'm truly stuck!
 
 kind regards
 
 Adam Preece
   

I see that you have a nested option ... tag.  Maybe you are looking for the
optgroup tag.

select
  optgroup label=Swedish Cars
option value=volvoVolvo/option
option value=saabSaab/option
  /optgroup
  optgroup label=German Cars
option value=mercedesMercedes/option
option value=audiAudi/option
  /optgroup
/select

?php

$categories[] = array('id' = 1, 'name' = 'cars');
$categories[] = array('id' = 2, 'name' = 'trucks');
$categories[] = array('id' = 3, 'name' = 'motorcycles');

$pages[] = array('id' = 1, 'name' = 'Neon', 'cat_id' = 1);
$pages[] = array('id' = 2, 'name' = 'Saturn', 'cat_id' = 1);
$pages[] = array('id' = 3, 'name' = 'F150', 'cat_id' = 2);
$pages[] = array('id' = 4, 'name' = 'Ram 2500', 'cat_id' = 2);
$pages[] = array('id' = 5, 'name' = 'Suzuki', 'cat_id' = 2);
$pages[] = array('id' = 6, 'name' = 'Honda', 'cat_id' = 3);

echo select id=\page_id\\n;

foreach ($categories AS $cat) {
  $c_cat_name = htmlspecialchars($cat['name']);
  echo \toptgroup label=\{$c_cat_name}\\n;

  foreach ($pages AS $page) {
if ( $page['cat_id'] == $cat['id'] ) {
  $c_page_id = htmlspecialchars((int)$page['id']);
  $c_page_name = htmlspecialchars($page['name']);
  echo \t\toption value=\{$c_page_id}\{$c_page_name}/option\n;
}
  }
  # Reset pages so you can loop through it again
  reset($pages);
  echo \t/optgroup\n;
}

echo /select\n;
?

All the above is untested, but should get you very close to what I think you are
trying to accomplish.

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



Re: [PHP] Doctrine madness!

2011-06-17 Thread Jim Lucas
On 6/16/2011 3:15 PM, Nathan Nobbe wrote:
 what it really amounts to is php is good at doing 1 thing and 1 thing only,
 generating web pages.  for anything else, including command line scripts
 that run for more than 30 seconds, choose an actual programming language or
 be prepared to deal w/ hacky, disgusting workarounds.
 

Nathan,

I would have to disagree with your statement about using PHP for applications
that take more then 30 seconds or CLI scripts.

I have a daemon (read: scripts) that I wrote using PHP.  It listens on a few UDP
sockets and maintains an open connection to mysql.  It receives server updates
and other client requests for data.  When it receives a client update it updates
a couple tables in mysql.  When it receives a request from a server for data, it
goes to mysql gets all needed data, compiles it into the format requested and
sends it down the wire.

This daemon starts when my system starts up.  As of this morning it has been
running non stop since Feb 28th (about 108 days).  Between then and now it has
received over 35M server updates and over 1.8M client requests.  I think it gets
used a bit.

So, to say that doing anything with PHP that takes longer then 30 seconds to
complete will require you to use hacky and disgusting workarounds is false.

I have no hacks nor disgusting workarounds in my scripts.  Combined the scripts
total about 200 lines, over half of which is either comments or vertical white
space.

It has been running pretty much non-stop since August 2007 with minimal
maintenance needed.

Jim Lucas

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



Re: [PHP] Doctrine madness!

2011-06-17 Thread Jim Lucas
On 6/17/2011 12:23 PM, Eric Butera wrote:
 On Fri, Jun 17, 2011 at 3:19 PM, Jim Lucas li...@cmsws.com wrote:
 On 6/16/2011 3:15 PM, Nathan Nobbe wrote:
 what it really amounts to is php is good at doing 1 thing and 1 thing only,
 generating web pages.  for anything else, including command line scripts
 that run for more than 30 seconds, choose an actual programming language or
 be prepared to deal w/ hacky, disgusting workarounds.


 Nathan,

 I would have to disagree with your statement about using PHP for applications
 that take more then 30 seconds or CLI scripts.

 I have a daemon (read: scripts) that I wrote using PHP.  It listens on a few 
 UDP
 sockets and maintains an open connection to mysql.  It receives server 
 updates
 and other client requests for data.  When it receives a client update it 
 updates
 a couple tables in mysql.  When it receives a request from a server for 
 data, it
 goes to mysql gets all needed data, compiles it into the format requested and
 sends it down the wire.

 This daemon starts when my system starts up.  As of this morning it has been
 running non stop since Feb 28th (about 108 days).  Between then and now it 
 has
 received over 35M server updates and over 1.8M client requests.  I think it 
 gets
 used a bit.

 So, to say that doing anything with PHP that takes longer then 30 seconds to
 complete will require you to use hacky and disgusting workarounds is false.

 I have no hacks nor disgusting workarounds in my scripts.  Combined the 
 scripts
 total about 200 lines, over half of which is either comments or vertical 
 white
 space.

 It has been running pretty much non-stop since August 2007 with minimal
 maintenance needed.

 Jim Lucas

 
 Hello,
 
 Impressive stats and has me a bit intrigued!  Just out of curiosity,
 does your daemon use a heavy amount of object orientation in it or is
 it mostly procedural codebase?
 
 
 Regards

Nathan,

It is strictly procedural code.

The basic concept of the code is that it starts up, and opens a connection to
MySQL.  Then using stream_socket_*() functions connects to a UDP sockets and
waits for data.  Once it receives data, it figures out what the request was for.
 Now, at this point, it pushed some data to MySQL, or it grabs the entire
contents of the DB tables and formats it to return to the client.

All along the way, I have debug statements that get sent to a log file in
/var/log/...

I currently have a CPU usage time of 435hrs 20.74minutes and memory usage of
just over 6MB.  Most of which is PHP itself.

Jim

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



[PHP] Re: Getting File Owner Name

2011-06-13 Thread Jim Giner
fileowner returns the username OF the file's OWNER.  Isn't that what you 
want?  You don't think you're going to get their first and last name do you?
Floyd Resler fres...@adex-intl.com wrote in message 
news:693f2104-a45d-403f-9c1d-13ad6e4fc...@adex-intl.com...
Is there a way I can get the name of a file's owner.  I know I can get the 
username by doing this:
posix_getpwuid(fileowner($filename));

How can I get the actual name of the owner?

Thanks!
Floyd



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



Re: [PHP] trying to combine two forms into a single form

2011-06-09 Thread Jim Lucas
On 6/9/2011 5:37 AM, matty jones wrote:
 formEl.action += 'title=' + formEl['_title'].value;

The only thing I see inconsistent is the above line.  But then again, it could
be right.  You might be looking for $_GET['title'] in your processing page
instead of $_GET['_title']

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



Re: [PHP] trying to combine two forms into a single form

2011-06-09 Thread Jim Lucas
On 6/9/2011 8:07 AM, matty jones wrote:
 The two forms work fine by themselves, my issue is getting to two of them to
 work with together, I don't even care if you need to upload the image
 seperately from submitting the text data as long as it is all on the same
 page.  Thanks for the thoughts on jQuerry, I will look into it.
 
 On Thu, Jun 9, 2011 at 10:53 AM, Jim Lucas li...@cmsws.com wrote:
 
 On 6/9/2011 5:37 AM, matty jones wrote:
 formEl.action += 'title=' + formEl['_title'].value;

 The only thing I see inconsistent is the above line.  But then again, it
 could
 be right.  You might be looking for $_GET['title'] in your processing page
 instead of $_GET['_title']

 

Can you show the PHP code that you use to process the form data text fields?

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



Re: [PHP] advice on how to build this array from an array.

2011-06-07 Thread Jim Lucas
On 6/7/2011 2:44 PM, Adam Preece wrote:
 hi,
 
 thanks for your reply.
 
 i have figured out, well kind of, and got the data i need but the problem is 
 its nested within to many arrays!
 
 Array ( 
   [threads  form types] = 
   Array ( [0] = Array ( [name] = imperial thread form [id] = 
 28 [page_cat_id] = 9 [main_nav] = true ) [1] = Array ( [name] = metric 
 iso threads [id] = 29 [page_cat_id] = 9 [main_nav] = true ) ) 
   [material range] = 
   Array ( [0] = Array ( [name] = super duplex stainless steels 
 [id] = 30 [page_cat_id] = 10 [main_nav] = true ) [1] = Array ( [name] = 
 standard stainless steels [id] = 31 [page_cat_id] = 10 [main_nav] = true ) 
 [2] = Array ( [name] = non ferrous [id] = 32 [page_cat_id] = 10 
 [main_nav] = true ) [3] = Array (   [name] = carbon based steels [id] 
 = 33 [page_cat_id] = 10 [main_nav] = true ) ) 
 ) 
 
 how can i get this just do its a $k = $v pair,
 
 the key as it is [threads  form types]  [material range], and the value, 
 the single array [Array ( [name] = imperial thread form [id] = 28 
 [page_cat_id] = 9 [main_nav] = true ) [1] = Array ( [name] = metric iso 
 threads [id] = 29 [page_cat_id] = 9 [main_nav] = true )] ?
 
 hope this makes sense
 
 Adam
 
 
 On 7 Jun 2011, at 22:25, Jasper Mulder wrote:
 

 
 From: a...@blueyonder.co.uk
 Date: Tue, 7 Jun 2011 21:50:27 +0100
 To: php-general@lists.php.net
 Subject: [PHP] advice on how to build this array from an array.

 hi all,

 please forgive me if i do not make sense, ill try my best to explain.


 i have this array or arrays.

 Array ( [name] = super duplex stainless steels [id] = 30 [page_cat_id] = 
 10 [main_nav] = true [cat_name] = material range )
 Array ( [name] = standard stainless steels [id] = 31 [page_cat_id] = 10 
 [main_nav] = true [cat_name] = material range )
 Array ( [name] = non ferrous [id] = 32 [page_cat_id] = 10 [main_nav] = 
 true [cat_name] = material range )
 Array ( [name] = carbon based steels [id] = 33 [page_cat_id] = 10 
 [main_nav] = true [cat_name] = material range )

 is it possible to build an array and use the [cat_name] as the key and 
 assign all the pages to that cat_name?

 what im trying to achieve is a category of pages but i want the cat_name as 
 the key to all the pages associated to it

 hope i make sense

 kind regards

 Adam

 Suppose that $arrays is your array of arrays.
 Then is 
 $res = array();
 foreach($arrays as $item){
   $res[$item['cat_name']][] = $item;
 }
 what you are looking for?

 Best regards,
 Jasper Mulder

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

 
 

How about showing your code?

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



Re: [PHP] Can't use class 'DOMDocument

2011-06-06 Thread Jim Lucas

On 6/6/2011 6:49 PM, Adam Tong wrote:

Hi,

When I try using DOMDocument I get the following error:
Fatal error: Class 'DOMDocument' not found in ...

I guess something has to be fixed in my php.ini?

Here is my php version:
# php -version
PHP 5.3.6 (cli) (built: Mar 17 2011 20:58:15)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

I also noticed when I click reply in gmail it does not reply to the
list. Sorry for that inconvenience for poeple who tried to help me
while the previous issue was already resolved.

Thank you



http://us.php.net/manual/en/dom.setup.php

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



Re: [PHP] displaying a pdf

2011-06-01 Thread Jim Giner
Well - the code works just fine as is and that's all I care about.  As for 
Richard's comments - the url in my header(Location) statement points to 
a pdf file, not a php file, so the target is not sending any headers (that I 
know of ). 



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



Re: [PHP] phpsadness

2011-05-31 Thread Jim Lucas
On 5/28/2011 12:34 PM, Andre Polykanine wrote:
 Hello Nathan,
 
 Do you mean $x{8}?
 That is good but not for all situations.
 I  need sometimes to make an array with letters as keys and numbers as
 values,  like  this  (I  give  English alphabet just as an example, so
 please don't suggest str_split):
 $alphabet=abcdefghijklmnopqrstuvwxyz;
 // I wish that worked
 $alphabet_array=explode('', $alphabet);
 $letter_numbers=array_flip($alphabet_array);
 
 this is just one case I encountered some time ago. Yes, I made this by
 separating  letters with commas... but it's not the unique case when I
 need it.

Why not do it the other way around...

$alphabet_array=range('a','z');
$alphabet=join($alphabet_array);
$letter_numbers=array_flip($alphabet_array);

Jim Lucas

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



Re: [PHP] displaying a pdf

2011-05-30 Thread Jim Giner
Thanks for the attempt Simon, but your code only displayed gibberish.
While looking around again for help, I found this and it works perfectly:

?php
session_start();
//
//  Specify the name of the pdf here and the folder
//
$pdfname='VFD_ByLaws.pdf';
$path='/pdfs/';
//
//  the rest will handle the displaying
//
header(Cache-Control: no-cache);
header(Content-type: application/pdf);
header(Location:$path$pdfname);
?




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



[PHP] displaying a pdf

2011-05-29 Thread Jim Giner
Perhaps someone can tell me what I'm doing wrong.  I did some ( a lot) 
looking around for hints on this and here is what I have compiled.  It 
doesn't work - just goes to a white, blank page and sits.  I don't know if I 
need all the html parts or even if I have placed my php in the right areas.

BTW - all I want to do is use a menu option to take me to a page that shows 
the pdf.  My menu (a js thing) won't let me use an a element, so I'm 
trying to just build a php page that I can go to and display the doc 
automacitcally without the user having to click on something..

[code begins]
?php
session_start();
$root = $_SERVER['DOCUMENT_ROOT'];
$pdfname='/pdfs/myfile.pdf';
$length = filesize($pdfname);
//
header(Content-type: application/pdf);
header(Content-Disposition: inline; filename=.$pdfname);
header(Content-Length: .$length);
//
?
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN 
http://www.w3.org/TR/html4/loose.dtd;
html
head
/head
body
?
readfile=$pdfname;
?
/body
/html
[code ends]

Thanks in advance! 



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



[PHP] Re: displaying a pdf

2011-05-29 Thread Jim Giner
Update.

I re-arranged my code and now I get a popup saying File does not begin with 
'%PDF-'.

Here's the code as it is now.

?php
session_start();
header(Cache-Control: no-cache);
header(Content-type: application/pdf);
$root = $_SERVER['DOCUMENT_ROOT'];
$pdfname=$root.'/pdfs/myfile.pdf';
?
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN 
http://www.w3.org/TR/html4/loose.dtd;
html
head
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
title|/title
/head
body bgcolor=#c0c0c0
/body
/html 



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



Re: [PHP] i need delay time in doing array_key_exists but while(true) can't work 4 it.

2011-05-20 Thread Jim Lucas
Negin,

You cannot pause PHP.  You need to do your checking and header() redirect on a
processing page that your form is submitting to.

file   process
form.php   Displays form
process.phpdecide what to you, redirect to secondary page
secondary.php  display your secondary page


On 5/20/2011 7:54 AM, Negin Nickparsa wrote:
 ===if(array_key_exists('sub5',$_POST))
 this line runs before i clicked on the submit
 while(true) before this line can't work then how can i solve the time
 problem?
 here is the whole code:
 ?php
 session_start();
 
 $connection=Mysql_connect('localhost','admin','123');
 if(array_key_exists('sub3',$_POST))
 {
 
 
 if(!$connection)
 {
 echo 'connection is invalid';
 }
 else
 {
 Mysql_select_db('drugnet',$connection);
 $query=select * from patient;
 $result=mysql_query($query);
 $num=Mysql_num_rows($result);
 $num1=Mysql_num_fields($result);
 }
 if($num0)
 {
 echo table border=2;
 for($i=0;$i$num;$i++)
 {
 $row=mysql_fetch_row($result);
 echo tr;
 for($j=0;$j$num1;$j++)
 {
 echotd$row[$j]/td;
 }
 echotdinput type='submit' name='sub5' value='patient
 file$row[0]'//td;
 echo/tr;
 }
 echo/table;
 }
 }
 if(array_key_exists('sub5',$_POST))
 {
 $_SESSION[s1]=$row[0];
 header(Location: patient.php?);
 }
 ?
 html
 head
 titleDoctor/title
 form method=post
 input type=submit name=sub3 value=patient list/
 input type=submit name=sub4 value=search patient/
 
 /form
 /head
 /html
 


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



Re: [PHP] Customize link

2011-05-05 Thread Jim Lucas
On 5/5/2011 3:38 PM, Michael Simiyu wrote:
 Dan,
 
 thanks for the reply.this is the code that shows/lists the categories
 

you need to make the following check look at $_GET instead of $_POST.  Or, I
hate to suggest it, you can use $_REQUEST.  It includes $_GET, $_POST, and
others all in one variable.

  if (isset($_POST['category_'.$c-id])) echo 'checked=checked';

[snipped]

 
 i can see the categories ids and i just want to get a custom link for each
 category and essentially hide this section from my memebers
 
 Thanks
 
 
 On May 6, 2011, at 1:28 AM, Daniel Brown wrote:
 
 ?php

 $cat_ids = array(1,3,5,7,13,15,24,36,81,92);

 echo 'select name=categories'.PHP_EOL;
 foreach ($cat_ids as $cid) {

echo '  option value='.$cid.'';

if (isset($_GET['cat_id'])  $_GET['cat_id'] == $cid) {
echo ' selected=selected';
}

echo ''.$cid.'/option'.PHP_EOL;
 }
 echo '/select'.PHP_EOL;

 ?
 
 


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



Re: [PHP] passing control to a separate script

2011-05-02 Thread Jim Giner
No includes.  Period.
 To get script 1 to begin from script 2 based on a certain path...

 script2.php
 ---
 if ($path1)
 {
 // do stuff here
 include('script1.php');
 exit;
 }
 // otherwise do other stuff here
 ---

 -Stuart

 -- 
 Stuart Dallas
 3ft9 Ltd
 http://3ft9.com/




 



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



Re: [PHP] passing control to a separate script

2011-05-02 Thread Jim Giner
Sorry - I responded directly to the responder - BECAUSE - I lost track of 
who I was answering.  That's what happens when people choose to repond to 
the poster directly INSTEAD of JUST replying to the list.

Tedd gave me the 'header' directive and it works just as I imagined 
something would do.  See below.

Is this do-able?

 Yes, this is do-able.


 If you don't want to use a $_POST to trigger the critter, then use 
 location, such as:

 // first script
 if($to_second_script)
   {
header('Location: http://www.example.com/second.php');
exit();
}

 // second script
 if($to_first_script)
   {
header('Location: http://www.example.com/first.php');
exit();
}


 Either those will work depending upon the trigger you need.

 Cheers,

 tedd

 -- 
 ---
 http://sperling.com/ 



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



[PHP] passing control to a separate script

2011-05-01 Thread Jim Giner
I have a large script that does a certain function for me.  I have a second 
script that gets called and does its thing and when I'm done with it I'd 
like to pass control to the first script.  I don't need this 'included' in 
my second script - I just want to pass control to it and let it take over 
again.

Is this do-able? 



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



Re: [PHP] passing control to a separate script

2011-05-01 Thread Jim Giner
No - I don't want to include either one in the other one.  They are separate 
things that interesect once.  I really am just trying to do this separately 
as I said.

script1
work
work
work
(done)

script2
do something
user response
do something (write data)
execute script 1
(done.

Script 2 doesn't need a response - no return to it.  I'm trying to keep from 
having the user interact with it one more time just to have a form  button 
that uses its' action= to run script 1. 



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



Re: [PHP] Re: PHP delete confirmation

2011-04-29 Thread Jim Lucas
On 4/29/2011 12:06 AM, Geoff Lane wrote:
 On Friday, April 29, 2011, ad...@buskirkgraphics.com wrote:
 
 Personally I would use the javascript page navigation is senseless if they
 miss click.
  
 Javascript: Small and simple javascript.
 
 onclick=return confirm('Are you sure you want to delete?')
 
 Personally, I'd use Javascript and also check that the form was
 submitted after the client-side check. So something like a hidden
 field ('jstest') in the client-side form that is set to 1 by the
 onClick event prior to showing the confirmation box. Then in the
 handling PHP:
 
 if ($_POST['jstest'] == 1){
   // the client called us via Javascript::confirm, so we know the
   // use really wants to delete
 } else {
   // We weren't called via Javascript::confirm, so we need to
   // handle the confirmation in PHP
 }
 
 HTH,
 

It wasn't a form, it was an HTML a tag

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



Re: [PHP] refreshing pages in the cache

2011-04-28 Thread Jim Giner
Yes - that seems to be the trick!  Thank you very much for your tip AND 
your patience.  :)

You've made an old programmer's day! 



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



[PHP] Re: What's faster using if else or arrays?

2011-04-28 Thread Jim Giner
how many entries are you talking about, ie., how many conditions?  Obviously 
if you have more than 4-5 it's going to be easier to code up as a case 
statement (?) rather than an if/else.

Never in all my days have I ever heard of using an array for such a 
determination though.

(remainder deleted for all reader's sakes :) ) 



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



Re: [PHP] Re: What's faster using if else or arrays?

2011-04-28 Thread Jim Giner
Arrays - using a  silly construct that probably still takes as much time to 
evaluate machine-wise as anything else.  And as far as readability goes, it 
is even sillier.   IMO.

(remainder deleted for readers' sakes :) ) 



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



<    1   2   3   4   5   6   7   8   9   10   >