Re: [PHP] upload progress (was www.soongy.com)

2009-03-03 Thread Ashley Sheridan
On Mon, 2009-03-02 at 18:35 -0800, mike wrote:
 On Mon, Mar 2, 2009 at 3:29 PM, Ashley Sheridan
 a...@ashleysheridan.co.uk wrote:
 
  There are a lot of free FTP Java applets out there, which you could
  easily integrate with a web page and your hosting. You'll have the
  advantage of a familiar interface, multiple uploads, queues, and
  progress bars. Worst case scenario, user has no Java and you have to
  offer a standard upload form.
 
 since it's java, you're getting into Michael's infinite paranoia soapbox... :)
 
 also it requires FTP credentials, or an FTP account, which makes life
 a living hell. firewalls, NATted setups, people finding out it's an
 open FTP, etc.
 
 If you are requiring an applet, I don't see why there is even a
 discussion. Go with Gears, no extra server code or configuration
 necessary.
 
 If you are anti-applet, you'll still need javascript, and depending on
 the file sizes you're dealing with, you'll need to modify the server
 configuration (which is out of a lot of people's control)
 
Whoever said anything about open FTP?


Ash
www.ashleysheridan.co.uk


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



[PHP] Question about template systems

2009-03-03 Thread Matthew Croud

Hello,

First post here, I'm in the process of learning PHP , I'm digesting a  
few books as we speak.
I'm working on a content heavy website that provides a lot of  
information, a template system would be great and so i've been looking  
at ways to create dynamic data with a static navigation system.


So far, using the require_once(); function seems to fit the bill in  
order to bring in the same header html file on each page.

I've also looked at Smartys template system.

I wondered how you folk would go about creating a template system ?

My second question might be me jumping the gun here, I haven't come  
across this part in my book but i'll ask about it anyway.  I often see  
websites that have a dynamic body and static header, and their web  
addresses end like this: index.php?id=445 where 445 i presume is  
some file reference.
What is this called ?  It seems like the system i'm after but it  
doesn't appear in my book,  If anyone could let me know what this page  
id subject is called i can do some research on the subject.


Thanks for any help you can provide :)

Matt.
 


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



Re: [PHP] upload progress (was www.soongy.com)

2009-03-03 Thread mike
On Tue, Mar 3, 2009 at 12:02 AM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:

 Whoever said anything about open FTP?

how else do you do it?

either it's open/anonymous, or some hardcoded account info. either
way, not very secure, and due to the nature of it, kinda requires the
user to have enough privileges to upload N files of X bytes (you could
put quotas on it, chroot it, blahblah... but still)

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



Re: [PHP] Question about template systems

2009-03-03 Thread Marcus Gnaß

Marcus Gnaß wrote:

like with programming questions in general.



Should have read my own post before sending! ;) Should be programming 
languages!


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



Re: [PHP] Question about template systems

2009-03-03 Thread Matthew Croud

Excellent, thanks for your help guys, you've been really helpful :)



On 3 Mar 2009, at 10:20, Marcus Gnaß wrote:


Matthew Croud wrote:

Hello,

First post here, I'm in the process of learning PHP , I'm digesting  
a few books as we speak.
I'm working on a content heavy website that provides a lot of  
information, a template system would be great and so i've been  
looking at ways to create dynamic data with a static navigation  
system.


So far, using the require_once(); function seems to fit the bill in  
order to bring in the same header html file on each page.

I've also looked at Smartys template system.

I wondered how you folk would go about creating a template system ?
Smarty is a good choice, although some people might prefer other  
templating systems. This is kind of a religious question like with  
programming questions in general. But I guess that most people would  
advise you to use an existing templating system instead of writing  
one on your own.
My second question might be me jumping the gun here, I haven't come  
across this part in my book but i'll ask about it anyway.  I often  
see websites that have a dynamic body and static header, and their  
web addresses end like this: index.php?id=445 where 445 i presume  
is some file reference.
What is this called ?  It seems like the system i'm after but it  
doesn't appear in my book,  If anyone could let me know what this  
page id subject is called i can do some research on the subject.

Have a look at the PHP manual and be sure to bookmark it! ;) 
http://www.php.net/manual/en/

The ID you mentioned is a query. id=445other_id=653 would be a  
querystring.
To retrieve data passed via this querystring you can use $_GET (http://de.php.net/manual/en/reserved.variables.get.php 
).



Have fun






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



Re: [PHP] Question about template systems

2009-03-03 Thread Richard Heyes
Hi,

 First post here, I'm in the process of learning PHP , I'm digesting a few
 books as we speak.
 I'm working on a content heavy website that provides a lot of information, a
 template system would be great and so i've been looking at ways to create
 dynamic data with a static navigation system.

 So far, using the require_once(); function seems to fit the bill in order to
 bring in the same header html file on each page.
 I've also looked at Smartys template system.

If you've looked at require_once() and it fits the bill, then
chances are that Smarty might be overkill slightly.

 I wondered how you folk would go about creating a template system ?

I wouldn't (or at least, I wouldn't advise it). Use one that's already
out there and save your self some (a lot of) work.

 My second question might be me jumping the gun here, I haven't come across
 this part in my book but i'll ask about it anyway.  I often see websites
 that have a dynamic body and static header, and their web addresses end like
 this: index.php?id=445 where 445 i presume is some file reference.
 What is this called ?

I don't know of the specific name, but the URL is simply passing an
identifier (445) to the script (index.php). This ID could be the ID of
a record in a database, which is then retrieved and shown to the user.

 It seems like the system i'm after but it doesn't
 appear in my book,  If anyone could let me know what this page id subject is
 called i can do some research on the subject.

Erm, don't know of the specific name, except that it's a GET parameter
(so I guess I do...). Everything following the question mark is
collectively known as the query string. You can retrieve these by
examining the $_GET variable. You will aalso find some useful things,
in $_SERVER.

Eg:

pre
?php
  print_r($_GET);
  print_r($_SERVER);
?

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated February 28th)

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



Re: [PHP] Question about template systems

2009-03-03 Thread Marcus Gnaß

Matthew Croud wrote:

Hello,

First post here, I'm in the process of learning PHP , I'm digesting a 
few books as we speak.
I'm working on a content heavy website that provides a lot of 
information, a template system would be great and so i've been looking 
at ways to create dynamic data with a static navigation system.


So far, using the require_once(); function seems to fit the bill in 
order to bring in the same header html file on each page.

I've also looked at Smartys template system.

I wondered how you folk would go about creating a template system ?
Smarty is a good choice, although some people might prefer other 
templating systems. This is kind of a religious question like with 
programming questions in general. But I guess that most people would 
advise you to use an existing templating system instead of writing one 
on your own.
My second question might be me jumping the gun here, I haven't come 
across this part in my book but i'll ask about it anyway.  I often see 
websites that have a dynamic body and static header, and their web 
addresses end like this: index.php?id=445 where 445 i presume is 
some file reference.
What is this called ?  It seems like the system i'm after but it 
doesn't appear in my book,  If anyone could let me know what this page 
id subject is called i can do some research on the subject.
Have a look at the PHP manual and be sure to bookmark it! ;) 
http://www.php.net/manual/en/


The ID you mentioned is a query. id=445other_id=653 would be a 
querystring.
To retrieve data passed via this querystring you can use $_GET 
(http://de.php.net/manual/en/reserved.variables.get.php).



Have fun

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



[PHP] XML manipulation

2009-03-03 Thread Raido

Hi!

Manipulating XML files with PHP is quite new thing to me, so I could 
need a bit help with it.

Here are the questions(and below are XML schema):
1) Is it possible to change those blocks order?
For example I move block number=1.1.1 below 1.1.3 and it's number 
gets changed from 1.1.1  1.1.3 and  1.1.2  1.1.1 and 1.1.3  1.1.2
I also should be able to change order of blocks with number=1.1 (for 
example 1.1  1.8 and 1.8  1.1)  and number=1.


2) where and how should I approach?
Theoretically I think I should make a html list from the blocks and make 
it sortable with help of jQuery... beginning doesn't seem so 
difficult..but what happends then? (SimpleXML havent helped me with 
changing order..it helps me to change and read attributes.)



So any suggestions/ideas for completing that kind of solution are welcome.


And here is the XML (simplified)structure:

--
block number=1 text=main of the all blocks
   block number=1.1
   block number=1.1.1
   somestuff_here text=hello/somestuff_here
   /block
   block number=1.1.2
   someotherstuff_here text=hello again/someotherstuff_here
   /block
   block number=1.1.3
   
   /block
   /block
   block number=1.2
   
   /block
/block

--



Thank you for help.

Raido

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



[PHP] Re: Fwrite() vs file_put_contents()

2009-03-03 Thread RottenEye

I Clancy,

Have you tried to convert your content to an .ini file? I heard that the 
php function parse_ini_file is very fast for reading this kind of 
files, although for writing you have to use some sort of php class, that 
can be slower than your method.

Depends what you trying to do I guess.

Regards


Clancy wrote:

I have been pondering whether it would be feasible to work with a 100,000 entry 
index
file, and had put yesterday aside to do some timing tests. I first generated 
some sample
index files of various lengths. Each entry consisted of a single line with the 
form

ASDF;rhubarb, rhubarb, 

where the ASDF is a randomly generated four character index, and the rest of 
the line is
filling, which varies slightly in length and contents from line to line, just 
in case
something tried to get smart and cache the line.  The average lenth of the line 
is about
80 bytes.

Then I wrote another program which read the file into an array, using the four 
character
index as the key, and the filling as the contents, sorted the array, and then 
rewrote it
to another file, reporting the elapsed time after each step.

My first version used fgets() to read the source file a line at a time, and 
fwrite() to
write the new file. This version performed quite consistently, and took 
approximately 1.3
seconds to read in a 100,000 entry 7.86Mb file, and another 5 seconds to write 
it out
again.

I then read the discussion following fschnittke's post File write operation 
slows to a
crawl ...  and wondered if the suggestions made there would help.

First I used file() to read the entire file into memory, then processed each 
line into the
form required to set up my matrix. This gave a useful improvement for small 
files, halving
the time required to read and process a 10,000 entry 815 kB file, but for a 
30,000 entry
file it had dropped to about 15%, and it made little difference for a 300,000 
entry file.

Then I tried writing my whole array into a single horrendous string, and using
file_put_contents() to write out the whole string in one bang. I started 
testing on a
short file, and thought I was onto a good thing, as it halved the time to write 
out a
10,000 entry 800 K file. But as I increased the file size it began to fail 
dismally. With
a 30,000 entry file it was 20% slower, and at 100,000 entries it was three 
times slower.

On Shawn McKenzie's suggestion, I also tried replacing fgets() with 
stream_get_line(). As
I had anticipated any difference was well within below the timing noise level.

In conclusion, for short (1MB!) files, using file() to read the whole file into 
memory is
substantially better than using fgets() to read the file a line at a time, but 
the
advantage rapidly diminishes for longer files. Similarly  using 
file_put_contents() in
place of fwrite() to write it out again is better for short files (up to 
perhaps 1 MB) but
the performance deteriorates rapidly above this.



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



[PHP] 0.T Java IDE

2009-03-03 Thread Almog Friedman
Since I know theres alot of Java progarammers in this list and I don't want
to sign upo to another mailing list i ask it here

I'm searching for a Java ide (not netbeans, I'm sick of netbeans) which does
gui in swing the best(i come from C# with visual studio and i'm searching
for something that is as easy and powerful as the visual studio gui editor)


Re: [PHP] ldap_search filter with memberOf

2009-03-03 Thread Romer Ventura
If you notice when you get the memberOf back from the server you ll  
see it is an array with full CN; so if you dont want to loop through  
the array returned you can try to see if filtering with the full CN  
will work.


I found it easier to just get all of memberOf and then use PHP to  
get only the desired groups.


On Feb 22, 2009, at 7:22 PM, Zaitchik, Alan wrote:

I am trying to construct a filter for ldap_search that tests the AD  
memberOf attribute. The latter has possibly multiple values for a  
given user, and I want something like (memberOf=*Student*) to get  
all and only the students. I realize that the above does not work,  
that the memberOf attribute has some internal structure that  
requires something more complicated, but I cannot seem to get it  
working.


What I have done is use a very broad $filter, an $attribs that  
includes memberOf-- and then loop through the results keeping  
only the students, thus:


$sr= ldap_search($ldapconn, $dn, $filter, $attribs);

for ($entryid=ldap_first_entry($ldapconn,$sr);$entryid!=false; 
$entryid=ldap_next_entry($ldapconn,$entryid)){


$this_memberof = implode(ldap_get_values($ldapconn, 
$entryid,'memberof'));


If (stripos($this_memberof,'student') ) {

// do something, etc.

}

}

But this is wildly inefficient. How can I just create the filter I  
need for ldap_search?


Thanks!

Alan






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



Re: [PHP] Question about template systems

2009-03-03 Thread Paul M Foster
On Tue, Mar 03, 2009 at 09:01:06AM +, Matthew Croud wrote:

 Hello,

 First post here, I'm in the process of learning PHP , I'm digesting a
 few books as we speak.
 I'm working on a content heavy website that provides a lot of
 information, a template system would be great and so i've been looking
 at ways to create dynamic data with a static navigation system.

 So far, using the require_once(); function seems to fit the bill in
 order to bring in the same header html file on each page.
 I've also looked at Smartys template system.

 I wondered how you folk would go about creating a template system ?

Here's a simple way of doing this: Set up a full page of HTML, with the
header, footer and all that stuff. But leave the center (content) part
of the page blank. You can call what you just built a template. What
goes in the center could be called a view. In the center of the page,
put a call like this:

include($view_page);

When you go to display the page, do this:

$view_page = 'apples.php';
include('template.php');

When the template page is included, it will, in turn, the view page
(apples.php) will get included. This works well if you want the same
basic look for all the pages of your site.

Just one way to do it.


 My second question might be me jumping the gun here, I haven't come
 across this part in my book but i'll ask about it anyway.  I often see
 websites that have a dynamic body and static header, and their web
 addresses end like this: index.php?id=445 where 445 i presume is
 some file reference.
 What is this called ?  It seems like the system i'm after but it
 doesn't appear in my book,  If anyone could let me know what this page
 id subject is called i can do some research on the subject.


Most likely, index.php is what is called a front controller (look it
up). The id=445 is a GET variable being passed to index.php. The
index.php file checks this variable and decides which page to display.
It could be a page called anything.php, but index.php knows that when
id = 445, it should display this page.

An awful lot of websites use a model-view-controller (MVC, look it up)
system using a front controller. There are tons of these about. My
personal recommendation for about the lightest weight of these is
CodeIgniter (codeigniter.com). Being lightweight also allows you to look
at its code and easily understand what it's doing and why.

Paul
-- 
Paul M. Foster

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



[PHP] RE: file locking...

2009-03-03 Thread bruce
Hi Dennis...

Thanks for the reply... Here's my solution up to now.. might change in the
future...

The problem:
App has a bunch of clients that need to get a separate/unique list of files
from a master server app. The files are created by the master server
process, and reside on the filesystem behind the server process. (this is a
client/server based app. client sends a request to the server.. the backend
operation of the server fetches the required files, and returns them to the
client app.)

A key issue is that I don't want to run into potential race conditions,
which would result in a given client never being served the files it's
trying to fetch.

Potential Soln:
1) Invoke a form of file locking, with each client processes waiting
   until it gets its lock.
2) Invoke some form of round-robin process, where the master process
   puts files in different dirs, so each client can have a better
   chance of getting a lock for the different dir..

Final Soln: (for now)
I decided to cheat!
I realized that since each client process is essentially unique, I can
create a uniqueId (uuid) for each process. Remember, the client app is
hitting the master server/file process via a webservice. So I have each
client send it's uuid to the master server via the webprocess. this
information is appended to a file, which gives me kind of a fifo approach
for creating unique dirs for each client. the server (on the backend) then
reads the fifo file, for the uuid. in getting the uuid for the 'client', a
master cron process then reads the fifo file, and for each uuid in the file,
creates a tmp dir for the uuid. the master cron process then populates this
dir, with the required files for the given client.

on the client side, the client loops through a wait loop, checking to see if
anything is created/placed in its tmp 'uuid' dir.. if files are there, it
fetches the files, and proceeds..

This approach ensures that a client would never run into a situation where
it might never get files where files are available for processing. in the
event there are no files, the client simply sleeps until there are files..
in the event a client requests files via the sending of the uuid, and the
client dies before getting the files, but the master cron had already placed
them in the uuid dir.. there will be a cleanup process to reabsorb those
files back into the system...

thanks to all who gave input/pointers!!

thoughts/comments/etc...



