[PHP] Hey, I have a full time PHP developer position in Chicago!

2013-09-10 Thread Steve Gadlin
Howdy. My name is Steve, and I run the web department for Weigel
Broadcasting in Chicago. We're looking for a senior-level PHP developer to
add to our team.

This is a full time gig with benefits. As it's an in-house thing, we're
happy to meet with people outside Chicago if they're willing to relocate
for the job.

What do we need? Oh, just someone who's great with PHP. We need someone who
can decipher our existing homegrown CMS and work with frameworks like
Kohana and Wordpress.

We need a Jack or Jill of all trades... someone comfortable using SSH and
messing around from the Linux prompt, and someone comfortable learning a
new API. An understanding of advanced front-end coding would be swell...
but we have a front-end coder on staff, so a passing familiarity will
suffice.

You'll be building out websites with very large built-in audiences. This is
rewarding work for an amazing company. And your boss will be some guy who,
off hours, draws stick figure cats for people (
http://iwanttodrawacatforyou.com).

Thanks for reading, and I apologize for dropping into your PHP party to
simply spout ads at you. I promise to try and participate in some
meaningful way when I see an opening!

Interested? Know someone who's interested? Reach out to me directly (
st...@blewt.com) and we'll skip this whole resume nonsense.

Beans!

Steve Gadlin



-- 
Steve Gadlin
Blewt! LLC
312-77-BLEWT

<http://iwanttodrawacatforyou.com/>Steev.org - IWantToDrawACatForYou.com -
TwoFilmTShirts.com - Blewt.com

<http://blewt.com>


RE: [PHP] What is wrong with this preg_match?

2011-10-27 Thread Steve Staples
-Original Message-
From: Paul Halliday [mailto:paul.halli...@gmail.com] 
Sent: Thursday, October 27, 2011 2:43 PM
To: PHP-General
Subject: [PHP] What is wrong with this preg_match?

I have the following:

if (isset($argc)) {
if ($argc == 1 || $argc > 2 || !preg_match("(\d{4}-\d{2}-\d{2})",
$argv[1])) {
echo "\nUsage: $argv[0] \n\n";
exit;
} else {
$base_date = $argv[1];
}
} else {
$base_date = date('Y-m-d');
}

When I run it:

 $ ./process_patches.php 201-01-01

Usage: ./process_patches.php 

patches@innm2 ~/Code/Oculi $ ./process_patches.php 2011-011-01

Usage: ./process_patches.php 

patches@innm2 ~/Code/Oculi $ ./process_patches.php 2011-01-011

Works..

What am I doing wrong?

Thanks!

--
Paul Halliday
http://www.squertproject.org/


Paul,

To me, it looks like you're just getting the next 2 digits, so 2011-01-011 is 
getting 2011-01-01 and truncating the last 1.

If you had used (I think)  "^(\d{4}-\d{2}-\d{2})$"  I think that would give you 
what you want... (but my reg-ex is horrible)

Steve

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



RE: [PHP] FW: parse error

2011-10-13 Thread Steve Staples


-Original Message-
From: Ken Robinson [mailto:kenrb...@rbnsn.com] 
Sent: Thursday, October 13, 2011 1:33 PM
To: php-general@lists.php.net
Subject: Re: [PHP] FW: parse error

At 01:26 PM 10/13/2011, Robert Williams wrote:
>On 10/13/11 10:06, "David Savage"  wrote:
>
>
> >php -l voip_cdrs.php
> >PHP Parse error:  parse error, unexpected T_STRING in 
> >/usr/local/cytrex/voip_cdrs.php on line 1050 Errors parsing 
> >voip_cdrs.php
> >
> > $alias_sql_stmt="SELECT ani FROM ldrates WHERE
> >ani='$termnum10'";// <-this is line 1050
> >
> >Could you please tell me what's wrong with the line 1050 ?   I've been
> >pulling my hair out (figuratively speaking) trying to understand why 
> >the compiler sees this line as a problem.  Thanks for whatever help 
> >you can give.
>
>My suspicion is that there's is an unmatched curly brace earlier in the 
>file. With this type of error, you'll generally get a report of a bad 
>line further down the file--sometimes way down--because the parser 
>can't recognize until it hits the later point that something is wrong. 
>Try double-checking that the {Š} blocks prior to line 1050 properly 
>balance, and you'll probably find there's an extra one, or that one is 
>missing, etc.

It's more likely an unterminated quoted string. 
It looks like PHP is giving up after finding unrecognizable stuff after either 
the first double or single quote on that line. If you're using an editor that 
doesn't do syntax high lighting, get one.

Ken 


I would suggest that you figure out what is the value of the variable your 
passing into your query  is it possible that the value is getting a ' 
character, in which case it would be crapping out the line...

For now, try adding [addslashes]:
 $termnum10=addslashes(substr($dest, $start_from_which_offset,10));
 $alias_sql_stmt="SELECT ani FROM ldrates WHERE ani='$termnum10'";// 
<-this is line 1050

Steve.

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



Re: [PHP] Querying a database for 50 users' information: 50 queries or a WHERE array?

2011-09-13 Thread Steve Staples
On Tue, 2011-09-13 at 09:48 -0700, David Harkness wrote:
> On Tue, Sep 13, 2011 at 7:29 AM, Ashley Sheridan
> wrote:
> 
> > SELECT * FROM table WHERE userID IN (1,2,3,4,5,etc)
> >
> 
> +1. And this is a great place to use implode():
> 
> $sql = 'select ... where userID in (' . implode(',', $ids) . ')';
> 
> David

I mentioned that implode earlier, but there is also the underlying
question (which I also asked earlier)... how is he getting the 50 id's
to populate?

here are 2 other ways of skinning the cat:

using an inner join:
select table.* from table inner join othertable on (table.userid =
othertable.userid) where (use the way your getting the 50 id's here);

OR by using a subselect,
select * from table where userid IN (select group_concat(userid,
separator ', ') FROM othertable where (using logic here));

guess it all depends on how you want to do it...  but that would make it
1 db query

good luck!


-- 

Steve Staples
Web Application Developer


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



Re: [PHP] Querying a database for 50 users' information: 50 queries or a WHERE array?

2011-09-13 Thread Steve Staples
On Tue, 2011-09-13 at 17:24 +0300, Dotan Cohen wrote:
> I have a MySQL database table with about 10,000 rows. If I want to
> query for 50 specific users (so no LIMIT ORDER BY) then I seem to have
> these choices:
> 
> 1) SELECT * FROM table
> This will pull in all 10,000 rows, not nice!
> 
> 2) foreach ($user as $u) { mysql_query("SELECT * FROM table WHERE
> userID=".$u);  }
> This will lead to 50 queries, again not nice! (maybe worse)
> 
> 3) foreach ($user as $u) { $whereClause+=" OR userID=".$u; }
> This makes a huge SQL query. However, this is the method that I'm using now.
> 
> Is there some sort of array that can be passed in the WHERE clause,
> containing all the userID's that I am interested in?
> 
> Thanks!
> 
> -- 
> Dotan Cohen
> 
> http://gibberish.co.il
> http://what-is-what.com
> 

what criteria are you using to get the "stats" for these 50 users?

also, wouldn't this be much better suited for the mysql mailing list?


if you know all the userids, then you could just do it as:

$sql = "SELECT * FROM table WHERE userid IN (". implode(', ',
$usersids) .")";

not very elegant, and I am not sure that the IN is any better than doing
50 mysql calls, but this is only 1 call, and gets you the data.

Are you querying the database to get the id's in the frist place?  if
so, you could look at doing an inner join on the 2 tables.

-- 

Steve Staples
Web Application Developer


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



Re: [PHP] array problem

2011-09-09 Thread Steve Staples
On Fri, 2011-09-09 at 16:00 +, Marc Fromm wrote:
> I am reading a csv file into an array. The csv file.
> 
> users.csv file contents:
> w12345678,a
> w23456789,b
> w34567890,c
> 
> $csvfilename = "users.csv";
> $handle = fopen($csvfilename, "r");
> if($handle) {
> while (($line = 
> fgetcsv($handle, 1000, ",")) !== FALSE) {
> $arrUsers[] = 
> $line;
> }
> fclose($handle);
> }
> 
> When I echo out the elements in the elements in the array $arrUsers I get:
> Array
> Array
> Array
> 
> foreach ($arrUsers as $user){
> echo $user . "";
> }
> 
> I can't figure out why the word Array is replacing the actual data.
> 

Try print_r($arrUsers);

also, the $line is an array of the CSV, so you're storing an array,
within the array $arrUsers.

foreach ($arrUsers as $user){
foreach ($user as $val) {
echo $val . "";
}
echo '';
}


-- 

Steve Staples
Web Application Developer
519.258.2333 x8414


-- 
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-29 Thread Steve Staples
On Sat, 2011-08-27 at 17:55 -0400, Daniel P. Brown wrote:
> On Sat, Aug 27, 2011 at 01:01, Jim Lucas  wrote:
> >
> > 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.
> 
> If possible, I'd also try running it from the production box CLI.
> It may give you some insight, such as a missing symlink or different
> path structure in a file include.
> 
> -- 
> 
> Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
> (866-) 725-4321
> http://www.parasane.net/
> 

What about looking at the memory_limit and _max_execution_time
variables?could they be different in the dev/prod conf files?

I remember a while back, I ran into a max execute time, and it wasn't
throwing errors (still never figured it out, but I've moved on since
then).

Just a thought, check your conf files for differences.


Steve.


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



Re: [PHP] Best editor?

2011-08-03 Thread Steve Staples
On Wed, 2011-08-03 at 09:22 -0400, Matty Sarro wrote:
> Hey everyone,
> I am a super newbie just beginning to learn PHP. Awhile ago, I had
> used aptana for dabbling with php and was amazed to find out that it
> had a built in php interpreter so I could do some minor testing
> without having to upload everything to a web server, or have a web
> server locally. Flash forward to now, and it looks like that
> functionality doesn't exist anymore (at least not by default).
> 
> So, I'm curious what editors are out there? Are there any out there
> which will let me test PHP files without having to upload everything
> every time I edit it? Any help would be greatly appreciated. Thanks!
> -Matty
> 

I personally use Komodo IDE, but there are lots out there.  There is the
Eclipse with PHP, or there was the way I learned, NotePad (then switched
to EditPlus+)

Steve


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



Re: [PHP] $_POST value disappearing?

2011-08-02 Thread Steve Staples
On Tue, 2011-08-02 at 10:04 -0500, Donovan Brooke wrote:
> Hello!,
> 
> I must not be understanding something as I would expect 'f_file'
> to show up in the print_r below.:
> 
> ---form--
> 
>
>
>
>
> 
> ---endform--
> 
> --index.php--
> 
> --/index.php--
> 
> 
> 
> 
> The result I get is:
> 
> Array
> (
>  [f_ap] => upload
>  [f_action] => doit
> )
> ---
> 
> Can someone enlighten me?
> 
> Thanks,
> Donovan

 try print_r($_FILE)  (i think, it's either FILE or FILES)

Steve.



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



Re: Re: [PHP] What is a label?

2011-07-14 Thread Steve Staples
On Thu, 2011-07-14 at 13:39 +0100, Stuart Dallas wrote:
> On Thu, Jul 14, 2011 at 1:37 PM, Steve Staples  wrote:
> 
> > On Wed, 2011-07-13 at 23:27 +0100, Tim Streater wrote:
> > > A valid variable name starts with a letter or underscore
> >
> > If I am not mistaken, $_1 is not a valid variable name.
> 
> 
> You are mistaken. Try it.
> 
> -Stuart
> 

You're right... I have like 100 php scripts open in my Komodo IDE, and I
tried it before I posted out of curiosity.  I put it in the wrong
script, therefore, when it didn't do anything I assumed it didn't work.

Thanks Stuart, for pointing that out!  I've never used a number as the
first character after the $_, and I still probably never will... force
of habit I guess :)

Steve.


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



Re: Re: [PHP] What is a label?

2011-07-14 Thread Steve Staples
On Wed, 2011-07-13 at 23:27 +0100, Tim Streater wrote:
> On 13 Jul 2011 at 22:39, Micky Hulse  wrote: 
> 
> > They must mean labels as in "general naming convention rules for
> > programming"... Like not naming a variable/function "label" with a number at
> > the front.
> >
> > Here's a page about variables:
> >
> > http://www.php.net/manual/en/language.variables.basics.php
> >
> > Variable names follow the same rules as other labels in PHP. A valid
> > variable name starts with a letter or underscore, followed by any
> > number of letters, numbers, or underscores. As a regular expression,
> > it would be expressed thus: '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'
> 
> Except that variables are case-sensitive whereas function names are not. And 
> if there's going to be a formal or "programmatic" definition, then I think 
> I'd prefer BNF to a regexp.
> 
> --
> Cheers  --  Tim
> 

Isn't that statement a little misleading?

> A valid variable name starts with a letter or underscore

If I am not mistaken, $_1 is not a valid variable name.  

Steve.


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



Re: [PHP] vend-bot?

2011-07-06 Thread Steve Staples
> What do you think you gain by limiting the link to a single use? If you
> think you're preventing them from passing it on to other people, then yes
> you are, but if you do that then they'll simply send the digital file
> instead so you're actually trading a poor user experience and increased
> support costs for practically no benefit.

Why not just send the file to them via email on success?

As Stuart said, if you're worried about them giving the download URL out
to other people, then they will just put it on a file sharing site and
give out that URL instead.

Either way, unless you have some kind of file locking/binding to IP/mac
address and/or a call home feature, it is kinda hard to stop piracy, and
even then, there are people who can and will crack it if it is something
that useful.

Good luck with this.

Steve.



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



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

2011-06-30 Thread Steve Staples
On Thu, 2011-06-30 at 15:20 +0100, Geoff Lane wrote:
> On Thursday, June 30, 2011, Jasper Mulder wrote:
> 
> I think the moral is that one should never code when tired ;(
> 

or coding while drunk... my favorite typo is $this == 'value';  or
$$this = 'value';   very hard to find sometimes...  

As much as I hate to go off-topic even more, this is one thing that I do
like about Python.  The fact that requires/enforces proper
indentation...   but that is as far as I am going with that :)

Steve.



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



Re: [PHP] PDO_INFOMIX connection problem...

2011-06-30 Thread Steve Staples
On Wed, 2011-06-29 at 16:42 -0400, Steve Staples wrote:
> I am trying to connect to an informix database, and using excel and odbc
> it works fine.
> 
> I installed the PDO_INFORMIX via:
> pecl download pdo_informix
> phpize
> ./configure --with-pdo-informix=/opt/IBM/informix
> make
> make install
> 
> and it all appeard to work... phpinfo()  shows that it's enabled, and
> active... and when i do my PDO connection, it fails with this error:
> 
> I also installed the CSDK prior to installing the pecl pdo_informix (as
> the php.net docs said)
> 
> Fatal error: Uncaught exception 'PDOException' with message
> 'SQLSTATE=HY000, SQLDriverConnect: -23101 [Informix][Informix ODBC
> Driver][Informix]Unspecified System Error = -23101.' 
> 
> all the values in my code, i was given from my boss, which he used to
> get in with excel and the odbc.  the $database has to be the full path
> of the informix table
> 
> Also, we cannot even see my local machine hitting the server, yet when i
> try telnet to it, i can connect no issues... so it's not a firewall from
> my machine to it.
> 
> Any ideas?  or thoughts on how to get this working??
> 
> -- code --
>  $host = "[ipaddress of machine]";
> $port = "[port number]";
> $database = "[actual path of database]";
> $server = "[server]";
> $protocol = "sesoctcp";
> $username = "[username]";
> $password = "[password]";
> $tablename = "[name of the table]";
> 
> $db = new PDO("informix:host={$host}; service={$port};
> database={$database}; server={$server}; protocol={$protocol};
> EnableScrollableCursors=1;", $username, $password);
> 
> print "Connection Established!\n\n";
> 
> $stmt = $db->query("select * from {$tablename}");
> $res = $stmt->fetch( PDO::FETCH_BOTH );
> $rows = $res[0];
> echo "Table contents: $rows.\n";
> 
> ?>
ok, so I ran the test... and it fails 100% of the tests...


# sudo make test

Build complete.
Don't forget to run 'make test'.

PHP Warning:  PHP Startup: Unable to load dynamic library
'modules/gd.so' - modules/gd.so: cannot open shared object file: No such
file or directory in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'modules/gd.so' -
modules/gd.so: cannot open shared object file: No such file or directory
in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library
'modules/mysql.so' - modules/mysql.so: cannot open shared object file:
No such file or directory in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'modules/mysql.so'
- modules/mysql.so: cannot open shared object file: No such file or
directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library
'modules/mysqli.so' - modules/mysqli.so: cannot open shared object file:
No such file or directory in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'modules/mysqli.so'
- modules/mysqli.so: cannot open shared object file: No such file or
directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library
'modules/pdo.so' - modules/pdo.so: cannot open shared object file: No
such file or directory in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'modules/pdo.so' -
modules/pdo.so: cannot open shared object file: No such file or
directory in Unknown on line 0
PHP Warning:  Module 'pdo_informix' already loaded in Unknown on line 0

Warning: Module 'pdo_informix' already loaded in Unknown on line 0
/usr/bin/php: symbol lookup error: modules/pdo_informix.so: undefined
symbol: php_pdo_register_driver
PHP Warning:  PHP Startup: Unable to load dynamic library
'modules/gd.so' - modules/gd.so: cannot open shared object file: No such
file or directory in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'modules/gd.so' -
modules/gd.so: cannot open shared object file: No such file or directory
in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library
'modules/mysql.so' - modules/mysql.so: cannot open shared object file:
No such file or directory in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'modules/mysql.so'
- modules/mysql.so: cannot open shared object file: No such file or
directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library
'modules/mysqli.so' - modules/mysqli.so: cannot open shared object file:
No such file or directory in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'modules/mysqli.so'
- modules/mysqli.so: cannot open share

[PHP] PDO_INFOMIX connection problem...

2011-06-29 Thread Steve Staples
I am trying to connect to an informix database, and using excel and odbc
it works fine.

I installed the PDO_INFORMIX via:
pecl download pdo_informix
phpize
./configure --with-pdo-informix=/opt/IBM/informix
make
make install

and it all appeard to work... phpinfo()  shows that it's enabled, and
active... and when i do my PDO connection, it fails with this error:

I also installed the CSDK prior to installing the pecl pdo_informix (as
the php.net docs said)

Fatal error: Uncaught exception 'PDOException' with message
'SQLSTATE=HY000, SQLDriverConnect: -23101 [Informix][Informix ODBC
Driver][Informix]Unspecified System Error = -23101.' 

all the values in my code, i was given from my boss, which he used to
get in with excel and the odbc.  the $database has to be the full path
of the informix table

Also, we cannot even see my local machine hitting the server, yet when i
try telnet to it, i can connect no issues... so it's not a firewall from
my machine to it.

Any ideas?  or thoughts on how to get this working??

-- code --
query("select * from {$tablename}");
$res = $stmt->fetch( PDO::FETCH_BOTH );
$rows = $res[0];
echo "Table contents: $rows.\n";

?>



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



Re: [PHP] caching problem

2011-06-28 Thread Steve Staples
On Tue, 2011-06-28 at 17:34 +0100, Stuart Dallas wrote:
> On Tue, Jun 28, 2011 at 5:12 PM, Fatih P.  wrote:
> 
> > On Tue, Jun 28, 2011 at 5:30 PM, Stuart Dallas  wrote:
> >
> >> Fatih, please explain what you mean by "the code files are being cached.
> >> and modifications in methods are skipped
> >> and not executed." How are you getting the modified files onto the server,
> >> and how are you running the scripts? Are you working directly on the 
> >> server,
> >> or are you uploading the files to the server via FTP, SCP or some other
> >> mechanism?
> >>
> >> OK, this is a development machine, everything is running on it. nothing is
> > being uploaded  through ftp, scp or something else.
> > all kind of content caching is disabled.
> >
> > and what I mean by the code files are being cached is: after the
> > modifications, i do get the result which was produced before modification.
> > which shows
> > that the file is not being interpreted by php. how i get to this point that
> > I see errors after restarting the machine which were not there during coding
> > or when
> > i dump an object it doesn't show up anything other than previous content.
> >
> > to recover this situation,  either I have to restart httpd which sometimes
> > does work or when it gets more problematic,
> > i have to crush httpd / php on start. and only having this problem on
> > windows machines.
> >
> > sounds funny to most of you but it is happening
> >
> 
> I'm sure it is happening, I don't doubt that, but there's probably a very
> simple explanation.
> 
> What browser are you using? Certain older browsers such as IE6 have their
> own ideas about whether pages should be cached or not. You can usually
> bypass the browser cache by holding control and/or shift while clicking on
> the refresh button. Try that next time this happens.
> 
> Other possibilities include filesystem issues, such that the OS is not
> seeing that the file has been changed - there are levels of caching on
> modern operating systems that most people, quite correctly, are not aware
> of. The likelihood of this being the cause is miniscule.
> 
> If you're absolutely certain that you are not using any opcode caching (you
> mentioned that you are using pre-compiled binaries, and it's possible they
> include APC or similar by default), then I have no idea what's going on
> beyond what I and others have already suggested.
> 
> -Stuart
> 