-Original Message-
From: python-list-bounces+bedouglas=earthlink@python.org
[mailto:python-list-bounces+bedouglas=earthlink@python.org]on Behalf
Of Dennis Lee Bieber
Sent: Sunday, March 01, 2009 11:41 AM
To: undisclosed-recipients:
Subject: Re: file locking...


On Sun, 1 Mar 2009 10:00:54 -0800, bruce bedoug...@earthlink.net
declaimed the following in comp.lang.python:


 Except in my situation.. the client has no knowledge of the filenaming
 situation, and i might have 1000s of files... think of the FIFO, first in,
 first out.. so i'm loking for a fast solution that would allow me to
create
 groups of say, 500 files, that get batched and processed by the client
 app...

My silly thoughts...

Main process creates temp/scratch directories for each subprocess;
spawn each subprocess, passing the directory path to it;
main process then just loops over the files moving them, one at a time,
to one of the temp/scratch directories, probably in cyclic order to
distribute the load;
when main/input directory is empty, sleep then check again (or, if the
OS supports it -- use some directory change notification) for new files.

Each subprocess only sees its files in the applicable temp/scratch
directory.
--
WulfraedDennis Lee Bieber   KD6MOG
wlfr...@ix.netcom.com   wulfr...@bestiaria.com
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff:   web-a...@bestiaria.com)
HTTP://www.bestiaria.com/
--
http://mail.python.org/mailman/listinfo/python-list


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



[PHP] whoami explanation

2009-03-03 Thread PJ
This really needs some explanation
I found this on the web:
?php echo `whoami`; ?
with it there was the comment the direction of those single-quotes matters
(WHY ?)
and it works

But this (_*FROM THE PHP MANUAL***_ * -  exec()* executes the given
/command/ ) does not,
COPIED AND PASTED:
|?php
// outputs the username that owns the running php/httpd process
// (on a system with the whoami executable in the path)
echo exec('whoami');
? |
What is going on here?
And I often find such discrepancies in examples - and some wonder why I
seem to be so stupid... and don't know the fundamentals... :-\
-- 

Phil Jourdan --- p...@ptahhotep.com
http://www.ptahhotep.com
http://www.chiccantine.com

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



Re: [PHP] whoami explanation

2009-03-03 Thread Robert Cummings
On Tue, 2009-03-03 at 10:42 -0500, PJ wrote:
 This really needs some explanation
 I found this on the web:
 ?php echo `whoami`; ?
 with it there was the comment the direction of those single-quotes matters
 (WHY ?)
 and it works
 
 But this (_*FROM THE PHP MANUAL***_ * -  exec()* executes the given
 /command/ ) does not,
 COPIED AND PASTED:
 |?php
 // outputs the username that owns the running php/httpd process
 // (on a system with the whoami executable in the path)
 echo exec('whoami');
 ? |
 What is going on here?
 And I often find such discrepancies in examples - and some wonder why I
 seem to be so stupid... and don't know the fundamentals... :-\

Those are backticks. They execute a program via the shell. If you drop
to the shell and type whoami at the prompt you will get the same result.
The backticks operator returns the shell's output which is why it can be
echoed.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] whoami explanation

2009-03-03 Thread Per Jessen
PJ wrote:

 This really needs some explanation
 I found this on the web:
 ?php echo `whoami`; ?
 with it there was the comment the direction of those single-quotes
 matters (WHY ?) and it works
 

GIYF - look up back quotes.

 But this (_*FROM THE PHP MANUAL***_ * -  exec()* executes the given
 /command/ ) does not,
 COPIED AND PASTED:
 |?php
 // outputs the username that owns the running php/httpd process
 // (on a system with the whoami executable in the path)
 echo exec('whoami');
 ? |
 What is going on here?

What sort of error did you get?  (it works fine here).


/Per

-- 
Per Jessen, Zürich (6.4°C)


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



Re: [PHP] whoami explanation

2009-03-03 Thread Daniel Brown
On Tue, Mar 3, 2009 at 10:42, PJ af.gour...@videotron.ca wrote:
 This really needs some explanation
 I found this on the web:
 ?php echo `whoami`; ?
 with it there was the comment the direction of those single-quotes matters
 (WHY ?)

Those are called backtick operators.  Like in BASh and most
other *NIX shells, that instructs the parser to evaluate, execute, and
return the result of the command within the ticks.

 But this (_*FROM THE PHP MANUAL***_ * -  exec()* executes the given
 /command/ ) does not,
 COPIED AND PASTED:
 |?php
 // outputs the username that owns the running php/httpd process
 // (on a system with the whoami executable in the path)
 echo exec('whoami');
 ? |
 What is going on here?

What you want to do with exec() is run it properly (RTFM for real ;-P).

?php
exec('whoami',$ret,$err);
echo $ret[0].\n;
?

The second parameter passed to exec() is the return array from
STDOUT, the third is the error response on channel 2 (STDERR).

 And I often find such discrepancies in examples - and some wonder why I
 seem to be so stupid... and don't know the fundamentals... :-\

I highly doubt that you're stupid you just need to pay closer
attention to what the manual is actually saying.  Check the user notes
as well, and then devise your own pattern from the collective examples
--- it'll jump-start your learning.

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

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



Re: [PHP] whoami explanation

2009-03-03 Thread PJ
Per Jessen wrote:
 PJ wrote:

   
 This really needs some explanation
 I found this on the web:
 ?php echo `whoami`; ?
 with it there was the comment the direction of those single-quotes
 matters (WHY ?) and it works

 

 GIYF - look up back quotes.

   
 But this (_*FROM THE PHP MANUAL***_ * -  exec()* executes the given
 /command/ ) does not,
 COPIED AND PASTED:
 |?php
 // outputs the username that owns the running php/httpd process
 // (on a system with the whoami executable in the path)
 echo exec('whoami');
 ? |
 What is going on here?
 

 What sort of error did you get?  (it works fine here).


 /Per
   
blank page

-- 

Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com


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



Re: [PHP] whoami explanation

2009-03-03 Thread PJ
Per Jessen wrote:
 PJ wrote:

   
 This really needs some explanation
 I found this on the web:
 ?php echo `whoami`; ?
 with it there was the comment the direction of those single-quotes
 matters (WHY ?) and it works

 

 GIYF - look up back quotes.

   
 But this (_*FROM THE PHP MANUAL***_ * -  exec()* executes the given
 /command/ ) does not,
 COPIED AND PASTED:
 |?php
 // outputs the username that owns the running php/httpd process
 // (on a system with the whoami executable in the path)
 echo exec('whoami');
 ? |
 What is going on here?
 

 What sort of error did you get?  (it works fine here).


 /Per
   
forgot to add:
What's the difference between back ticks or quotes and regular single
quotes?
How does one enter back quotes from the keyboard?

-- 

Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com


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



RE: [PHP] whoami explanation

2009-03-03 Thread bruce
hi pj...

single quotes are entered via the key directly left from the return/enter
key on most/all qwerty keyboards...

the 'backtic' is normally the shift '~' key... the key, right to the left of
the '1' key... in the upper left position of the keyboard...




-Original Message-
From: PJ [mailto:af.gour...@videotron.ca]
Sent: Tuesday, March 03, 2009 7:57 AM
To: Per Jessen
Cc: php-general@lists.php.net
Subject: Re: [PHP] whoami explanation


Per Jessen wrote:
 PJ wrote:


 This really needs some explanation
 I found this on the web:
 ?php echo `whoami`; ?
 with it there was the comment the direction of those single-quotes
 matters (WHY ?) and it works



 GIYF - look up back quotes.


 But this (_*FROM THE PHP MANUAL***_ * -  exec()* executes the given
 /command/ ) does not,
 COPIED AND PASTED:
 |?php
 // outputs the username that owns the running php/httpd process
 // (on a system with the whoami executable in the path)
 echo exec('whoami');
 ? |
 What is going on here?


 What sort of error did you get?  (it works fine here).


 /Per

forgot to add:
What's the difference between back ticks or quotes and regular single
quotes?
How does one enter back quotes from the keyboard?

--

Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com


--
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] whoami explanation

2009-03-03 Thread Per Jessen
PJ wrote:

 forgot to add:
 What's the difference between back ticks or quotes and regular single
 quotes?

text in back ticks is executed via a shell, text in single quotes isn't. 

 How does one enter back quotes from the keyboard?
 

Depends on your keyboard - on my current keyboard, the back tick is sat
on the key to the left of '1' on the top row. 


/Per

-- 
Per Jessen, Zürich (6.4°C)


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



[PHP] possible session bug - Mantis Bug Tracker

2009-03-03 Thread Edsall, William (WJ)
Hello list!
 I'm having a strange problem with php after installing Mantis Bug
Tracker. I'm not sure if this is a Mantis bug or a PHP bug but I'm
leaning toward PHP.

 Here's what's going on. When I view an issue in Mantis, it is slow to
spit out the text and often does not finish spitting out the text on the
page. When it does this, the browser I was using is locked out from
further communication to the server. If I delete the session file in use
by this session, I am able to use the browser again immediately.
 
 I can't tell if this is a session bug or if Mantis is causing this bug.
Please advise!


PHP 5.2.4 with Suhosin-Patch 0.9.6.2 (cli) (built: Sep 22 2007 02:01:31)
Server version: Apache/2.2.4 (Unix)
Server built:   Mar  6 2008 02:37:06


Thank you ahead of time list.


___
William J. Edsall 

Walking on water and developing software from a specification are easy
if both are frozen.





Re: [PHP] whoami explanation

2009-03-03 Thread Daniel Brown
On Tue, Mar 3, 2009 at 10:57, PJ af.gour...@videotron.ca wrote:

 forgot to add:
 What's the difference between back ticks or quotes and regular single
 quotes?
 How does one enter back quotes from the keyboard?

Welcome to the Internet!

The first place you should look when you have a question is on
Google.  The first result that comes up for backtick operator is the
PHP manual itself:

http://php.net/language.operators.execution

If you don't know where a key is on your keyboard, please look down.

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

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



Re: [PHP] whoami explanation

2009-03-03 Thread PJ
Per Jessen wrote:
 PJ wrote:

   
 This really needs some explanation
 I found this on the web:
 ?php echo `whoami`; ?
 with it there was the comment the direction of those single-quotes
 matters (WHY ?) and it works

 

 GIYF - look up back quotes.

   
 But this (_*FROM THE PHP MANUAL***_ * -  exec()* executes the given
 /command/ ) does not,
 COPIED AND PASTED:
 |?php
 // outputs the username that owns the running php/httpd process
 // (on a system with the whoami executable in the path)
 echo exec('whoami');
 ? |
 What is going on here?
 

 What sort of error did you get?  (it works fine here).


 /Per

   
ok, ok, I found it but you guys are assuming that this is something
everybody should know... hell, I've been tinkering with programming and
unix etc. for many, many years and this is the first time I ran into
back quotes.
SORRY!

-- 

Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com


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



Re: [PHP] whoami explanation

2009-03-03 Thread Robert Cummings
On Tue, 2009-03-03 at 10:57 -0500, PJ wrote:
 Per Jessen wrote:
  PJ wrote:
 

  This really needs some explanation
  I found this on the web:
  ?php echo `whoami`; ?
  with it there was the comment the direction of those single-quotes
  matters (WHY ?) and it works
 
  
 
  GIYF - look up back quotes.
 

  But this (_*FROM THE PHP MANUAL***_ * -  exec()* executes the given
  /command/ ) does not,
  COPIED AND PASTED:
  |?php
  // outputs the username that owns the running php/httpd process
  // (on a system with the whoami executable in the path)
  echo exec('whoami');
  ? |
  What is going on here?
  
 
  What sort of error did you get?  (it works fine here).
 
 
  /Per

 forgot to add:
 What's the difference between back ticks or quotes and regular single
 quotes?
 How does one enter back quotes from the keyboard?

Single quotes don't interpolate (expand) variables within them. They are
for string literals. Only escaping recognized is \\ to include a
backslash and \' to include a single quote. Double quotes recognize all
sorts of escape chars such as \n for newline, \r for carriage return, \t
for tab, etc, etc. Additionally they expand embedded variables to their
value. Backtick key can usually be found to the left of the 1 key and
unders the escape key.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] whoami explanation

2009-03-03 Thread Daniel Brown
On Tue, Mar 3, 2009 at 11:03, PJ af.gour...@videotron.ca wrote:

 ok, ok, I found it but you guys are assuming that this is something
 everybody should know... hell, I've been tinkering with programming and
 unix etc. for many, many years and this is the first time I ran into
 back quotes.
 SORRY!

You're assuming that we're assuming something (though I don't even
know to whom that's supposed to be directed).

Backtick operators have been around since the inception of UNIX
itself.  I don't mean this offensively by any means whatsoever, but if
you haven't run into them before, you haven't been tinkering very
much.

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

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



[PHP] Problems with displaying results

2009-03-03 Thread Terion Miller
I have two queries one pulls out which users to use and the second pulls
those users orders
Looks something like this but is only pulling the first record:


$query =  SELECT `UserName`, `AdminID` FROM admin
  WHERE   Key1 =  'YES' ;

$result = mysql_query ($query) ;
$row = mysql_fetch_assoc($result);

//Reveal Variables for Debugging
// include(VariableReveal2.php);
 echo (Hello br);
//echo $row['AdminID'];
echo ($row['UserName']);




if ($row['Key1'] == NO) {
header (Location: Welcome.php?AdminID=$AdminIDmsg=Sorry, you do
not have access to that page.);
}

if (isset($_GET['SortBy'])) {$SortBy = $_GET['SortBy'];} else {$SortBy =
'WorkOrderID DESC';}
if (isset($_GET['Page'])) {$Page = $_GET['Page'];} else {$Page = 1;}

$PerPage = 30;
$StartPage = ($Page - 1) * $PerPage;

second query here is using the $row from the first (and yes I know
not to use *, just did so here to keep post shorter)

 $sql= SELECT * FROM workorders WHERE AdminID =
'.$row['AdminID'].' ;
  // $sql .= ORDER BY $SortBy LIMIT $StartPage, $PerPage;
  $result = mysql_query ($sql);
  $row2 = mysql_fetch_assoc($result);
  $Total = ceil(mysql_num_rows($result)/$PerPage);


So this works but only half way as it only displays the first record in
the table.




Thanks
Terion

Happy Freecycling
Free the List !!
www.freecycle.org
Over Moderation of Freecycle List Prevents Post Timeliness.

Twitter?
http://twitter.com/terionmiller

Facebook:
a href=http://www.facebook.com/people/Terion-Miller/1542024891;
title=Terion Miller's Facebook profile target=_TOPimg src=
http://badge.facebook.com/badge/1542024891.237.919247960.png; border=0
alt=Terion Miller's Facebook profile/a
Groucho Marx  - I have had a perfectly wonderful evening, but this wasn't
it.


Re: [PHP] whoami explanation

2009-03-03 Thread PJ
Daniel Brown wrote:
 On Tue, Mar 3, 2009 at 10:57, PJ af.gour...@videotron.ca wrote:
   
 forgot to add:
 What's the difference between back ticks or quotes and regular single
 quotes?
 How does one enter back quotes from the keyboard?
 

 Welcome to the Internet!

 The first place you should look when you have a question is on
 Google.  The first result that comes up for backtick operator is the
 PHP manual itself:

 http://php.net/language.operators.execution

 If you don't know where a key is on your keyboard, please look down.

   
I don't think it's necessary to be sarcastic...
Hate to disappoint you, but on my computer (FreeBSD 7.0) on Firefox
Google does not go directly to the php manual... it goes to some nitwit
site thinkexist.com
So, this list is a much better source of information that waddling
through the crap that's thrown at you on G.
And I find that Googie is getting pretty garbagy even if there is
nothing better around ;-)
As for the keyboard, this is the first time I have ever, ever needed the
back quote key although I have occasionally needed the ~ key for Windows
stuff.

-- 

Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com


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



[PHP] Re: whoami explanation

2009-03-03 Thread Shawn McKenzie
PJ wrote:
 This really needs some explanation
 I found this on the web:
 ?php echo `whoami`; ?
 with it there was the comment the direction of those single-quotes matters
 (WHY ?)
 and it works
 
 But this (_*FROM THE PHP MANUAL***_ * -  exec()* executes the given
 /command/ ) does not,
 COPIED AND PASTED:
 |?php
 // outputs the username that owns the running php/httpd process
 // (on a system with the whoami executable in the path)
 echo exec('whoami');
 ? |
 What is going on here?
 And I often find such discrepancies in examples - and some wonder why I
 seem to be so stupid... and don't know the fundamentals... :-\

Others have shown how exec() returns the output.  If you use
shell_exec() it's the same as using the backticks:

?php echo `whoami`; ?

-or-

?php echo shell_exec(whoami); ?

You can use single quotes here also, i used double so you can easily
tell they are not backticks

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

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



Re: [PHP] possible session bug - Mantis Bug Tracker

2009-03-03 Thread Robert Cummings
On Tue, 2009-03-03 at 11:01 -0500, Edsall, William (WJ) wrote:
 Hello list!
  I'm having a strange problem with php after installing Mantis Bug
 Tracker. I'm not sure if this is a Mantis bug or a PHP bug but I'm
 leaning toward PHP.
 
  Here's what's going on. When I view an issue in Mantis, it is slow to
 spit out the text and often does not finish spitting out the text on the
 page. When it does this, the browser I was using is locked out from
 further communication to the server. If I delete the session file in use
 by this session, I am able to use the browser again immediately.
  
  I can't tell if this is a session bug or if Mantis is causing this bug.
 Please advise!

The lock aspect is a feature. Otherwise one session might clobber
another session's data. PHP locks sessions so new ones won't begin
processing until the lock is released. This is why only one page can run
at a time. The code can release the lock early if it is finished with
the session, but whatever Mantis is spending time on, is before it
releases the lock (or finishes the page if it uses the default release
mechanism).

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] whoami explanation

2009-03-03 Thread Robert Cummings
On Tue, 2009-03-03 at 11:03 -0500, PJ wrote:

 ok, ok, I found it but you guys are assuming that this is something
 everybody should know... hell, I've been tinkering with programming and
 unix etc. for many, many years and this is the first time I ran into
 back quotes.
 SORRY!

You're not tinkering hard enough then. Put your mouse down!

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] whoami explanation

2009-03-03 Thread PJ
Per Jessen wrote:
 PJ wrote:

   
 forgot to add:
 What's the difference between back ticks or quotes and regular single
 quotes?
 

 text in back ticks is executed via a shell, text in single quotes isn't.
   
Ok, but how does this relate to a command passed from a php Web page?
I don't understand the processus.
I use bash on my FreeBSD and have not needed a back quote yet that I can
recall... and on WinXP?
   
 How does one enter back quotes from the keyboard?

 

 Depends on your keyboard - on my current keyboard, the back tick is sat
 on the key to the left of '1' on the top row. 


 /Per
   
Found it. :-[  on a linux site and on my keyboard


-- 

Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com


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



Re: [PHP] whoami explanation

2009-03-03 Thread Daniel Brown
On Tue, Mar 3, 2009 at 11:16, PJ af.gour...@videotron.ca wrote:

 I don't think it's necessary to be sarcastic...

That's okay, I'll allow it anyway.

 Hate to disappoint you, but on my computer (FreeBSD 7.0) on Firefox
 Google does not go directly to the php manual... it goes to some nitwit
 site thinkexist.com

And I hate to disappoint you, but it's not related to the
operating system and browser being used --- it's a centralized remote
database in the form of a search engine.  The result you see with that
(unless you're using some particular language or locality preferences)
is the same I see, the same Per sees, the same Rob sees, the same we
all see.

 So, this list is a much better source of information that waddling
 through the crap that's thrown at you on G.
 And I find that Googie is getting pretty garbagy even if there is
 nothing better around ;-)

I agree with you on that.  What used to be a superior algorithm is
slowly and inevitably turning into a standard, run-of-the-mill search
engine that's being SPAM'ed and exploited with blackhat SEO crap that
certainly lowers the value of the results as a whole.

 As for the keyboard, this is the first time I have ever, ever needed the
 back quote key although I have occasionally needed the ~ key for Windows
 stuff.

Yeah, I think the only thing that Windows uses it for is
punctuation, but since ~1970 UNIX has used it for code execution
purposes.  Just keep in mind that, in PHP, it's run completely raw ---
so make sure you do your sanity checks before passing any kind of user
input to that (as always).

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

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



Re: [PHP] Re: whoami explanation

2009-03-03 Thread PJ
Shawn McKenzie wrote:
 PJ wrote:
   
 This really needs some explanation
 I found this on the web:
 ?php echo `whoami`; ?
 with it there was the comment the direction of those single-quotes matters
 (WHY ?)
 and it works

 But this (_*FROM THE PHP MANUAL***_ * -  exec()* executes the given
 /command/ ) does not,
 COPIED AND PASTED:
 |?php
 // outputs the username that owns the running php/httpd process
 // (on a system with the whoami executable in the path)
 echo exec('whoami');
 ? |
 What is going on here?
 And I often find such discrepancies in examples - and some wonder why I
 seem to be so stupid... and don't know the fundamentals... :-\
 

 Others have shown how exec() returns the output.  If you use
 shell_exec() it's the same as using the backticks:

 ?php echo `whoami`; ?

 -or-

 ?php echo shell_exec(whoami); ?

 You can use single quotes here also, i used double so you can easily
 tell they are not backticks
   
What is not clear to me is why would I need to use a shell? What kind of
situations call for it's use?

-- 

Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com


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



Re: [PHP] whoami explanation

2009-03-03 Thread Daniel Brown
On Tue, Mar 3, 2009 at 11:22, PJ af.gour...@videotron.ca wrote:

 Ok, but how does this relate to a command passed from a php Web page?
 I don't understand the processus.
 I use bash on my FreeBSD and have not needed a back quote yet that I can
 recall... and on WinXP?

As in the email I just sent, remember to sanitize any commands
passed from the web (or anywhere, for that matter), but here are some
examples.

?php

$name = Dan;

echo Hello, my name is $name.; // Output: Hello, my name is Dan.
echo 'Hello, my name is $name.'; // Output: Hello, my name is $name.
echo `Hello, my name is $name.`; // Will run Hello, my name is
Dan. run as a shell command.

$name = `whoami`; // Presume that your Linux web server is as user 'apache'.

echo Hello, my name is $name.; // Output: Hello, my name is apache.;
echo 'Hello, my name is $name.'; // Output: Hello, my name is $name.
?

Single quotes means literal, double quotes means translatable, and
backticks means executable.

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

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



Re: [PHP] Re: whoami explanation

2009-03-03 Thread Daniel Brown
On Tue, Mar 3, 2009 at 11:27, PJ af.gour...@videotron.ca wrote:

 What is not clear to me is why would I need to use a shell? What kind of
 situations call for it's use?

On what kind of programming did you spend those years?

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

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



[PHP] Re: Problems with displaying results

2009-03-03 Thread Shawn McKenzie
Terion Miller wrote:
 I have two queries one pulls out which users to use and the second pulls
 those users orders
 Looks something like this but is only pulling the first record:
 
 
 $query =  SELECT `UserName`, `AdminID` FROM admin
   WHERE   Key1 =  'YES' ;
 
 $result = mysql_query ($query) ;
 $row = mysql_fetch_assoc($result);
 
 //Reveal Variables for Debugging
 // include(VariableReveal2.php);
  echo (Hello br);
 //echo $row['AdminID'];
 echo ($row['UserName']);
 
 
 
 
 if ($row['Key1'] == NO) {
 header (Location: Welcome.php?AdminID=$AdminIDmsg=Sorry, you do
 not have access to that page.);
 }
 
 if (isset($_GET['SortBy'])) {$SortBy = $_GET['SortBy'];} else {$SortBy =
 'WorkOrderID DESC';}
 if (isset($_GET['Page'])) {$Page = $_GET['Page'];} else {$Page = 1;}
 
 $PerPage = 30;
 $StartPage = ($Page - 1) * $PerPage;
 
 second query here is using the $row from the first (and yes I know
 not to use *, just did so here to keep post shorter)
 
  $sql= SELECT * FROM workorders WHERE AdminID =
 '.$row['AdminID'].' ;
   // $sql .= ORDER BY $SortBy LIMIT $StartPage, $PerPage;
   $result = mysql_query ($sql);
   $row2 = mysql_fetch_assoc($result);
   $Total = ceil(mysql_num_rows($result)/$PerPage);
 
 
 So this works but only half way as it only displays the first record in
 the table.
 
 
 
 
 Thanks
 Terion
 
 Happy Freecycling
 Free the List !!
 www.freecycle.org
 Over Moderation of Freecycle List Prevents Post Timeliness.
 
 Twitter?
 http://twitter.com/terionmiller
 
 Facebook:
 a href=http://www.facebook.com/people/Terion-Miller/1542024891;
 title=Terion Miller's Facebook profile target=_TOPimg src=
 http://badge.facebook.com/badge/1542024891.237.919247960.png; border=0
 alt=Terion Miller's Facebook profile/a
 Groucho Marx  - I have had a perfectly wonderful evening, but this wasn't
 it.
 

You need to lookup the mysql_fetch_assoc() function.  It only returns
one row from a result set that may contain multiple rows.  You need
something like:

while($row = mysql_fetch_assoc($result)) {
  // do something with $row
}

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

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



RE: [PHP] Re: whoami explanation

2009-03-03 Thread Bob McConnell
From: PJ
 
 What is not clear to me is why would I need to use a shell? What kind
of
 situations call for it's use?

It's a matter of expectations. I am still trying to figure out why
anyone would want a GUI on any version of Unix or Linux. They just slow
me down and make it very difficult to do any real work.

Bob McConnell

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



Re: [PHP] Re: whoami explanation

2009-03-03 Thread Robert Cummings
On Tue, 2009-03-03 at 11:27 -0500, PJ wrote:
 Shawn McKenzie wrote:
  PJ wrote:

  This really needs some explanation
  I found this on the web:
  ?php echo `whoami`; ?
  with it there was the comment the direction of those single-quotes 
  matters
  (WHY ?)
  and it works
 
  But this (_*FROM THE PHP MANUAL***_ * -  exec()* executes the given
  /command/ ) does not,
  COPIED AND PASTED:
  |?php
  // outputs the username that owns the running php/httpd process
  // (on a system with the whoami executable in the path)
  echo exec('whoami');
  ? |
  What is going on here?
  And I often find such discrepancies in examples - and some wonder why I
  seem to be so stupid... and don't know the fundamentals... :-\
  
 
  Others have shown how exec() returns the output.  If you use
  shell_exec() it's the same as using the backticks:
 
  ?php echo `whoami`; ?
 
  -or-
 
  ?php echo shell_exec(whoami); ?
 
  You can use single quotes here also, i used double so you can easily
  tell they are not backticks

 What is not clear to me is why would I need to use a shell? What kind of
 situations call for it's use?

You must be a point and clicker. Many, many, many people use the shell
to perform basic system administration, edit config files, even edit
source code. There are thousands of shell commands available at the
touch of your fingertips while in a shell. Using the backticks or exec()
function allows one to utilize these programs as part of a larger
program.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] Re: whoami explanation

2009-03-03 Thread Shawn McKenzie
PJ wrote:
 Shawn McKenzie wrote:
 PJ wrote:
   
 This really needs some explanation
 I found this on the web:
 ?php echo `whoami`; ?
 with it there was the comment the direction of those single-quotes matters
 (WHY ?)
 and it works

 But this (_*FROM THE PHP MANUAL***_ * -  exec()* executes the given
 /command/ ) does not,
 COPIED AND PASTED:
 |?php
 // outputs the username that owns the running php/httpd process
 // (on a system with the whoami executable in the path)
 echo exec('whoami');
 ? |
 What is going on here?
 And I often find such discrepancies in examples - and some wonder why I
 seem to be so stupid... and don't know the fundamentals... :-\
 
 Others have shown how exec() returns the output.  If you use
 shell_exec() it's the same as using the backticks:

 ?php echo `whoami`; ?

 -or-

 ?php echo shell_exec(whoami); ?

 You can use single quotes here also, i used double so you can easily
 tell they are not backticks
   
 What is not clear to me is why would I need to use a shell? What kind of
 situations call for it's use?
 

Well, if you need to run any executable on the server to have it do
something or return something.  Whether you need to get some information
from the system or run an executable that does something specific.
Maybe you want to do a 'ps -ef' to get processes on linux, or maybe you
want to start a service on windows 'netstart SOMESERVICE'.

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

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



Re: [PHP] whoami explanation

2009-03-03 Thread PJ
Daniel Brown wrote:
 On Tue, Mar 3, 2009 at 11:22, PJ af.gour...@videotron.ca wrote:
   
 Ok, but how does this relate to a command passed from a php Web page?
 I don't understand the processus.
 I use bash on my FreeBSD and have not needed a back quote yet that I can
 recall... and on WinXP?
 

 As in the email I just sent, remember to sanitize any commands
 passed from the web (or anywhere, for that matter), but here are some
 examples.

 ?php

 $name = Dan;

 echo Hello, my name is $name.; // Output: Hello, my name is Dan.
 echo 'Hello, my name is $name.'; // Output: Hello, my name is $name.
 echo `Hello, my name is $name.`; // Will run Hello, my name is
 Dan. run as a shell command.

 $name = `whoami`; // Presume that your Linux web server is as user 
 'apache'.

 echo Hello, my name is $name.; // Output: Hello, my name is apache.;
 echo 'Hello, my name is $name.'; // Output: Hello, my name is $name.
 ?

 Single quotes means literal, double quotes means translatable, and
 backticks means executable.
   
I'll try to digest all this today if not sooner... :-)
As to the sanitize, that is on my list of todos; I am not doing it as,
for the moment, I am only developing on my intranet server and do not
fear much external threats... anyway, inch Allah :-)
I appreciate the input and I take the chastizing with a ton of salt.

-- 

Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com


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



Re: [PHP] whoami explanation

2009-03-03 Thread Daniel Brown
On Tue, Mar 3, 2009 at 11:41, PJ af.gour...@videotron.ca wrote:

 I appreciate the input and I take the chastizing with a ton of salt.

It's all in good fun and being the new guy, it's at your expense.  ;-P

Having thick skin means you'll stick around and probably learn a
lot from the folks on this list.  So welcome.

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

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



Re: [PHP] Re: whoami explanation

2009-03-03 Thread PJ
Daniel Brown wrote:
 On Tue, Mar 3, 2009 at 11:27, PJ af.gour...@videotron.ca wrote:
   
 What is not clear to me is why would I need to use a shell? What kind of
 situations call for it's use?
 

 On what kind of programming did you spend those years?
   