maybe, you're updating the wrong files?   I've done that a few times,
where the files i THOUGHT it was using, ended up being in the wrong
folder (or apache was pointing to a different folder... kinda one in the
same).

just an alternate spin on it... 

Steve


-- 
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-27 Thread Steve Staples
On Sat, 2011-06-25 at 16:11 -0500, Tamara Temple wrote:
> On Jun 24, 2011, at 1:35 PM, Richard Quadling wrote:
> > On 24 June 2011 18:23, Tamara Temple  wrote:
> >> On Jun 24, 2011, at 10:28 AM, Richard Quadling wrote:
> >>> On 24 June 2011 15:44, Vitalii Demianets   
> >>> wrote:
> >>>> And furthermore, I think Carthage must be destroyed.
> >> Let's haul out the PHP war wagons!
> >>> http://xkcd.com/327/
> >> I so wanted to rename my daughter "Little Chelsea Tables" after I  
> >> read that one. Randall is one mean mofo.
> >
> > And because it is so relevant, I added it to the docs...
> >
> > http://docs.php.net/manual/en/security.database.sql-injection.php
> 
> Well played, sir, well played. I think we should go through all the  
> xkcd comics that relate to programming somehow and insert them in the  
> php.net documentation :)
> 
> 
Tamara, kind of like this one?

http://ca3.php.net/manual/en/control-structures.goto.php

I love that comic :)

Steve.


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



Re: [PHP] Ftp upload

2011-06-15 Thread Steve Staples
On Wed, 2011-06-15 at 07:42 -0400, Marc Guay wrote:
> > If that was about 20 years ago, then it would be fine!
> 
> Would have been around 1992, good guesswork!
> 

ugh, i feel old now (even though i am not)... 20 years ago is 1991... i
got my car/motorcycle license in 1992 at the age of 16...

-- 

Steve Staples
Web Application Developer
519.258.2333 x8414


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



Re: [PHP] What do you get for ...

2011-06-07 Thread Steve Staples
On Tue, 2011-06-07 at 16:09 +0300, Vitalii Demianets wrote:
> On Tuesday 07 June 2011 13:35:06 Richard Quadling wrote:
> > Hi.
> >
> > What do you get for ...
> >
> > php -r "var_dump(realpath(null));"
> >
> 
> 1.
> PHP 5.3.6 @ Gentoo Linux(x86_64)
> 
> tmp $ php -r "print getcwd();"
> /var/tmp
> 
> tmp $ php -r "var_dump(realpath(null));"
> string(8) "/var/tmp"
> 
> 2.
> PHP 5.2.14 @ Linux(ARM) 
> 
> tmp $ php -r "print getcwd();"
> /var/tmp
> 
> tmp $ php -r "var_dump(realpath(null));"
> string(8) "/var/tmp"
> 
> -- 
> Vitalii
> 

sstaples@webdev01:~$ php -v
PHP 5.2.10-2ubuntu6.4 with Suhosin-Patch 0.9.7 (cli) (built: Jan  6 2010
22:41:56) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
sstaples@webdev01:~$ 

sstaples@webdev01:~$ pwd
/home/sstaples
sstaples@webdev01:~$ php -r "var_dump(realpath(null));"
string(14) "/home/sstaples"
sstaples@webdev01:~$ 

I am running Ubuntu 9.10

Steve.


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



[PHP] PHP Brainteasers 2011

2011-05-20 Thread Steve Staples
Just wondering if anyone has done anything for this?   I personally
haven't had any "ideas" come to mind yet... 

Looking forward to seeing them!!!  (once they come)


Steve


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



Re: [PHP] Closing Session (Revisited)

2011-05-05 Thread Steve Staples
On Thu, 2011-05-05 at 21:41 +1000, Roger Riordan wrote:
> On Thu, 31 Mar 2011 16:40:06 -0400, eth...@earthlink.net (Ethan Rosenberg) 
> wrote:
> ...
> >> > > Can you rephrase the question, Ethan, or give more details?  From
> >> > >the way it sounds, you're concerned that destroying a session will
> >> > >have implications for other sessions as well, which is not the case
> >> > >(unless all sessions are shared).  For example, if you have Chrome,
> >> > >Firefox, and Internet Exploder all active, the sessions should be
> >> > >different, if even from the very same computer.  However, multiple
> >> > >tabs in the same browser will generally be the same session (unless
> >> > >it's something like Chrome's Incognito feature).
> ...
> 
> I have developed a common engine which I use for several different websites. 
> I had been
> using PHP 5.2.? and IE6 (yes; I know!), and had been able to have multiple 
> sessions open
> at once, displaying the same or different websites, without them interfering 
> with each
> other. This was incredibly useful; I could be looking at, or even edit, 
> different parts of
> the same, or different, websites simultaneously without any problems.
> 
> But I recently had a hard disk crash and had to re-install all the system 
> software. Now I
> have PHP 5.3 and IE 8, and find that if I try to do this the various sessions 
> interfere
> with each other. From the above comment I gather that this is because IE 8 
> combines all
> the instances, whereas previously each instance was treated as a different 
> user.
> 
> Is there any simple way to make IE 8 treat each instance as a new user, or 
> should I switch
> to Chrome and use the Incognito feature?
> 
> Roger Riordan AM
> http://www.corybas.com/
> 

The Incognito feature wont give you the results you're looking for.
>From my experience, the incognito window(s) and tab(s) share the same
memory/cookie/session space, which is different from the main window...
which means you will run into the same issue.

Once you close all your incognito windows/tabs, you will release those
cookies/sessions/memory space and if you open a new one afterwards, then
you will be fine, but if one tabs stays open, no go :(

Have you looked at the http://ca3.php.net/session_name function, and
putting that into your site just after your session_start() ?  I believe
that will fix your issues (as long as your session names are unique),
but i am not 100% sure.

Steve



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



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

2011-04-29 Thread Steve Staples
On Thu, 2011-04-28 at 19:19 -0400, Robert Cummings wrote:
> On 11-04-28 06:37 PM, dholmes1...@gmail.com wrote:
> > Thanks switch and case seems to be more faster for the job and a lot cleaner
> > --Original Message--
> > From: Andre Polykanine
> > To: dholmes1...@gmail.com
> > Cc: php-general@lists.php.net
> > Subject: Re: [PHP] What's faster using if else or arrays?
> > Sent: Apr 28, 2011 6:17 PM
> >
> > Hello Dholmes1031,
> >
> > I would write it like this:
> > switch($foo) {
> > case 5: $dothis; break;
> > case 3: $dothat; break;
> > default: $donothing; break;
> > }
> 
> This sounds like a job for *dun dun dun* GOTO!
> 
> Kidding, of course ;)
> 
> Cheers,
> Rob.
> -- 

you should be removed and banned from this list for even just THINKING
about using a GOTO!  :P

(yes, there are still *SOME* (and i use that loosely) benefits to the
GOTO command, but in reality, no.)

Steve


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



Re: [PHP] Newsgroup status

2011-04-27 Thread Steve Staples
On Wed, 2011-04-27 at 11:54 -0400, Joshua Kehn wrote:
> If this is the PHP list thinking of it's moderately active. I sometimes 
> forget which ones I'm subscribed to.
> 
> Regards,
> 
> -Josh___
> Joshua Kehn | josh.k...@gmail.com
> http://joshuakehn.com
> 
> On Wednesday, April 27, 2011 at 11:52 AM, Al wrote:
> Is this group off the air or just no topics being posted?
> > 
> > I've not seen it so quiet in years.
> > 
> > Al.
> > 
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 

I guess we've all figured out how to deal with our problems... 

TO THE CLOUD!!


Steve.


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



Re: [PHP] email w/attachments

2011-04-18 Thread Steve Staples
On Mon, 2011-04-18 at 11:05 +0100, Richard Quadling wrote:
> On 18 April 2011 04:38, Bastien  wrote:
> >
> >
> >
> >
> > On 2011-04-17, at 10:26 PM, tedd  wrote:
> >
> >> Hi gang:
> >>
> >> Anyone have an email script that allows attachments they would share?
> >>
> >> I've been trying to figure this out and everything I've tried has failed. 
> >> I've looked at over a dozen scripts that don't work. I'm about to pull out 
> >> what hair I have left.
> >>
> >> Cheers (I think),
> >>
> >> tedd
> >>
> >> --
> >> ---
> >> http://sperling.com/
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >
> > I use phpmailer for that. Great class and easy to do
> >
> > Bastien Koert
> 
> When I started out, I used the HtmlMimeMail class from Richard Heyes
> at phpguru.org. It is now called RMail.
> 
> I found this very easy to use.
> 
> Extending the main class to include logging of mail is very easy (this
> year, I've sent 33,500 emails using it).
> 
> I send email with a plain text part as well as a HTML part. With
> embedded images and PDF attachments.
> 
> The recipients use a combination of Outlook (2003 and later),
> GoogleMail and YahooMail.
> 
> All of the clients so far can read the messages sent and get the attachments.
> 
> If you intend to send HTML mail, you will have to go back to using
> tables with inline CSS if you want to be halfway readable on Outlook
> 2007+. Outlook 2003 was very good with HTML mail. Outlook 2007+, not
> so good. But that is fine for me, as the data was all tables. But for
> those sending out pretty mails, I believe it is a harder job that
> expected.
> 
> Richard.
> 
> -- 
> Richard Quadling
> Twitter : EE : Zend
> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
> 

I use phpmailer[1], and even though most people dont like it, Pear
MAILER as well.  With both, I've sent both HTML and plain text, as well
as attachments without any issues.

phpmailer[1] is my "mailer script" of choice.

Steve.

[1] http://phpmailer.worxware.com/index.php


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



Re: [PHP] Last Name extraction in query

2011-04-04 Thread Steve Staples
On Mon, 2011-04-04 at 14:06 -0400, Jim Giner wrote:
> no - that address came back undeliverable.
> >
> > To subscribe to the list, send an empty message to
> > 
> >
> > Marc 
> 
> 
> 
http://lists.mysql.com/mysql

there is the subscribe box on the right side... use that.   they are a
helpful bunch over there.

-- 

Steve Staples
Web Application Developer
MNSi (Managed Network Systems Inc.)
519.258.2333 x8414
http://www.mnsi.net


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



Re: [PHP] Closing Session

2011-03-31 Thread Steve Staples
On Thu, 2011-03-31 at 16:51 -0400, Daniel Brown wrote:
> On Thu, Mar 31, 2011 at 16:40, Ethan Rosenberg  wrote:
> >
> > 
> > Ash -
> >
> > I can be working on more than one program simultaneously and have one tab
> > open w/ program A and another w/ program B.  The site in reference is
> > "http://localhost";
> >
> > I hope this helps.
> 
> Ah, but running on the same domain, the session will be common.
> Right.  Killing a session will kill it in both programs, as you
> already know, but there's no native way to do one for one
> [file|directory].  Your best bet, if at all possible, is to separate
> by subdomains (which you can do on localhost, too, by modifying your
> hosts file to alias like so:
> 
> 127.0.0.1 localhost development subdomain.development
> 
> Don't worry about it being an FQDN.  Prior to checking with the
> router or DNS servers, all modern systems check the hosts file.  Then
> just add a reference to each in your Apache configuration file and
> restart Apache.  Boom.  Done.
> 
> -- 
> 
> Network Infrastructure Manager
> http://www.php.net/
> 

Can you not "NAME" the sessions?  and kill/destory the named session?



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



Re: [PHP] neubie seeking answers

2011-03-31 Thread Steve Staples
On Thu, 2011-03-31 at 17:34 +0100, Stuart Dallas wrote:
> On Thursday, 31 March 2011 at 17:24, Kirk Bailey wrote:
> I need to extract the name of the subdirectory a page lives in to 
> > use in the title for that page. This will be returned as a string to 
> > echo to the output stream. Now how the heck do I do that?!?
> 
> $dir = basename(dirname(__FILE__));
> 
> -Stuart
> 
> -- 
> Stuart Dallas
> 3ft9 Ltd
> http://3ft9.com/

That is what I was thinking... but for some reason, I couldn't remember
it... so I did that whole explode() thing... oh well! Kirk, use that :)


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



Re: [PHP] neubie seeking answers

2011-03-31 Thread Steve Staples
On Thu, 2011-03-31 at 12:24 -0400, Kirk Bailey wrote:
> I need to extract the name of the subdirectory a page lives in to 
> use in the title for that page. This will be returned as a string to 
> echo to the output stream. Now how the heck do I do that?!?
> 
> -- 
> end
> 
> Very Truly yours,
>   - Kirk Bailey,
> Largo Florida
> 
> kniht
>+-+
>| BOX |
>+-+
> think
> 
> 

I am SURE that there is a better reply already... but quick and dirty...




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



Re: [PHP] [OT:Friday] Kunal invites you to join Games24x7.com

2011-03-25 Thread Steve Staples
On Fri, 2011-03-25 at 10:56 +, Richard Quadling wrote:
> On 25 March 2011 09:57, Kalle Sommer Nielsen  wrote:
> > Dear usang...@gmail.com,
> >
> > We are sorry to inform you back that the PHP project only is of the age 15,
> > which means we are not eligible to take participate within your games.
> >
> > You may in the future, when the PHP project have reach the age of 18, resend
> > an invitation and we can take it from there.
> >
> >
> > --
> > regards,
> >
> > Kalle Sommer Nielsen
> > ka...@php.net
> >
> 
> When PHP _is_ 18, do you think it would be allowed to construct an app
> that plays the games automatically?
> 
> 
> -- 
> Richard Quadling
> Twitter : EE : Zend
> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
> 

H... didn't PHP start development in 1994 (technical birth year)? so
that would technically make it 17 years old, not the 15 that they are
claiming it is.

Also, you have to admit, the way they spelled "Like"  (lyk)  was
awesome!

Steve


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



Re: [PHP] Upload Progress Meter

2011-03-23 Thread Steve Staples
On Wed, 2011-03-23 at 09:59 -0400, Floyd Resler wrote:
> I am in need of an upload progress meter.  I've seen plenty of tutorials =
> on-line requiring installing modules, hooks, patches, etc.  However, my =
> Wordpress install accomplished this without me having to make any =
> modifications to my PHP install.  So, how is it done?
> 
> Thanks!
> Floyd
> 

you can google this...

"jquery upload progress meter"

or:
http://www.nixboxdesigns.com/demos/jquery-uploadprogress.php

http://www.bitrepository.com/uploading-files-with-progress-bar.html



Steve


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



Re: [PHP] Re: echo?

2011-03-23 Thread Steve Staples
On Wed, 2011-03-23 at 08:28 -0400, Jim Giner wrote:
> I am outputting to a  on an html page.  A  doesn't work, nor 
> does \n, hence the 
.  Of course, if I don't need the & then I've 
> just saved two keystrokes.  :)  Also - I do believe I tried ($i+1) and that 
> didn't work either.
> 
> "Paul M Foster"  wrote in message 
> news:20110323034621.go1...@quillandmouse.com...
> > On Tue, Mar 22, 2011 at 10:50:54PM -0400, Jim Giner wrote:
> >
> >> Yes - it is J and I.  I tried using $i+1 in the echo originally but it
> >> wouldn't run.  That's why I created $j.
> >
> > Yes, the substitution creates a syntax error unless surrounded by
> > parentheses or the like.
> >
> >> And just what is wrong with the old cr/lf sequence?  How would you have 
> >> done
> >> it?
> >
> > You're using HTML-encoded entities for 0x0d and 0x0a. You can simply
> > use 0x0d and 0x0a instead. If you're running this in a web context, you
> > should use "" instead of CRLF. At the command line, I'm not
> > familiar with running PHP on Windows. In *nix environments, it's enough
> > to use "\n", just as they do in C. It might even work in Windows; I
> > don't know. If not, you should be able to use "\r\n". You can also try
> > the constant PHP_EOL, which is supposed to handle newlines in a
> > cross-platform way.
> >
> > Paul
> >
> > -- 
> > Paul M. Foster
> > http://noferblatz.com
> > http://quillandmouse.com 
> 
> 
> 

Jim

with the \n, it does work in a textarea.   you must put the \n inside
the "", so:

$q = 'select * from director_records ';
$qrslt = mysql_query($q);
$rows = mysql_num_rows($qrslt);
for ($i = 0; $i < $rows; $i++)
{
$row = mysql_fetch_array($qrslt);
echo ($i + 1) .'-'. $row['userid'];
if ($row['user_priv'] != "")
echo ' ('. $row['user_priv'] .')';
echo "\n";
}


give that a try



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



RE: [PHP] problem with if and exact match

2011-03-15 Thread Steve Staples
On Tue, 2011-03-15 at 01:20 -0400, Jack wrote:
> Thanks everyone... great examples...works ( both methods )
> 
> Thanks!
> Jack
> 
> > -Original Message-
> > From: Alexis Antonakis [mailto:ad...@antonakis.co.uk]
> > Sent: Tuesday, March 15, 2011 1:10 AM
> > To: Jack
> > Subject: Re: [PHP] problem with if and exact match
> > 
> > http://php.net/manual/en/function.preg-match.php
> > 
> > On 14/03/11 23:02, Jack wrote:
> > > I want to be able to match if a string is contained within the string
> > > I am evaluating.
> > >
> > >
> > >
> > > I know that if ( $name == "xxjacksonxx"); based on the below would be
> > true.
> > >
> > > But I want to be able to say if "jackson"  is contained within $name
> > > that it's a match.
> > >
> > >
> > >
> > > I tried the below without success..
> > >
> > > Not getting the operand properly..
> > >
> > >
> > >
> > >  > >
> > >
> > >
> > > $name = "xxjacksonxx";
> > >
> > >
> > >
> > > if ( preg_match($name, "jackson")) {
> > >
> > > print "true";
> > >
> > >
> > >
> > > } else {
> > >
> > >
> > >
> > > print "false";
> > >
> > > }
> > >
> > >
> > >
> > > ?>
> > >
> > >
> > >
> > > Thanks!
> > >
> > > Jack
> > >

Wouldn't this be better to use, as it is meant to search for the string
inside the string?  (use use regex)

if(stristr($name, 'Jackson'))
{
echo "String is in String";
}
else
{
echo "Failed";
}

http://ca.php.net/manual/en/function.strstr.php  (case sensative)
http://ca.php.net/manual/en/function.stristr.php (case insensative)

Steve.


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



Re: [PHP] $_POST variable

2011-03-11 Thread Steve Staples
On Fri, 2011-03-11 at 21:28 +0200, Danny wrote:
> Hi guys,
> 
> I have a form that has a long list of radio-bottons inside of it. The
> radio-buttons are dynamically created via php and MySQL.
> 
> Here is an example of one of the radio buttons:
> 
> " 
> value="0">
> " 
> value="1">
> 
> Now, when I submit this form to another page for processing, how would I 
> "catch"
> the above radio-button's $_POST name since I do not know the name, only that 
> it
> starts with "radio_" ?
> 
> Thank You
> 
> Danny
> 

loop thought all the $_POST variables...

foreach($_POST as $key => $val)
{
if(susbtr($key, 0, 7) === "radio_")
{
# this is what we're looking for
}
}

crude, but works... I am sure there are many ways to look for it.

Steve


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



Re: [PHP] Check for open file

2011-03-04 Thread Steve Staples
On Fri, 2011-03-04 at 09:55 -0500, Daniel Brown wrote:
> On Thu, Mar 3, 2011 at 14:59, Ashley M. Kirchner  wrote:
> >
> >Can PHP detect this, or should I look into some delayed
> > process of checking the file's modified time stamp versus current time and
> > not touch the file till a certain threshold has been reached (say 30 seconds
> > difference?).
> 
> Give the native stat() function a spin:
> 
> http://php.net/stat
> 
> -- 
> 
> Network Infrastructure Manager
> http://www.php.net/
> 

Depending on the size of the file, wouldn't this fall under the 2gb
limitation on windows 32bit OS?  I ran into this problem on a project I
was working on, and ended up switching to Python (but that is a WHOLE
other conversation)

just food for thought, since I am not sure of the size of files they are
dealing with.

Steve


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



RE: [PHP] Check for open file