Not really programming, more like overseeing the programming of others
(as a client) and trying to fix their awful mistakes about which I
learned from lists on the Net. I tinkered with some basic stuff and
looked into machine code back around `82... never very serious...
Now I'm trying to modify my daughter's ptahhotep.com to use MySql. It's
a learning experience.
My real profession if director and director of photography in motion
pictures and tv. :-D
I appreciate the help I'm getting here and the fact that I am tolerated
here (maybe just)...


-- 

Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com


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



Re: [PHP] Re: whoami explanation

2009-03-03 Thread PJ
Bob McConnell wrote:
 From: PJ
   
 What is not clear to me is why would I need to use a shell? What kind
 
 of
   
 situations call for it's use?
 

 It's a matter of expectations. I am still trying to figure out why
 anyone would want a GUI on any version of Unix or Linux. They just slow
 me down and make it very difficult to do any real work.

 Bob McConnell
   
Ok, I thought I understood. The only programs I use that are non-shell
on FreeBSD are openoffice  and FireFox3, and sometimes Gimp. I use the
shell for administration of the server and program installation and
maintenance... I suppose a shell on Windows would be the cmd but I never
thought of it as a shell. :-)

-- 

Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com


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



Re: [PHP] Re: whoami explanation

2009-03-03 Thread Daniel Brown
On Tue, Mar 3, 2009 at 11:48, PJ af.gour...@videotron.ca wrote:

[snip!]
 Now I'm trying to modify my daughter's ptahhotep.com to use MySql. It's
 a learning experience.

Through the years I've probably sounded like a broken record or
like I'm paid to endorse them or something, but I'd recommend checking
out PHPBuilder for some of this.  Specifically:

http://phpbuilder.com/columns/index.php3?cat=1subcat=2

Some other great sites for code snippets and examples are from
folks here on this list:

http://webbytedd.com/a.php
http://phpguru.org/

 and, of course, it should go without saying that Google and
the manual should be your first stop.


-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

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



Re: [PHP] whoami explanation

2009-03-03 Thread PJ
Daniel Brown wrote:
 On Tue, Mar 3, 2009 at 11:41, PJ af.gour...@videotron.ca wrote:
   
 I appreciate the input and I take the chastizing with a ton of salt.
 

 It's all in good fun and being the new guy, it's at your expense.  ;-P

 Having thick skin means you'll stick around and probably learn a
 lot from the folks on this list.  So welcome.

   
:-*

-- 

Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com


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



Re: [PHP] Re: Problems with displaying results

2009-03-03 Thread Kyle Terry
On Tue, Mar 3, 2009 at 8:32 AM, Shawn McKenzie nos...@mckenzies.net wrote:

 Terion Miller wrote:
  I have two queries one pulls out which users to use and the second pulls
  those users orders
  Looks something like this but is only pulling the first record:
 
 
  $query =  SELECT `UserName`, `AdminID` FROM admin
WHERE   Key1 =  'YES' ;
 
  $result = mysql_query ($query) ;
  $row = mysql_fetch_assoc($result);
 
  //Reveal Variables for Debugging
  // include(VariableReveal2.php);
   echo (Hello br);
  //echo $row['AdminID'];
  echo ($row['UserName']);
 
 
 
 
  if ($row['Key1'] == NO) {
  header (Location: Welcome.php?AdminID=$AdminIDmsg=Sorry, you do
  not have access to that page.);
  }
 
  if (isset($_GET['SortBy'])) {$SortBy = $_GET['SortBy'];} else {$SortBy =
  'WorkOrderID DESC';}
  if (isset($_GET['Page'])) {$Page = $_GET['Page'];} else {$Page = 1;}
 
  $PerPage = 30;
  $StartPage = ($Page - 1) * $PerPage;
 
  second query here is using the $row from the first (and yes I
 know
  not to use *, just did so here to keep post shorter)
 
   $sql= SELECT * FROM workorders WHERE AdminID =
  '.$row['AdminID'].' ;
// $sql .= ORDER BY $SortBy LIMIT $StartPage, $PerPage;
$result = mysql_query ($sql);
$row2 = mysql_fetch_assoc($result);
$Total = ceil(mysql_num_rows($result)/$PerPage);
 
 
  So this works but only half way as it only displays the first record
 in
  the table.
 
 
 
 
  Thanks
  Terion
 
  Happy Freecycling
  Free the List !!
  www.freecycle.org
  Over Moderation of Freecycle List Prevents Post Timeliness.
  
  Twitter?
  http://twitter.com/terionmiller
  
  Facebook:
  a href=http://www.facebook.com/people/Terion-Miller/1542024891;
  title=Terion Miller's Facebook profile target=_TOPimg src=
  http://badge.facebook.com/badge/1542024891.237.919247960.png; border=0
  alt=Terion Miller's Facebook profile/a
  Groucho Marx  - I have had a perfectly wonderful evening, but this
 wasn't
  it.
 

 You need to lookup the mysql_fetch_assoc() function.  It only returns
 one row from a result set that may contain multiple rows.  You need
 something like:

 while($row = mysql_fetch_assoc($result)) {
  // do something with $row
 }

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

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

 You also need to filter your user inputted data.


Kyle Terry | www.kyleterry.com
Help kick start VOOM (Very Open Object Model) for a library of PHP classes.
http://www.voom.me | IRC EFNet #voom


Re: [PHP] whoami explanation

2009-03-03 Thread Daniel Brown
On Tue, Mar 3, 2009 at 11:59, PJ af.gour...@videotron.ca wrote:

 :-*

Umm thanks?

(You do know that's the emoticon to symbolize kissing, right?)

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

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



Re: [PHP] Re: whoami explanation

2009-03-03 Thread PJ
Daniel Brown wrote:
 On Tue, Mar 3, 2009 at 11:48, PJ af.gour...@videotron.ca wrote:
   
 [snip!]
   
 Now I'm trying to modify my daughter's ptahhotep.com to use MySql. It's
 a learning experience.
 

 Through the years I've probably sounded like a broken record or
 like I'm paid to endorse them or something, but I'd recommend checking
 out PHPBuilder for some of this.  Specifically:

 http://phpbuilder.com/columns/index.php3?cat=1subcat=2

 Some other great sites for code snippets and examples are from
 folks here on this list:

 http://webbytedd.com/a.php
 http://phpguru.org/

  and, of course, it should go without saying that Google and
 the manual should be your first stop.
   
Oh, I do go through some of that and when my brain has turned to php
mush, I turn to you guys to get my thrashing (and pretty good results) O:-)

-- 

Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com


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



[PHP] Re: [PHP-DB] Re: Problems with displaying results

2009-03-03 Thread Terion Miller
On Tue, Mar 3, 2009 at 10:32 AM, Shawn McKenzie nos...@mckenzies.netwrote:

 Terion Miller wrote:
  I have two queries one pulls out which users to use and the second pulls
  those users orders
  Looks something like this but is only pulling the first record:
 
 
  $query =  SELECT `UserName`, `AdminID` FROM admin
WHERE   Key1 =  'YES' ;
 
  $result = mysql_query ($query) ;
  $row = mysql_fetch_assoc($result);
 
  //Reveal Variables for Debugging
  // include(VariableReveal2.php);
   echo (Hello br);
  //echo $row['AdminID'];
  echo ($row['UserName']);
 
 
 
 
  if ($row['Key1'] == NO) {
  header (Location: Welcome.php?AdminID=$AdminIDmsg=Sorry, you do
  not have access to that page.);
  }
 
  if (isset($_GET['SortBy'])) {$SortBy = $_GET['SortBy'];} else {$SortBy =
  'WorkOrderID DESC';}
  if (isset($_GET['Page'])) {$Page = $_GET['Page'];} else {$Page = 1;}
 
  $PerPage = 30;
  $StartPage = ($Page - 1) * $PerPage;
 
  second query here is using the $row from the first (and yes I
 know
  not to use *, just did so here to keep post shorter)
 
   $sql= SELECT * FROM workorders WHERE AdminID =
  '.$row['AdminID'].' ;
// $sql .= ORDER BY $SortBy LIMIT $StartPage, $PerPage;
$result = mysql_query ($sql);
$row2 = mysql_fetch_assoc($result);
$Total = ceil(mysql_num_rows($result)/$PerPage);
 
 
  So this works but only half way as it only displays the first record
 in
  the table.
 
 
 
 
  Thanks
  Terion
 
  Happy Freecycling
  Free the List !!
  www.freecycle.org
  Over Moderation of Freecycle List Prevents Post Timeliness.
  
  Twitter?
  http://twitter.com/terionmiller
  
  Facebook:
  a href=http://www.facebook.com/people/Terion-Miller/1542024891;
  title=Terion Miller's Facebook profile target=_TOPimg src=
  http://badge.facebook.com/badge/1542024891.237.919247960.png; border=0
  alt=Terion Miller's Facebook profile/a
  Groucho Marx  - I have had a perfectly wonderful evening, but this
 wasn't
  it.
 

 You need to lookup the mysql_fetch_assoc() function.  It only returns
 one row from a result set that may contain multiple rows.  You need
 something like:

 while($row = mysql_fetch_assoc($result)) {
  // do something with $row
 }

 ---

well I looked it up in my book and tried this example but still get the same
thing, the first record

$result = mysql_query ($query) ;
//$row = mysql_fetch_array($result);
while ($row = mysql_fetch_row($result)){
for ($i=0; $imysql_num_fields($result); $i++)
echo $row[$i] .  ;
//print a return for neatness sake
echo \n;


Re: [PHP] whoami explanation

2009-03-03 Thread PJ
Daniel Brown wrote:
 On Tue, Mar 3, 2009 at 11:59, PJ af.gour...@videotron.ca wrote:
   
 :-*
 

 Umm thanks?

 (You do know that's the emoticon to symbolize kissing, right?)

   
Let's not get too personnal here... it was meant to blow a kiss of
appreciation to all... ;-)
I may not be gay, but I love my gay friends... and I do  not mean in the
way Jimmy Carter's translators goofed when he went to Poland and
announced that he wanted to get to know the polish people - the
translation came out as wanting to know them carnally - you get the gist.

-- 

Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com


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



Re: [PHP] whoami explanation

2009-03-03 Thread Daniel Brown
On Tue, Mar 3, 2009 at 12:13, PJ af.gour...@videotron.ca wrote:

 Let's not get too personnal here... it was meant to blow a kiss of
 appreciation to all... ;-)
 I may not be gay, but I love my gay friends... and I do  not mean in the
 way Jimmy Carter's translators goofed when he went to Poland and
 announced that he wanted to get to know the polish people - the
 translation came out as wanting to know them carnally - you get the gist.

Ah, to be a leader and represent the nation

Kennedy tells Germany that he's a pastry; Carter tells Poland that
he wants to be *very* friendly; Bush, Sr. offers his dinner back to
the folks of Japan; Dubya walks around holding hands a little too long
with the Saudi king.

We must look like the clown portion of the world circus sometimes

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

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



Re: [PHP] whoami explanation

2009-03-03 Thread Robert Cummings
On Tue, 2009-03-03 at 12:17 -0500, Daniel Brown wrote:
 On Tue, Mar 3, 2009 at 12:13, PJ af.gour...@videotron.ca wrote:
 
  Let's not get too personnal here... it was meant to blow a kiss of
  appreciation to all... ;-)
  I may not be gay, but I love my gay friends... and I do  not mean in the
  way Jimmy Carter's translators goofed when he went to Poland and
  announced that he wanted to get to know the polish people - the
  translation came out as wanting to know them carnally - you get the gist.
 
 Ah, to be a leader and represent the nation
 
 Kennedy tells Germany that he's a pastry; Carter tells Poland that
 he wants to be *very* friendly; Bush, Sr. offers his dinner back to
 the folks of Japan; Dubya walks around holding hands a little too long
 with the Saudi king.
 
 We must look like the clown portion of the world circus sometimes

You have an extraneous sometimes in the above sentence!

;)

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] whoami explanation

2009-03-03 Thread Daniel Brown
On Tue, Mar 3, 2009 at 12:37, Robert Cummings rob...@interjinn.com wrote:

 You have an extraneous sometimes in the above sentence!

Yeah, I was waiting for that ;-P

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

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



Re: [PHP] whoami explanation

2009-03-03 Thread Paul M Foster
On Tue, Mar 03, 2009 at 10:57:21AM -0500, PJ wrote:

snip

 How does one enter back quotes from the keyboard?

Tell me you didn't seriously just ask that question.

Paul
-- 
Paul M. Foster

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



[PHP] IasisNet.org Free Medical Resources-Doctors Online Community! Newsletter for 03/03/2009

2009-03-03 Thread IasisNet
This is not SPAM, if you want to unsubscribe just reply to this message with 
subject unsubscribe.

IasisNet.org Free Medical Resources-Doctors Online Community! Newsletter for 
03/03/2009:

 News Young ex-servicemen at increased risk of suicide 
 News Alcohol abuse may lead to depression risk, rath... 
 News Babies Learn Music While Asleep 
 Weird News Missouri farmer's male calf born with two heads 
 News Chinese children get free measles vaccine inocul.. 
 News Conjoined Twins of Egypt Separated in Saudi Hosp.. 
 News Milk Could be Insurance Against Alzheimer’s Dise.. 
 Funny News Two Australians Fined for Riding Bicycles Nude 
 Funny News Fake Prostitutes and Drug Dealers Abound In Soho.. 
 News Ex vivo neural stem cell expansion 
 Weird News Skeleton found in Fontana chimney is identified 
 News New Zealand Reports High Rates of Gut Infections 
 News Healthy Eating, Exercise Could Reduce Cancers by.. 
 News Newly discovered gene plays vital role in cancer 
 News Download Iasis Free EMR-EHR Practice Management 
 News Lung Cancer practical way to detect early: study 
 Funny News Woman, 70, whacks intruder in head with sauce pan 
 Weird News Teenager burned trying to kill head lice with gas 
 Weird News Bullet holes found after Mo. death ruled natural 
 News New tool guides doctors to save cancer patients'.. 

  Latest Medical News From IasisNet.org. 

Also Register!!! and

List your medical related blog, website etc.

Add To Your Site Our Latest Medical News

Post your events (Congresses etc.)

Publish your News

Get free medical records software (Iasis Free EMR-EHR Practice Management V 
1.0.0.301)

See All Forums or Search 

Contacts Us if :

You want to Have a forum related to your subject inside iasisnet.org

Ref :  
Recipients Current Total  : 118.521Updated Daily 
Submited Every :  Monday-Tuesday 
To : Medical/Health Related Recipients 


 Bests Regards

2008-2009 IasisNet.org
All Rights Reserved

Re: [PHP] Re: whoami explanation

2009-03-03 Thread Paul M Foster
On Tue, Mar 03, 2009 at 11:27:08AM -0500, PJ wrote:

snip

 What is not clear to me is why would I need to use a shell? What kind of
 situations call for it's use?

If you don't know the answer to that question, why would you ask the
original question? If you don't believe you don't have a use for this
material, don't worry about it. At the least, examine a book on the
subject, rather than asking questions here. If this was a
mission-critical part of your project and you need an immediate answer
now, then I understand asking the question here. But if the whole thing
is hypothetical, take the opportunity to read up on it; it's not
critical to your work at this point.

And asking us where a character is on your keyboard? Come on.

I'm the first guy in line to answer newbie questions if I can. And I've
castigated list members for framing their answers in a way which would
be impossible for newbies to understand. And I understand how things can
get confusing to newbies. But I sometimes reach a point where I begin to
wonder whether a newbie is actually paying attention. Or whether a
newbie is really just playing around, wasting our time because he won't
take the time to buy a book or carefully research an item on the web.

And FWIW, php.net has better documentation than that of any
other package I've ever seen. I keep a browser tab open to php.net at
all times.

Paul

-- 
Paul M. Foster

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



[PHP] How important is your Express or Web Edition database? Please weigh in--

2009-03-03 Thread Stan Stadelman
Thank you to everyone who participated in the survey, or who posted to the
thread!

To cover some of the responses:

Yes, web-edition is a reduced-functionality version.  Typically they're
capped at 4GB, a la MSSQL Express Edition.

Our (Sybase) Web-Edition has no volume restriction, but access is limited to
web fronts.  The SQL Anywhere engineering team has solved the
offline/synching issue for local-store db's, such that you can run your php
locally, and provision/sync when connected.  It's likely that we'll deliver
this through the Web Edition, thus my queries.

Ash - I got the feedback, thanks!

Cheers--

-- 
Stan Stadelman
(925) 336-6473
s...@berkeley.edu
stanley.stadel...@sybase.com


[PHP] Cache engines in a multi-tenant environment (a bit long)

2009-03-03 Thread Damon Miller
Hi all.  I need some guidance on implementing a PHP cache engine in a
multi-tenant environment.  I've done some research on the open-source
cache engines available--specifically, APC, XCache, and
eAccelerator--but I haven't found anything that speaks to my use case.
Hopefully someone will be able to point me in the right direction.


Here's the basic use case:  I've got multiple instances of one PHP
application running on a single server.  This is accomplished in a
fairly straightforward manner:  We just create multiple copies of the
application on the filesystem.  It looks something like this:

/var/www/html/abc
/var/www/html/def
/var/www/html/ghi

Etc.


Each of the directories above ('abc', 'def', and 'ghi') contains a
complete copy of the PHP applicationwith slight variations based on
customer need.  Examples of these differences are LDAP parameters,
layout customizations, field names, etc.  Note that these variations
often occur in the PHP code, i.e. there will be multiple occurrences of
file ldap.php 


This works without incident but due to increasing adoption, performance
has become an issue.  In an attempt to improve performance, I
implemented APC.  This resulted in a significant performance gain, but
after several days we noticed intermittent problems that clearly
indicated one instance's code was being leaked to another instance.
As a specific example, we began seeing one customner's layout changes in
another instance.  These were quite obvious in that a field bearing the
wrong company name suddenly appeared.


After ruling out obvious filesystem mistakes I was forced to conclude
that the cache engine was serving the wrong version of a file.  I
enclose that in quotes because APC may technically doing the right
thing; given multiple copies of the same source file--as would
frequently occur in our environment--it cached the latest one and served
it up as requested.  However, this behavior is not compatible with our
hosting approach.


My question then becomes the following:  Is there a cache engine
available which can store multiple (different) copies of a source file
and serve them only to the appropriate request?  Perhaps a better way to
describe this would be a sort of mapping feature allowing
per-directory control.  I'm imagining a simple list of directories that
instructs the cache engine to keep their caches separate.  This might
even be implemented by incorporating the directory name into the key
used for lookups, but frankly I haven't spent much time looking at APC's
code (nor have I looked at XCache's or eAccelerator's at all.)


Thanks in advance for any guidance.



Regards,

Damon

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



[PHP] Re: Can't set expect.timeout

2009-03-03 Thread Clement Yui-Wah Lee

Dear friends,

I am still hoping to get an answer to this question (see 
below).  Kindly please see if you can run the test on your site.


Any insight is very much welcome!

Clement

Clement Yui-Wah Lee wrote:

Hi,

Apparently I can't set the value for expect.timeout to any values other 
than 0 (the default is 10).  Can someone try the following script and 
see if you see the same problem as me?  My php is 5.1.6, php-expect is 
0.2.4, the platform is a Redhat Enterprise Linux 5.3


Test method:

1. Drop the following script onto your php server machine (use a 
different ini_set() line in each successive test).


2. Use a browser to execute the script and see what phpinfo() would 
return the value for expect.timeout (and expect.logfile)



?php
// ini_set(expect.timeout, 0); // This worked
// ini_set(expect.timeout, 0); // This worked
// ini_set(expect.timeout, 1); // No effect
// ini_set(expect.timeout, 5); // No effect
// ini_set(expect.timeout, 5); // No effect
ini_set(expect.timeout, 50); // No effect

ini_set(expect.logfile, /tmp/tmp); // This worked
phpinfo();

?

Thanks!

Clement




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



Re: [PHP] Cache engines in a multi-tenant environment (a bit long)

2009-03-03 Thread Robert Cummings
On Tue, 2009-03-03 at 11:41 -0800, Damon Miller wrote:

 My question then becomes the following:  Is there a cache engine
 available which can store multiple (different) copies of a source file
 and serve them only to the appropriate request?  Perhaps a better way
 to
 describe this would be a sort of mapping feature allowing
 per-directory control.  I'm imagining a simple list of directories
 that
 instructs the cache engine to keep their caches separate.  This might
 even be implemented by incorporating the directory name into the key
 used for lookups, but frankly I haven't spent much time looking at
 APC's
 code (nor have I looked at XCache's or eAccelerator's at all.)

If the path to the source file differs then it shouldn't matter that the
source tree is a copy, for all intents and purposes, as far as an
accelerator is concerned, the sources are different. I've not liked APC
in the past (I don't remember exactly what the problem was) and
personally use eAccelerator.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



[PHP] Re: Question about template systems

2009-03-03 Thread Martin Zvarík

Matthew Croud napsal(a):

Hello,

First post here, I'm in the process of learning PHP , I'm digesting a 
few books as we speak.
I'm working on a content heavy website that provides a lot of 
information, a template system would be great and so i've been looking 
at ways to create dynamic data with a static navigation system.


So far, using the require_once(); function seems to fit the bill in 
order to bring in the same header html file on each page.

I've also looked at Smartys template system.



If you are looking for performance stick to Blitz PHP - the only true 
template system.


Martin


Thanks for any help you can provide :)

Matt.
 


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



Re: [PHP] Re: Can't set expect.timeout

2009-03-03 Thread Robert Cummings
On Tue, 2009-03-03 at 14:49 -0500, Clement Yui-Wah Lee wrote:
 Dear friends,
 
 I am still hoping to get an answer to this question (see 
 below).  Kindly please see if you can run the test on your site.
 
 Any insight is very much welcome!
 
 Clement
 
 Clement Yui-Wah Lee wrote:
  Hi,
  
  Apparently I can't set the value for expect.timeout to any values other 
  than 0 (the default is 10).  Can someone try the following script and 
  see if you see the same problem as me?  My php is 5.1.6, php-expect is 
  0.2.4, the platform is a Redhat Enterprise Linux 5.3
  
  Test method:
  
  1. Drop the following script onto your php server machine (use a 
  different ini_set() line in each successive test).
  
  2. Use a browser to execute the script and see what phpinfo() would 
  return the value for expect.timeout (and expect.logfile)
  
  
  ?php
  // ini_set(expect.timeout, 0); // This worked
  // ini_set(expect.timeout, 0); // This worked

Are you sure this isn't just the default value before you attempted an
ini_set()? It may be that expect.timeout is not accessible at runtime.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] Re: Can't set expect.timeout

2009-03-03 Thread Clement Yui-Wah Lee

Dear Rob,

The default value of expect.timeout is 10 (minutes), which 
is what I would get if I don't do any ini_set().  I could 
set the value to 0 but not to any values.


What do you mean by inaccessible at runtime?  I could set 
another  related parameter expect.logfile to, say, 
/tmp/tmp (as reported by phpinfo()).


This problem looks like a bug to me.  I will be most 
grateful if someone can try out the test program on their 
site.  Thanks in advance!


Clement

Robert Cummings wrote:

On Tue, 2009-03-03 at 14:49 -0500, Clement Yui-Wah Lee wrote:

Dear friends,

I am still hoping to get an answer to this question (see 
below).  Kindly please see if you can run the test on your site.


Any insight is very much welcome!

Clement

Clement Yui-Wah Lee wrote:

Hi,

Apparently I can't set the value for expect.timeout to any values other 
than 0 (the default is 10).  Can someone try the following script and 
see if you see the same problem as me?  My php is 5.1.6, php-expect is 
0.2.4, the platform is a Redhat Enterprise Linux 5.3


Test method:

1. Drop the following script onto your php server machine (use a 
different ini_set() line in each successive test).


2. Use a browser to execute the script and see what phpinfo() would 
return the value for expect.timeout (and expect.logfile)



?php
// ini_set(expect.timeout, 0); // This worked
// ini_set(expect.timeout, 0); // This worked


Are you sure this isn't just the default value before you attempted an
ini_set()? It may be that expect.timeout is not accessible at runtime.

Cheers,
Rob.



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



Re: [PHP] whoami explanation

2009-03-03 Thread Ashley Sheridan
On Tue, 2009-03-03 at 11:16 -0500, PJ wrote:
 Daniel Brown wrote:
  On Tue, Mar 3, 2009 at 10:57, PJ af.gour...@videotron.ca wrote:

  forgot to add:
  What's the difference between back ticks or quotes and regular single
  quotes?
  How does one enter back quotes from the keyboard?
  
 
  Welcome to the Internet!
 
  The first place you should look when you have a question is on
  Google.  The first result that comes up for backtick operator is the
  PHP manual itself:
 
  http://php.net/language.operators.execution
 
  If you don't know where a key is on your keyboard, please look down.
 

 I don't think it's necessary to be sarcastic...
 Hate to disappoint you, but on my computer (FreeBSD 7.0) on Firefox
 Google does not go directly to the php manual... it goes to some nitwit
 site thinkexist.com
 So, this list is a much better source of information that waddling
 through the crap that's thrown at you on G.
 And I find that Googie is getting pretty garbagy even if there is
 nothing better around ;-)
 As for the keyboard, this is the first time I have ever, ever needed the
 back quote key although I have occasionally needed the ~ key for Windows
 stuff.
 
 -- 
 
 Phil Jourdan --- p...@ptahhotep.com
http://www.ptahhotep.com
http://www.chiccantine.com
 
 
You tinker on Unix and you only ever use ~ for Windows?!


Ash
www.ashleysheridan.co.uk


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



[PHP] Whats the correct syntax for using query results in a new query

2009-03-03 Thread Terion Miller
I'm trying to use the AdminID that returns from query #1 in the WHERE
AdminID = AdminID from Query 1

$sql= SELECT WorkOrderID, CreatedDate, Location, WorkOrderName,
AdminID, FormName, Status, Notes, pod FROM `workorders` WHERE AdminID =
'.$row['AdminID'].' ;

that isn't working and the query 1 does return in this case 3 AdminID's so
I'm thinking it's just the .$row['AdminID'] part that is wrong
and I have tried some different things but am not sure the correct term for
what I'm trying to do so I can' t seem to google answers

Here is my query #1

  $query =  SELECT `UserName`, `AdminID` FROM admin
  WHERE   Retail1 =  'YES' ;

$result = mysql_query ($query) ;
//$row = mysql_fetch_array($result);
while ($row = mysql_fetch_row($result)){
for ($i=0; $imysql_num_fields($result); $i++)
echo $row[$i] .  ;

}
Above returns 3 AdminID ... I also tried using the While statement in my
second query to return the sets but nothing... yet the code isn't breaking,
just returning 0

Thanks
Terion

Happy Freecycling
Free the List !!
www.freecycle.org
Over Moderation of Freecycle List Prevents Post Timeliness.

Twitter?
http://twitter.com/terionmiller

Facebook:
a href=http://www.facebook.com/people/Terion-Miller/1542024891;
title=Terion Miller's Facebook profile target=_TOPimg src=
http://badge.facebook.com/badge/1542024891.237.919247960.png; border=0
alt=Terion Miller's Facebook profile/a
Joe DiMaggio  - Pair up in threes.


Re: [PHP] upload progress (was www.soongy.com)

2009-03-03 Thread Ashley Sheridan
On Tue, 2009-03-03 at 02:20 -0800, mike wrote:
 On Tue, Mar 3, 2009 at 12:02 AM, Ashley Sheridan
 a...@ashleysheridan.co.uk wrote:
 
  Whoever said anything about open FTP?
 
 how else do you do it?
 
 either it's open/anonymous, or some hardcoded account info. either
 way, not very secure, and due to the nature of it, kinda requires the
 user to have enough privileges to upload N files of X bytes (you could
 put quotas on it, chroot it, blahblah... but still)
 
The way I've done it for a system at work (it is for staff and clients
only, so I guess that offers some protection) is to use scripts in
conjunction with vsftp. Accounts are managed through an admin web
interface, and each user has their own login credentials. Admittedly,
the username and password are passed as plain text for it to auto
log-in, but afaik, that happens with standard FTP anyway (unencrypted
connections). This is more than likely overkill for this situation, but
I had to resort to it as the system has to handle files over 2GB, and
file upload forms are just not meant to handle that kind of load in the
upstream!


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Re: Question about template systems

2009-03-03 Thread Ashley Sheridan
On Tue, 2009-03-03 at 20:53 +0100, Martin Zvarík wrote:
 Matthew Croud napsal(a):
  Hello,
  
  First post here, I'm in the process of learning PHP , I'm digesting a 
  few books as we speak.
  I'm working on a content heavy website that provides a lot of 
  information, a template system would be great and so i've been looking 
  at ways to create dynamic data with a static navigation system.
  
  So far, using the require_once(); function seems to fit the bill in 
  order to bring in the same header html file on each page.
  I've also looked at Smartys template system.
 
 
 If you are looking for performance stick to Blitz PHP - the only true 
 template system.
 
 Martin
 
  Thanks for any help you can provide :)
  
  Matt.
   
 
For now, while you're learning about PHP, I'd use an existing template
system and tweak it to your needs. As you learn more, and need something
a little more bespoke, then you can look at making one yourself based on
what you've learnt about the coding and about existing template systems.
I've never used any myself, so I can't comment from first-hand
experience, but perhaps the Wikipedia entry may be of some help:
http://en.wikipedia.org/wiki/Template_engine_(web) 


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] possible session bug - Mantis Bug Tracker

2009-03-03 Thread Ashley Sheridan
On Tue, 2009-03-03 at 11:18 -0500, Robert Cummings wrote:
 On Tue, 2009-03-03 at 11:01 -0500, Edsall, William (WJ) wrote:
  Hello list!
   I'm having a strange problem with php after installing Mantis Bug
  Tracker. I'm not sure if this is a Mantis bug or a PHP bug but I'm
  leaning toward PHP.
  
   Here's what's going on. When I view an issue in Mantis, it is slow to
  spit out the text and often does not finish spitting out the text on the
  page. When it does this, the browser I was using is locked out from
  further communication to the server. If I delete the session file in use
  by this session, I am able to use the browser again immediately.
   
   I can't tell if this is a session bug or if Mantis is causing this bug.
  Please advise!
 
 The lock aspect is a feature. Otherwise one session might clobber
 another session's data. PHP locks sessions so new ones won't begin
 processing until the lock is released. This is why only one page can run
 at a time. The code can release the lock early if it is finished with
 the session, but whatever Mantis is spending time on, is before it
 releases the lock (or finishes the page if it uses the default release
 mechanism).
 
 Cheers,
 Rob.
 -- 
 http://www.interjinn.com
 Application and Templating Framework for PHP
 
 
Are you using the latest release of Mantis? I've just installed 1.1.6 at
work (convincing people to use it is still an ongoing issue!) and it
works just fine. Do you have an odd settings in your php.ini?


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Whats the correct syntax for using query results in a new query

2009-03-03 Thread Ashley Sheridan
On Tue, 2009-03-03 at 14:09 -0600, Terion Miller wrote:
 I'm trying to use the AdminID that returns from query #1 in the WHERE
 AdminID = AdminID from Query 1
 
 $sql= SELECT WorkOrderID, CreatedDate, Location, WorkOrderName,
 AdminID, FormName, Status, Notes, pod FROM `workorders` WHERE AdminID =
 '.$row['AdminID'].' ;
 
 that isn't working and the query 1 does return in this case 3 AdminID's so
 I'm thinking it's just the .$row['AdminID'] part that is wrong
 and I have tried some different things but am not sure the correct term for
 what I'm trying to do so I can' t seem to google answers
 
 Here is my query #1
 
   $query =  SELECT `UserName`, `AdminID` FROM admin
   WHERE   Retail1 =  'YES' ;
 
 $result = mysql_query ($query) ;
 //$row = mysql_fetch_array($result);
 while ($row = mysql_fetch_row($result)){
 for ($i=0; $imysql_num_fields($result); $i++)
 echo $row[$i] .  ;
 
 }
 Above returns 3 AdminID ... I also tried using the While statement in my
 second query to return the sets but nothing... yet the code isn't breaking,
 just returning 0
 
 Thanks
 Terion
 
 Happy Freecycling
 Free the List !!
 www.freecycle.org
 Over Moderation of Freecycle List Prevents Post Timeliness.
 
 Twitter?
 http://twitter.com/terionmiller
 
 Facebook:
 a href=http://www.facebook.com/people/Terion-Miller/1542024891;
 title=Terion Miller's Facebook profile target=_TOPimg src=
 http://badge.facebook.com/badge/1542024891.237.919247960.png; border=0
 alt=Terion Miller's Facebook profile/a
 Joe DiMaggio  - Pair up in threes.
 

$query =  SELECT `UserName`, `AdminID` FROM admin WHERE   Retail1 =
'YES' ;

When you run this in phpMyAdmin, what is returned?

Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Whats the correct syntax for using query results in a new query

2009-03-03 Thread Terion Miller
On Tue, Mar 3, 2009 at 2:20 PM, Ashley Sheridan 
a...@ashleysheridan.co.ukwrote:

 On Tue, 2009-03-03 at 14:09 -0600, Terion Miller wrote:
  I'm trying to use the AdminID that returns from query #1 in the WHERE
  AdminID = AdminID from Query 1
 
  $sql= SELECT WorkOrderID, CreatedDate, Location, WorkOrderName,
  AdminID, FormName, Status, Notes, pod FROM `workorders` WHERE AdminID =
  '.$row['AdminID'].' ;
 
  that isn't working and the query 1 does return in this case 3 AdminID's
 so
  I'm thinking it's just the .$row['AdminID'] part that is wrong
  and I have tried some different things but am not sure the correct term
 for
  what I'm trying to do so I can' t seem to google answers
 
  Here is my query #1
 
$query =  SELECT `UserName`, `AdminID` FROM admin
WHERE   Retail1 =  'YES' ;
 
  $result = mysql_query ($query) ;
  //$row = mysql_fetch_array($result);
  while ($row = mysql_fetch_row($result)){
  for ($i=0; $imysql_num_fields($result); $i++)
  echo $row[$i] .  ;
 
  }
  Above returns 3 AdminID ... I also tried using the While statement in my
  second query to return the sets but nothing... yet the code isn't
 breaking,
  just returning 0
 
 
 

 $query =  SELECT `UserName`, `AdminID` FROM admin WHERE   Retail1 =
 'YES' ;

 When you run this in phpMyAdmin, what is returned?

 Ash
 www.ashleysheridan.co.uk

 When I run the second query the one where the WHERE syntax is wrong if I
put it like this I still get one record:

SQL query: SELECT WorkOrderID, CreatedDate, Location, WorkOrderName, AdminID
, FormName,
STATUS , Notes, pod
FROM `workorders`
WHERE AdminID = '20'
AND '61'
AND '24'
LIMIT 0 , 30 this part keeps getting put in by phpMyAdmin

the first query works and returns the records it should... which are 3
usernames and 3 adminID


Re: [PHP] Whats the correct syntax for using query results in a new query

2009-03-03 Thread Dan Shirah

 I'm trying to use the AdminID that returns from query #1 in the WHERE
 AdminID = AdminID from Query 1


Okay, I think I understand what you are trying to do.

//query 1
$query1 =  SELECT UserName, AdminID FROM admin
 WHERE   Retail1 =  'YES';

$result1 = mysql_query ($query1) ;
while ($row1 = mysql_fetch_row($result1)){

$admin_id = $row1['AdminID'];

//query 2
$query2= SELECT WorkOrderID, CreatedDate, Location, WorkOrderName,
AdminID, FormName, Status, Notes, pod FROM workorders WHERE AdminID =
$admin_id;

$result2 = mysql_query ($query2) ;
$end_result = mysql_fetch_row($result2);
echo $end_result['WorkOrderID'];
echo $end_result['CreatedDate'];

}


Re: [PHP] Question about template systems

2009-03-03 Thread Stuart
2009/3/3 Matthew Croud m...@obviousdigital.com

 First post here, I'm in the process of learning PHP , I'm digesting a few
 books as we speak.
 I'm working on a content heavy website that provides a lot of information,
 a template system would be great and so i've been looking at ways to create
 dynamic data with a static navigation system.

 So far, using the require_once(); function seems to fit the bill in order
 to bring in the same header html file on each page.
 I've also looked at Smartys template system.

 I wondered how you folk would go about creating a template system ?


http://stut.net/blog/2008/10/28/snippet-simple-templates-with-php/

My second question might be me jumping the gun here, I haven't come across
 this part in my book but i'll ask about it anyway.  I often see websites
 that have a dynamic body and static header, and their web addresses end like
 this: index.php?id=445 where 445 i presume is some file reference.
 What is this called ?  It seems like the system i'm after but it doesn't
 appear in my book,  If anyone could let me know what this page id subject is
 called i can do some research on the subject.


This could be being handled any number of ways. 445 could refer to a row in
a database, a file on disk or a number of other things. All you really need
to know is that the script will take $_GET['id'], sanitise it (important!)
and use it as a resource identifier in a SQL query, filename or something
else. That will give the script the content to display. It would likely then
include a file containing the common header HTML, output the retrieved
content and then include a file containing the common footer HTML.

Even at the simplest level you'd probably call this an instance of the front
controller pattern (Google it), but they usually go a lot further than this.

As far as templating systems go I personally don't think they add anything
to the equation unless you're working with designers who are already
familiar with something. Separation of logic and content is important,
abstraction away from PHP is not (IMHO).

-Stuart

-- 
http://stut.net/


RE: [PHP] Cache engines in a multi-tenant environment (a bit long)

2009-03-03 Thread Damon Miller
On Tue, 2009-03-03 at 14:52 -0500, Robert Cummings wrote:
 
  My question then becomes the following:  Is there a cache engine
  available which can store multiple (different) copies of a source
file
  and serve them only to the appropriate request?  Perhaps a better
way
  to describe this would be a sort of mapping feature allowing
  per-directory control.  I'm imagining a simple list of directories
  that instructs the cache engine to keep their caches separate.  This
might
  even be implemented by incorporating the directory name into the key
  used for lookups, but frankly I haven't spent much time looking at
  APC's code (nor have I looked at XCache's or eAccelerator's at all.)
 
 If the path to the source file differs then it shouldn't matter that
the
 source tree is a copy, for all intents and purposes, as far as an
 accelerator is concerned, the sources are different. I've not liked
APC
 in the past (I don't remember exactly what the problem was) and
 personally use eAccelerator.
 
 Cheers,
 Rob.

Rob,

Thanks very much for your response.  I was surprised at APC's behavior
(thinking that files in different directories would be treated as
different entities) but I couldn't explain the behavior I was seeing
otherwise.  However, that may be a function of APC specifically and not
all PHP cache engines.  I'll spend some time with eAccelerator and
hopefully it will work as expected.

Thanks again,

Damon


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



Re: [PHP] Whats the correct syntax for using query results in a new query

2009-03-03 Thread Ashley Sheridan
On Tue, 2009-03-03 at 14:36 -0600, Terion Miller wrote:
 On Tue, Mar 3, 2009 at 2:20 PM, Ashley Sheridan 
 a...@ashleysheridan.co.ukwrote:
 
  On Tue, 2009-03-03 at 14:09 -0600, Terion Miller wrote:
   I'm trying to use the AdminID that returns from query #1 in the WHERE
   AdminID = AdminID from Query 1
  
   $sql= SELECT WorkOrderID, CreatedDate, Location, WorkOrderName,
   AdminID, FormName, Status, Notes, pod FROM `workorders` WHERE AdminID =
   '.$row['AdminID'].' ;
  
   that isn't working and the query 1 does return in this case 3 AdminID's
  so
   I'm thinking it's just the .$row['AdminID'] part that is wrong
   and I have tried some different things but am not sure the correct term
  for
   what I'm trying to do so I can' t seem to google answers
  
   Here is my query #1
  
 $query =  SELECT `UserName`, `AdminID` FROM admin
 WHERE   Retail1 =  'YES' ;
  
   $result = mysql_query ($query) ;
   //$row = mysql_fetch_array($result);
   while ($row = mysql_fetch_row($result)){
   for ($i=0; $imysql_num_fields($result); $i++)
   echo $row[$i] .  ;
  
   }
   Above returns 3 AdminID ... I also tried using the While statement in my
   second query to return the sets but nothing... yet the code isn't
  breaking,
   just returning 0
  
  
  
 
  $query =  SELECT `UserName`, `AdminID` FROM admin WHERE   Retail1 =
  'YES' ;
 
  When you run this in phpMyAdmin, what is returned?
 
  Ash
  www.ashleysheridan.co.uk
 
  When I run the second query the one where the WHERE syntax is wrong if I
 put it like this I still get one record:
 
 SQL query: SELECT WorkOrderID, CreatedDate, Location, WorkOrderName, AdminID
 , FormName,
 STATUS , Notes, pod
 FROM `workorders`
 WHERE AdminID = '20'
 AND '61'
 AND '24'
 LIMIT 0 , 30 this part keeps getting put in by phpMyAdmin
 
 the first query works and returns the records it should... which are 3
 usernames and 3 adminID
What about joining the queries?

SELECT admin.UserName, admin.AdminID, workorders.WorkOrderID,
workorders.CreateDate, workorders.Location, workorders.WorkOrderName,
workorders.FormName, workorders.STATUS, workorders.Notes, workorders.pod
FROM admin LEFT JOIN workorders ON (admin.AdminID = workorders.AdminID)
WHERE admin.Retail1 = 'yes'

I know it looks like a mess, but it should do the trick


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Whats the correct syntax for using query results in a new query

2009-03-03 Thread Bastien Koert
On Tue, Mar 3, 2009 at 3:51 PM, Ashley Sheridan 
a...@ashleysheridan.co.ukwrote:

  On Tue, 2009-03-03 at 14:36 -0600, Terion Miller wrote:
  On Tue, Mar 3, 2009 at 2:20 PM, Ashley Sheridan 
 a...@ashleysheridan.co.ukwrote:
 
   On Tue, 2009-03-03 at 14:09 -0600, Terion Miller wrote:
I'm trying to use the AdminID that returns from query #1 in the WHERE
AdminID = AdminID from Query 1
   
$sql= SELECT WorkOrderID, CreatedDate, Location, WorkOrderName,
AdminID, FormName, Status, Notes, pod FROM `workorders` WHERE AdminID
 =
'.$row['AdminID'].' ;
   
that isn't working and the query 1 does return in this case 3
 AdminID's
   so
I'm thinking it's just the .$row['AdminID'] part that is wrong
and I have tried some different things but am not sure the correct
 term
   for
what I'm trying to do so I can' t seem to google answers
   
Here is my query #1
   
  $query =  SELECT `UserName`, `AdminID` FROM admin
  WHERE   Retail1 =  'YES' ;
   
$result = mysql_query ($query) ;
//$row = mysql_fetch_array($result);
while ($row = mysql_fetch_row($result)){
for ($i=0; $imysql_num_fields($result); $i++)
echo $row[$i] .  ;
   
}
Above returns 3 AdminID ... I also tried using the While statement in
 my
second query to return the sets but nothing... yet the code isn't
   breaking,
just returning 0
   
   
   
  
   $query =  SELECT `UserName`, `AdminID` FROM admin WHERE   Retail1 =
   'YES' ;
  
   When you run this in phpMyAdmin, what is returned?
  
   Ash
   www.ashleysheridan.co.uk
  
   When I run the second query the one where the WHERE syntax is wrong if
 I
  put it like this I still get one record:
 
  SQL query: SELECT WorkOrderID, CreatedDate, Location, WorkOrderName,
 AdminID
  , FormName,
  STATUS , Notes, pod
  FROM `workorders`
  WHERE AdminID = '20'
  AND '61'
  AND '24'
  LIMIT 0 , 30 this part keeps getting put in by phpMyAdmin
 
  the first query works and returns the records it should... which are 3
  usernames and 3 adminID
 What about joining the queries?

 SELECT admin.UserName, admin.AdminID, workorders.WorkOrderID,
 workorders.CreateDate, workorders.Location, workorders.WorkOrderName,
 workorders.FormName, workorders.STATUS, workorders.Notes, workorders.pod
 FROM admin LEFT JOIN workorders ON (admin.AdminID = workorders.AdminID)
 WHERE admin.Retail1 = 'yes'

 I know it looks like a mess, but it should do the trick


 Ash
 www.ashleysheridan.co.uk


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



incorrect syntax on your query

try

SQL query: SELECT WorkOrderID, CreatedDate, Location, WorkOrderName, AdminID
, FormName,
STATUS , Notes, pod
FROM `workorders`
WHERE AdminID in ( '20','61','24')

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Re: [PHP-DB] Re: Problems with displaying results

2009-03-03 Thread Ashley Sheridan
On Tue, 2009-03-03 at 11:08 -0600, Terion Miller wrote:
 On Tue, Mar 3, 2009 at 10:32 AM, Shawn McKenzie nos...@mckenzies.netwrote:
 
  Terion Miller wrote:
   I have two queries one pulls out which users to use and the second pulls
   those users orders
   Looks something like this but is only pulling the first record:
  
  
   $query =  SELECT `UserName`, `AdminID` FROM admin
 WHERE   Key1 =  'YES' ;
  
   $result = mysql_query ($query) ;
   $row = mysql_fetch_assoc($result);
  
   //Reveal Variables for Debugging
   // include(VariableReveal2.php);
echo (Hello br);
   //echo $row['AdminID'];
   echo ($row['UserName']);
  
  
  
  
   if ($row['Key1'] == NO) {
   header (Location: Welcome.php?AdminID=$AdminIDmsg=Sorry, you do
   not have access to that page.);
   }
  
   if (isset($_GET['SortBy'])) {$SortBy = $_GET['SortBy'];} else {$SortBy =
   'WorkOrderID DESC';}
   if (isset($_GET['Page'])) {$Page = $_GET['Page'];} else {$Page = 1;}
  
   $PerPage = 30;
   $StartPage = ($Page - 1) * $PerPage;
  
   second query here is using the $row from the first (and yes I
  know
   not to use *, just did so here to keep post shorter)
  
$sql= SELECT * FROM workorders WHERE AdminID =
   '.$row['AdminID'].' ;
 // $sql .= ORDER BY $SortBy LIMIT $StartPage, $PerPage;
 $result = mysql_query ($sql);
 $row2 = mysql_fetch_assoc($result);
 $Total = ceil(mysql_num_rows($result)/$PerPage);
  
  
   So this works but only half way as it only displays the first record
  in
   the table.
  
  
  
  
   Thanks
   Terion
  
   Happy Freecycling
   Free the List !!
   www.freecycle.org
   Over Moderation of Freecycle List Prevents Post Timeliness.
   
   Twitter?
   http://twitter.com/terionmiller
   
   Facebook:
   a href=http://www.facebook.com/people/Terion-Miller/1542024891;
   title=Terion Miller's Facebook profile target=_TOPimg src=
   http://badge.facebook.com/badge/1542024891.237.919247960.png; border=0
   alt=Terion Miller's Facebook profile/a
   Groucho Marx  - I have had a perfectly wonderful evening, but this
  wasn't
   it.
  
 
  You need to lookup the mysql_fetch_assoc() function.  It only returns
  one row from a result set that may contain multiple rows.  You need
  something like:
 
  while($row = mysql_fetch_assoc($result)) {
   // do something with $row
  }
 
  ---
 
 well I looked it up in my book and tried this example but still get the same
 thing, the first record
 
 $result = mysql_query ($query) ;
 //$row = mysql_fetch_array($result);
 while ($row = mysql_fetch_row($result)){
 for ($i=0; $imysql_num_fields($result); $i++)
 echo $row[$i] .  ;
 //print a return for neatness sake
 echo \n;
What happens if you just change your while loop to this:

while($row = mysql_fetch_array($result))
{
print_r($row);
}


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Whats the correct syntax for using query results in a new query

2009-03-03 Thread Ashley Sheridan
On Tue, 2009-03-03 at 15:54 -0500, Bastien Koert wrote:
 On Tue, Mar 3, 2009 at 3:51 PM, Ashley Sheridan 
 a...@ashleysheridan.co.ukwrote:
 
   On Tue, 2009-03-03 at 14:36 -0600, Terion Miller wrote:
   On Tue, Mar 3, 2009 at 2:20 PM, Ashley Sheridan 
  a...@ashleysheridan.co.ukwrote:
  
On Tue, 2009-03-03 at 14:09 -0600, Terion Miller wrote:
 I'm trying to use the AdminID that returns from query #1 in the WHERE
 AdminID = AdminID from Query 1

 $sql= SELECT WorkOrderID, CreatedDate, Location, WorkOrderName,
 AdminID, FormName, Status, Notes, pod FROM `workorders` WHERE AdminID
  =
 '.$row['AdminID'].' ;

 that isn't working and the query 1 does return in this case 3
  AdminID's
so
 I'm thinking it's just the .$row['AdminID'] part that is wrong
 and I have tried some different things but am not sure the correct
  term
for
 what I'm trying to do so I can' t seem to google answers

 Here is my query #1

   $query =  SELECT `UserName`, `AdminID` FROM admin
   WHERE   Retail1 =  'YES' ;

 $result = mysql_query ($query) ;
 //$row = mysql_fetch_array($result);
 while ($row = mysql_fetch_row($result)){
 for ($i=0; $imysql_num_fields($result); $i++)
 echo $row[$i] .  ;

 }
 Above returns 3 AdminID ... I also tried using the While statement in
  my
 second query to return the sets but nothing... yet the code isn't
breaking,
 just returning 0



   
$query =  SELECT `UserName`, `AdminID` FROM admin WHERE   Retail1 =
'YES' ;
   
When you run this in phpMyAdmin, what is returned?
   
Ash
www.ashleysheridan.co.uk
   
When I run the second query the one where the WHERE syntax is wrong if
  I
   put it like this I still get one record:
  
   SQL query: SELECT WorkOrderID, CreatedDate, Location, WorkOrderName,
  AdminID
   , FormName,
   STATUS , Notes, pod
   FROM `workorders`
   WHERE AdminID = '20'
   AND '61'
   AND '24'
   LIMIT 0 , 30 this part keeps getting put in by phpMyAdmin
  
   the first query works and returns the records it should... which are 3
   usernames and 3 adminID
  What about joining the queries?
 
  SELECT admin.UserName, admin.AdminID, workorders.WorkOrderID,
  workorders.CreateDate, workorders.Location, workorders.WorkOrderName,
  workorders.FormName, workorders.STATUS, workorders.Notes, workorders.pod
  FROM admin LEFT JOIN workorders ON (admin.AdminID = workorders.AdminID)
  WHERE admin.Retail1 = 'yes'
 
  I know it looks like a mess, but it should do the trick
 
 
  Ash
  www.ashleysheridan.co.uk
 
 
   --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 incorrect syntax on your query
 
 try
 
 SQL query: SELECT WorkOrderID, CreatedDate, Location, WorkOrderName, AdminID
 , FormName,
 STATUS , Notes, pod
 FROM `workorders`
 WHERE AdminID in ( '20','61','24')
 
Where and what is the syntax error?


Ash
www.ashleysheridan.co.uk


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



[PHP] Intermittent problem sending mail with PHP

2009-03-03 Thread Stephen Hutchison
I've set up a small website which allows users to create a form letter and 
email it to their local candidates in the upcoming state election.


The user enters their email address, town/suburb and message into an html 
form and clicks the Send button. The site then sends an email to each 
candidate for their area. The email is plain text and only about 3k in size.


The problem I'm having is that it works fine for the first few tests but any 
messages after that it just hangs for 5 minutes before giving a time-out 
message. When it's working it goes through without any delay. If I leave for 
say anther half an hour its back working again. I send a couple more test 
messages its all good, but and then it hangs again.


How can I troubleshoot this intermittent problem? My ISP is running PHP on 
an IIS server. It seems like a server issue.


Thanks
Stephen


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



Re: [PHP] allow_url_fopen allow_url_include

2009-03-03 Thread Chris

Kaushal Shriyan wrote:
On Tue, Mar 3, 2009 at 12:21 PM, Kaushal Shriyan 
kaushalshri...@gmail.com mailto:kaushalshri...@gmail.com wrote:


On Tue, Mar 3, 2009 at 11:52 AM, Chris dmag...@gmail.com
mailto:dmag...@gmail.com wrote:

Kaushal Shriyan wrote:

Hi,

I have enabled allow_url_fopen  allow_url_include in
php.ini file.
is it a security issue ?


allow_url_fopen means you can fetch pages:

$page = file_get_contents('http://www.example.com');

This is ok to enable - all it does is fetch the page. It does
not execute the code it retrieved.


allow_url_include means you can remotely include code as if it
was on your server:

include('http://www.example.com/page.html'
http://www.example.com/page.html%27);

That means if http://www.example.com/page.html includes any php
code, it will be executed on your server - this one definitely
is a security consideration.

If you enable allow_url_include be very careful about what you
include.

If you're still not sure, enable url_fopen, do not enable
url_include.

-- 
Postgresql  php tutorials

http://www.designmagick.com/

Thanks Chris :-)

Kaushal

Hi Chris

Can i use curl option to php to take care of the security issue so that 
i can disable  both allow_url_fopen  allow_url_include in php.ini file.


allow_url_include is a security issue because it will actually execute 
the code returned from the url (like an 'include' or 'require' does 
locally).


allow_url_fopen is not a security issue - it only returns the code, it 
does not execute it.


But yes you can use curl instead of relying on allow_url_fopen.

--
Postgresql  php tutorials
http://www.designmagick.com/


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



[PHP] Re: Intermittent problem sending mail with PHP

2009-03-03 Thread Stephen Hutchison
This appears to by a problem with the mail function. When I comment out the 
lines:

if (mail($recipient, $subject, $message, $headers))
   echo 'Succeededbr';
   else
   echo 'Error - please check your e-mail addressbr';

and replace them with:
   echo $recipient . 'brbr';
   echo $subject . 'brbr';
   echo $message . 'brbr';
   echo $headers . 'brbr';
it displays to the screen perfectly every time.

Here's the output (ignore the hyperlinks, my news reader created those, in 
the browser they are plain text):

candid...@someparty.org

message subject

message body blah blah blah blah blah blah blah blah blah blah blah blah 
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah 
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah 
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah


From: steph...@qcoss.org.au Reply-To: steph...@qcoss.org.au X-Mailer: PHP/ 
5.1.1 Cc: steph...@qcoss.org.au, takeact...@qcoss.org.au



thanks

Stephen Hutchison steph...@qcoss.org.au wrote in message 
news:bc.e4.19118.b059d...@pb1.pair.com...
I've set up a small website which allows users to create a form letter and 
email it to their local candidates in the upcoming state election.


The user enters their email address, town/suburb and message into an html 
form and clicks the Send button. The site then sends an email to each 
candidate for their area. The email is plain text and only about 3k in 
size.


The problem I'm having is that it works fine for the first few tests but 
any messages after that it just hangs for 5 minutes before giving a 
time-out message. When it's working it goes through without any delay. If 
I leave for say anther half an hour its back working again. I send a 
couple more test messages its all good, but and then it hangs again.


How can I troubleshoot this intermittent problem? My ISP is running PHP on 
an IIS server. It seems like a server issue.


Thanks
Stephen




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



Re: [PHP] Re: Intermittent problem sending mail with PHP

2009-03-03 Thread Chris

Stephen Hutchison wrote:
This appears to by a problem with the mail function. When I comment out 
the lines:

if (mail($recipient, $subject, $message, $headers))
   echo 'Succeededbr';
   else
   echo 'Error - please check your e-mail addressbr';


More likely a mail server issue rather than the mail function itself.

Do they have any restrictions on how often you can send email? (Some 
hosts only let you send say 50 emails an hour).


Log everything you're trying to do in php (log when it works, when it 
doesn't) and include a timestamp - then get your host to look at their 
mail server logs for the failure times and see what shows up.


--
Postgresql  php tutorials
http://www.designmagick.com/


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



Re: [PHP] Whats the correct syntax for using query results in a new query

2009-03-03 Thread Terion Miller
On Tue, Mar 3, 2009 at 2:51 PM, Ashley Sheridan 
a...@ashleysheridan.co.ukwrote:

 On Tue, 2009-03-03 at 14:36 -0600, Terion Miller wrote:
  On Tue, Mar 3, 2009 at 2:20 PM, Ashley Sheridan 
 a...@ashleysheridan.co.ukwrote:
 
   On Tue, 2009-03-03 at 14:09 -0600, Terion Miller wrote:
I'm trying to use the AdminID that returns from query #1 in the WHERE
AdminID = AdminID from Query 1
   
$sql= SELECT WorkOrderID, CreatedDate, Location, WorkOrderName,
AdminID, FormName, Status, Notes, pod FROM `workorders` WHERE AdminID
 =
'.$row['AdminID'].' ;
   
that isn't working and the query 1 does return in this case 3
 AdminID's
   so
I'm thinking it's just the .$row['AdminID'] part that is wrong
and I have tried some different things but am not sure the correct
 term
   for
what I'm trying to do so I can' t seem to google answers
   
Here is my query #1
   
  $query =  SELECT `UserName`, `AdminID` FROM admin
  WHERE   Retail1 =  'YES' ;
   
$result = mysql_query ($query) ;
//$row = mysql_fetch_array($result);
while ($row = mysql_fetch_row($result)){
for ($i=0; $imysql_num_fields($result); $i++)
echo $row[$i] .  ;
   
}
Above returns 3 AdminID ... I also tried using the While statement in
 my
second query to return the sets but nothing... yet the code isn't
   breaking,
just returning 0
   
   
   
  
   $query =  SELECT `UserName`, `AdminID` FROM admin WHERE   Retail1 =
   'YES' ;
  
   When you run this in phpMyAdmin, what is returned?
  
   Ash
   www.ashleysheridan.co.uk
  
   When I run the second query the one where the WHERE syntax is wrong if
 I
  put it like this I still get one record:
 
  SQL query: SELECT WorkOrderID, CreatedDate, Location, WorkOrderName,
 AdminID
  , FormName,
  STATUS , Notes, pod
  FROM `workorders`
  WHERE AdminID = '20'
  AND '61'
  AND '24'
  LIMIT 0 , 30 this part keeps getting put in by phpMyAdmin
 
  the first query works and returns the records it should... which are 3
  usernames and 3 adminID
 What about joining the queries?

 SELECT admin.UserName, admin.AdminID, workorders.WorkOrderID,
 workorders.CreateDate, workorders.Location, workorders.WorkOrderName,
 workorders.FormName, workorders.STATUS, workorders.Notes, workorders.pod
 FROM admin LEFT JOIN workorders ON (admin.AdminID = workorders.AdminID)
 WHERE admin.Retail1 = 'yes'

 I know it looks like a mess, but it should do the trick


 Ash
 www.ashleysheridan.co.uk
 The joined query works as far as returning the records now I just have to
 get them to display and I'm good to go, thanks guys!



Re: [PHP] allow_url_fopen allow_url_include

2009-03-03 Thread 9el
---
Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get
a Free CD of Ubuntu mailed to your door without any cost. Visit :
www.ubuntu.com
--


On Wed, Mar 4, 2009 at 3:26 AM, Chris dmag...@gmail.com wrote:

 Kaushal Shriyan wrote:

 On Tue, Mar 3, 2009 at 12:21 PM, Kaushal Shriyan 
 kaushalshri...@gmail.com mailto:kaushalshri...@gmail.com wrote:

On Tue, Mar 3, 2009 at 11:52 AM, Chris dmag...@gmail.com
 - Show quoted text -
mailto:dmag...@gmail.com wrote:

Kaushal Shriyan wrote:

Hi,

I have enabled allow_url_fopen  allow_url_include in
php.ini file.
is it a security issue ?


allow_url_fopen means you can fetch pages:

$page = file_get_contents('http://www.example.com');

This is ok to enable - all it does is fetch the page. It does
not execute the code it retrieved.


allow_url_include means you can remotely include code as if it
was on your server:

include('http://www.example.com/page.html'
http://www.example.com/page.html%27);

That means if http://www.example.com/page.html includes any php
code, it will be executed on your server - this one definitely
is a security consideration.

If you enable allow_url_include be very careful about what you
include.

If you're still not sure, enable url_fopen, do not enable
url_include.

--Postgresql  php tutorials
http://www.designmagick.com/

Thanks Chris :-)

Kaushal

 Hi Chris

 Can i use curl option to php to take care of the security issue so that i
 can disable  both allow_url_fopen  allow_url_include in php.ini file.


 allow_url_include is a security issue because it will actually execute the
 code returned from the url (like an 'include' or 'require' does locally).

 allow_url_fopen is not a security issue - it only returns the code, it does
 not execute it.

 But yes you can use curl instead of relying on allow_url_fopen.


Well,  allow_url_fopen is really a security issue. A renowned programmer (
http://hasin.wordpress.com) said it could even cause DoS(Denial of Service)
for the running server.

Read  Chris Shiflett's blog http://shiflett.org/

http://sitepoint.com/article/php-security-blunders

http://phpsec.org/projects/guide/

Regards

Lenin

www.twitter.com/nine_L



 --
 Postgresql  php tutorials
 http://www.designmagick.com/


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




Re: [PHP] 0.T Java IDE

2009-03-03 Thread German Geek
Give the free eclipse a go. If you need an easy to use gui editor IBM
Websphere (which is also based on Eclipse):
http://www-01.ibm.com/software/websphere/

Eclipse is great, has PDT (PHP Development Tools) too...

Regards,
Tim

Tim-Hinnerk Heuer

http://www.ihostnz.com
Dick Cavett  - If your parents never had children, chances are... neither
will you.

2009/3/4 Almog Friedman ter...@gmail.com

 Since I know theres alot of Java progarammers in this list and I don't want
 to sign upo to another mailing list i ask it here

 I'm searching for a Java ide (not netbeans, I'm sick of netbeans) which
 does
 gui in swing the best(i come from C# with visual studio and i'm searching
 for something that is as easy and powerful as the visual studio gui editor)



Re: [PHP] allow_url_fopen allow_url_include

2009-03-03 Thread Chris



allow_url_fopen is not a security issue - it only returns the code,
it does not execute it.

But yes you can use curl instead of relying on allow_url_fopen.


Well,  allow_url_fopen is really a security issue. A renowned programmer 
(http://hasin.wordpress.com) said it could even cause DoS(Denial of 
Service) for the running server.


So can curl.

--
Postgresql  php tutorials
http://www.designmagick.com/


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



RE: [PHP] 0.T Java IDE

2009-03-03 Thread Boyd, Todd M.
 -Original Message-
 From: Almog Friedman [mailto:ter...@gmail.com]
 Sent: Tuesday, March 03, 2009 7:55 AM
 To: php-general@lists.php.net
 Subject: [PHP] 0.T Java IDE
 
 Since I know theres alot of Java progarammers in this list and I don't
 want
 to sign upo to another mailing list i ask it here
 
 I'm searching for a Java ide (not netbeans, I'm sick of netbeans) which
 does
 gui in swing the best(i come from C# with visual studio and i'm
 searching
 for something that is as easy and powerful as the visual studio gui
 editor)

Having used Eclipse, Netbeans, JGrasp, Visual J#/J++, and Processing.org's 
notepad, I've got to say:

Developing UIs is easiest in Netbeans. Sorry. :(


// Todd


RE: [PHP] whoami explanation

2009-03-03 Thread Boyd, Todd M.
 -Original Message-
 From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk]
 Sent: Tuesday, March 03, 2009 2:07 PM
 To: PJ
 Cc: Daniel Brown; Per Jessen; php-general@lists.php.net
 Subject: Re: [PHP] whoami explanation
 
 On Tue, 2009-03-03 at 11:16 -0500, PJ wrote:
  Daniel Brown wrote:
   On Tue, Mar 3, 2009 at 10:57, PJ af.gour...@videotron.ca wrote:
  
   forgot to add:
   What's the difference between back ticks or quotes and regular
 single
   quotes?
   How does one enter back quotes from the keyboard?
  
  
   Welcome to the Internet!
  
   The first place you should look when you have a question is on
   Google.  The first result that comes up for backtick operator is
 the
   PHP manual itself:
  
   http://php.net/language.operators.execution
  
   If you don't know where a key is on your keyboard, please look
 down.
  
  
  I don't think it's necessary to be sarcastic...
  Hate to disappoint you, but on my computer (FreeBSD 7.0) on Firefox
  Google does not go directly to the php manual... it goes to some
 nitwit
  site thinkexist.com
  So, this list is a much better source of information that waddling
  through the crap that's thrown at you on G.
  And I find that Googie is getting pretty garbagy even if there is
  nothing better around ;-)
  As for the keyboard, this is the first time I have ever, ever needed
 the
  back quote key although I have occasionally needed the ~ key for
 Windows
  stuff.
 
  --
 
  Phil Jourdan --- p...@ptahhotep.com
 http://www.ptahhotep.com
 http://www.chiccantine.com
 
 
 You tinker on Unix and you only ever use ~ for Windows?!

I realize this thread is old and dead and buried, but I have to get my
licks in on the new guy, too... but Ash beat me to it. I was going to
talk about how ~ was an alias for the current user context's home
directory in any POSIX system I've ever used. :)

Welcome aboard, PJ.


// Todd

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



Re: [PHP] 0.T Java IDE

2009-03-03 Thread 9el
---
Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get
a Free CD of Ubuntu mailed to your door without any cost. Visit :
www.ubuntu.com
--


On Wed, Mar 4, 2009 at 4:38 AM, Boyd, Todd M. tmbo...@ccis.edu wrote:

 - Show quoted text -
  -Original Message-
  From: Almog Friedman [mailto:ter...@gmail.com]
  Sent: Tuesday, March 03, 2009 7:55 AM
  To: php-general@lists.php.net
  Subject: [PHP] 0.T Java IDE
 
  Since I know theres alot of Java progarammers in this list and I don't
  want
  to sign upo to another mailing list i ask it here
 
  I'm searching for a Java ide (not netbeans, I'm sick of netbeans) which
  does
  gui in swing the best(i come from C# with visual studio and i'm
  searching
  for something that is as easy and powerful as the visual studio gui
  editor)

 Having used Eclipse, Netbeans, JGrasp, Visual J#/J++, and Processing.org's
 notepad, I've got to say:

 Developing UIs is easiest in Netbeans. Sorry. :(


Lots of people support NetBeans as the best IDE for Java and for PDT as
well.




 // Todd



Re: [PHP] Re: Intermittent problem sending mail with PHP

2009-03-03 Thread Stephen Hutchison
I'll check with my ISP but if is that then it's a very low limit. I'm 
finding it's only allowing two or three through before hanging.


Is there something i can put in my code so that it at least fails 
gracefully? It's not a good look just hanging like that.


Thanks
Stephen


Chris dmag...@gmail.com wrote in message 
news:49ada6ab.5060...@gmail.com...

Stephen Hutchison wrote:
This appears to by a problem with the mail function. When I comment out 
the lines:

if (mail($recipient, $subject, $message, $headers))
   echo 'Succeededbr';
   else
   echo 'Error - please check your e-mail addressbr';


More likely a mail server issue rather than the mail function itself.

Do they have any restrictions on how often you can send email? (Some hosts 
only let you send say 50 emails an hour).


Log everything you're trying to do in php (log when it works, when it 
doesn't) and include a timestamp - then get your host to look at their 
mail server logs for the failure times and see what shows up.


--
Postgresql  php tutorials
http://www.designmagick.com/




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



Re: [PHP] Question about template systems

2009-03-03 Thread Ross McKay
On Tue, 3 Mar 2009 20:46:40 +, stuttle wrote:

[...]
As far as templating systems go I personally don't think they add anything
to the equation unless you're working with designers who are already
familiar with something. Separation of logic and content is important,
abstraction away from PHP is not (IMHO).

Yeah, I've been meaning to ask about that myself - what benefit is there
in using something like Smarty, which requires learning yet another set
of notation, over just having a class/interface for the page and calling
methods on that in plain-old PHP from the template?

--- the PHP page (e.g. index.php) ---

?php
$page = new YourPageClass();
require_once 'include/template.php';

--- template.php ---

html
head
title?php $page-showPageTitle();?/title
...
?php $page-showCustomHeaders();?
/head
body
...
?php $page-showMenu();?
...
?php $page-showContent();?
...
/body
/html

--- snip 

For that matter, why go with Smarty over the more widely supported
(across multiple languages) XSL?

Maybe I'm missing something, but I don't see the point of special
templating systems that require you to know yet another notation set,
i.e. abstraction away from PHP as Stuart puts it.
-- 
Ross McKay, Toronto NSW Australia
Click me, drag me, treat me like an object

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



Re: [PHP] whoami explanation

2009-03-03 Thread Clancy
On Tue, 3 Mar 2009 11:09:48 -0500, danbr...@php.net (Daniel Brown) wrote:

On Tue, Mar 3, 2009 at 11:03, PJ af.gour...@videotron.ca wrote:

 ok, ok, I found it but you guys are assuming that this is something
 everybody should know... hell, I've been tinkering with programming and
 unix etc. for many, many years and this is the first time I ran into
 back quotes.
 SORRY!

You're assuming that we're assuming something (though I don't even
know to whom that's supposed to be directed).

Backtick operators have been around since the inception of UNIX
itself.  I don't mean this offensively by any means whatsoever, but if
you haven't run into them before, you haven't been tinkering very
much.

In my 40 plus years of programming I don't think I have ever deliberately typed 
a back
tick, and had forgotten that it was on the keyboard. And I have tinkered with 
all sorts of
strange systems, but I have had very little to do with UNIX.

This discussion reminds me of the Any key as in: 

Support person now press any key. User but there isn't an Any key on my 
keyboard!

Clancy

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



Re: [PHP] whoami explanation

2009-03-03 Thread PJ
Boyd, Todd M. wrote:
 -Original Message-
 From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk]
 Sent: Tuesday, March 03, 2009 2:07 PM
 To: PJ
 Cc: Daniel Brown; Per Jessen; php-general@lists.php.net
 Subject: Re: [PHP] whoami explanation

 On Tue, 2009-03-03 at 11:16 -0500, PJ wrote:
 
 Daniel Brown wrote:
   
 On Tue, Mar 3, 2009 at 10:57, PJ af.gour...@videotron.ca wrote:

 
 forgot to add:
 What's the difference between back ticks or quotes and regular
   
 single
 
 quotes?
 How does one enter back quotes from the keyboard?

   
 Welcome to the Internet!

 The first place you should look when you have a question is on
 Google.  The first result that comes up for backtick operator is
 
 the
 
 PHP manual itself:

 http://php.net/language.operators.execution

 If you don't know where a key is on your keyboard, please look
 
 down.
 
 
 I don't think it's necessary to be sarcastic...
 Hate to disappoint you, but on my computer (FreeBSD 7.0) on Firefox
 Google does not go directly to the php manual... it goes to some
   
 nitwit
 
 site thinkexist.com
 So, this list is a much better source of information that waddling
 through the crap that's thrown at you on G.
 And I find that Googie is getting pretty garbagy even if there is
 nothing better around ;-)
 As for the keyboard, this is the first time I have ever, ever needed
   
 the
 
 back quote key although I have occasionally needed the ~ key for
   
 Windows
 
 stuff.

 --

 Phil Jourdan --- p...@ptahhotep.com
http://www.ptahhotep.com
http://www.chiccantine.com


   
 You tinker on Unix and you only ever use ~ for Windows?!
 

 I realize this thread is old and dead and buried, but I have to get my
 licks in on the new guy, too... but Ash beat me to it. I was going to
 talk about how ~ was an alias for the current user context's home
 directory in any POSIX system I've ever used. :)

 Welcome aboard, PJ.
   
Gee, thanks. So, when was I supposed to have used this alias? Hell, I
can live with my ignorance. What's a POSIX system and why is it a POSIX
- a language, I think I heard

But I'm sorry I missed the fun earlier about the American foibles...
unfortunately that should go on some other list and I wish I knew which
one - one that had some smarts to it (like this one) and I'd like to
really hear what people think about us and what's really going on in
the world... oooh, well


-- 

Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com


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



Re: [PHP] whoami explanation

2009-03-03 Thread Daniel Brown
On Tue, Mar 3, 2009 at 18:56, PJ af.gour...@videotron.ca wrote:

 But I'm sorry I missed the fun earlier about the American foibles...
 unfortunately that should go on some other list and I wish I knew which
 one - one that had some smarts to it (like this one) and I'd like to
 really hear what people think about us and what's really going on in
 the world... oooh, well

Stick around, PJ that's *this* list.

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

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



Re: [PHP] whoami explanation

2009-03-03 Thread Michael A. Peters

PJ wrote:

  

Gee, thanks. So, when was I supposed to have used this alias? Hell, I
can live with my ignorance. What's a POSIX system and why is it a POSIX
- a language, I think I heard


cd ~

brings you to your home directory.

cd ~/stuff

brings you to the stuff sub-directory of your home directory.

[mpet...@athens ~]$ echo ~
/home/mpeters
[mpet...@athens ~]$

Notice the tilde in the prompt - tells me I am in my home directory when 
I issued the command.


POSIX is not a programming language, it is a specification that allows 
for some compatability between different operating systems.


http://en.wikipedia.org/wiki/POSIX

-=-

With respect to value of issuing shell commands from within php - I'm 
sure there are some legitimate uses. I use to do it all the time but now 
I really try not to because it makes the php less portable.


IE not only is it now tied to the php modules that I use, but features 
of the operating system it is running on top of.


In some cases it may really be necessary - IE when calling the TeX 
system to generate a document, or when writing a search engine capable 
of indexing not html/xml formats (IE pdf, MS Word, etc.) you may really 
need to use the shell of the underlying operating system, but I think 
one really should try to find a pure php way whenever possible.


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



Re: [PHP] whoami explanation

2009-03-03 Thread Michael A. Peters

Michael A. Peters wrote:



With respect to value of issuing shell commands from within php - I'm 
sure there are some legitimate uses. I use to do it all the time but now 
I really try not to because it makes the php less portable.


You also have to be super careful with your code so that use of the 
shell doesn't open you up to a cracker being able to execute a local 
exploit.


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



[PHP] Re: Question about template systems

2009-03-03 Thread Shawn McKenzie
Matthew Croud wrote:
 Hello,
 
 First post here, I'm in the process of learning PHP , I'm digesting a
 few books as we speak.
 I'm working on a content heavy website that provides a lot of
 information, a template system would be great and so i've been looking
 at ways to create dynamic data with a static navigation system.
 
 So far, using the require_once(); function seems to fit the bill in
 order to bring in the same header html file on each page.
 I've also looked at Smartys template system.
 
 I wondered how you folk would go about creating a template system ?
 
 My second question might be me jumping the gun here, I haven't come
 across this part in my book but i'll ask about it anyway.  I often see
 websites that have a dynamic body and static header, and their web
 addresses end like this: index.php?id=445 where 445 i presume is some my 
 file reference.
 What is this called ?  It seems like the system i'm after but it doesn't
 appear in my book,  If anyone could let me know what this page id
 subject is called i can do some research on the subject.
 
 Thanks for any help you can provide :)
 
 Matt.
  

I have written a popular theme/template system for some CMS systems.  In
my opinion, templating is only needed for those that are totally
ignorant of the concept of programming languages in general.  It helps
for those designers that know HTML or they export their graphics as HTML
and know enough to modify it or add some simple tags like {post-date} to
HTML.  That's it!  No loops, no ifs, nothing.  Simple things
designers/users can add that represent some complex code, queries, etc...

PHP IS a template language.  You can easily separate your logic and
design/display using PHP.  Anything more than abstracting some complex
code to some simple var is overkill.  If you want to display a dropdown
of categories, and the code needed is a database query and some PHP
logic, etc., then it makes sense in my above scenario to do this in code
and then assign the result to a template var like {categories-dropdown}
that the designer/user can use in the HTML.  Other than that its just waste.

Smarty and similar template approaches just take PHP (but more limited)
and make it look slightly different.  Anyone who doesn't know or want to
know anything about programming will not see the difference between PHP
and Smarty.  Consider the following:

PHP: ?php echo $somevar; ?

Smarty: {somevar}
//oh except in your PHP you have to do the following
//$smarty-assign('somevar', $somevar);
//$smarty-display('some.tpl');

PHP: include('header.tpl');

Smarty: {include file=header.tpl}

Don't even get me started on loops and conditionals.  Smarty just
replicates PHP, except it looks slightly different and is much less
powerful.  If you are confused with:

if ($something) {
echo Some stuff...;
} else {
echo Some other stuff...;
}

Why is this better:

{if $something}
Some stuff...
{else}
Some other stuff...
{/if}

Like I said earlier, if you have some complex code that you can reduce
to a simple tag or something that a designer can insert into HTML then
great.  If not then it is just unsuccessfully trying to replicate PHP!
-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: Question about template systems

2009-03-03 Thread Shawn McKenzie
Shawn McKenzie wrote:
 Matthew Croud wrote:
 Hello,

 First post here, I'm in the process of learning PHP , I'm digesting a
 few books as we speak.
 I'm working on a content heavy website that provides a lot of
 information, a template system would be great and so i've been looking
 at ways to create dynamic data with a static navigation system.

 So far, using the require_once(); function seems to fit the bill in
 order to bring in the same header html file on each page.
 I've also looked at Smartys template system.

 I wondered how you folk would go about creating a template system ?

 My second question might be me jumping the gun here, I haven't come
 across this part in my book but i'll ask about it anyway.  I often see
 websites that have a dynamic body and static header, and their web
 addresses end like this: index.php?id=445 where 445 i presume is some my 
 file reference.
 What is this called ?  It seems like the system i'm after but it doesn't
 appear in my book,  If anyone could let me know what this page id
 subject is called i can do some research on the subject.

 Thanks for any help you can provide :)

 Matt.
  
 
 I have written a popular theme/template system for some CMS systems.  In
 my opinion, templating is only needed for those that are totally
 ignorant of the concept of programming languages in general.  It helps
 for those designers that know HTML or they export their graphics as HTML
 and know enough to modify it or add some simple tags like {post-date} to
 HTML.  That's it!  No loops, no ifs, nothing.  Simple things
 designers/users can add that represent some complex code, queries, etc...
 
 PHP IS a template language.  You can easily separate your logic and
 design/display using PHP.  Anything more than abstracting some complex
 code to some simple var is overkill.  If you want to display a dropdown
 of categories, and the code needed is a database query and some PHP
 logic, etc., then it makes sense in my above scenario to do this in code
 and then assign the result to a template var like {categories-dropdown}
 that the designer/user can use in the HTML.  Other than that its just waste.
 
 Smarty and similar template approaches just take PHP (but more limited)
 and make it look slightly different.  Anyone who doesn't know or want to
 know anything about programming will not see the difference between PHP
 and Smarty.  Consider the following:
 
 PHP: ?php echo $somevar; ?
 
 Smarty: {somevar}
 //oh except in your PHP you have to do the following
 //$smarty-assign('somevar', $somevar);
 //$smarty-display('some.tpl');
 
 PHP: include('header.tpl');
 
 Smarty: {include file=header.tpl}
 
 Don't even get me started on loops and conditionals.  Smarty just
 replicates PHP, except it looks slightly different and is much less
 powerful.  If you are confused with:
 
 if ($something) {
   echo Some stuff...;
 } else {
   echo Some other stuff...;
 }
 
 Why is this better:
 
 {if $something}
 Some stuff...
 {else}
 Some other stuff...
 {/if}
 
 Like I said earlier, if you have some complex code that you can reduce
 to a simple tag or something that a designer can insert into HTML then
 great.  If not then it is just unsuccessfully trying to replicate PHP!

Actually, I forgot myself and the alternative syntax:

if($something):
echo Some stuff...;
else:
echo Some other stuff...;
endif;

Hardly different...

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

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



RE: [PHP] Re: Question about template systems

2009-03-03 Thread Chetan Rane
Hi

I think what you are looking for is static Header Footer and dynamic
content.
One way of doing this is by having the front controller pattern

For example : consider the following list of files in your application

1000.php
2000.php
1001.php
3000.php

In the front controller Pattern we usually have a only one file referenced
all eth time and most of the times it is Index.php

The code of your index.php file would be something like this

require_once header.php;

require_once $_GET['r']..php;

require_once footer.php;

once this is done. To access any of the above mentioned files your URL will
be like this

index.php?r=1000 or index.php?r=2000 or index.php?r=1001 etc

The code given above is just the start point and is not secure enough and
had a Code injection threat. 
However I think this is enough to get you started.
You can do more research on what is Code Injection and how to avoid it.



From: Shawn McKenzie [mailto:nos...@mckenzies.net] 
Sent: Wednesday, March 04, 2009 9:05 AM
To: php-general@lists.php.net
Subject: [PHP] Re: Question about template systems

Shawn McKenzie wrote:
 Matthew Croud wrote:
 Hello,

 First post here, I'm in the process of learning PHP , I'm digesting a
 few books as we speak.
 I'm working on a content heavy website that provides a lot of
 information, a template system would be great and so i've been looking
 at ways to create dynamic data with a static navigation system.

 So far, using the require_once(); function seems to fit the bill in
 order to bring in the same header html file on each page.
 I've also looked at Smartys template system.

 I wondered how you folk would go about creating a template system ?

 My second question might be me jumping the gun here, I haven't come
 across this part in my book but i'll ask about it anyway.  I often see
 websites that have a dynamic body and static header, and their web
 addresses end like this: index.php?id=445 where 445 i presume is some
my 
 file reference.
 What is this called ?  It seems like the system i'm after but it doesn't
 appear in my book,  If anyone could let me know what this page id
 subject is called i can do some research on the subject.

 Thanks for any help you can provide :)

 Matt.
  
 
 I have written a popular theme/template system for some CMS systems.  In
 my opinion, templating is only needed for those that are totally
 ignorant of the concept of programming languages in general.  It helps
 for those designers that know HTML or they export their graphics as HTML
 and know enough to modify it or add some simple tags like {post-date} to
 HTML.  That's it!  No loops, no ifs, nothing.  Simple things
 designers/users can add that represent some complex code, queries, etc...
 
 PHP IS a template language.  You can easily separate your logic and
 design/display using PHP.  Anything more than abstracting some complex
 code to some simple var is overkill.  If you want to display a dropdown
 of categories, and the code needed is a database query and some PHP
 logic, etc., then it makes sense in my above scenario to do this in code
 and then assign the result to a template var like {categories-dropdown}
 that the designer/user can use in the HTML.  Other than that its just
waste.
 
 Smarty and similar template approaches just take PHP (but more limited)
 and make it look slightly different.  Anyone who doesn't know or want to
 know anything about programming will not see the difference between PHP
 and Smarty.  Consider the following:
 
 PHP: ?php echo $somevar; ?
 
 Smarty: {somevar}
 //oh except in your PHP you have to do the following
 //$smarty-assign('somevar', $somevar);
 //$smarty-display('some.tpl');
 
 PHP: include('header.tpl');
 
 Smarty: {include file=header.tpl}
 
 Don't even get me started on loops and conditionals.  Smarty just
 replicates PHP, except it looks slightly different and is much less
 powerful.  If you are confused with:
 
 if ($something) {
   echo Some stuff...;
 } else {
   echo Some other stuff...;
 }
 
 Why is this better:
 
 {if $something}
 Some stuff...
 {else}
 Some other stuff...
 {/if}
 
 Like I said earlier, if you have some complex code that you can reduce
 to a simple tag or something that a designer can insert into HTML then
 great.  If not then it is just unsuccessfully trying to replicate PHP!

Actually, I forgot myself and the alternative syntax:

if($something):
echo Some stuff...;
else:
echo Some other stuff...;
endif;

Hardly different...

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

-- 
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] Re: Intermittent problem sending mail with PHP

2009-03-03 Thread Jim Lucas

Stephen Hutchison wrote:
I'll check with my ISP but if is that then it's a very low limit. I'm 
finding it's only allowing two or three through before hanging.


Is there something i can put in my code so that it at least fails 
gracefully? It's not a good look just hanging like that.


Thanks
Stephen


Chris dmag...@gmail.com wrote in message 
news:49ada6ab.5060...@gmail.com...

Stephen Hutchison wrote:
This appears to by a problem with the mail function. When I comment 
out the lines:

if (mail($recipient, $subject, $message, $headers))
   echo 'Succeededbr';
   else
   echo 'Error - please check your e-mail addressbr';


More likely a mail server issue rather than the mail function itself.

Do they have any restrictions on how often you can send email? (Some 
hosts only let you send say 50 emails an hour).


Log everything you're trying to do in php (log when it works, when it 
doesn't) and include a timestamp - then get your host to look at their 
mail server logs for the failure times and see what shows up.


--
Postgresql  php tutorials
http://www.designmagick.com/






I would recommend getting away from using the mail() function altogether.

I would look into using something like phpmailer or SwiftMailer.

They are SMTP mail classes that let you build and email and send it directly to 
your SMTP server.

Also allows you to log into the mail server with a valid email account and send 
using that account.

That last part might get you around the X/minute email limit or whatever else 
it might be.

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



  1   2   >