2011-03-03 Thread Steve Staples
On Thu, 2011-03-03 at 13:23 -0700, Ashley M. Kirchner wrote:
> > Write the file with a temporary name and extension. Once the file is
> closed,
> > change the name to the pattern your server is looking for. Once you finish
> > processing it, either change the name again, or move it to a different
> > directory. Don't reuse the same file name, but add a numeric value which
> > increases every time you create it. Keep a log of which files have been
> > processed and any errors each one produced.
> > 
> > Bob McConnell
> 
> I can't require nor expect those copying the files into the share folder to
> do this.  No, they will simply be grabbing a set of image files from one
> network share and drag them into this Samba share, as is.  I'm not worried
> with what happens when PHP picks it up (name changes, moving to a diff
> folder, etc., etc.)  I'm only concerned with the first step ... picking up
> the file only *after* it's done copying.
> 
> I can run PHP as a timed crontask, but I need to figure out a safe way for
> it to either grab a file or leave it alone because it's not done yet.
> 
> 

If i recall correctly, with FTP, the file is copied into the directory,
but it is not "ready" for use... I have an application that reads the
contents of a FTP directory, looking for files there... i've never had
any issues where it only got a part of the file (that i know of
anyways)... maybe the samba does the same thing?

how large are these files (or how large would the largest file typically
be) ?   would it be worth looking at the "time" of the file, and waiting
until that file is at least (say) 5 mintues old, then do something with
it?  if it only takes < 1 minute to put these files on teh share, then
maybe you can reduce that time... 

Just thinking of alternatives...

Steve


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



Re: [PHP] Somewhat OT - Stored Procedures

2011-03-03 Thread Steve Staples
On Thu, 2011-03-03 at 11:30 -0700, Nathan Nobbe wrote:
> Hey gang,
> 
> (Yes Tedd, I like your style, when it pertains to how you address the list
> :))
> 
> I have a new curiosity that's arisen as a result of a new contract I'm
> working on, I'd like to bounce around some thoughts off the list and see
> what you folks think if interested.
> 
> The topic at hand is stored procedures.  Frankly, I've hardly ever even seen
> these in use, and what I'm trying to figure out are good rules of thumb as
> to where / when / how they are best used in application development.
> 
> Also, bear in mind that personally I tend to favor OO paradigms for
> application development so would prefer feedback that incorporates that
> tendency.
> 
> Initial thoughts are
> 
> Bad:
> . Not well suited for ORM, particularly procedures which return multiple
> result sets consisting of columns from multiple tables
> . Greater potential for duplicated logic, I think this comes down to a well
> defined set of rules for any given application, read: convention required
> for success
> . Scripting languages are vendor specific, and likely most application
> developers have a limited understanding thereof
> 
> Good:
> . Better performance
> . 
> 
> I've also done some reading on MSSQL vs. MySQL and found that the former
> offers much more features.  I've also read that most databases only see
> roughly 40% of the feature sets being used for typical applications in the
> wild, and would agree from personal experience it is accurate.
> 
> >From my standpoint MySQL is popular because the features it offers are the
> features folks are really looking, one of those 80/20 things...
> 
> I stumbled into this link on a google search, it's from '04 but looks to be
> relevant to this day
> 
> http://www.codinghorror.com/blog/2004/10/who-needs-stored-procedures-anyways.html
> 
> Your thoughts appreciated,
> 
> -nathan

Would this not be a better suited question for the mysql mailing list?

regardless, I use stored procedures and functions on my mysql server
here at work, in regards to our radius accounting packets.

I will say, that it was WAY easier to send the packet dump to mysql in a
"call()" statement, than it was to try and do all the programming
necessary to insert the packet, calculate user usage, is the packet
there already, etc etc etc on the radius server.  Doing it this way, we
have 4 radius servers that just fire the same thing over to the mysql,
and if there is a change, i do it on the mysql server, and not have to
do the same thing on 4 different servers.

views, stored procedures, triggers and functions really do have their
purpose within mysql/mssql (and whichever sql server you are using if
they support them), and most of the times they are forgotten about
and/or overlooked.

take a look at this article:
http://www.tonymarston.net/php-mysql/stored-procedures-are-evil.html

Good luck, and I think you may get more response from
my...@lists.mysql.com

Steve.


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



RE: [PHP] Delaying $(document).ready() in jQuery until php script finish

2011-03-03 Thread Steve Staples
On Thu, 2011-03-03 at 10:42 -0500, HallMarc Websites wrote:
> Maybe I misread this and it seems to me he is asking how they could trigger
> the jQuery event after the necessary PHP script is called. Maybe it is being
> over-thought, have you tried placing the javascript call after the PHP
> script? Maybe wrap it in a conditional statement that isn't satisfied until
> whatever necessary condition is met?

Could also echo the jQuery at the bottom of the PHP script, so that way,
no matter what, when the PHP is done, it will echo out (even if
buffered) once the script is completed is "thing".

What I don't get about the question is, is the document.ready()
shouldn't fire, until the page has completely loaded, and if the PHP
script is still running, the "document" shouldn't be "ready" yet, should
it?

Steve




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



Re: [PHP] Re: Dynamically Created Checkboxes

2011-02-24 Thread Steve Staples
On Thu, 2011-02-24 at 12:52 -0500, Gary wrote:
> "Steve Staples"  wrote in message 
> news:1298568238.14826.2431.camel@webdev01...
> > On Thu, 2011-02-24 at 11:42 -0500, Gary wrote:
> >> "Steve Staples"  wrote in message
> >> news:1298492194.14826.2425.camel@webdev01...
> >> > On Wed, 2011-02-23 at 14:56 -0500, Gary wrote:
> >> >> "Steve Staples"  wrote in message
> >> >> news:1298490417.14826.2418.camel@webdev01...
> >> >> > On Wed, 2011-02-23 at 14:17 -0500, Gary wrote:
> >> >> >> "Jim Lucas"  wrote in message
> >> >> >> news:4d653673.7040...@cmsws.com...
> >> >> >> > On 2/23/2011 4:35 AM, Gary wrote:
> >> >> >> >> "Pete Ford"  wrote in message
> >> >> >> >> news:62.c1.32612.d49d4...@pb1.pair.com...
> >> >> >> >>> This bit?
> >> >> >> >>>
> >> >> >> >>> On 22/02/11 22:06, Gary wrote:
> >> >> >> >>>> for($i=1; $i<=$_POST['counties']; $i++) {
> >> >> >> >>>> if ( isset($_POST["county{$i}"] ) ) {
> >> >> >> >>>
> >> >> >> >>> You loop over $_POST['counties'] and look for 
> >> >> >> >>> $_POST["county$i"]
> >> >> >> >>>
> >> >> >> >>> I suspect that there is no field 'counties' in your form, so 
> >> >> >> >>> the
> >> >> >> >>> server
> >> >> >> >>> is
> >> >> >> >>> complaining about the missing index - seems likely that the
> >> >> >> >>> production
> >> >> >> >>> server
> >> >> >> >>> is not showing the error, but instead just giving up on the 
> >> >> >> >>> page.
> >> >> >> >>>
> >> >> >> >>> I think the IE7/Firefox browser difference is a red herring: it
> >> >> >> >>> wasn't
> >> >> >> >>> actually working in any browser, or the code changed between
> >> >> >> >>> tests.
> >> >> >> >>> Remember, PHP is server side and generates HTML (or whatever).
> >> >> >> >>> Unless
> >> >> >> >>> you
> >> >> >> >>> tell the PHP what browser you are using and write PHP code to 
> >> >> >> >>> take
> >> >> >> >>> account
> >> >> >> >>> of that (not generally recommended) then the server output is 
> >> >> >> >>> the
> >> >> >> >>> same
> >> >> >> >>> regardless of browser.
> >> >> >> >>>
> >> >> >> >>> -- 
> >> >> >> >>> Peter Ford, Developer phone: 01580 89 fax:
> >> >> >> >>> 01580
> >> >> >> >>> 893399
> >> >> >> >>> Justcroft International Ltd.
> >> >> >> >>> www.justcroft.com
> >> >> >> >>> Justcroft House, High Street, Staplehurst, Kent   TN12 0AH
> >> >> >> >>> United
> >> >> >> >>> Kingdom
> >> >> >> >>> Registered in England and Wales: 2297906
> >> >> >> >>> Registered office: Stag Gates House, 63/64 The Avenue, 
> >> >> >> >>> Southampton
> >> >> >> >>> SO17
> >> >> >> >>> 1XS
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> Pete
> >> >> >> >>
> >> >> >> >> Once again, thank you for your help.
> >> >> >> >>
> >> >> >> >> I was able to get it to work, I did not understand the browser
> >> >> >> >> differences
> >> >> >> >> either, but on my testing server on IE, it worked as I wanted 
> >> >> >> >> but
> >> >> >> >> not
> >> >> >> >> on
>

Re: [PHP] Re: Dynamically Created Checkboxes

2011-02-24 Thread Steve Staples
On Thu, 2011-02-24 at 11:42 -0500, Gary wrote:
> "Steve Staples"  wrote in message 
> news:1298492194.14826.2425.camel@webdev01...
> > On Wed, 2011-02-23 at 14:56 -0500, Gary wrote:
> >> "Steve Staples"  wrote in message
> >> news:1298490417.14826.2418.camel@webdev01...
> >> > On Wed, 2011-02-23 at 14:17 -0500, Gary wrote:
> >> >> "Jim Lucas"  wrote in message
> >> >> news:4d653673.7040...@cmsws.com...
> >> >> > On 2/23/2011 4:35 AM, Gary wrote:
> >> >> >> "Pete Ford"  wrote in message
> >> >> >> news:62.c1.32612.d49d4...@pb1.pair.com...
> >> >> >>> This bit?
> >> >> >>>
> >> >> >>> On 22/02/11 22:06, Gary wrote:
> >> >> >>>> for($i=1; $i<=$_POST['counties']; $i++) {
> >> >> >>>> if ( isset($_POST["county{$i}"] ) ) {
> >> >> >>>
> >> >> >>> You loop over $_POST['counties'] and look for $_POST["county$i"]
> >> >> >>>
> >> >> >>> I suspect that there is no field 'counties' in your form, so the
> >> >> >>> server
> >> >> >>> is
> >> >> >>> complaining about the missing index - seems likely that the
> >> >> >>> production
> >> >> >>> server
> >> >> >>> is not showing the error, but instead just giving up on the page.
> >> >> >>>
> >> >> >>> I think the IE7/Firefox browser difference is a red herring: it
> >> >> >>> wasn't
> >> >> >>> actually working in any browser, or the code changed between 
> >> >> >>> tests.
> >> >> >>> Remember, PHP is server side and generates HTML (or whatever). 
> >> >> >>> Unless
> >> >> >>> you
> >> >> >>> tell the PHP what browser you are using and write PHP code to take
> >> >> >>> account
> >> >> >>> of that (not generally recommended) then the server output is the
> >> >> >>> same
> >> >> >>> regardless of browser.
> >> >> >>>
> >> >> >>> -- 
> >> >> >>> Peter Ford, Developer phone: 01580 89 fax: 
> >> >> >>> 01580
> >> >> >>> 893399
> >> >> >>> Justcroft International Ltd.
> >> >> >>> www.justcroft.com
> >> >> >>> Justcroft House, High Street, Staplehurst, Kent   TN12 0AH 
> >> >> >>> United
> >> >> >>> Kingdom
> >> >> >>> Registered in England and Wales: 2297906
> >> >> >>> Registered office: Stag Gates House, 63/64 The Avenue, Southampton
> >> >> >>> SO17
> >> >> >>> 1XS
> >> >> >>
> >> >> >>
> >> >> >> Pete
> >> >> >>
> >> >> >> Once again, thank you for your help.
> >> >> >>
> >> >> >> I was able to get it to work, I did not understand the browser
> >> >> >> differences
> >> >> >> either, but on my testing server on IE, it worked as I wanted but 
> >> >> >> not
> >> >> >> on
> >> >> >> anything else.  I chopped out most of the code and ended up with 
> >> >> >> this:
> >> >> >>
> >> >> >> if ( isset($_POST['submit']) ) {} else {
> >> >> >> print "\n";
> >> >> >> if ($Recordset1) {
> >> >> >> print "\n";
> >> >> >> print "  \n";
> >> >> >> print " State \n"; //2 fields in Counties table, State and
> >> >> >> County
> >> >> >> print " County \n";
> >> >> >> print "\n";
> >> >> >> //create table
> >> >> >> $i = 0;
> >> >> >> while ( $row = mysql_fetch_array($Recordset1) ) {
> >> >> >> $i++;
> >> >> >> print "\n";
> >> >> >> print " >> >> &

Re: [PHP] Re: Dynamically Created Checkboxes

2011-02-23 Thread Steve Staples
On Wed, 2011-02-23 at 14:56 -0500, Gary wrote:
> "Steve Staples"  wrote in message 
> news:1298490417.14826.2418.camel@webdev01...
> > On Wed, 2011-02-23 at 14:17 -0500, Gary wrote:
> >> "Jim Lucas"  wrote in message
> >> news:4d653673.7040...@cmsws.com...
> >> > On 2/23/2011 4:35 AM, Gary wrote:
> >> >> "Pete Ford"  wrote in message
> >> >> news:62.c1.32612.d49d4...@pb1.pair.com...
> >> >>> This bit?
> >> >>>
> >> >>> On 22/02/11 22:06, Gary wrote:
> >> >>>> for($i=1; $i<=$_POST['counties']; $i++) {
> >> >>>> if ( isset($_POST["county{$i}"] ) ) {
> >> >>>
> >> >>> You loop over $_POST['counties'] and look for $_POST["county$i"]
> >> >>>
> >> >>> I suspect that there is no field 'counties' in your form, so the 
> >> >>> server
> >> >>> is
> >> >>> complaining about the missing index - seems likely that the 
> >> >>> production
> >> >>> server
> >> >>> is not showing the error, but instead just giving up on the page.
> >> >>>
> >> >>> I think the IE7/Firefox browser difference is a red herring: it 
> >> >>> wasn't
> >> >>> actually working in any browser, or the code changed between tests.
> >> >>> Remember, PHP is server side and generates HTML (or whatever). Unless
> >> >>> you
> >> >>> tell the PHP what browser you are using and write PHP code to take
> >> >>> account
> >> >>> of that (not generally recommended) then the server output is the 
> >> >>> same
> >> >>> regardless of browser.
> >> >>>
> >> >>> -- 
> >> >>> Peter Ford, Developer phone: 01580 89 fax: 01580
> >> >>> 893399
> >> >>> Justcroft International Ltd.
> >> >>> www.justcroft.com
> >> >>> Justcroft House, High Street, Staplehurst, Kent   TN12 0AH   United
> >> >>> Kingdom
> >> >>> Registered in England and Wales: 2297906
> >> >>> Registered office: Stag Gates House, 63/64 The Avenue, Southampton 
> >> >>> SO17
> >> >>> 1XS
> >> >>
> >> >>
> >> >> Pete
> >> >>
> >> >> Once again, thank you for your help.
> >> >>
> >> >> I was able to get it to work, I did not understand the browser
> >> >> differences
> >> >> either, but on my testing server on IE, it worked as I wanted but not 
> >> >> on
> >> >> anything else.  I chopped out most of the code and ended up with this:
> >> >>
> >> >> if ( isset($_POST['submit']) ) {} else {
> >> >> print "\n";
> >> >> if ($Recordset1) {
> >> >> print "\n";
> >> >> print "  \n";
> >> >> print " State \n"; //2 fields in Counties table, State and
> >> >> County
> >> >> print " County \n";
> >> >> print "\n";
> >> >> //create table
> >> >> $i = 0;
> >> >> while ( $row = mysql_fetch_array($Recordset1) ) {
> >> >> $i++;
> >> >> print "\n";
> >> >> print " >> >> value=\"$row[name]\">\n";
> >> >> echo "{$row['state_id']}\n";
> >> >> echo "{$row['name']}\n";
> >> >> echo "\n";
> >> >> }//end while
> >> >> print "\n";
> >> >> } else {
> >> >> echo("Error performing query: " .
> >> >> mysql_error() . "");
> >> >> }
> >> >> print "\n";
> >> >> print "\n";
> >> >> }
> >> >> ?>
> >> >>
> >> >> Again, thank you.
> >> >>
> >> >> Gary
> >> >>
> >> >> __ Information from ESET Smart Security, version of virus
> >> >> signature database 5899 (20110223) __
> >> >>
> >> >> The message was checked by ESET Smart Securi

Re: [PHP] Re: Dynamically Created Checkboxes

2011-02-23 Thread Steve Staples
t; if ( !empty($_POST['county'])
> >  foreach ( $_POST['county'] AS $id => $name )
> >echo "{$id} {$name}\n";
> >
> > ...
> > ?>
> >
> > Hope this clears things up for you a little.
> >
> > Enjoy.
> >
> > Jim
> 
> In a weird twist, I have/had  the script working, but again it is not 
> working in FF or Chrome.  This is a link to the first page which runs you 
> through the pages.
> 
> I have the submit to trigger upon change so there is no submit button.  This 
> works in IE7.  If I add a submit button, it does not work in any of them.
> 
> I am wondering if this is more a problem with the html.
> 
> 
> http://www.assessmentappeallawyer.com/forum_state.php
> 
> This is the code for the first processing page
> 
> if ( !isset($_POST['submit']) ) {
>   echo '';
>   if ($Recordset1) {
> echo << 
>   State  County 
> HEADER;
> while ( $row = mysql_fetch_array($Recordset1) ) {
>   echo <<   
> 
> {$row['state_id']}
> {$row['name']}
>   
> ROW;
>   }//end while
>   echo '';
> } else {
>   echo 'Error performing query: '.mysql_error().'';
> }
>   echo '';
> }
> 
> ?>
> 
> This is the code for the second processing page.
> 
> 
>  
> 
> if ( !empty($_POST['county']))
>   foreach ( $_POST['county'] AS $id => $name )
> echo 'You have selected '. " {$name}".'';
> 
> 
> 
> $totalRows_county_result_net= "($totalRows_county_result) + (1)";
>  echo "[$totalRows_county_result_net]";
>  echo "$totalRows_county_result";
>  ?>
> 
> 
> 
> 
>  $name=$_POST['name'];
> echo 'You have selected'."$name";
> 
> ?>
>  mysql_free_result($county_result);
> ?>
> 
> Again, thank you for any input.
> 
> Gary 

I think it may have to do with HTML, or the fact that IE is "helping"
you with your coding... where FF and Chrome are usually more
"literal" (yet better IMO). Also, the fact that "submit" has not been
defined.

try adding:


This *SHOULD* give you the submit button, but the style is "hidden" now,
so it shouldn't show, but it will fire off the "submit" action... make
sure it is in between the  tags though.

Steve


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



Re: [PHP] > 2gb file issues

2011-02-17 Thread Steve Staples
On Thu, 2011-02-17 at 15:36 -0600, Nicholas Kell wrote:
> On Feb 17, 2011, at 3:29 PM, Steve Staples wrote:
> 
> > Is there a workaround for 32bit systems wanting to use 
> > fopen()
> > is_file()
> > filesize()
> > 
> > and i am sure there are others.. on files that are > 2gb?
> > 
> > My development box is win visat 64bit, and i dont have any issues, when
> > i ported it to my test live server, it is running 5.2.8 32bit, and it is
> > not reading the files  :(
> > 
> > any assistance?  besides upgrading to a 64bit php version.
> > 
> 
> What OS is on your live server?
> 
> 

well... my testing live server is slackware 12.2 (i think?  it's my
unraid server)  i installed php from
http://mirrors.easynews.com/linux/slackware/slackware-12.2/slackware/n/php-5.2.8-i486-1.tgz

Normally, I use debian, but I am doing something else this time... long
story... 

Steve


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



[PHP] > 2gb file issues

2011-02-17 Thread Steve Staples
Is there a workaround for 32bit systems wanting to use 
fopen()
is_file()
filesize()

and i am sure there are others.. on files that are > 2gb?

My development box is win visat 64bit, and i dont have any issues, when
i ported it to my test live server, it is running 5.2.8 32bit, and it is
not reading the files  :(

any assistance?  besides upgrading to a 64bit php version.

Steve




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



Re: [PHP] root of PHP found!

2011-02-17 Thread Steve Staples
On Wed, 2011-02-16 at 19:04 -0500, Daniel Brown wrote:
> On Wed, Feb 16, 2011 at 18:15, Daevid Vincent  wrote:
> > Aha!  I am working for the company that was the root of PHP!
> >
> > http://www.panasonic.net/history/founder/chapter3/story3-02.html
> >
> > ;-)
> 
> I'm surprised you found that.  Very few people know that PHP is
> actually just a cover-up for Pan-Asian culture influence operations
> conducted regularly by the CIA.
> 
> Unfortunately, now that you do know, you know what we have to do to 
> you
> 
> ;-P
> 
> -- 
> 
> Network Infrastructure Manager
> Documentation, Webmaster Teams
> http://www.php.net/
> 

Wow... I knew PHP4 was old, but since 1946?   It's amazing people still
use PHP4, and it's 65 years old now.

(the image says PHP and then below it says 4, for those people who
didn't/haven't opened the link above)


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



Re: [PHP] Howdy (new in here)

2011-02-15 Thread Steve Staples
On Tue, 2011-02-15 at 15:54 -0500, tedd wrote:
> At 2:20 PM -0500 2/15/11, Mujtaba Arshad wrote:
> >I would say all languages have their 'lousy developers', however, since very
> >few schools focus on teaching the 'proper coding style' for PHP it leads to
> >people learning from a variety of resources available online, and this leads
> >to them receiving mixed messages from the tutorials and allowing people the
> >ability to choose the method they prefer. Since there is very little
> >syntactic consistency among the code produced by developers, it leads to the
> >perception that the developers are 'lousy'.
> 
> I don't know if I buy that or not -- I didn't learn programming in school.
> 
> I learned by using rocks instead of ones. It was a few years later 
> that we created the concept of using the absence of rocks as zeros 
> and were finally able to build things other than pyramids.
> 
> Style became a matter of choice -- it's what makes sense to you and 
> that usually works.
> 
> For example, while it's true that Rob and I disagree on brace style, 
> there are many different types to choose from.
> 
> This is what I show my students:
> 
> http://rebel.lcc.edu/sperlt/citw229/brace-styles.php
> 
> Cheers,
> 
> tedd
> 
> -- 
> ---
> http://sperling.com/
> 

Tedd:

Your bracing style is WRONG.  Whitesmiths Style sucks... and Allman
Style is the best way to do it.

:)


My personal bracing style is the Allman Style... I've been doing it that
way forever, it just made sense to me (even before I knew there was that
style name... which was about 3 minutes ago).   everything lined up nice
and neat.

Steve



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



Re: [PHP] 2 submit buttons.

2011-02-15 Thread Steve Staples
On Tue, 2011-02-15 at 08:07 -0500, Floyd Resler wrote:
> On Feb 14, 2011, at 5:24 PM, Paul M Foster wrote:
> 
> > On Mon, Feb 14, 2011 at 05:15:11PM -0500, Floyd Resler wrote:
> > 
> >> 
> >> On Feb 14, 2011, at 4:18 PM, Paul M Foster wrote:
> >> 
> >>> On Mon, Feb 14, 2011 at 03:35:02PM -0400, Paul Halliday wrote:
> >>> 
> >>>> I have 2 buttons on a page:
> >>>> 
> >>>> if (isset($_POST['botton1'])) {dothing1();} if
> >>>> (isset($_POST['button2'])) {dothing2();}
> >>>> 
> >>>> They both work as intended when I click on them. If however I click
> >>>> within a text box and hit enter, they both fire.
> >>>> 
> >>>> Is there a way to stop this?
> >>> 
> >>> Check your code. My experience has been that forms with multiple
> >>> submits will fire the *first* submit in the form when you hit Enter
> >>> in a text field or whatever. I just tested this and found it to be
> >>> true.
> >>> 
> >>> Now, I'm doing this in Firefox on Linux. I suppose there could be
> >>> differences among browsers, but I suspect that the specs for HTML
> >>> mandate the behavior I describe.
> >>> 
> >>> Paul
> >>> 
> >> 
> >> If you don't mind using a little JavaScript you can test for which
> >> button should fire when enter is pressed.  How I would do it is to
> >> first add a hidden field and call it "buttonClicked".  Now, in the
> >> text field where you would like a button to fire if enter is pressed,
> >> at this to the tag: onkeyup="checkKey(this,event)".  For the
> >> JavaScript portion of it, do this:
> > 
> > Yeah, but you don't even have to go that far. Just put a print_r($_POST)
> > at the beginning of the file, and you'll see which button gets pressed.
> > It will show up in the POST array.
> > 
> > Paul
> > 
> > -- 
> 
> Yeah, except that the original question was about controlling which button 
> fires when the enter key is pressed. :)
> 
> Thanks!
> Floyd
> 
> 

I think if you have more than 1 submit button, then you need to disable
the "enter to submit" functionality.  This would force people/users to
click on either of the submit buttons...

Or better yet, if you have a "default" submit button, have a hidden text
value with your default submit value, and then on the submit "onclick"
event of the other submit button, replace the text value of the hidden
field to something else.   Then finally in your postback check, check
the value of the hidden field to determine what you're going to do.

Personally, I do a combination of both.  I disable the ability to submit
on key press, and require you to submit via my submit methods, and
onclick of the submit button sets a value to the hidden text field, and
then do a switch() case:... on that hidden value.   But that is my way
of doing it (which will prolly get ripped apart by someone here, which
is good/constructive criticism for me)

steve


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



Re: [PHP] PHP -- using without installing

2011-02-14 Thread Steve Staples
On Mon, 2011-02-14 at 16:10 -0500, Paul M Foster wrote:
> On Mon, Feb 14, 2011 at 12:32:51PM -0500, Steve Staples wrote:
> 
> > Hi!
> > 
> > I've been developing this stand alone application, found the webserver
> > that I am going to use (it is written in php) and all is good... on
> > windows.
> > 
> > I can get the php.exe and php-cgi.exe running no issue on windows
> > without "installing" them... even tested on 3 machines (developed on
> > Vista, sent to my friend on W7, and my GF on XP Home) and they all work
> > fine... now I was trying to port it over to linux, and I can't find
> > anything that I can use :(
> > 
> > Is there such a thing?  or will I have to have a pre-req of "php and
> > php-cgi must be installed on linux" disclaimer?
> > 
> > Any help, or pointers to where my google-fu has failed me would be
> > appreciated :)
> 
> I don't know if there's a web server under Linux which is written in
> PHP. But I imagine you'd be hard pressed to find a Linux distribution
> which does not come with several web servers and PHP either already
> installed or easily installable. After all, most of the web is running
> on Linux servers.
> 
> Paul
> 
> -- 
> Paul M. Foster
> http://noferblatz.com
> 
> 

it's not that I dont want to have a webserver installed, it is a
standalone app, that doesn't require apache or any other httpd server
running... for people who want to run this on their windows, or linux,
or slackware servers and have no use for an "apache" server running for
just this.

i've got it working for windows, where i didn't have to install
anything, was just looking for something for a "*nix" distribution that
will do it too.

the webserver i am using, is 'nanserv', which works perfectly for what I
need it to do, and running under linux, it's very fast (windows is a bit
slow, but that's windows for ya)

I guess I am just going to have to say that having PHP installed is a
pre-req for the app (i just dont want to go installing software on
people's computers)


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



[PHP] PHP -- using without installing

2011-02-14 Thread Steve Staples
Hi!

I've been developing this stand alone application, found the webserver
that I am going to use (it is written in php) and all is good... on
windows.

I can get the php.exe and php-cgi.exe running no issue on windows
without "installing" them... even tested on 3 machines (developed on
Vista, sent to my friend on W7, and my GF on XP Home) and they all work
fine... now I was trying to port it over to linux, and I can't find
anything that I can use :(

Is there such a thing?  or will I have to have a pre-req of "php and
php-cgi must be installed on linux" disclaimer?

Any help, or pointers to where my google-fu has failed me would be
appreciated :)

TIA!

Steve


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



Re: [PHP] curl_exec won't return (any data)

2011-02-08 Thread Steve Staples
On Tue, 2011-02-08 at 21:15 +0100, Tolas Anon wrote:
> On Tue, Feb 8, 2011 at 8:54 PM, Tolas Anon  wrote:
> > But in the meanwhile I found a new idea to try as well;
> >
> >curl_setopt($ch, CURLOPT_HTTPHEADER, array(
> >'Connection: Keep-Alive',
> >'Keep-Alive: 300'
> >));
> >
> > I already checked via phpinfo() that keep-alive is on in
> > apache2handler, and no other mentions of "keepalive" or "keep alive"
> > in the phpinfo() output.
> >
> > I'll post the results.
> >
> 
> ehm
> 
> http://www.io.com/~maus/HttpKeepAlive.html :
> 
> HTTP/1.0
> 
> Under HTTP 1.0, there is no official specification for how keepalive
> operates. It was, in essence, tacked on to an existing protocol. If
> the browser supports keep-alive, it adds an additional header to the
> request:
> Connection: Keep-Alive
> 
> Then, when the server receives this request and generates a response,
> it also adds a header to the response:
> Connection: Keep-Alive
> 
> Following this, the connection is NOT dropped, but is instead kept
> open. When the client sends another request, it uses the same
> connection. This will continue until either the client or the server
> decides that the conversation is over, and one of them drops the
> connection.
> 
> -
> HTTP/1.1
> 
> Under HTTP 1.1, the official keepalive method is different. All
> connections are kept alive, unless stated otherwise with the following
> header:
> Connection: close
> 
> The Connection: Keep-Alive header no longer has any meaning because of this.
> Additionally, an optional Keep-Alive: header is described, but is so
> underspecified as to be meaningless. Avoid it.
> 
> -
> 
> And of course, my return data packet 5901 uses HTTP1.1, so the test
> i'm running now probably won't fix things.. :(((
> 


i've been sorta reading this (as I am sure most maybe stopped after the
4th consecutive post)... but what I am wondering is...

why can't you just write the output of the what you're doing to a file,
or the db, and then query along the way or when you need/want some
information on it??   Maybe i just haven't quite figured out, or got the
gist of what you are trying to accomplish...

it also seems to me, that this really isn't a PHP specific issue, so all
the posts that you're doing, really doesn't pertain to the PHP mailing
list, so (and sorry to say this) maybe stop posting all the incremental
updates you're doing, and when there is a major break through, or
someone has an idea on how to help solve your issue, update us.

Steve.


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



Re: [PHP] override built-in mail()

2011-02-04 Thread Steve Staples
On Fri, 2011-02-04 at 20:25 +0100, Thijs Lensselink wrote:
> On 02/04/2011 04:59 PM, Steve Staples wrote:
> > On Fri, 2011-02-04 at 07:51 -0800, Jim Lucas wrote:
> >> On 2/4/2011 5:37 AM, Steve Staples wrote:
> >>> Hello Guys/Gals,
> >>>
> >>> it's friday (at least where I am it is) and I have an issue with a
> >>> script that I just started using again.  The problem is, is that it uses
> >>> the built in PHP mail() function, and on my testing server, mail()
> >>> doesn't work. The other issue, is that I use SMTP Auth to connect to my
> >>> mail server, so that when mail sends out, it comes from my mail server
> >>> so that there is less of a chance for being marked as SPAM.
> >>>
> >>> So, what I am looking to do, is use either the trust old Pear::Mail or
> >>> PHPMailer scripts (I am sure there are other ones out there, but those
> >>> are the 2 I am most familiar with).
> >>>
> >>> So now to my actual question.  How can I override the built-in PHP
> >>> mail() function, to let either of those 2 (or something else someone may
> >>> suggest) to act in the same manner as the mail() function?
> >>>
> >>> Is this easy?  I've googled, but haven't seen any reference to doing
> >>> what I am looking to do (maybe I just can't google)
> >>>
> >>> Steve
> >>>
> >>>
> >>
> >> You cannot "override" a function.  You will have to write a new function,
> >> "my_mail" or some such.  Have it take the same arguments as the built in 
> >> mail
> >> function, but internally it uses phpmailer or the likes.  Then, do a 
> >> search and
> >> replace for " mail(" with " my_mail("
> >>
> >> One other possible option, which I had not contemplated until now, would 
> >> be to
> >> actually specify a replacement sendmail executable when setting up the 
> >> sendmail
> >> option in the php.ini.  You could specify a php script that can run as 
> >> though it
> >> was sendmail, accept the same arguments, etc... but do all the phpmailer 
> >> stuff
> >> inside.
> >>
> >> Jim Lucas
> >>
> > 
> > after posting this, and doing some more googleing, I found this:
> > http://ca.php.net/manual/en/function.override-function.php
> > 
> > it says you can override built-in php functions... I haven't tested to
> > see if i can do it, but it seems possible... has anyone used this
> > before?  and will it do what I need?  (this has been put on the back
> > burner for today, so tonight I will look more deeper into this unless
> > someone else has any luck in the mean time)
> > 
> > TIA!
> > 
> > Steve
> > 
> > 
> 
> In PHP versions < 5.3 you need something like runkit or apd. In PHP 5.3
> and up you could use monkey patching
> 
>  
> namespace somenamespace;
> 
> function mail() {
>   // do something!
> }
> 
> 
> You don't actually overwrite the core function but it's close.
> 
>  
> use somenamespace;
> 
> mail() // will call the namespaced function
> 
> \mail() // will call the core function
> 

The reason i was hoping to override the function, was because then if
the script has updates, then i would need to change all references of
mail() to my_mail()   or if i am not using < 5.3  (and what is runkit or
apd??)



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



Re: [PHP] override built-in mail()

2011-02-04 Thread Steve Staples
On Fri, 2011-02-04 at 07:51 -0800, Jim Lucas wrote:
> On 2/4/2011 5:37 AM, Steve Staples wrote:
> > Hello Guys/Gals,
> > 
> > it's friday (at least where I am it is) and I have an issue with a
> > script that I just started using again.  The problem is, is that it uses
> > the built in PHP mail() function, and on my testing server, mail()
> > doesn't work. The other issue, is that I use SMTP Auth to connect to my
> > mail server, so that when mail sends out, it comes from my mail server
> > so that there is less of a chance for being marked as SPAM.
> > 
> > So, what I am looking to do, is use either the trust old Pear::Mail or
> > PHPMailer scripts (I am sure there are other ones out there, but those
> > are the 2 I am most familiar with).
> > 
> > So now to my actual question.  How can I override the built-in PHP
> > mail() function, to let either of those 2 (or something else someone may
> > suggest) to act in the same manner as the mail() function?
> > 
> > Is this easy?  I've googled, but haven't seen any reference to doing
> > what I am looking to do (maybe I just can't google)
> > 
> > Steve
> > 
> > 
> 
> You cannot "override" a function.  You will have to write a new function,
> "my_mail" or some such.  Have it take the same arguments as the built in mail
> function, but internally it uses phpmailer or the likes.  Then, do a search 
> and
> replace for " mail(" with " my_mail("
> 
> One other possible option, which I had not contemplated until now, would be to
> actually specify a replacement sendmail executable when setting up the 
> sendmail
> option in the php.ini.  You could specify a php script that can run as though 
> it
> was sendmail, accept the same arguments, etc... but do all the phpmailer stuff
> inside.
> 
> Jim Lucas
> 

after posting this, and doing some more googleing, I found this:
http://ca.php.net/manual/en/function.override-function.php

it says you can override built-in php functions... I haven't tested to
see if i can do it, but it seems possible... has anyone used this
before?  and will it do what I need?  (this has been put on the back
burner for today, so tonight I will look more deeper into this unless
someone else has any luck in the mean time)

TIA!

Steve


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



[PHP] override built-in mail()

2011-02-04 Thread Steve Staples
Hello Guys/Gals,

it's friday (at least where I am it is) and I have an issue with a
script that I just started using again.  The problem is, is that it uses
the built in PHP mail() function, and on my testing server, mail()
doesn't work. The other issue, is that I use SMTP Auth to connect to my
mail server, so that when mail sends out, it comes from my mail server
so that there is less of a chance for being marked as SPAM.

So, what I am looking to do, is use either the trust old Pear::Mail or
PHPMailer scripts (I am sure there are other ones out there, but those
are the 2 I am most familiar with).

So now to my actual question.  How can I override the built-in PHP
mail() function, to let either of those 2 (or something else someone may
suggest) to act in the same manner as the mail() function?

Is this easy?  I've googled, but haven't seen any reference to doing
what I am looking to do (maybe I just can't google)

Steve


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



Re: [PHP] Pulling from Multiple Databases

2011-02-01 Thread Steve Staples
-- purposely top posting as well --
just think, here in ontario, we have UBB... where Bell is proposing a 25
cap on usage... you sir, are killing my usage!

:)

On Tue, 2011-02-01 at 12:18 -0700, Alexis wrote:
> Bloody Hell!!
> 
> How many lines is the footer in your email response!!!
> 
> I make it almost ten times longer than the reply itselftalk about 
> abominable netiquette, and I have purposely put this response at the top 
> as after all footers do go at the bottom of an email :)
> 
> Do you even NEED a footer with nothing but inane comments in it?
> 
> Alexis
> On 01/02/11 11:54, David Hutto wrote:
>  > I'd pass the db's to a threaded function that processes each db's info
>  > in an algorithmic order.
>  >
>  > -- The lawyer in me says argue...even if you're wrong. The scientist in
>  > me... says shut up, listen, and then argue. But the lawyer won on
>  > appeal, so now I have to argue due to a court order. Furthermore, if you
>  > could be a scientific celebrity, would you want einstein sitting around
>  > with you on saturday morning, while you're sitting in your undies,
>  > watching Underdog?...Or better yet, would Einstein want you to violate
>  > his Underdog time? Can you imagine Einstein sitting around in his
>  > underware? Thinking about the relativity between his pubic nardsac, and
>  > his Fruit of the Looms, while knocking a few Dorito's crumbs off his
>  > inner brilliant white thighs, and hailing E = mc**2, and licking the
>  > orangy, delicious, Doritoey crust that layered his genetically rippled
>  > fingertips? But then again, J. Edgar Hoover would want his pantyhose
>  > intertwined within the equation. However, I digress, momentarily. But
>  > Einstein gave freely, for humanity, not for gain, other than personal
>  > freedom. An equation that benefited all, and yet gain is a personal
>  > product. Also, if you can answer it, is gravity anymore than
>  > interplanetary static cling?
>  > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
>  > http://www.php.net/unsub.php
> 



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



RE: [PHP] Different sessions, same client

2011-01-24 Thread Steve Staples
On Sun, 2011-01-23 at 17:40 -0800, Tommy Pham wrote:
> > -Original Message-
> > From: Tommy Pham [mailto:tommy...@gmail.com]
> > Sent: Sunday, January 23, 2011 5:23 PM
> > To: 'Paul M Foster'
> > Cc: 'php-general@lists.php.net'; 'Thijs Lensselink'
> > Subject: RE: [PHP] Different sessions, same client
> > 
> > > -Original Message-
> > > From: Thijs Lensselink [mailto:d...@lenss.nl]
> > > Sent: Sunday, January 23, 2011 12:21 AM
> > > To: php-general@lists.php.net
> > > Subject: Re: [PHP] Different sessions, same client
> > >
> > > -BEGIN PGP SIGNED MESSAGE-
> > > Hash: SHA1
> > >
> > > On 01/23/2011 07:33 AM, Paul M Foster wrote:
> > > > Storing any sort of login/auth data in cookies has regularly been
> > > > panned on this list. The preference seems to be to store whatever
> > > > login/auth information *must* be stored in the $_SESSION variable.
> > > >
> > > > Well and good. My problem, however, is that I have multiple
> > > > applications in different tabs running on the same server, which may
> > > > all use the same sub-variables, like "username". As a result, they
> > > > run into
> > > each other.
> > > > One application will think I'm logged in when I'm not logged in to
> > > > that application, but to another in the same browser on the same box.
> > > >
> > > > So my question is how to prevent this using the standard PHP
> > > > functions relating to sessions. I'd like different applications in
> > > > different tabs on the same box/browser to have different sessions,
> > > > so they don't share data.
> > > >
> > > > Thoughts?
> > > >
> > > > Paul
> > > >
> > >
> > >
> > > Using session_name will allow you to run two different sessions in the
> > > same browser.
> > >
> > > session_name('app1');
> > > session_start();
> > 
> > Paul,
> > 
> > I'd would go with session_name($_SERVER['SCRIPT_NAME']) or
> > session_name(substr($_SERVER['SCRIPT_NAME'], 0,
> > strripos($_SERVER['SCRIPT_NAME'], '/')).  My regex skills sucks so I can't 
> > give
> > you a sample using regex.  But you get the idea.
> > 
> > It's easier to get a particular app's relevant data to the URL while not 
> > hard
> > coding the session name, eventually giving your app(s) more flexibility
> > especially if you may have multiple URLs mapped to an app serving
> > different purposes/clients.
> > 
> > Regards,
> > Tommy
> 
> Forgot to mention that this assumes your app's design is MVC like with a 
> single point entry only.
> 
> 

Hey guys...

I too once tried this, basically so that I could stop users logging in
on multiple tabs, and if they did, then it would kill the previous login
(or not allow them to be logged in as they would be logged in still).  I
had so many issues, that I abandoned it.

After reading this thread, I thought I would try Tommy's suggestion
about using a unique named session... so I just tried this:



YAY!  it worked!!

so then i tried this:
';
print_r($_SESSION);
echo '';
?>

and it doesn't preserve the older session information... so I must be
doing something wrong.  I can assume that because the name is being
regenerated new each time, that the old "previous" session is destroyed
(which would make sense) but then how can *I* ensure that each session
is going to be unique enough, but preserve "old" session information
too?  

I know it has to be possible, as my bank doesn't allow multiple tabs
while online banking.

/sigh  the joys of protecting users from themselves... 


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



Re: [PHP] Class and interface location

2011-01-20 Thread Steve Staples
On Wed, 2011-01-19 at 21:46 -0600, Larry Garfield wrote:
> On Wednesday, January 19, 2011 8:56:50 pm Tommy Pham wrote:
> 
> > > And actually, thinking about it, I wonder if requiring the explicit
> > declaration
> > > is a good thing anyway because then it's immediately obvious and
> > > greppable what the class does. :-)
> > > 
> > > --Larry Garfield
> > 
> > You mean requiring explicit declaration of
> > 
> > > class Bob implements Foo {
> > > 
> > > }
> > 
> > It's so you can guarantee your app from future breakage because the
> > interface guarantees minimum functionality and still maintain great
> > flexibility such that:
> 
> Well, let me offer a more precise example of what I want to do:
> 
> interface Stuff {
>   function doStuff($a);
> }
> 
> interface Things extends Stuff {
>   function doThings($a);
> }
> 
> class Bob implements Stuff {...}
> 
> class Alice implements Stuff {...}
> 
> class George {}
> 
> class Matt implements Things {...}
> 
> 
> function make_stuff_happen($o) {
>   foreach (class_that_implements_stuff() as $class) {
> $c = new $class();
> $c->doStuff($o);
>   }
> }
> 
> The above code should iterate over Bob, Alice, and Matt, but not George.  The 
> trick is how to implement class_that_implements_stuff() (or rather, 
> class_that_implements_something('Stuff')) in a sane and performant fashion 
> that supports auto-loading.
> 
> If all of the above is together in a single file, it's dead simple with 
> get_declared_classes() and class_implements().  However, in practice there 
> could be some 200 interfaces -- with each installation having a different set 
> of them -- and as many as 500 classes implementing some combination of those 
> interfaces, possibly multiple on the same class -- also with each 
> installation 
> having a different set of them.  I do not want to be forced to include all of 
> those classes and interfaces on every page load when in practice only perhaps 
> two dozen will be needed on a particular request.  That makes 
> class_that_implements_stuff() considerably tricker.
> 
> That let naturally to having a cached index (in a database, in a file with a 
> big lookup array, whatever) that pre-computed which class implements what 
> interface and what file it lives in, so that we can easily lookup what 
> classes 
> we need and then let the autoloader find them.  (Previous benchmarks have 
> shown that an index-based autoloader is actually pretty darned fast.)  That 
> just makes building that index the challenge, hence this email thread.
> 
> Thinking it through, however, I am now wondering if, in practice, indirect 
> implementation (class Matt above) will even be that common.  It may not be 
> common enough to be an issue in practice, so requiring Matt to be declared as:
> 
> class Matt implements Stuff, Things {...}
> 
> isn't really that big of a deal and makes the indexer considerably simpler.  
> We actually have one already that indexes class locations; it just doesn't 
> track interfaces.  
> 
> I also, on further review, don't think that class-based inheritance will ever 
> be an issue.  The following:
> 
> class Mary extends Alice {...}
> 
> Would not make much sense at all because then both Mary and Alice would run, 
> so Alice's code would run twice.  So I may be over-complicating the situation.
> 
> (For those following along at home, yes, this is essentially observer 
> pattern.  
> However, it's on a very large scale and the thing being observed may not 
> always be an object, so the usual active registration process of 
> instantiating 
> both objects and telling them about each other on the off chance that they 
> *may* be needed is excessively wasteful.)
> 
> Does that make it clearer what I'm trying to do?
> 
> --Larry Garfield
> 

Maybe it's the noob in me, or the lack of smrts... but couldn't you just
add a var in the class, and set it like:
$GLOBALS['classes_that_do_things']['name'] = 'class_name';
And for those that do 'things', and then do the foreach on that?  
foreach($GLOBALS['classes_that_do_things']['name'] as $class_name) {...}

not sure if that would work or not, it was just something that was in
the cobwebs of my brain this morning.

Steve


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



Re: [PHP] Class and interface location

2011-01-19 Thread Steve Staples
On Wed, 2011-01-19 at 01:07 -0600, Larry Garfield wrote:
> Hi all.  I'm trying to come up with a solution to an architectural problem I 
> could use some extra eyes on.
> 
> I have (or will have) a large code base with lots of classes, spread out over 
> many optional plugin components.  These classes, of course, will have 
> interfaces on them.  These classes will, of course, lazy-load using PHP's 
> autoload capability.
> 
> What I need to know is which classes implement which interfaces, so that I 
> can 
> load and use "all classes that implement interface Foo".  
> 
> There are a couple of approaches that I've considered, all of which I dislike 
> for one reason or another.
> 
> 1) Magic file naming.  That is, any class that implements interface Foo lives 
> in a $something.Foo.inc file, or some similar pattern.  This has a number of 
> problems.  First, it means a huge number of file_exists() calls to determine 
> if a given potential class exists, and then disk hits to load those files.  
> While that information is possible to cache, it also means that we cannot 
> have 
> a class that implements two of the interfaces I'm interested in (a feature I 
> will need) because then it would have to live in two files, which is clearly 
> impossible.
> 
> 2) Reflection.  PHP makes it quite easy to get a list of all loaded classes, 
> and to get a list of all interfaces that a loaded class implements.  The 
> catch 
> there is "loaded".  Reflection only works once you've loaded the code file 
> into memory.  Once you've done so, you cannot unload it.  That means the code 
> is sitting there in memory wasting space.  Given the size of the code base in 
> question, that could easily blow out the process memory limit.  Even if we 
> cache that information we derive from reflection we still have to load it the 
> first time (or periodically when rebuilding the cache), which will blow the 
> memory limit.  The only alternative would be to have some sort of incremental 
> rebuild across a multi-request batch process, the complexity of which makes 
> my 
> skin crawl.
> 
> 3) Static analysis.  Instead of reflection, either tokenize or string parse 
> all files to determine what classes implement what interfaces and then cache 
> that information.  We are actually using this method now to locate classes, 
> and it works surprisingly well.  Because we never parse code into memory it 
> does not ever spike the memory usage.  However, it is impossible to determine 
> if a class implements a given interface by static analysis unless it declare 
> so itself with the implements keyword.  If it does so indirectly via 
> inheritance, either via the class or via the interface, it would not find it. 
>  
> That necessitates that any "detectable" classes must explicitly themselves 
> declare their interfaces, even if it is redundant to do so.  I don't like 
> that 
> approach, but it's the first one that strikes me as even viable.
> 
> 4) Explicit declaration.  In this approach we detect nothing and rely on the 
> plugin developer to do everything.  That is, they must provide somewhere 
> (either in code or a configuration file) an index of all classes they offer, 
> the interfaces they implement, and the file in which they live.  While this 
> makes the implementation easy, it is a huge burden on the plugin developer 
> and 
> I'm quite sure they'll forget to do so or get it wrong on a regular basis.
> 
> 5) Wave a wand and let the magic ponies figure it out.  I wish. :-)
> 
> Can anyone suggest a better alternative?  At the moment option 3 seems like 
> the most viable approach, but I'm not wild about the implied performance 
> impact nor the potentially redundant interface definitions it would require.
> 
> --Larry Garfield
> 

My suggestion, would be for #5. The magic ponies do wonderful work.

:)

Steve (TheStapler) Staples.


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



Re: [PHP] Array Symbol Suggestion

2011-01-12 Thread Steve Staples
On Wed, 2011-01-12 at 20:58 +0100, Per Jessen wrote:
> sono...@fannullone.us wrote:
> 
> > I'd like to make a suggestion for a change, or possibly an addition,
> > to the PHP language.
> > 
> > I'm learning PHP and have been very excited with what it can do in
> > relation to HTML.  But when I got to the part about arrays, I was
> > disappointed to see that they are designated with a $ the same as
> > other variables.  I was learning Perl before I switched, and it uses
> > the @ sign to designate an array.  That makes it a lot simpler to see
> > at a glance what is an array and what isn't - at least for beginners
> > like me.
> > 
> > Has there been any talk of adopting the @ sign for arrays in PHP?  Or
> > is that symbol used for something else that I haven't read about yet?
> > 
> > What is the proper channel for making suggestions like this?
> 
> The php-development mailing list.  What you're suggesting is a pretty
> fundamental change, don't be disappointed if it is not met with
> universal approval.
> 
> 
> -- 
> Per Jessen, Zürich (5.9°C)
> 
> 
not to mention, the @ symbol is a reserved character... an error control
character[1].   So I dont think that using that char, would work.  I
dont see using it's own character to work at all, but in your own code,
you can use your own naming conventions to denote what is an array, and
what is a variable.

Good luck with your suggestion, I personally wouldn't like it (as I am
so used to the way it is now), but that is just me.


Steve.

[1] http://ca.php.net/manual/en/language.operators.errorcontrol.php


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



Re: [PHP] HTML errors

2011-01-12 Thread Steve Staples
On Wed, 2011-01-12 at 13:40 +, Richard Quadling wrote:
> On 12 January 2011 13:20, Steve Staples  wrote:
> > Jim,
> >
> > Not to be a smart ass like Danial was (which was brilliantly written
> > though),  but you have your "example" formatted incorrectly.  You are
> > using commas instead of periods for concatenation, and it would have
> > thrown an error trying to run your example. :)
> >
> > # corrected:
> > echo "{$replace}";
> >
> > Steve Staples.
> 
> Steve,
> 
> The commas are not concatenation. They are separators for the echo construct.
> 
> I don't know the internals well enough, but ...
> 
> echo $a.$b.$c;
> 
> vs
> 
> echo $a, $b, $c;
> 
> On the surface, the first instance has to create a temporary variable
> holding the results of the concatenation before passing it to the echo
> construct.
> 
> In the second one, the string representations of each variable are
> added to the output buffer in order with no need to create a temp var
> first.
> 
> So, I think for large strings, using commas should be more efficient.
> 
> Richard.
> 

Well... I have been learned.  I had no idea about doing it that way, I
apologize to you, Jim.

I guess my PHP-fu is not as strong as I had thought?

Thank you Richard for pointing out this to me,  I may end up using this
method from now on.  I have just always concatenated everything as a
force of habit.

Steve Staples.


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



Re: [PHP] HTML errors

2011-01-12 Thread Steve Staples
On Tue, 2011-01-11 at 23:38 -0800, Jim Lucas wrote:
> On 1/11/2011 7:35 PM, David McGlone wrote:
> > Hi Everyone, I'm having a problem validating some links I have in a foreach.
> > Here is my code:
> >> "http://www.w3.org/TR/html4/loose.dtd";>
> >
> > my PHP code:
> > $categorys = array('home', 'services', 'gallery', 'about_us', 'contact_us',
> > 'testimonials');
> > foreach($categorys as $category){
> > $replace = str_replace("_", " ", $category);
> > echo "$replace";
> 
> Try this instead
> 
> echo '',$replace,'';
> 
> Jim Lucas
[snip]

Jim, 

Not to be a smart ass like Danial was (which was brilliantly written
though),  but you have your "example" formatted incorrectly.  You are
using commas instead of periods for concatenation, and it would have
thrown an error trying to run your example. :)

# corrected:
echo "{$replace}";

Steve Staples.


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



Re: [PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-11 Thread Steve Staples
On Tue, 2011-01-11 at 19:00 +, Ashley Sheridan wrote:
> On Tue, 2011-01-11 at 17:07 +0100, Michelle Konzack wrote:
> 
> > Hello Ashley Sheridan,
> > 
> > Am 2011-01-08 17:09:27, hacktest Du folgendes herunter:
> > > Also, each label is checked to ensure it doesn't run over 63 characters,
> > > and the whole thing isn't over 253 characters. Lastly, each label is
> > > checked to ensure it doesn't completely consist of digits.
> > 
> > Do you know, that there are MANY domains with numbers only?
> > 
> > Like <163.com> or <126.net> which are legal names.
> > 
> > Oh I should mention that I block ANY mails from this two  domains  since
> > chinese spamers use it excessively.
> > 
> > Thanks, Greetings and nice Day/Evening
> > Michelle Konzack
> > 
> 
> 
> I just based the code on the spec.
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 

my old (still kinda active but not really) business was/is called
990WEBS, and my URL is www.990webs.ca / www.990webs.com  is the url with
preceeding numerals an issue?  or is this only numerals only?

it also is my business number :P   990-9327 (WEBS)

TheStapler.ca is also my domain...   which is a my nickname (last name
is staples) ANYWAY... way off topic there, was just wodnering about
the "legality" of my 990webs domains... since i can't think of any other
domains that start with numbers off the top of my head?



-- 

Steve Staples
Web Application Developer
519.258.2333 x8414


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



Re: [PHP] First PHP job

2011-01-10 Thread Steve Staples
On Mon, 2011-01-10 at 16:21 -0500, Paul M Foster wrote:
> On Mon, Jan 10, 2011 at 12:02:51PM -0600, Donovan Brooke wrote:
> 
> > Hello!, .. will try to keep this short!
> > I've been a long time lurker but minimal poster. I made it a new years
> > resolution to finally take on PHP jobs and now have my first one (with a
> > completion date in a couple weeks!).
> > 
> > I've been scripting in another language for many years and do know a
> > thing or two.. but anticipate bothering the list a few times in the near
> > future... hope that is fine with you all.
> > 
> > I'm just about through Larry Ullman's "PHP" third edition that I started
> > a couple days ago. Good book to start with I think, even for folks who
> > have some kind of head start in Web Programming. I'm able to skim over
> > a lot of it.
> > 
> > I don't know how you all remain sane in dealing with quotes workarounds
> > in echo/print statements, having to open/close PHP parsing using  > ?> all the time, and having to deal with array's for just about
> > everything... but I'm sure I'll get used to it and it will become second
> > nature at some point. ;-)
> 
> That stuff's easy. I'm still trying to wrap my wits around the crazy way
> functions are handled in Javascript. I know of no other language which
> treats functions the way Javascript does.
> 
> Wait until you get to PHP's automatic casting of strings to numbers under
> the proper conditions. You'll scratch your head for quite a while once
> you hit that one.
> 
> Paul
> 
> -- 
> Paul M. Foster
> http://noferblatz.com
> 
> 
or the ($needle, $haystack) vs ($haystack, $needle)... i still get it
screwed up... thankfully php.net/{function_name} is easy to use :P



-- 

Steve Staples
Web Application Developer
519.258.2333 x8414


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



Re: [PHP] Re: Help: Validate Domain Name by Regular Express

2011-01-10 Thread Steve Staples
On Mon, 2011-01-10 at 11:39 -0500, tedd wrote:
> At 11:41 AM -0600 1/9/11, Donovan Brooke wrote:
> >Daniel Brown wrote:
> >>On Sun, Jan 9, 2011 at 11:58, tedd  wrote:
> >>>
> >>>For example --
> >>>
> >>>http://xn--19g.com
> >>>
> >>>-- is square-root dot com. In all browsers except Safari...
> >
> >but yes, the actual square root character appears in safari only.
> >
> >Interesting!
> >Donovan
> 
> Donovan:
> 
> Yes, Safari shows ALL Unicode Code-Points (i.e., 
> Characters) as they were intended.
> 
> Here's a couple of examples:
> 
> http://xn--u2g.com
> 
> http://xn--w4h.com
> 
> Interesting enough, the above characters cannot 
> be typed directly from a key-board, but are shown 
> correctly by a Browser.
> 
> However as I said, these can only be seen 
> correctly by the Safari browser. If you use IE, 
> then the URL's will be shown as PUNYCODE -- M$ 
> has a "better idea".
> 
> What I also find interesting is that there are no 
> restrictions for using IDNS names in email 
> addresses. However, even Apple's Mail program 
> restricts these to standard ASCII.
> 
> IOW, an email address of t...@ˆ.com is perfectly 
> legal (and will work), but no email application 
> will allow it.
> 
> Cheers,
> 
> tedd
> -- 
> ---
> http://sperling.com/
> 
on my Ubuntu box, I can copy and past the √ (square-root) character and
it displays properly in he address bar on google chome, but it
translates it back to the http://xn--19g.com and doesn't show anything
else (well... the page loads...LOL)

so did you register the xn--19q.com address knowing that it would
work/translate to √.com (square-root) ?

-- 

Steve Staples
Web Application Developer
519.258.2333 x8414


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



Re: [PHP] Newbie Question

2011-01-04 Thread Steve Staples
On Sun, 2011-01-02 at 21:10 -0500, David McGlone wrote:
> On Sunday, January 02, 2011 08:43:51 pm Larry Garfield wrote:
> > On Sunday, January 02, 2011 4:56:28 pm Adolfo Olivera wrote:
> > > Thanks for the replies. I'll just put a php on all my html containing
> > > php. A little of topic. Wich IDE are you guys using. I'm sort of in a
> > > catch twenty two here. I been alternating vim and dreamweaver. I'm
> > > trying to go 100% open source, but I really find dreamweaver easier to
> > > use so far.
> > 
> > I bounce between NetBeans and Eclipse, depending on which currently sucks
> > less.  I have yet to find a PHP IDE that doesn't suck; it's just degrees of
> > suckage. :-)
> 
> I use Kate. It doesn't suck at all because it doesn't try to do the coding 
> for 
> you :-)
> 
> -- 
> Blessings
> David M.
> 

Personally, for the longest time I used EditPlus++ on windows... used it
for about 4-5 years.  I knew it, I liked it... then i got a job where
they used ZEND (basically Eclipse yes?)  I started to like it once i got
the hang of it... but that job only lasted 3 weeks.  ANYWAY... I now use
Komodo (the free version) on my ubuntu workstation, and I love it... I
dont know how I managed before.

>From my observations and experience, it's all about personal
preferences.  If the one you use works for you, and you like it, then
use it.  I caught flack for some time when I told people I used EditPlus
++ for all my coding, but they just didn't know how to use the features.

Good luck with your coding!  and finding an IDE that works for you! (or
just a standard text editor like VI if you desire)

Steve


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



Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Steve Staples
On Wed, 2010-12-29 at 19:35 -0500, Daniel P. Brown wrote:
> On Wed, Dec 29, 2010 at 19:12, Ethan Rosenberg  wrote:
> > Dear List -
> >
> > Thank you for all your help in the past.
> >
> > Here is another one
> >
> > I would like to have a regex  which would validate that a telephone number
> > is in the format xxx-xxx-.
> 
> Congrats.  People in Hell would like ice water.  Now we all know
> that everyone wants something.  ;-P
> 
> Really, this isn't a PHP question, but rather one of regular
> expressions.  That said, something like this (untested) should work:
> 
>  
> $numbers = array(
> '123-456-7890',
> '2-654-06547',
> 'sf34-asdf-',
> 'abc-def-ghij',
> '555_555_',
> '000-000-',
> '8007396325',
> '241-555-2091',
> '800-555-0129',
> '900-976-739',
> '5352-342=452',
> '200-200-2000',
> );
> 
> foreach ($numbers as $n) {
> echo $n.(validate_phone($n) ? ' is ' : ' is not ').'a valid
> US/Canadian telephone number.'.PHP_EOL;
> }
> 
> 
> function validate_phone($number) {
> 
> if 
> (preg_match('/^[2-9]{1,}[0-9]{2,}\-[2-9]{1,}[0-9]{2,}\-[0-9]{4,}$/',trim($number)))
> {
> return true;
> }
> 
> return false;
> }
> ?>
> 
 THIS 
is the regex you want to use... it is the most complete one that has
been posted here, and it works.


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



Re: [PHP] Printing PDF

2010-12-29 Thread Steve Staples
On Wed, 2010-12-29 at 17:36 +, Richard Quadling wrote:
> On 29 December 2010 17:24, Steve Staples  wrote:
> > I can create the PDF's no problem, it is just how to send the created
> > pdf to the printer to print (it is a label printer, printing 3x5 labels)
> 
> What type of printer? Some printers require their own language and
> won't have any sort of PS, PCL, Esc/2 or GDI support.
> 
> I've worked with industrial printers which take strings of plain text
> to do page layout/description. You load template layouts into the
> printer and can use them.
> 
> Completely useless under normal circumstances.
> 
> If the printer is something like an Epson TM-L90 (thermal label
> printer with barcode support), then sending it a PDF isn't possible as
> it doesn't have PS support. It is much easier to send it the string of
> codes to have the barcode generated within the label.
> 
> On Windows, the drivers deal with all of this stuff. I've no idea on Unix.
> 
> The exact model of the printer would help.

I am currently unaware of the printer model, I am mostly working at
building a quote for them.   I suppose I should get the make/models of
what they are going to be using... and hope to hell that they are
compatible.  I do know that the printer has a custom formatted label, so
I hope that there is some drivers or wahtever availble to linux that i
can send the PDF to it to print... looks like this will be some trial
and error (err... research and development?).   The printing is the only
real trivial part of the whole thing.

maybe i should just make this all a greenscreen app, using windows .bat
scripting :)

thanks for all your insight, and once i get some more information, and
after googleing some, if i have MORE questions, i'll be back!!

hope everyone's holidays (if you celebrated any over the last few weeks)
were good, and the new year treats you well!

Steve


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



Re: [PHP] Printing PDF

2010-12-29 Thread Steve Staples
On Wed, 2010-12-29 at 11:49 -0500, Paul M Foster wrote:
> On Wed, Dec 29, 2010 at 10:36:30AM -0500, Steve Staples wrote:
> 
> > Hi!
> > 
> > I have an app that needs to be created, and it is all running on linux.
> > I am sure I shoulnd't really write it using PHP, but it's kinda what I
> > know, and am familiar with... so I am thinking about doing with PHP.
> > 
> > Anyway, for simplicity sake, i am creating a pdf through php (no
> > problems there) and it needs to be printed.  I've never done printing on
> > linux, but is there an easy way to send the pdf print job via command
> > lines to the local (or network) printer?
> > 
> > a friend of mine said "postscript" or "cups", but I am not familiar with
> > them, so I thought I would ask you GURU's here :)
> 
> The big problem here is that the site is on the server and the printer
> is on the client (most likely). Normally if you provide a link to a PDF
> in a webpage, the user/client downloads that PDF and the browser tries
> to open it in whatever program it thinks is good for that (like XPDF
> under Linux). The program in which it opens the PDF will have an option
> to print the file. I've been printing invoices, checks and reports out
> of my corporate system for years this way.
> 
> Paul
> 

actually... it is a localized app (it should be more of a C++ or Java
(or even Python), but I know PHP more weller than the others... and
there is also a few other things they want... so right now, it will be
on the local machine, but down the road, it will be on a "server", but
it is all on the local intranet, so the printers will be accessible.
this is not a "world" app, just internal.

I can create the PDF's no problem, it is just how to send the created
pdf to the printer to print (it is a label printer, printing 3x5 labels)


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



[PHP] Printing PDF

2010-12-29 Thread Steve Staples
Hi!

I have an app that needs to be created, and it is all running on linux.
I am sure I shoulnd't really write it using PHP, but it's kinda what I
know, and am familiar with... so I am thinking about doing with PHP.

Anyway, for simplicity sake, i am creating a pdf through php (no
problems there) and it needs to be printed.  I've never done printing on
linux, but is there an easy way to send the pdf print job via command
lines to the local (or network) printer?

a friend of mine said "postscript" or "cups", but I am not familiar with
them, so I thought I would ask you GURU's here :)

thank in advance!

Steve


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



Re: [PHP] Server response very poor again

2010-12-22 Thread Steve Staples
On Wed, 2010-12-22 at 12:49 -0500, Daniel P. Brown wrote:
> On Wed, Dec 22, 2010 at 12:17, Nicholas Kell  wrote:
> >
> > I am with Steve. Well, what I mean is, on this topic I am in agreement with 
> > Steve. My connection, etc. seems to be quite responsive.
> 
> Oh, that's what you mean!  Several of us were speaking about it
> the other day and thought you two were dating.
> 
> -- 
> 
> Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
> (866-) 725-4321
> http://www.parasane.net/
> 
whoa... wait a sec there...  i seem to recall this statement... ;)

"This seems to be the most likely, and considering how all messages
are permanently and independently archived and propagate throughout
the Internet, it might be a good reason not to go nuts in sending
unrelated and unintelligible messages of this nature in the future."

this could be one of those situations ;)


so now the whole world knows... GREAT!  this was supposed to be a
secret.


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



Re: [PHP] Server response very poor again

2010-12-22 Thread Steve Staples
On Wed, 2010-12-22 at 10:19 -0500, Al wrote:
> It was fixed about 3 or 4 weeks ago; but, has reverted to poor again.  Many 
> times outs etc.
> 
> Took me 4 tries to post this.
> 
> Al...
> 

Not trying to sound rude or prickish... but is it your ISP or connection
to the intertubes?   Or could it be an issue with your computer?

I've never had any problems posting, or retrieving mail from this list,
so I can't say/speak to a related issue.

Steve




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



Re: [PHP] Problems w/ goto

2010-12-17 Thread Steve Staples
On Fri, 2010-12-17 at 12:22 -0500, Robert Cummings wrote:
> On 10-12-17 12:08 PM, Steve Staples wrote:
> > On Fri, 2010-12-17 at 10:50 -0600, Jay Blanchard wrote:
> >> [snip]
> >> Thank you with your excellent help in the past.  Here is another
> >> puzzler
> >>
> >> I am trying to write a program that can have two(2) independent forms
> >> in one PHP file.  When I run the code below [from PHP - A Beginner's
> >> Guide], to which I have added a second form, it freezes.  Without the
> >> goto statements, it runs.  When it does run, it displays both forms
> >> on one Web screen. What I desire is for the first form to be
> >> displayed, the data entered and then the second form displayed.  In
> >> an actual, not test program like this one, the data in the second
> >> form would be dependent on the first form.
> >>
> >> What did I do wrong?
> >> [/snip]
> >>
> >> You used GOTO.
> >>
> >> In this case I would recommend using something like jQuery to 'hide' one
> >> form until the other form is complete. PHP has sent the output to the
> >> browser already, both forms are there and display when you remove the
> >> GOTO.
> >>
> >> GOTO should never be used like this.
> >>
> >> GOTO should never be used.
> >>
> >
> > Wow... that brought me back to 1990... using basic and batch files...
> > I honestly didn't even know that the GOTO was still in existence,
> > especially within PHP.
> >
> > I had to show the people in my office, and we all got a chuckle from teh
> > XKCD comic in the PHP documentation for GOTO
> > http://ca2.php.net/goto
> >
> > Steve
> 
> I was one of the people that argued in favour of GOTO on the Internals 
> list a few years ago. GOTO has a use, and a very good one at that. It is 
> by far the most efficient construct when creating parsers or other 
> similar types of logic flow. The demonized GOTO of the 80s was primarily 
> due to jumping to arbitrary points in the code, or in the case of basic 
> to arbitrary line numbers in the code which had little meaning for 
> future readers. When used properly within a well defined scope and with 
> well named labels, GOTO can be a superior choice. If you think GOTO 
> doesn't exist in many types of software, you need only grep for it in 
> the C source code for PHP, MySQL, and Apache.
> 
> Cheers,
> Rob.

Oh, i can see where it would be useful, i just hadn't realized it was
still in existence...   and the cartoon, was blown up, and put in my
cubical :)

RAWR!!


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



RE: [PHP] Problems w/ goto

2010-12-17 Thread Steve Staples
On Fri, 2010-12-17 at 10:50 -0600, Jay Blanchard wrote:
> [snip]
> Thank you with your excellent help in the past.  Here is another
> puzzler
> 
> I am trying to write a program that can have two(2) independent forms 
> in one PHP file.  When I run the code below [from PHP - A Beginner's 
> Guide], to which I have added a second form, it freezes.  Without the 
> goto statements, it runs.  When it does run, it displays both forms 
> on one Web screen. What I desire is for the first form to be 
> displayed, the data entered and then the second form displayed.  In 
> an actual, not test program like this one, the data in the second 
> form would be dependent on the first form.
> 
> What did I do wrong?
> [/snip]
> 
> You used GOTO. 
> 
> In this case I would recommend using something like jQuery to 'hide' one
> form until the other form is complete. PHP has sent the output to the
> browser already, both forms are there and display when you remove the
> GOTO. 
> 
> GOTO should never be used like this.
> 
> GOTO should never be used.
> 

Wow... that brought me back to 1990... using basic and batch files...
I honestly didn't even know that the GOTO was still in existence,
especially within PHP.

I had to show the people in my office, and we all got a chuckle from teh
XKCD comic in the PHP documentation for GOTO
http://ca2.php.net/goto

Steve


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



Re: [PHP] Re: Error Querying Database

2010-12-15 Thread Steve Staples
On Wed, 2010-12-15 at 15:41 -0500, Gary wrote:
> ""Gary""  wrote in message 
> news:81.d1.49824.33c09...@pb1.pair.com...
> >I cant seem to get this to connect.  This is to my local testing server, 
> >which is on, so we need not worry that I have posted the UN/PW.
> >
> > This is a duplicate of a script I have used countless times and it worked. 
> > The error message is 'Error querying database.'
> >
> > Some one point out the error of my ways?
> >
> > Gary
> >
> >
> > " method="post">
> > 
> > 
> > Name of Beer
> > 
> > 
> > 
> > 
> > Maker of Beer
> > 
> > 
> > 
> > 
> > Type of Beer
> > 
> >  Imported
> >  Domestic
> >  Craft
> >  Light
> > 
> > 
> > 
> > 
> > 
> > Sold in
> >  Singles > />
> >  Six Packs 
> >  Cans
> >  Bottles 
> >  Draft 
> > 
> > 
> > Size
> > 
> > 
> > Description > rows="5">
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >  > $beername = $_POST['beername'];
> > $manu = $_POST['manu'];
> > $type = $_POST['type'];
> > $singles = $_POST['singles'];
> > $six = $_POST['six'];
> > $can = $_POST['can'];
> > $bottles = $_POST['bottles'];
> > $tap = $_POST['tap'];
> > $size = $_POST['size'];
> > $desc = $_POST['desc'];
> > $ip= $_SERVER['REMOTE_ADDR'];
> >
> > $dbc = mysqli_connect('localhost','root','','rr')or die('Error connecting 
> > with MySQL Database');
> >
> > $query = "INSERT INTO beer (beername, manu, type, singles, six, can, 
> > bottles, tap, size, desc, ip )"." VALUES ('$beername', '$manu', '$type', 
> > '$singles', '$six', '$can', '$bottles', '$tap', '$size', '$desc', 
> > '$ip' )";
> >
> > $result = mysqli_query($dbc, $query)
> > or die('Error querying database.');
> >
> >
> > mysqli_close($dbc);
> >
> 
> 
> 
> I have tried something completely different, changed to mysql instead of 
> mysqli and I put it up on my remote server/database, and it is still not 
> behaving...
> 
> mysql_connect('server','un','pw') or die(mysql_error());
> mysql_select_db("db") or die(mysql_error());
> 
> mysql_query("INSERT INTO beer (beername, manu, type, singles, six, can, 
> bottles, tap, size, desc, ip)"."VALUES "."('$beername', '$manu', '$type', 
> '$singles', '$six', '$can', '$bottles', '$tap', '$size', '$desc', '$ip' )")
> or die(mysql_error());
> 
> echo "Data Inserted!";
> 
> I am now getting this error message, but it does not make sense
> 
> You have an error in your SQL syntax; check the manual that corresponds to 
> your MySQL server version for the right syntax to use near 'desc, ip)VALUES 
> ('', '', 'Imported', '', '', '', '', '', '', '', '68.80.24.11' at line 1
> 
> Does this mean I am getting closer to getting some actual work done today?
> 
> Thanks again
> 
> gary 


not sure if this is the issue or not, but you have reserved words in
your field names... try escaping them all in backticks...  and the way i
do things with variables inside "", i put them in {}... here is what i
mean:

mysql_query("INSERT INTO `beer` (`beername`, `manu`, `type`, `singles`,
`six`, `can`, `bottles`, `tap`, `size`, `desc`, `ip`)"."VALUES
"."('{$beername}', '{$manu}', '{$type}', '{$singles}', '{$six}',
'{$can}', '{$bottles}', '{$tap}', '{$size}', '{$desc', '{$ip}')");

Steve





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



Re: [PHP] Error Querying Database

2010-12-15 Thread Steve Staples
On Wed, 2010-12-15 at 14:34 -0500, Gary wrote:
> "Steve Staples"  wrote in message 
> news:1292440837.5460.8.ca...@webdev01...
> > On Wed, 2010-12-15 at 13:42 -0500, Gary wrote:
> >> I cant seem to get this to connect.  This is to my local testing server,
> >> which is on, so we need not worry that I have posted the UN/PW.
> >>
> >> This is a duplicate of a script I have used countless times and it 
> >> worked.
> >> The error message is 'Error querying database.'
> >>
> >> Some one point out the error of my ways?
> >>
> >> Gary
> >>
> >>
> >> " method="post">
> >> 
> >> 
> >> Name of Beer
> >> 
> >> 
> >> 
> >> 
> >> Maker of Beer
> >> 
> >> 
> >> 
> >> 
> >> Type of Beer
> >> 
> >>   Imported
> >>   Domestic
> >>   Craft
> >>   Light
> >> 
> >> 
> >> 
> >> 
> >> 
> >> Sold in
> >>  Singles >> />
> >>  Six Packs 
> >>  Cans
> >>  Bottles 
> >>  Draft 
> >> 
> >> 
> >> Size
> >> 
> >> 
> >> Description >> rows="5">
> >> 
> >> 
> >> 
> >> 
> >> 
> >> 
> >> 
> >>  >> $beername = $_POST['beername'];
> >> $manu = $_POST['manu'];
> >> $type = $_POST['type'];
> >> $singles = $_POST['singles'];
> >> $six = $_POST['six'];
> >> $can = $_POST['can'];
> >> $bottles = $_POST['bottles'];
> >> $tap = $_POST['tap'];
> >> $size = $_POST['size'];
> >> $desc = $_POST['desc'];
> >> $ip= $_SERVER['REMOTE_ADDR'];
> >>
> >> $dbc = mysqli_connect('localhost','root','','rr')or die('Error connecting
> >> with MySQL Database');
> >>
> >> $query = "INSERT INTO beer (beername, manu, type, singles, six, can,
> >> bottles, tap, size, desc, ip )"." VALUES ('$beername', '$manu', '$type',
> >> '$singles', '$six', '$can', '$bottles', '$tap', '$size', '$desc', 
> >> '$ip' )";
> >>
> >> $result = mysqli_query($dbc, $query)
> >> or die('Error querying database.');
> >>
> >>
> >> mysqli_close($dbc);
> >>
> >>
> >>
> >> -- 
> >> Gary
> >
> >
> > Read Ash's reply...   but basically, you're running the query with POST
> > variables, and inserting them on page display as well as on form submit.
> >
> > can you ensure that you can connect from the command line?
> >
> >
> > if you may take some criticism, you should rethink your database design,
> > as well as the page flow/design... you should either post the form to a
> > new page, or if it is back to itself, you should check to see that you
> > have in fact posted it before just blindly inserting into the database
> > (as currently, every time you view the page, you will insert into the
> > database, even if completely empty values).
> >
> 
> Steve
> 
> Thank you for your reply.
> 
> I did not see a reply from Ashley, but I would love to read it.
> 
> I always welcome criticism, however this form is for the owner of a bar 
> where he will inputing his list of beer that he sells.  The rest of the code 
> that is not there is I will have the list then echo to screen below the 
> form.  This is an internal list only, no customers will be seeing itif 
> that makes any difference to your suggestion.
> 
> On your one point
> 
> <<(as currently, every time you view the page, you will insert into the
> database, even if completely empty values).>>
> 
> Is this always the case when you process a form onto itself?  Or is there a 
> fix?
> 
> I did just create a new page, inserted the script onto it, and got the same 
> error message.
> 
> Again, thank you for your help.
> 
> Gary 


Gary

the line:


is the submit part... if you encapsulate the DB part of the code,
within:
if($_POST['submit'] == 'Submit')
{
# do db stuff in here and value sanitizing
}

basically, what that does is the submit button is name $_POST['submit']
and has the value "Submit" (the 'value' of the button) which will not be
set, until you submit the form.   Personally, I do it another way, but
but is how most people check to see if a form is submitted (i think?)

but it seems as if your issue stems from the lack of being able to
connect to the database itself, so either your login credentials are
wrong, or you dont have the mysqli connector enabled with your php in
your development box.

check your phpinfo() to ensure it is enabled.

Steve


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



Re: [PHP] Error Querying Database

2010-12-15 Thread Steve Staples
On Wed, 2010-12-15 at 13:42 -0500, Gary wrote:
> I cant seem to get this to connect.  This is to my local testing server, 
> which is on, so we need not worry that I have posted the UN/PW.
> 
> This is a duplicate of a script I have used countless times and it worked. 
> The error message is 'Error querying database.'
> 
> Some one point out the error of my ways?
> 
> Gary
> 
> 
> " method="post">
> 
> 
> Name of Beer
> 
> 
> 
> 
> Maker of Beer
> 
> 
> 
> 
> Type of Beer
> 
>   Imported
>   Domestic
>   Craft
>   Light
> 
> 
> 
> 
> 
> Sold in
>  Singles
>  Six Packs 
>  Cans
>  Bottles 
>  Draft 
> 
> 
> Size
> 
> 
> Description rows="5">
> 
> 
> 
> 
> 
> 
> 
>  $beername = $_POST['beername'];
> $manu = $_POST['manu'];
> $type = $_POST['type'];
> $singles = $_POST['singles'];
> $six = $_POST['six'];
> $can = $_POST['can'];
> $bottles = $_POST['bottles'];
> $tap = $_POST['tap'];
> $size = $_POST['size'];
> $desc = $_POST['desc'];
> $ip= $_SERVER['REMOTE_ADDR'];
> 
> $dbc = mysqli_connect('localhost','root','','rr')or die('Error connecting 
> with MySQL Database');
> 
> $query = "INSERT INTO beer (beername, manu, type, singles, six, can, 
> bottles, tap, size, desc, ip )"." VALUES ('$beername', '$manu', '$type', 
> '$singles', '$six', '$can', '$bottles', '$tap', '$size', '$desc', '$ip' )";
> 
> $result = mysqli_query($dbc, $query)
> or die('Error querying database.');
> 
> 
> mysqli_close($dbc);
> 
> 
> 
> -- 
> Gary 


Read Ash's reply...   but basically, you're running the query with POST
variables, and inserting them on page display as well as on form submit.

can you ensure that you can connect from the command line?


if you may take some criticism, you should rethink your database design,
as well as the page flow/design... you should either post the form to a
new page, or if it is back to itself, you should check to see that you
have in fact posted it before just blindly inserting into the database
(as currently, every time you view the page, you will insert into the
database, even if completely empty values).



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



Re: [PHP] sending emails

2010-12-09 Thread Steve Staples
On Thu, 2010-12-09 at 19:06 +, Ashley Sheridan wrote:
> On Thu, 2010-12-09 at 14:03 -0500, TR Shaw wrote:
> 
> > On Dec 9, 2010, at 1:36 PM, Marc Fromm wrote:
> > 
> > > We have web forms that send the user an email confirmation after 
> > > submission, like most forms do.
> > > The emails are being delivered to the users' junk folder. The main campus 
> > > IT staff claim it is because our server is sending the emails.
> > > The campus is using Microsoft exchange servers. I am using Red Hat Linux, 
> > > sendmail, and PHP. Is there a way to give php the exchange server's ip 
> > > address and have the emails from my php forms be sent from the exchange 
> > > server?
> > 
> > 
> > Marc
> > 
> > Use phpmailer.
> > 
> > Tom
> 
> 
> Would that stop the email being seen as spam? Depending on the root
> issue, probably unlikely, as there are countless reasons an email could
> be seen as spam, the majority of which wouldn't be fixed by something
> like phpmailer.
> 

If it were me, I'd use something like PHPMailer with SMTP
Authentication, which then the email comes from the "MailServer" rather
than the "WebServer" if they are 2 separate machines.

That COULD solve the issue there, but as Ash said, if it has "spammy"
words in it, it wouldn't make any difference then.

Try using the "-f" flag with the PHP mail(), and if that doesn't work,
then try a 3rd party class such as PEAR::Mail, or PHPMailer.

Steve



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



Re: Re[2]: [PHP] Redirect output to a file on the web server

2010-12-06 Thread Steve Staples
On Mon, 2010-12-06 at 20:31 +0200, Andre Polykanine wrote:
> Hello Steve,
> 
> Btw, the built-in mail() function is to slow to send such amount
> of mail. Consider using SMTP (if you don't).
> -- 
> With best regards from Ukraine,
> Andre
> Skype: Francophile
> Twitter: http://twitter.com/m_elensule
> Facebook: http://facebook.com/menelion
> 
> - Original message -
> From: Steve Staples 
> To: php-general@lists.php.net 
> Date: Monday, December 6, 2010, 6:41:34 PM
> Subject: [PHP] Redirect output to a file on the web server
> 
> On Mon, 2010-12-06 at 16:19 +, Richard Quadling wrote:
> > On 6 December 2010 15:46, Ferdi  wrote:
> > > On 6 December 2010 20:47, Steve Staples  wrote:
> > >
> > >> On Mon, 2010-12-06 at 20:29 +0530, Ferdi wrote:
> > >> > Greetings List members,
> > >> >
> > >> > I have a script that takes quite a while to run, one or two hours, I 
> > >> > wish
> > >> to
> > >> > redirect the normal php output to a file on the webserver itself. I 
> > >> > don't
> > >> > mind if in the process, the browser displays a blank page. The reason I
> > >> want
> > >> > to do this is that if the script crashes or the browser Is closed by
> > >> > mistake, I have absolutely no record of where the script stopped 
> > >> > running.
> > >> >
> > >> > I could use code like below
> > >> > At the beginning of the script:
> > >> > ob_start();
> > >> >
> > >> > At the end of the script:
> > >> > $page = ob_get_contents();
> > >> > ob_end_flush();
> > >> > $fp = fopen("output.html","w");
> > >> > fwrite($fp,$page);
> > >> > fclose($fp);
> > >> >
> > >> > However, I see some problems with this:
> > >> > I'm not too sure of the size of the output. It may balloon to over the
> > >> > buffering limit (in PHP? Apache?) and then what happens?
> > >> > Secondly, if the script crashes before the end, I won't get any output.
> > >> > Finally, I am using a library in the script that outputs status and 
> > >> > error
> > >> > messages of its own. So, if I manually opened a file and used fwrite()
> > >> > alongside echo for my messages, I would lose out on those messages.
> > >> >
> > >> > Anybody has any pointers on how you could send the output not only to a
> > >> > browser, but also to a file on the webserver? If not, at least to a 
> > >> > file?
> > >> >
> > >> > Thanks and regards,
> > >> > Ferdi
> > >>
> > >> Just curious, but if it takes that long to run, why are you running it
> > >> from a browser?  why not run it from the commandline, that way you dont
> > >> have to change your php.ini for the webserver (increasing the timeout,
> > >> memory limits, etc etc... you can change those for the CLI only?
> > >>
> > >> 2 hours is a long time to "hope" that the browser doesn't close, or
> > >> connectivity doesn't get interupted for even 1 microsecond...
> > >>
> > >> if the script has "breaks" in it, where it starts to do something else,
> > >> you can put in an email to yourself, to say "hey, we're HERE now"
> > >>
> > >> but i would look into running it from the CLI over the webserver, you
> > >> would be less likely to run into issues on something that takes that
> > >> amount of time to run.
> > >>
> > >> If you needed the output to be displayed on a webpage, you can write the
> > >> progress to a file, and then have a php webpage that reads the file, and
> > >> using ajax or whatever, refresh the content.
> > >>
> > >> good luck in your script, and if you still run it from the browser, and
> > >> need to output to a file, then i would continually be writing content to
> > >> that file, every time you do soemthing, or start another part of the
> > >> script so you know EXACTLY where you are, at all times...
> > >>
> > >> Steve
> > >>
> > >
> > > Hi Steve,
> > >
> > > Thanks for the tips. To answer your queries, I don't mind using CLI. How 
> > > do
> > > I then ensure the messages, e

Re: [PHP] Redirect output to a file on the web server

2010-12-06 Thread Steve Staples
On Mon, 2010-12-06 at 16:19 +, Richard Quadling wrote:
> On 6 December 2010 15:46, Ferdi  wrote:
> > On 6 December 2010 20:47, Steve Staples  wrote:
> >
> >> On Mon, 2010-12-06 at 20:29 +0530, Ferdi wrote:
> >> > Greetings List members,
> >> >
> >> > I have a script that takes quite a while to run, one or two hours, I wish
> >> to
> >> > redirect the normal php output to a file on the webserver itself. I don't
> >> > mind if in the process, the browser displays a blank page. The reason I
> >> want
> >> > to do this is that if the script crashes or the browser Is closed by
> >> > mistake, I have absolutely no record of where the script stopped running.
> >> >
> >> > I could use code like below
> >> > At the beginning of the script:
> >> > ob_start();
> >> >
> >> > At the end of the script:
> >> > $page = ob_get_contents();
> >> > ob_end_flush();
> >> > $fp = fopen("output.html","w");
> >> > fwrite($fp,$page);
> >> > fclose($fp);
> >> >
> >> > However, I see some problems with this:
> >> > I'm not too sure of the size of the output. It may balloon to over the
> >> > buffering limit (in PHP? Apache?) and then what happens?
> >> > Secondly, if the script crashes before the end, I won't get any output.
> >> > Finally, I am using a library in the script that outputs status and error
> >> > messages of its own. So, if I manually opened a file and used fwrite()
> >> > alongside echo for my messages, I would lose out on those messages.
> >> >
> >> > Anybody has any pointers on how you could send the output not only to a
> >> > browser, but also to a file on the webserver? If not, at least to a file?
> >> >
> >> > Thanks and regards,
> >> > Ferdi
> >>
> >> Just curious, but if it takes that long to run, why are you running it
> >> from a browser?  why not run it from the commandline, that way you dont
> >> have to change your php.ini for the webserver (increasing the timeout,
> >> memory limits, etc etc... you can change those for the CLI only?
> >>
> >> 2 hours is a long time to "hope" that the browser doesn't close, or
> >> connectivity doesn't get interupted for even 1 microsecond...
> >>
> >> if the script has "breaks" in it, where it starts to do something else,
> >> you can put in an email to yourself, to say "hey, we're HERE now"
> >>
> >> but i would look into running it from the CLI over the webserver, you
> >> would be less likely to run into issues on something that takes that
> >> amount of time to run.
> >>
> >> If you needed the output to be displayed on a webpage, you can write the
> >> progress to a file, and then have a php webpage that reads the file, and
> >> using ajax or whatever, refresh the content.
> >>
> >> good luck in your script, and if you still run it from the browser, and
> >> need to output to a file, then i would continually be writing content to
> >> that file, every time you do soemthing, or start another part of the
> >> script so you know EXACTLY where you are, at all times...
> >>
> >> Steve
> >>
> >
> > Hi Steve,
> >
> > Thanks for the tips. To answer your queries, I don't mind using CLI. How do
> > I then ensure the messages, error or otherwise, output by the library I use,
> > show up in the file I'm outputting to? Please note that I only make calls to
> > the functions and object methods from this library and error or success
> > messages are probably echo'd by the code from the library.
> >
> > I believe some context is in order. I am actually sending an email to a
> > large number of our customers (around 10,000), each with the customer's
> > name.
> >
> > My script does output a simple success or failure message. The library
> > outputs more technical info. All I would like to know is which email got
> > sent and which one failed. As you point out, I could write the success /
> > failure messages to a file, but, I would also like to capture the messages
> > output by the library.
> >
> > Thanks and regards,
> > Ferdi
> >
> 
> I would log the success/failure with the data (assuming it is coming from a 
> DB).
> 
> If not, you could use a simple file_put_contents($filename, date('r')
> . $text . PHP_EOL, FILE_APPEND);
> 
> That would append 1 line of text at a time to the file. Using tail on
> that file would show you the last work done (and when it was done).
> 
> 
> -- 
> Richard Quadling
> Twitter : EE : Zend
> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
> 

if you're using a linux based server, you could log (like Richard said)
each success / failure to the file, or each to its own success / failure
file, and then if you want to watch the, you could just do a tail -f of
the file, to see what is it doing (sometimes having it scroll is pretty
handy i find)... 

it wouldn't be hard to write a web-based 'tail -f' page, so you can
track the progress from anywhere you wanted :)




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



Re: [PHP] Redirect output to a file on the web server

2010-12-06 Thread Steve Staples
On Mon, 2010-12-06 at 20:29 +0530, Ferdi wrote:
> Greetings List members,
> 
> I have a script that takes quite a while to run, one or two hours, I wish to
> redirect the normal php output to a file on the webserver itself. I don't
> mind if in the process, the browser displays a blank page. The reason I want
> to do this is that if the script crashes or the browser Is closed by
> mistake, I have absolutely no record of where the script stopped running.
> 
> I could use code like below
> At the beginning of the script:
> ob_start();
> 
> At the end of the script:
> $page = ob_get_contents();
> ob_end_flush();
> $fp = fopen("output.html","w");
> fwrite($fp,$page);
> fclose($fp);
> 
> However, I see some problems with this:
> I'm not too sure of the size of the output. It may balloon to over the
> buffering limit (in PHP? Apache?) and then what happens?
> Secondly, if the script crashes before the end, I won't get any output.
> Finally, I am using a library in the script that outputs status and error
> messages of its own. So, if I manually opened a file and used fwrite()
> alongside echo for my messages, I would lose out on those messages.
> 
> Anybody has any pointers on how you could send the output not only to a
> browser, but also to a file on the webserver? If not, at least to a file?
> 
> Thanks and regards,
> Ferdi

Just curious, but if it takes that long to run, why are you running it
from a browser?  why not run it from the commandline, that way you dont
have to change your php.ini for the webserver (increasing the timeout,
memory limits, etc etc... you can change those for the CLI only?

2 hours is a long time to "hope" that the browser doesn't close, or
connectivity doesn't get interupted for even 1 microsecond...

if the script has "breaks" in it, where it starts to do something else,
you can put in an email to yourself, to say "hey, we're HERE now"

but i would look into running it from the CLI over the webserver, you
would be less likely to run into issues on something that takes that
amount of time to run.   

If you needed the output to be displayed on a webpage, you can write the
progress to a file, and then have a php webpage that reads the file, and
using ajax or whatever, refresh the content.

good luck in your script, and if you still run it from the browser, and
need to output to a file, then i would continually be writing content to
that file, every time you do soemthing, or start another part of the
script so you know EXACTLY where you are, at all times... 

Steve



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



Re: [PHP] desire your recommendation for our specific HTML -> PDF project

2010-12-06 Thread Steve Staples
On Fri, 2010-12-03 at 18:11 -0500, Govinda wrote:
> Hi all
> 
> I have a question which I see from googling has been discussed at  
> length.. but I want to know what you would recommend based on our  
> particular needs.  I want to be on the right track before I find out a- 
> week-of-work later that I chose the wrong tool (a tool which works,  
> but whose peculiarity, in the end, would rule it out for our project).
> 
> We have a dynamic HTML page that displays 30 "address labels" within  
> the dimensions of one single US-letter-size document.  We want the  
> user to be able to print the single letter-sized page and have the  
> content line up perfectly (as it does in the browser) for the Avery  
> address label (printed) sticker paper which they will use to then peel  
> the 30 stickers and affix to physical product.  The HTML page is ~  
> 200k worth of HTML (s and s), text, gifs, jpgs, a barcode  
> PNG graphic, and heavy use of exacting CSS - CSS2 as well as a touch  
> of CSS3 (CSS3 property transform), i.e. this:
> /* --- for firefox, safari, chrome, etc. --- */
> -webkit-transform: rotate(90deg);
> -moz-transform: rotate(90deg);
> /* --- for ie --- */
> filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
> 
> ...which I use to rotate (90 degrees) a barcode which I grab off of  
> this site/service:
> http://www.barcodesinc.com/generator/index.php
> 
> We could drop that barcode PNG/service only if I could easily replace  
> it with another... and the barcode must be rotated 90 degrees - to  
> thus fit in its tiny (vertically-oriented) alloted slot on each of the  
> 30 "address label cells".
> 
> A thread on stackOverflow has people making recommendations all over  
> the map.. as I would expect - our needs and experiences are all over  
> the map.
> 
> - I wish we had budget for the server version of PrinceXML ;-) ... but  
> no luck.
> - I have never used any PHP libraries like FPDF or TCPDF, but am  
> concerned about speed; corporate users (on various browsers) will need  
> the pdf in real time.  They may be patient and wait for the final PDF  
> if keep the solution free.. but if it takes minutes to generate, that  
> is a minus point.
> Also I am not sure how good these are for HTML -> PDF (as opposed to  
> straight PDF from scratch).. plus not sure how good is the CSS  
> support.  Our page is a bit of an HTML/CSS kludge.
> - I have used the command-line tools HTMLDOC and wkpdf, but the former  
> lacked the CSS I need now, and the latter introduces margin that kills  
> it for exact address-label formatting (plus this project is on Linux).
> 
> My PHP skills are not super strong yet.. but I am willing to do  
> whatever it takes to pull any solution together.
> In case you have any familiarity with any PDF generation tools that  
> you feel would fit the need here, then *please advise*!
> 
> Thanks!
> -Govinda
> 
> 
> 
> Govinda
> govinda(DOT)webdnatalk(AT)gmail(DOT)com
> 

Personally, I use FPDF [1] to generate PDF's on the fly.  It has a lot
of "addons" that people have created, and some of those, are barcodes.
use it to generate shipping/packing labels for a client, and it creates
about 1000+ at a time, each containing 5 code128, and 1 QR code (on the
same label).  I've used the FPDF with the rendering that includes the
image from memory (as i have another app that creates all the barcodes
in memory).

Anyway, I would look into that if pdf is the way you're going.  There is
also html2pdf, but if you're looking for exact specifications, and
sizes, then I wouldn't personally use pure CSS, i would create my own
PDF.  my shipping labels take < 20 seconds to create a 1500page pdf,
with all those barcodes, so creating a 30 label page, i can't see taking
more than 1 second to do.

just my $0.02

Steve


[1] http://www.fpdf.org


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



Re: [PHP] code quest

2010-12-02 Thread Steve Staples
On Thu, 2010-12-02 at 10:07 -0500, Daniel P. Brown wrote:
> On Wed, Dec 1, 2010 at 23:13, Kirk Bailey  wrote:
> [snip!]
> >
> > Can this be improved to exclude anything with a '.' or a '-' in it's name?
> > This will exclude the smileys and cgi-bin and such. If it can be persuaded
> > to read a 1 line description from each subdirectory it could then use THAT
> > as the text in the link, instead of the name. This could be useful in many
> > settings.
> 
> Sure.  Change:
> 
> if (is_dir($d) && $d != '.' && $d != '..') {
> 
> To:
> 
> if (is_dir($d) && !preg_match('/[\.\-]/',$d)) {
> 
> Keep in mind, though, that the change will no longer show anything
> that matches the below either:
> 
> example.directory
> example-directory
> special-images
> css.files
> 
> In other words, you may instead want to explicitly state which
> directories to omit, and then drop anything that begins with a dot as
> well (hidden directories on *NIX-like boxes) like so:
> 
>  $excludes[] = 'cgi-bin';
> $excludes[] = 'vti_cnf';
> $excludes[] = 'private';
> $excludes[] = 'thumbnail';
> 
> $ls = scandir(dirname(__FILE__));
> foreach ($ls as $d) {
>   if (is_dir($d) && !preg_match('/^\./',basename($d)) &&
> !in_array(basename($d),$excludes)) {
>   echo ''.$d.''.PHP_EOL;
>   }
> }
> ?>
> 
> -- 
> 
> Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
> (866-) 725-4321
> http://www.parasane.net/
> 

damn you Daniel... I was just about to reply with almost the EXACT same
answer!!!

I think the last example would probably be the best one to use, that way
you can still have some directories with the . or - or even the _ in the
names, and still be able to display them.

Steve

ps thanks for saving me type it all out Daniel :)


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



Re: [PHP] $_POST issues

2010-12-01 Thread Steve Staples
On Wed, 2010-12-01 at 20:18 +0400, Nadim Attari wrote:
> On 12/01/2010 07:18 PM, Jay Blanchard wrote:
> > [snip]
> >>> If I just put only this piece of code:
> >>>
> >>>  >>>  var_dump($_POST);
> >>> ?>
> >>>
> >>> i get nothing.
> > [/snip]
> >
> > Where are you putting this var_dump?
> >
> >
> 
> That's the only code on the page. Otherwise, the other codes - header(), 
> print, etc. are on the page.
> 
> nadim
> 

if i follow correctly, your form submits via:


then you redirect to the page.php, and it puts the $_POST variables into
the url string... and that works fine.

and now, you're trying to get the variables from the page.php, using the
$_POST method?   wouldn't you want to be checking the $_GET on this
page, as they would be coming in from the url string?


Steve


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



Re: [PHP] PHP shows nothing

2010-11-30 Thread Steve Staples
On Tue, 2010-11-30 at 22:26 +0330, Mohammad Taghi Khalifeh wrote:
> Hi there,
> I have a package written in pure PHP, some .php files that refer to others
> via require_once(''),
> but when I try to see package's contents via a browser, the pacakge just
> shows nothing: a blank page.
> I've activated all log levels, and it seems that php doesn't encounter any
> problem.
> I'm using PHP 5.3.3 and apache httpd 2.2.
> FYI, I'm new to PHP and this mailing list :)
> I would appreciate if someone could help me.
> 
> 
> Best
> Mohammad


Pacakges, as in the classes?   if you're trying to view a class file,
then yes, you won't (err... usually shouldn't) see anything.  If you
were to go to the main page that actually builds the pages, utilizes the
classes and stuff, then you should see something.

There is also another potential issue.  There was a godaddy server that
i used to use, i switched over a site to their servers, and all of a
sudden, the site didn't show up.   The issue was that there were either
trailing spaces after the ?>, or there was no closing ?> for the php
file.  

Make sure that the page you're trying to pull up has some kind of echo,
or at least output of any type... if that fails, then you can try
adding:
error_reporting(E_ALL);
to the top of the page you're trying to view, to see if there are any
errors it is generating.

just some things to think/check...

good luck, and Welcome to PHP!!!

Steve


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



Re: [PHP] Poor newsgroup server performance

2010-11-29 Thread Steve Staples
On Mon, 2010-11-29 at 13:01 -0500, Daniel Brown wrote:
> On Mon, Nov 29, 2010 at 12:52, Al  wrote:
> > On 11/29/2010 11:03 AM, Daniel P. Brown wrote:
> >>
> >> Via what news server(s), Al?
> >>
> >
> > news.php.net
> 
> Okay, figured as much.  I had mentioned some time ago that I would
> look into adding an NNTP-only mirror of news.php.net because of those
> issues, so I'll get to work on that this week.  I'm working to revamp
> some of the php.net infrastructure as it is, so that won't be too much
> additional work.
> 
> (Famous last words)
> 
> -- 
> 
> Network Infrastructure Manager
> Documentation, Webmaster Teams
> http://www.php.net/
> 
i remember telling a client that..  oh yeah, you're just moving cpanel
accounts to a new cpanel server... shoulnd't take more than a few hours
to copy it over, and dns to propagate..   36 hours later, and no
sleep... i got it done... barely in time for his clients to log back in
at 8am... that was a stressful weekend... 

steve


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



Re: [PHP] MySQL database export to Excel

2010-11-26 Thread Steve Staples
On Fri, 2010-11-26 at 15:21 +0200, Sotiris Katsaniotis wrote:
> Greetings fellow PHP developers!
> 
> I am looking of a relatively simple way to export a whole database into 
> an Excel file. I have several methods to export tables to Excel files 
> but unfortunately I have failed to export a whole database!
> 
> Can someone be so kind to point me in the right direction?
> 
> Thanks a lot!
> 
DISCLAIMER
  This is untested, and just off the top of my pointy head, do some
research, and know how much strain this COULD put on your system.
/DISCLAIMER

there are MANY MySQL commands that you can use, and combine them into 1
script, and then export them into excel, using multiple pages with
something like this:

http://www.codediesel.com/php/creating-excel-documents-in-php/

example mysql queries:
SHOW DATABASES; -- gets a lits of all the databases (skip MySQL and
information_schema)

SHOW TABLES FROM {tablename};  -- gets all the tables in a specific
database


SELECT column_name FROM information_schema.columns WHERE
table_name='{tablename}' AND table_schema='{databasename}'; -- gets you
a list of all the column headers (there are other ways you can avoid
doing this, but this works)


SELECT * FROM {databasename}.{tablename}; -- gets all the rows from a
table in the database


if you were to create a script, and providing your scipt has enough
"max_execution_time", and "memory_limit" (should prolly be done from the
CLI)  you can prolly get it done... 

and yeah, this is a pointer to how it *COULD* be done, but it's not the
only way, nor is it prolly the best either.

Good Luck, and if you need more MySQL related questions answered, try
the my...@lists.mysql.com mailing list.  they are really good over
there.


Steve



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



Re: [PHP] is this thing on??

2010-11-23 Thread Steve Staples
On Tue, 2010-11-23 at 20:55 +0100, Peter Lind wrote:
> On 23 November 2010 20:52, Steve Staples  wrote:
> > tap tap tap... testing testing... 1, 2, 3
> >
> > Hello?No activity since yesterday at like 6pm EST... am i not
> > getting messages, or has there not been any activity?
> >
> > Just curious... carry on about your business... :P
> >
> 
> http://news.php.net/php.general - please, next time, don't spam tons of 
> people.
> 
> -- 
> 
> WWW: plphp.dk / plind.dk
> LinkedIn: plind
> BeWelcome/Couchsurfing: Fake51
> Twitter: kafe15
> 
> 

My apologies to you, and to everyone else on the list.

Peter,  I didn't know that page/site existed.  I will check there from
now on when there seems to be a lull in messages (usually seems to be at
least a few every day).

Steve.


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



[PHP] is this thing on??

2010-11-23 Thread Steve Staples
tap tap tap... testing testing... 1, 2, 3

Hello?No activity since yesterday at like 6pm EST... am i not
getting messages, or has there not been any activity?

Just curious... carry on about your business... :P


Steve


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



Re: [PHP] Procedural Autoloader?

2010-11-23 Thread Steve Staples
On Mon, 2010-11-22 at 15:26 -0800, David Harkness wrote:
> On Mon, Nov 22, 2010 at 3:05 PM, Richard Quadling wrote:
> 
> > Would it be overboard to use a namespace? Aren't namespaces handled by
> > the autoloader? If not autoload(), how about spl_autoloading?
> >
> 
> Autoloading is for determining the path and filename where a named item is
> defined. Namespaces only give you the path. Even with namespaces, you'd
> still need to require the files that contain the functions. Plus you'd also
> need to use the namespace everywhere you use the function because you cannot
> alias functions--only classes. :(
> 
> David

can I maybe make a suggestion?   If I have been following this
correctly, it seems as if the OP has a bunch of "non specific class"
functions, that he doesn't want in 1 big gigantic file, and include that
one huge file ALL the time...   what if the OP put some naming
conventions into the function names, and then did some kind of error
trapping on the function calls, and if the function does not exist (yet)
then call some other function to rip apart the name of the function that
was called, and then include that "file"?   I am just offering some kind
of hypothetical solution, and off the top of my head can't think exactly
how it could be accomplished.

you could always wrap all your "non class"/"custom" functions in a
function...


function checkFunction($file, $function, $args)
{
  $filename = "./function_{$file}.php";
  if(file_exists($filename))
  {
include_once($filename);
  }
  else
  {
return 'function file not exist';
  }

  if(function_exists($file .'_'. $function))
  {
return call_user_func_array($file .'_'. $function, $args);
  }
  else
  {
return "Function: {$function}() does not exist";
  }

  return 'Fire and brimstone coming down from the skies! Rivers and seas
boiling! Forty years of darkness! Earthquakes, volcanoes... The dead
rising from the grave! Human sacrifice, dogs and cats living together...
mass hysteria!!';
}

$temp = checkFunction('test', 'somefunction', array('var1', 'var2'));

then create the functions file- functions_test.php that holds all the
functions you would "group" together... 

function test_somefunction($var1, $var2, $var3 = '')
{
return $var1 .' - '. $var2;
}


This is just a thought, and yeah, it would require some rewrites, and
some forward thinking...  but could solve your issue... maybe

steve


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



Re: [PHP] Wordpress Page: How to add pagination?

2010-11-22 Thread Steve Staples
> perhaps you could just google wordpress pagination
> 
> http://www.google.ca/#sclient=psy&hl=en&q=wordpress+pagination&aq=1&aqi=g4g-o1&aql=&oq=&gs_rfai=&pbx=1&fp=88df74f51cdeec4c
> 
> -- 
> 
> Bastien
> 
> Cat, the other other white meat
> 

Here, this may help:
http://lmgt4u.com/?q=wordpress+pagination


Steve


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



RE: [PHP] smary assign var

2010-11-19 Thread Steve Staples
On Thu, 2010-11-18 at 22:08 -0500, ad...@buskirkgraphics.com wrote:
> Taking what I understand from C, I think you are looking for this equivalent
> in php.
> 
> $product = array('reduction'=>'4','price_without_reduction'=>'22','price
> '=>'18')
> $yuzde = $product['reduction']*100;
> $yuzde = round($yuzde / $product['price_without_reduction']);
> 
> 
> Echo $yuzde;
> This is no reason to truncate or escape html since the strings do not
> contain them.
> I might suggest you read 
> http://www.php.net/manual/en/function.round.php
> for a better understand the precision options with round.
> 
> 
> 
> 
> Richard L. Buskirk
> 
> 
> -Original Message-
> From: Tontonq Tontonq [mailto:root...@gmail.com] 
> Sent: Thursday, November 18, 2010 6:59 PM
> To: PHP General Mailing List
> Subject: [PHP] smary assign var
> 
> hi guys
> i have 2x sub value
> 
> [reduction] => 4
> [price_without_reduction] => 22
> [price] => 18
> 
> and i want to calculate how much i did reduction percent
> 
> {assign var='yuzde' value=$product.reduction*100}
> {assign var='yuzde' value=$yuzde/$product.price_without_reduction}
> 
> -{$yuzde|truncate:3:''|escape:'htmlall':'UTF-8'}%
> when i escape only 3 chars i see some products returns
> like "-18.%"
> when i escape only 2 chars
> i get e result like
> "-5.%"
> 
> so is there a way to round that value to int not float?
> 
> 

would something like this should work... just pieced it from the smarty
site:
http://www.smarty.net/docsv2/en/language.function.math

{math assign='yuzde' equation="x + y" x=$height y=$width format="%.2f"}

Steve

-- 

Steve Staples
Web Application Developer
519.258.2333 x8414


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



Re: FW: [PHP] Why the PEAR hate?

2010-11-16 Thread Steve Staples
On Tue, 2010-11-16 at 10:25 -0700, Hansen, Mike wrote:
> > -Original Message-
> > From: Hansen, Mike 
> > Sent: Tuesday, November 16, 2010 10:24 AM
> > To: 'Daniel Brown'
> > Subject: RE: [PHP] Why the PEAR hate?
> > 
> > > -Original Message-
> > > From: paras...@gmail.com [mailto:paras...@gmail.com] On 
> > > Behalf Of Daniel Brown
> > > 
> > > Some of the PEAR stuff is older and unmaintained, which is one
> > > possible reason.  More likely is that folks often expect PEAR to be
> > > the end-all, be-all, and that was never the intent.  PEAR 
> > is supposed
> > > to jump-start a project and extend some built-in functionality, not
> > > provide a framework or do all of the work for folks who consider
> > > themselves "programmers" because they can iterate an array in just
> > > twenty-seven lines of procedural code.
> > > 
> > > As for folks who say that PEAR and PECL don't work --- the most
> > > common reason for this is user error or system configuration issues.
> > > I've experienced the same issues myself over the years quite
> > > frustrating, but sure enough, it was my fault most times.
> > > 
> > 
> Oops...I just replied to Daniel.
> 
> Is PEAR supposed to be the CPAN for PHP, or is there another  repository of 
> PHP modules that is used by the typical PHP developer?
> 
> 

the only pear module i use, is MDB2... and i would actually change from
it, if i could find something comparable... i suppose i could write my
own, but it works, and have been using it for a few years now.

any suggestions to a replacement?

Steve


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



Re: [PHP] Switch Question...

2010-11-15 Thread Steve Staples
On Mon, 2010-11-15 at 22:43 +, Ashley Sheridan wrote:
> On Mon, 2010-11-15 at 16:27 -0500, Steve Staples wrote:
> 
> > Ok, dumb question, and i have tested, but I want to ensure that my tests
> > were accurate, and behavior is correct.
> > 
> > Ok, i have an integer, that based on what it is, does certain things...
> > 
> > switch ((int)$intval)
> > {
> > }
> > 
> > now, if i need to do something on a few of the numbers, then:
> > case 0:
> > # do nothing as strings will be (int) as 0
> > break;
> > case 1:
> > # do this
> > break;
> > case 12:
> > # do this
> > break;
> > default:
> > # do everything that is general to this
> > 
> > which this works, as the $intval should never be anything that i am not
> > expecting as there is another part of the code that decides which int's
> > to send to this class.
> > 
> > but is there a better way to do this?   this could potentially do a lot
> > more, and be more dynamic, but there is also the possibilty that i need
> > to have more "custom" commands based on an integer value, and not
> > something that is "generic".
> > 
> > Is there a way to only do from like cases 2-11, without doing:
> > case 2:
> > case 3:
> > case 4:
> > .
> > case 11:
> > # do this stuff
> > break;
> > 
> > 
> > am I just overthinking things?  i dunno... it's monday...  brains still
> > on weekend mode.
> > 
> > Steve
> > 
> > 
> 
> 
> There is actually a very cool way you can use a switch in PHP to do what
> you want:
> 
> switch(true)
> {
> case ($intval >= 2 && $intval <= 11):
> {
> // stuff here for cases 2-11 inclusive
> break;
> }
> }
> 
> Although I think in your case a series of if/else if statements would
> work, and might possibly be more readable in your code.
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 

yeah, totally forgot about putting logic into the case... yep... still
monday here...

thanks ash!


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



[PHP] Switch Question...

2010-11-15 Thread Steve Staples
Ok, dumb question, and i have tested, but I want to ensure that my tests
were accurate, and behavior is correct.

Ok, i have an integer, that based on what it is, does certain things...

switch ((int)$intval)
{
}

now, if i need to do something on a few of the numbers, then:
case 0:
# do nothing as strings will be (int) as 0
break;
case 1:
# do this
break;
case 12:
# do this
break;
default:
# do everything that is general to this

which this works, as the $intval should never be anything that i am not
expecting as there is another part of the code that decides which int's
to send to this class.

but is there a better way to do this?   this could potentially do a lot
more, and be more dynamic, but there is also the possibilty that i need
to have more "custom" commands based on an integer value, and not
something that is "generic".

Is there a way to only do from like cases 2-11, without doing:
case 2:
case 3:
case 4:
.
case 11:
# do this stuff
break;


am I just overthinking things?  i dunno... it's monday...  brains still
on weekend mode.

Steve


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



Re: [PHP] Chat

2010-11-09 Thread Steve Staples
On Tue, 2010-11-09 at 16:51 +0100, Dušan Novaković wrote:
> Hello there,
> 
> I have to make chat for website that has around 10 000 users (small
> social network). So before I start, I would like to hear different
> opinions. Important thing is to have in mind that in one moment you
> can have over 1 000 users using chat.
> So, if you have time fill free to write you experience in this field,
> suggestions, etc.
> 
> Thnx,
> Dusan
> 
> 
> 
> -- 
> 
> 
> Please consider the environment before printing this email.
> 

I did that for a site for my buddy... i tried a few different ways, and
the current way seems to work decently... but i've been thinking about
altering it...

what i did for that one, is it inserts into a database what the person
wrote, then on eth other side, it pulls every x seconds from the db, and
using ajax adds to the .   it is a pain in the ass, but yeah, it
works.  I also had a flag for "typing" indicator.

i am sure there are many different ways to do this, but posting to a db,
and pulling from the db seemed to be the logical way to do it when i did
that...my buddies old way of doing it, is at http://radiokaos.com
it just posts to the db, and then refreshed the iframe every 20 seconds
or something.


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



Re: [PHP] Template engines

2010-11-08 Thread Steve Staples
On Mon, 2010-11-08 at 14:41 -0700, Hansen, Mike wrote:
> I really like the idea of using a templating engine. Which one do you use? 
> Why? For those that don't use templating engines, why don't you use them? 
> 
> 

for the longest time, i didn't know about them, and was breaking in and
out of php, as well as didn't use ANY classes... then i was starting to
play with phpbb, and found out a little about templates... so i
"borrowed" the template engine from them for a personal project... and
was pretty impressed.

then shortly after that, i got a job with a company who used smarty
templates... and was VERY impressed with them :)  ever since then, i've
been using smarty, and have been very happy since.

I dont know of any others out there, but that is mostly becuase i am
content with what smarty does for me (and prolly becuase i am too lazy
to change now ;) )

all of my projects now consist of smarty, pear mdb2, phpmailer, jquery,
fpdf (if needed), and pchart (again, if needed).   these are my personal
choices, and I have been happy with them so far ;)

Steve


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



Re: [PHP] read smb drive

2010-11-05 Thread Steve Staples
On Fri, 2010-11-05 at 11:06 -0600, Nathan Nobbe wrote:
> On Fri, Nov 5, 2010 at 11:01 AM, Alexandr wrote:
> 
> > Nathan Nobbe пишет:
> >
> >  On Fri, Nov 5, 2010 at 10:43 AM, Richard Quadling  >> >wrote:
> >>
> >>
> >>
> >>> On 5 November 2010 16:30, Nathan Nobbe  wrote:
> >>>
> >>>
> >>>> On Fri, Nov 5, 2010 at 10:18 AM, Steve Staples 
> >>>>
> >>>>
> >>> wrote:
> >>>
> >>>
> >>>> On Fri, 2010-11-05 at 10:06 -0600, Nathan Nobbe wrote:
> >>>>>
> >>>>>
> >>>>>> On Fri, Nov 5, 2010 at 9:48 AM, Steve Staples 
> >>>>>>
> >>>>>>
> >>>>> wrote:
> >>>
> >>>
> >>>> Hey guys (and gals)
> >>>>>>>
> >>>>>>> I am writing something that needs to connect to a SMB server... can
> >>>>>>>
> >>>>>>>
> >>>>>> this
> >>>>>
> >>>>>
> >>>>>> be done easliy?
> >>>>>>>
> >>>>>>> I copied a sample code from php.net that used the system() command
> >>>>>>>
> >>>>>>>
> >>>>>> and
> >>>
> >>>
> >>>> mounted the SMB to a /mnt/tmp partion, and technically, it works
> >>>>>>>
> >>>>>>>
> >>>>>> the
> >>>>>
> >>>>>
> >>>>>> problem is, is that mount has to be run as root...
> >>>>>>>
> >>>>>>> is there a way to put the "mount/unmount" commands into an allowed
> >>>>>>> command?   i supposed, the other problem is, is waht if this is on a
> >>>>>>> windows machine?
> >>>>>>>
> >>>>>>> i dont really want to mess with permissions too much, since this
> >>>>>>>
> >>>>>>>
> >>>>>> will
> >>>
> >>>
> >>>> have to be portable from linux to windows...   any help would be
> >>>>>>> appreciated...
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>> is there any reason the php application code has to be responsible for
> >>>>>> mounting the network drive?
> >>>>>>
> >>>>>> typically this is an os-level responsibility.
> >>>>>>
> >>>>>> -nathan
> >>>>>>
> >>>>>>
> >>>>> this is true, but i am looking at mounting it, reading the contents,
> >>>>> maybe moving a file to it, or renaming a file... and then closing the
> >>>>> smb share.
> >>>>>
> >>>>> i have thought abotu making it a requirement on the users end to have
> >>>>> the directory ready for the application... but thought also about maybe
> >>>>> giving them the option to connect to it and do what it has to do, then
> >>>>> close it...
> >>>>>
> >>>>> i've been doing it the second way, but was wondering if the first was a
> >>>>> viable option or not.
> >>>>>
> >>>>>
> >>>> hmm, yeah im not sure if theres a clean mounting interface between
> >>>>
> >>>>
> >>> windows
> >>>
> >>>
> >>>> and linux.  the nomenclature is different for one, and im not even sure
> >>>>
> >>>>
> >>> how
> >>>
> >>>
> >>>> to mount a network drive programmatically under windows.  maybe someone
> >>>>
> >>>>
> >>> else
> >>>
> >>>
> >>>> on the list does.
> >>>>
> >>>> -nathan
> >>>>
> >>>>
> >>>>
> >>> You don't need to "mount" the share. If the share is available, then
> >>> you can access using UNC ...
> >>>
> >>> But you don't need to mount the share
> >>>
> >>> Is this not the same on unix?
> >>>
> >>>
> >>
> >>
> >> im not sure, ive got some linux machines mounting windows shares and it
> >> seems ls is not happy using the smb url to the share.  there may be a way
> >> though, for those willing to dig a little :D
> >>
> >> -nathan
> >>
> >>
> >>
> > You can use 'smbclient' for copy file from the machine running the
> > client (Linux) to the server (Windows). In PHP it is necessary to use
> > functions like system or shell_exec.
> 
> 
> ahh - good call.  iirc that's the underlying program used by mount actually
> when mounting smb shares.  i know it's called by our automount scripts as
> well.  never bothered to use it directly, however that sounds like the way
> to go in this scenario.
> 
> -nathan


looks like it is not as simple as i had hoped/thought...

i found a smb class on phpclasses.org, maybe tonight i will look at that
and see if it what i need it to be.




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



Re: [PHP] read smb drive

2010-11-05 Thread Steve Staples
On Fri, 2010-11-05 at 10:06 -0600, Nathan Nobbe wrote:
> On Fri, Nov 5, 2010 at 9:48 AM, Steve Staples  wrote:
> 
> > Hey guys (and gals)
> >
> > I am writing something that needs to connect to a SMB server... can this
> > be done easliy?
> >
> > I copied a sample code from php.net that used the system() command and
> > mounted the SMB to a /mnt/tmp partion, and technically, it works the
> > problem is, is that mount has to be run as root...
> >
> > is there a way to put the "mount/unmount" commands into an allowed
> > command?   i supposed, the other problem is, is waht if this is on a
> > windows machine?
> >
> > i dont really want to mess with permissions too much, since this will
> > have to be portable from linux to windows...   any help would be
> > appreciated...
> >
> 
> is there any reason the php application code has to be responsible for
> mounting the network drive?
> 
> typically this is an os-level responsibility.
> 
> -nathan

this is true, but i am looking at mounting it, reading the contents,
maybe moving a file to it, or renaming a file... and then closing the
smb share.

i have thought abotu making it a requirement on the users end to have
the directory ready for the application... but thought also about maybe
giving them the option to connect to it and do what it has to do, then
close it... 

i've been doing it the second way, but was wondering if the first was a
viable option or not.

Steve


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



[PHP] read smb drive

2010-11-05 Thread Steve Staples
Hey guys (and gals)

I am writing something that needs to connect to a SMB server... can this
be done easliy?

I copied a sample code from php.net that used the system() command and
mounted the SMB to a /mnt/tmp partion, and technically, it works the
problem is, is that mount has to be run as root...

is there a way to put the "mount/unmount" commands into an allowed
command?   i supposed, the other problem is, is waht if this is on a
windows machine?

i dont really want to mess with permissions too much, since this will
have to be portable from linux to windows...   any help would be
appreciated...

Steve


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



Re: [PHP] PHP sockets enabled but socket_create() gives an error call to undefined function

2010-11-04 Thread Steve Staples
On Thu, 2010-11-04 at 11:48 -0600, Nathan Nobbe wrote:
> On Thu, Nov 4, 2010 at 11:43 AM, Nathan Nobbe wrote:
> 
> > $ yum search php | grep -i socket
> > php-pear-Net-Socket.noarch : Network Socket Interface
> >
> 
> check that - thats def *not* the package you're looking for, it's a
> userspace oo wrapper.  you'd be best asking how to install this software on
> some sort of red hat / php list really.  like i said, i tend to stay away
> from red hat.
> 
> the gentoo guys have #gentoo-php on irc so i would expect there to be
> similar channels for other distros.
> 
> still though, update the locate database and see if you just need to enable
> sockets in a cli specific ini file.
> 
> -nathan

is there a PEAR module you can install that will do this?  I know there
are a lot of PEAR modules out there...

just a thought...

Steve


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



Re: [PHP] php-general-digest-unsubscr...@lists.php.net not working?

2010-11-04 Thread Steve Staples
On Thu, 2010-11-04 at 12:34 -0400, Daniel P. Brown wrote:
> On Thu, Nov 4, 2010 at 12:33, Daniel P. Brown  
> wrote:
> >
> >If you continue to have issues, let me know and I will remove you.
> 
> From the list, that is, to be clear.  Not the Earth.
> 

i lol'd.



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



Re: [PHP] include() and duplicate function definition

2010-11-03 Thread Steve Staples
On Thu, 2010-11-04 at 00:00 +0800, David Nelson wrote:
> Hi Thijs, :-)
> 
> On Wed, Nov 3, 2010 at 20:38, Thijs Lensselink  wrote:
> > I re-read your original post. And noticed you include the function inside
> > your child action.php
> > Is there a special reason for that? You want to overwrite the original
> > function in a child theme.
> > probably to get different functionality. So why do you need the original
> > function?
> >
> > Just create your action.php and define the same function.
> 
> It's a WordPress issue. When theme updates become available from the
> original vendor, you can update them from within the admin backend. In
> that case, any hacks you've applied (such as removing a function) get
> overwritten. So the evangelized solution is to create a child theme.
> The child theme incorporates only files that you've added or changed,
> with the original parent theme being used for all others.
> 
> Easy peasy if you want to *add* a function.
> 
> But, if you want to *modify* a function, you're faced with the problem
> of the original function still being present in the parent theme files
> and of your having to define a function of the same name in your child
> theme (if you change the function name, you then have to hack other
> code further upstream, and the work involved becomes not worth the
> bother). Somehow, I would need to make my hacked function *replace*
> the original function, *without* touching the original function...
> 
> It seems like that's not possible and I'll have to find another
> solution... unless my explanation gives you any good ideas?
> 
> Just to put the dots on the I's, the original "actions.php" contains a
> lot of *other* functions that I don't want to touch, and that I do
> want to leave exposed to the updates process. It's just one single
> function I want to hack...
> 
> Sticky problem, huh? :-)
> 
> In any case, thanks for your kind help, :-)
> 
> David Nelson
> 
> P.S. Sorry about the direct mails: I keep forgetting to hit the
> "Replly to all" button.
> 


I am curious on how this would work, if for some reason they were using
a different template?   the function you want to "overwrite", wont be
used, and therefore, wouldn't your app/template/whatever be updated
improperly than waht you expect it to be?

Just curious... 


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