RE: [PHP] Re:Re: [PHP] help for me about session

2005-04-24 Thread Warren Vail
Looks like you are mixing JavaScript syntax with PHP, and that doesn't
work since JavaScript runs on the browser machine, and PHP on the server
(document.form.NextCourse.value is a syntax you will find in JavaScript,
not PHP).

Try something like this;

?php
Startsession();
If($_SESSION[NextCourse] == 1) {
   do something here on 2nd pass
} else {
   do something here on 1st pass
   $_SESSION[NextCourse] = 1;
}
?

Make sure sessions are enabled on your server, you can confirm this by
executing php_info();

HTH,

Warren Vail


 -Original Message-
 From: Josephson Tracy [mailto:[EMAIL PROTECTED] 
 Sent: Sunday, April 24, 2005 8:27 AM
 To: Steve Buehler
 Cc: php-mailing-lists
 Subject: Re: [PHP] Re:Re: [PHP] help for me about session
 
 
 I want to get the value of document.form1.NextCourse.value
 But I got the  value of $NextCourse in last page.
 
 Steve Buehler [EMAIL PROTECTED] wrote:
 
 At 10:29 PM 4/23/2005, Josephson Tracy wrote:
   At 09:35 PM 4/23/2005, Josephson Tracy wrote:
   hi everyone,
   when i study php, i have a problem as following:
   -
   file1.php
 if($NextCourse == 1){ do something;}
   else($NextCourse ==){do something other }
   ?
   -
   but when the 2ed access the file1.php
   the value of $NextCourse is the $NextCourse in the , Not 
 the value 
   of document.form1.NextCourse.value.
   
   could someone tell me why?thanks
  
   I believe it should be:
 if($NextCourse == 1){ do something; }
   elseif(!$NextCourse){ do something other; }

   By the way you have your statement, I think you are only 
 looking for 
   the 1. You might try the following instead.
 if($NextCourse == 1){
   do something;
   }else{
   do something else;
   }
   ?
  
 ok. the key problem is when I click the button to submit.
 the value of $NextCourse is not the value of value
  of document.form1.NextCourse.value.
 just is the pre page's $NextCourse,that's say null;
 how can i get document.form1.NextCourse.value?
 
 How are you passing the variable $NextCourse to this script?
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around 
 http://mail.yahoo.com 
 

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



RE: [PHP] I need do paging in php, I use ODBC Access

2005-04-21 Thread Warren Vail
 Somebody did paging in php for data origin in ODBC Access?
 
 I need an algorithm for doing this, please Help me!

I assume by paging you are referring to a scrolling algorithm that
allows you to view only a small portion of your query result set.  The
algorithm that comes to mind is dependent on the database that ODBC is
connected to.

If the database is MySQL, the query that would allow do this is the SQL
LIMIT clause, where executing and re-executing the query will return
only a portion of the sequence set produced by the query;

$query = SELECT .$columnlist
. from my_table where col1 = \sold\ order by order_date 
.LIMIT .sprintf(%01d,$rowno)., 10 ;

If $rowno = 0 the query will return the first 10 rows
If you add 10 to $rowno and re-execute the query, it will return the
second set of 10 rows
And so on.

I have used ODBC to access Microsoft SQL Server and DB2 Databases, and I
believe neither support the SQL LIMIT clause, although I am not as
certain about my memory of MSS as DB2.  Someone will correct me if I am
wrong.

The only approach left that I could come up with is to transfer the
entire sequence set to your application, and count the rows, perhaps
only displaying the rows you want to show.  This is obviously not very
efficient (in fact, with enough rows it may prove impossible because of
memory limitations), but it will produce what appears to be a paged
result.

HTH,

Warren Vail

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



RE: [PHP] Are sessions unreliable?

2005-04-16 Thread Warren Vail
I have had similar things happen but in every case it turned out to be a
program bug in my code.  It was usually something I looked at over and
over and I saw the way it was supposed to work, but because I missed a
detail it was not working that way.  I would suggest you find someone to
look over your code and help you with the debug process.  I found many
bugs just trying to explain to someone clearly how it worked.

I suppose it could be a browser problem, but you need to solve those as
well, or at least handle them gracefully.  Do you make it a practice of
having multiple browser instances open at the same time.  I believe they
will each normally get their own session key, and if you get your hands
crossed, you will be looking at the symptoms in the wrong browser,
bottom line, test, test, and test, then get a second set of eyes to look
at your code, show them how it works, they don't need to really know a
lot about PHP, or even programming for that matter, they will ask
questions that as you try to answer them, you will find your problems.

I have never found a legitimate bug in PHP Sessions, I have on the other
hand found I was inconsistently using session handler routines, and
before register globals was turned off, I was finding form variables
that clobbered my session variables (or maybe it was the other way).

Good Luck,

Warren Vail
[EMAIL PROTECTED]

 -Original Message-
 From: Dasmeet Singh [mailto:[EMAIL PROTECTED] 
 Sent: Friday, April 15, 2005 11:04 PM
 To: php-general@lists.php.net
 Subject: [PHP] Are sessions unreliable?
 
 
 Hi!
 
 I store some user info in sessions.. it works fine but sometimes what 
 happens is that the user id stored in session get changed.. and it 
 happens only sometimes..
 
 Can it be browser problem? or this is common?
 
 Thanks
 
 
 
 -
 Free cPanel Web Hosting 
 http://hostwindow.info/web-hosting/2/free- cpanel-web-hosting/
 
 
 -- 
 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] Amazon/eBay API

2005-04-15 Thread Warren Vail
There is a PHPNuke (web portal application) module that will allow you
to open an Amazon Store on your website.

NukeAmazon http://www.PrecioGasolina.com/

I'm still looking for an eBay feed, I think the barrier there is that I
heard eBay charges some big bucks to be able to access the interface.
Amazon on the other hand recognized the power of having a proliferation
of front-ends promoting and selling their products and provides access
pretty much for free (there are features you can pay extra for if you
are inclined).  

Don't know if eBay will ever come along.  Apple, even today, doesn't
recognize that IBM gained it's dominance by giving away its bios listing
and hardware specs (and some of its business) in the very beginning,
while apple looked at that type of move as giving away income it was
intitled to receive and jealously guarded it's monopoly, even sueing
vendors in some cases.  eBay probably feels they already have a monopoly
on auction sites and don't need to give their stuff away.

Warren Vail
[EMAIL PROTECTED]

 -Original Message-
 From: Brian Dunning [mailto:[EMAIL PROTECTED] 
 Sent: Friday, April 15, 2005 9:57 AM
 To: php-general@lists.php.net
 Subject: [PHP] Amazon/eBay API
 
 
 Does anyone know of any PHP classes for processing the Amazon or eBay 
 XML feeds?
 
 - Brian
 
 -- 
 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] Printing

2005-04-02 Thread Warren Vail
That is because Windoz, for all it's faults, provides a bit of an
interface for applications to exercise some control over printed output,
and even attempts to make it device independent.  Don't know if Gnome,
or other GUI's provide something, but if you write the output intended
for a printer to a physical file and then post that file to your print
spooler using a exec() function that should do the trick.

http://us4.php.net/manual/en/function.exec.php

I suspect you would use the unix command to cause the file to be spooled
to the printer as you would manually (I seem to recall an lpr command
being involved, but don't trust my memory).

This carries with it all the caviates about whether or not you know who
your website visitors are, and what happens when multiple users try to
trigger printing (who loads paper in the printer?).  Another potential
snag is, will you website user (usually nobody) have permission to
print (execute the lpr command)?

Unless gnome or kde is involved, don't know how you could detect your
printer types, since your program will need to know which pcl (printer
control language) is required.

Good luck,
Anyone have other solutions?

Warren Vail


 -Original Message-
 From: Niels Riis Kristensen [mailto:[EMAIL PROTECTED] 
 Sent: Saturday, April 02, 2005 8:03 AM
 To: php-general@lists.php.net
 Subject: [PHP] Printing
 
 
 Hi
 
 I am using a Unix machine (Mac) but can't find ways to print to my 
 local printer. Plenty of information about printing from a 
 PC, but none 
 from a mac. Can that be, that you can't print from php to mac?
 
 
 Niels Riis Kristensen
 ([EMAIL PROTECTED])
 
 NRK Group
 - Electronic Music Engraving
 - Webhosting
 - Dynamic Web design
 - E-Lists hosting
 

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



RE: [PHP] php compiler

2005-03-14 Thread Warren Vail
I could be wrong, but I believe that all the Java apps out there are not
native binary machine code either?  unless you count the JRE (Java Runtime
Environment).  Seems to me that is the way things are today, with JRE's all
having run time configuration.  I would prefer to PHP to Java any day.

Have you checked out the Road Send compiler?  http://www.roadsend.com/  I
don't believe it produces pure native binary either, but I could be wrong
here as well.

good luck,

Warren Vail

 -Original Message-
 From: Davy Durham [mailto:[EMAIL PROTECTED]
 Sent: Monday, March 14, 2005 9:22 PM
 To: php-general@lists.php.net
 Subject: [PHP] php compiler


 Sooo.. I'm assuming there's no stable project for compiling php code to
 native binary machine code huh?  (I've done some searching)  Even
 anything commercial? (I didn't care for Zend's optimizer so much.. still
 has *RUN*time configuration)

 Thanks,
   Davy

 --
 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] [noob] can't submit simple form, need help

2005-03-03 Thread Warren Vail
 $submit_post=$_REQUEST['submit']; 
  
 if ($submit_post=='yes') { 
 
looks like the value in your form is not 'yes' but 'submit'


 pinput type=submit name=submit value=submit /  /p 

if this is not it, perhaps we should see more.

Warren Vail

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



RE: [PHP] fopen and http://

2005-02-25 Thread Warren Vail
Just a wild guess, but try url;

http://localhost/zed/htdocs/rgfindingaids/series594.html

or

file://zed/htdocs/rgfindingaids/series594.html to bypass your web server

I am struggling with the section of the manual that deals with this as well.

http://us3.php.net/manual/en/ref.stream.php

hope this helps,

Warren Vail

 -Original Message-
 From: Mulley, Nikhil [mailto:[EMAIL PROTECTED]
 Sent: Friday, October 08, 2004 6:58 AM
 To: Adam Williams; php-general@lists.php.net
 Subject: RE: [PHP] fopen and http://


 May be the path is not the correct ,just check with the Web
 Directory you configured to be and if its htdocs then I would say
 that its better to remove the htdocs from the path in fopen statement.

 -Original Message-
 From: Adam Williams [mailto:[EMAIL PROTECTED]
 Sent: Friday, October 08, 2004 6:22 PM
 To: php-general@lists.php.net
 Subject: [PHP] fopen and http://


 Hi, I'm having a problem with fopen and http files.  I keep getting the
 error:

 Warning: fopen(http://zed/htdocs/rgfindingaids/series594.html )
 [function.fopen]: failed to open stream: HTTP request failed!
 HTTP/1.1 404
 Not Found in /home/awilliam/public_html/rgfaidstest.php on line 15
 http://zed/htdocs/rgfindingaids/series594.html does not exist

 Warning: fopen(http://zed/htdocs/rgfindingaids/ser391.html )
 [function.fopen]: failed to open stream: HTTP request failed!
 HTTP/1.1 404
 Not Found in /home/awilliam/public_html/rgfaidstest.php on line 15
 http://zed/htdocs/rgfindingaids/ser391.html does not exist

 Warning: fopen(http://zed/htdocs/rgfindingaids/ser392.html )
 [function.fopen]: failed to open stream: HTTP request failed!
 HTTP/1.1 404
 Not Found in /home/awilliam/public_html/rgfaidstest.php on line 15
 http://zed/htdocs/rgfindingaids/ser392.html does not exist



 I have a text file /home/awilliam/public_html/rgfaids containing
 URLs such
 as:

 http://zed/htdocs/rgfindingaids/series594.html
 http://zed/htdocs/rgfindingaids/ser391.html
 http://zed/htdocs/rgfindingaids/ser392.html

 and I can bring up these URLs fine in a browser on the PC i'm running the
 script on.

 The following is my code:

 ?

 $filelist = fopen(/home/awilliam/public_html/rgfaids, r);

 if (!$filelist)
 {
 echo error opening rgfaids;
 exit;
 }

 while ( !feof($filelist))
 {
 $line = fgets($filelist, 9);

 $filetotest = fopen($line, r);

 if (!$filetotest)
 {
 echo $line does not existbr;
 }
 elseif ($filetotest)
 {
 echo $line does exist;
 }
 }

 ?



 But I don't understand why I am getting that error about failed to open
 strem: HTTP request failed, when I can bring up the links fine in a
 browser on the server running the php script.  So can anyone help
 me out?
 Thanks

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

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





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



RE: [PHP] Open source portal systems???

2005-02-25 Thread Warren Vail
Where did you hear that PHP Nuke required a powerful server?  I personally
implemented PHP Nuke on a Windoz box (one strike there), that ran on a 166
mmx box (a big second strike), and benchmarked it handling 90 concurrent
users, with no noticeable delays.  If I were you, I'd dig deeper into what
you heard and you may find that someone had another agenda in mind when they
passed along that info.  It's unfortunate, but there are lots of people in
the IT field that distort results to justify an already conceived opinion.

go figure,
Warren Vail

 -Original Message-
 From: Kostyantyn Shakhov [mailto:[EMAIL PROTECTED]
 Sent: Friday, February 25, 2005 9:34 AM
 To: php-general@lists.php.net
 Subject: [PHP] Open source portal systems???


 I've got an order for the media portal. Thus, I'm looking for an open
 source portal systems. First that comes to my mind is PHP-Nuke, but I
 heared that it requires a powerful server and i'll have just a
 middle-level one. So, could someone knows another PHP-based open
 source portal systems? Thank you in advance.

 --
 Best regards,
  Kostyantyn  mailto:[EMAIL PROTECTED]


 --
 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: FTP info in a variable

2005-02-25 Thread Warren Vail
Good stuff Jamie.

Steve, I believe it may even be possible to compress the file on the fly, or
send it using SSL if that is desirable;

http://www.php.net/manual/en/ref.stream.php describes how to use stream
wrappers.

good luck,

Warren Vail

 -Original Message-
 From: Jamie Alessio [mailto:[EMAIL PROTECTED]
 Sent: Friday, February 25, 2005 9:13 AM
 To: php-general@lists.php.net
 Subject: [PHP] Re: FTP info in a variable


  I have to write a little program that pulls information from a
  database, formats it into csv format for importing into excel and ftps
  it to another server.  I have everything worked out except for the
  ftping.  I have read through http://us4.php.net/manual/en/ref.ftp.php
  and I know I can get the data from the database, save it to a file and
  ftp it.  Does anybody know if I can skip the step of saving it
 to a file
  and ftp/stream it directly to a filename on another server?
 
 Steve,
 You should be able to skip the step of writing the CSV file out to disk
 by using PHP's Filsystem functions along with FTP wrappers. I think
 something like this will work:

 $handle = fopen(ftp://user:[EMAIL PROTECTED]/somefile.csv, w);
 fwrite($handle, $yourCSVdata);

 The FTP wrappers allow you to (almost) treat the file as though it were
 on your local filesystem.

 Check the man pages for details on how to do this properly and check for
 errors:
 http://us4.php.net/manual/en/function.fopen.php
 http://us4.php.net/manual/en/function.fwrite.php
 http://us4.php.net/manual/en/wrappers.ftp.php

 - Jamie

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




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



[PHP] fopen and redirects

2005-02-24 Thread Warren Vail
I am using fopen with a url to open a remote file (read only of course).
The url I am providing results in a redirect and the fopen seems to be smart
enough to follow the redirect to return the actual file contents.  How can I
get at the redirected filename?

The problem is the file contains html and relative references in href's
buried in the html are relative to the redirected location and not my
original location, and I would like to subsequently open some of those files
(like a crawler does).

thanks in advance,

Warren Vail


RE: [PHP] Crontab for Windows

2005-02-17 Thread Warren Vail
 On my live server I use Linux, so am fully familiar with Crontab. I am
 not that familiar with running scripts using the scheduler in
 Win2K though.

I use nncronlite which is a cron implementation for windoz (familiar
crot.tab file);

http://www.batchconverter.com/nnCronLITE-download-16062.shtml

One problem I encountered with the MS scheduler, is it needed to be running
as a process, and in an implementation of windows that had Microsoft SQL
Server running on NT, seems this SQL server has the ability to schedule some
batch processes, but it implemented a replacement for the batch scheduler
that would not process my AT commands.  In windoz the AT command is used
to add processes to the schedule.

hope this helps,

Warren Vail

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



RE: [PHP] Re: Crawlers (was parsing large files - PHP or Perl)

2005-02-17 Thread Warren Vail
Check out PHPdig;

http://www.phpdig.net/

Warren

 -Original Message-
 From: Jamie Alessio [mailto:[EMAIL PROTECTED]
 Sent: Thursday, February 17, 2005 9:22 AM
 To: John Cage
 Cc: php-general@lists.php.net
 Subject: [PHP] Re: Crawlers (was parsing large files - PHP or Perl)
 
 
  Is there anyone on this list who has written fast and decent 
  crawlers in PHP who would be willing to share their experiences?
  
 My first inclination would be to use an existing crawler to grab the 
 pages and store all the files locally (even if only temporarily). Then, 
 you can use PHP to do whatever type of processing you want on those 
 files and can even have PHP crawl deeper based on links in those files 
 if necessary. I'd have a hard time coming up with a reason to think I 
 would implement a better web crawler on my own than is already available 
 from other projects that focus on that. What about existing search 
 systems like:
 
 Nutch - http://www.nutch.org
 mnoGoSearch - http://mnogosearch.org/
 htdig - http://www.htdig.org/
 or maybe even a wget -r - http://www.gnu.org/software/wget/wget.html
 (I'm sure I missed a bunch of great options)
 
 Just an idea - I'd also like to hear if someone has written nice 
 crawling code in PHP.
 
 - Jamie
 
 -- 
 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] [NEWBIE] Trying to combine array into one string

2005-02-15 Thread Warren Vail
Try loading he email address to an array from your query;

$addressarray[] = $address;

and when done extracting the rows from your database, parse them into a comma 
separated string using

$listofaddresses = implode(, ,$addressarray);

HTH,

Warren Vail

 -Original Message-
 From: Dave [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, February 15, 2005 7:37 AM
 To: php-general
 Subject: [PHP] [NEWBIE] Trying to combine array into one string
 
 
 PHP General,
 
 The Situation:
 I'm retrieving some email addresses from a database. I want to be 
 able assemble all the addresses into one string that I can use in the 
 mail() command. At no time should there ever be more than about 5 email 
 addresses collected from the database. I want all addresses to appear in 
 the To: field so everyone receiving the email will know who else has a 
 copy.
 
 The Problem:
 I can't quite figure out how to take the results of the 
 mysql_query() and assemble them into a string. In my experiments so far, 
 I either get a mysql_data_seek(): Offset 0 is invalid for MySQL result 
 index error, or my mail function sends to a blank address.
 
 What I've Tried So Far:
 My own code is obviously flawed in syntax in logic, so I searched 
 the manual and this list's archives under the terms array, 
 concatenate, convert, append and string in various combinations. 
 However, while I learned some interesting tips on a variety of topics, I 
 suspect I'm missing some essential description that will lead me to the 
 command I need.
 
 The Question:
 How do I take the contents of an array and turn them into a single 
 string?
 
 For Reference:
 Here is the code I have. I know it's flawed, but hopefully it will 
 give an indication of what I'm trying to achieve:
 --code--
 $tantoQuery = SELECT forum_members.emailAddress AS email FROM 
 forum_members, event_tanto WHERE forum_members.ID_MEMBER = 
 event_tanto.tanto AND event_tanto.event =' . $show . ';
 
 $tantoResult = mysql_query($tantoQuery);
 
 while ($tantoData = mysql_fetch_array($tantoResult))
 {
 $tantoEmail = $tantoEmail . , . $tantoData;
 }
 
 mail($tantoEmail, $subject, $mailcontent, $addHeaders);
 --code--
 
 Any help would be much appreciated.
 
 -- 
 Dave Gutteridge
 [EMAIL PROTECTED]
 Tokyo Comedy Store
 http://www.tokyocomedy.com/english/
 
 -- 
 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: mediator between PHP and Perl (with sessions)

2005-02-15 Thread Warren Vail
Eli,

Sessions work just fine with CLI (Command Line Interpreter), although there is 
little need for them as a CLI script, since once started the script does not 
wait on user clicks of a browser for it's next set of input, therefore no need 
to use sessions for passing information.  Most CLI scripts are started via a 
cron process, and if started from a webpage, the items passed to the script can 
be passed via command line parameters, or if passed as session variables, the 
session key needs to be passed to the CLI script, since CLI scripts don't have 
access to cookies.  One advantage of using session variables when starting a 
CLI script, is that the session may be able to pass bigger values than can be 
contained in a command line. (Command line variables can be accessed in the 
argc/argv array like in c) and once passed this way the sessions are no 
longer needed since your CLI script will run to completion.

If your server is a NIX box, you may have access to the  character after the 
command name that will cause it to run as a separate shell script, but you will 
need to set the timeout to allow it to run long enough, and if you do not use 
the  separate shell character, the script will be interruptible by the user 
who started it by clicking a button like stop on his browser.

The unserialize function is indeed used for sessions, but with most newer 
releases of PHP register variables is turned off, which means the variables 
are not restored automatically (you will find them in the $_SESSION array).  
Sections of the manual you may want to reread are as follows;

http://www.php.net/manual/en/ref.session.php
http://www.php.net/manual/en/function.session-set-save-handler.php (good 
illustrations of what happens in sessions)
http://www.php.net/manual/en/function.session-register.php (notice the notes on 
register variables).
http://www.php.net/manual/en/function.session-id.php
http://us3.php.net/manual/en/function.set-time-limit.php to allow script to run 
longer.
http://us3.php.net/manual/en/function.shell-exec.php for starting a cli script 
(don't forget to start php).

hope this helps,

Warren Vail

 -Original Message-
 From: Eli [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, February 15, 2005 7:07 AM
 To: php-general@lists.php.net
 Subject: [PHP] Re: mediator between PHP and Perl (with sessions)
 
 
 It's quite easy to pass the session variables to the script. The problem 
 with sessions and shell PHP scripts, is that PHP doesn't support 
 sessions on that mode (CLI mode it is called). So, I would have to 
 manualy read the session file and parse it. If anyone knows what is the 
 exact function that is used to unserialize the session file, please 
 tell.. and it's not the unserialize() function in PHP.
 
 I guess that using a shell PHP script with sessions is not the solution. 
 Is anybody familiar with another way to use sessions??? but not through 
 web, since the script returns sensitive data.
 
 
 -thanks, Eli
 
 -- 
 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] script PHP to detect IP address

2004-12-17 Thread Warren Vail
hmmm, perhaps you are not clear about how IP addresses are used (assigned
and reassigned), if your interest is the ip address of a PC connected to
your website or the ip of the website, probably depends on your web server,
for my apache server;

$_SERVER[SERVER_ADDR] (apache server IP address, at least the one being
used by my connection)
$_SERVER[REMOTE_ADDR] (browser IP address, that is connected to my task)

If on the other hand you are talking about a stand alone script, you need to
understand how IP addresses are assigned as needed (there is probably no one
IP address that identifies a single PC in most cases), there are a few
exceptions where fixed IP addresses are assigned, but more often not.
Perhaps if you were to identify what you are trying to find out, asking that
question would get you a more definitive answer?

good luck,

Warren Vail

 -Original Message-
 From: welly limston [mailto:[EMAIL PROTECTED]
 Sent: Friday, December 17, 2004 6:18 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] script PHP to detect IP address



 Anybody out there who know the PHP script that can use to detect
 an IP address of a PC?

 If u dont know, maybe some sites address which have related with
 this topic, might be point me little.



 Many your help very appreciate.

 Thanks so much for ur respone





 -
 Do you Yahoo!?
  Yahoo! Mail - You care about security. So do we.

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



RE: [PHP] login.php

2004-12-08 Thread Warren Vail
You can find lots of information on your own by reading the manual, always a
good place to start.

Try http://us2.php.net/manual/en/ref.ldap.php

Google is another source.

good luck,

Warren

 -Original Message-
 From: badlya badlu [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, December 08, 2004 9:27 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] login.php


 Hi All

 This is my first mail to php mailing list. i want to
 create one login.php program in linux. i want this
 page to go the ldap server for authentication. how
 should i do it.
 thanks in advance.

 badlya





 __
 Do you Yahoo!?
 Read only the mail you want - Yahoo! Mail SpamGuard.
 http://promotions.yahoo.com/new_mail

 --
 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] converting a number

2004-11-18 Thread Warren Vail

 I have a number like 1.0122E9 and I want to convert it into a
 real number in
 a common notation and not in that scientific one (with E).

 I have seen that very long numbers are always converted
 automaticly to that
 notation and I need to insert that number in  a MySQL database and in that
 case MySQL won't calculate well.

 Please tell me how to do that in PHP or in MySQL..

Is this what you were thinking of?

$query = insert table(floatcol) values(.sprintf(%2.4f,$yourno).) ;

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



RE: [PHP] I am new - Having problems displaying something

2004-11-18 Thread Warren Vail
Looks like the URL you are trying to passthru is missing a domain, No?  ;-)

Warren Vail

 -Original Message-
 From: Brian Heibert [mailto:[EMAIL PROTECTED]
 Sent: Thursday, November 18, 2004 9:33 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] I am new - Having problems displaying something
 
 
 Hi,
 
 I am new to this list.  I am trying to do a php script that will say what
 song is currently playing in iTunes/NiceCast Internet Radio broadcaster
 Onto my website
 
 Every attempt I have made so far has failed
 
 I got a file called playing.php
 With this text inside it:
 ?php
 
 echo Current Song: .passthru(osascript
 /Library/WebServer/Documents/christiantoplist/whattrack.scpt);
 
 ?
 
 
 And a file called whattrack.scpt (AppleScript file) with this in it
 tell application iTunes
 set trk to current track
 set tle to name of trk
 set art to artist of trk
 set albm to album of trk
  return tle   -   art  ,   albm
  end tell
 
 But it is not displaying what song is playing on my website
 All it says is Current Song: and then it doesn't say the song
 
 Brian Heibert
 
 PS: I have a iMac G4 800mhz OS 10.3.6 running Apple's webserver system
 preference which is there version of Apache I think
 
 -- 
 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] getting a number range from user input.. (weight)

2004-11-05 Thread Warren Vail
Sorry for the delay in getting back to you but I had a long commute tonight.

Suppose you load an array in high weight order (from the zone that applies).

weight   value
 .5  9.45
1.0 10.71
1.5 11.97
2.0 13.23

load them into an array where like so;

select weight, zone$zn, from postage_costs

// looping thru returned rows, load an array ;
$zonearray[] = array($weight, $value);

// then performing lookups;

unset($postage);
foreach($zonearray as $entry) {
list($wght, $val) = $entry;
if($wght = $actualpkgweight) {
$postage = $val;
  break;
}
}
if(isset($postage)) // here you have the minimum postage to cover the
package.
else  // here you have a package that weighs more than your largest
weight

You can probably figure ways to streamline this, but I think it may answer
your basic question.  The best solution is one that works for you reliably,
and there have to be at least 50 ways to do this.  This is just one.

good luck,

Warren Vail

-Original Message-
From: Louie Miranda [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 04, 2004 10:06 PM
To: Murray @ PlanetThoughtful; [EMAIL PROTECTED]
Subject: Re: [PHP] getting a number range from user input.. (weight)


I have this on my db.

mysql select * from rates_dhl where weight_kg = 6 between range and
Weight_KG;
++---+---++++++-
---+++
| id | range | Weight_KG | Zone_A | Zone_B | Zone_C | Zone_D | Zone_E
| Zone_F | Zone_G | Zone_H |
++---+---++++++-
---+++
|  1 | .000  | .5| 9.45   | 12.29  | 14.18  | 15.12  | 16.59
| 18.48  | 21.32  | 23.63  |
++---+---++++++-
---+++
1 row in set (0.00 sec)

When i did try the between, even when i try to change the weight_kg to
any number, it only display the first entry.


On Fri, 5 Nov 2004 15:52:16 +1000, Murray @ PlanetThoughtful
[EMAIL PROTECTED] wrote:



  OK, here is what it should do.
 
  I have a fixed range of weights from .5 to 20.0 Kg (kilogram) and for
  each weight it has a succeeding value, i cannot jump or just round off
  the numbers. So i need a range detector to do it.
 
  Because for each of the item below:
 
   weight   value
   .59.45
   1.0 10.71
   1.5 11.97
   2.0 13.23
 
  I must get the exact value, so let say for example. I have 1.3 it
  should fall under 1.5 the idea i had was to do this, so i can detect
  where the number should fall..

 Put the weight ranges in a MySQL table and use the BETWEEN operator to
 retrieve the appropriate weight.

 Something like:

 fromweight, toweight, value
 0,0.5,9.45
 0.501,1.0,10.71
 1.001,1.5,11.97

 Then, the following SQL statement will pull the appropriate value:

 SELECT value FROM weights WHERE 1.3 BETWEEN fromweight AND toweight

 Much warmth,

 Murray
 http://www.planetthoughtful.org
 Building a thoughtful planet,
 One quirky comment at a time.

 --


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




--
Louie Miranda
http://www.axishift.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] getting a number range from user input.. (weight)

2004-11-05 Thread Warren Vail

  You can probably figure ways to streamline this, but I think it
 may answer
  your basic question.  The best solution is one that works for you
  reliably,
  and there have to be at least 50 ways to do this.  This is just one.

 Hmm. Personally I would have thought the best way to do this is to get the
 db server to perform as much of the selection work as possible, thus the
 suggestion of using a BETWEEN operation in a WHERE clause of an SQL
 statement.

In theory perhaps, the better approach kind of depends on if he is looking
up the cost of one shipment or many.  Databases, like you indicated, are
optimized for looking up this kind of information from large record sets on
a hard drive and a good database will try to cache as much of their last
result as possible for use in the next query, but once cache cannot be used,
performance drops dramatically.  For one lookup on an single order, the
direct DB approach probably would produce faster results, but I doubt the
user would be able to see the performance difference on one order (can you
see a savings of 200 milliseconds), and for processing multiple shipments,
avoiding multiple db lookups would produce faster results.

I did forget to include an order by weight clause in the query which would
be required for my solution (and would add an overhead), and probably not
required for the DB solution, hopefully he figured that out.  Bottom line
the real best solution is the one that works for him, that he understands
and can change if needed.  He probably would have a tough time measuring
things that could cause the DB approach to suddenly not be able to use
cached contents, like DB server load from other applications, etc., and if
he is processing multiple shipments factors outside his control, like
other apps, could impact his applications performance.

Warren Vail

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



RE: [PHP] Is there any way of knowing User Currently Logged On?

2004-10-12 Thread Warren Vail
If it throws out garbage, you should be able to execute the who command on
the remote system, which should show users that are currently signed on to a
Unix or Linux system and if you do it all in the perl script, you can format
the output to look pretty much the same (in case you haven't figured it out
the @users_list is an array, very similar to PHP arrays actually [IMHO]).
If you modified the perl script to detect the garbage, it could simply do a
telnet connection and execute the who command.  There are probably ways
that use privileged commands similar to the one used for your windows
solution on remote Linux Unix, but I don't know them, and I'm not sure it's
a good idea to use them in a PHP script, but you can get opinions the other
way as well.  If all your machines are behind the same firewall, away from
the internet, the risk could be less if you have a good firewall.  For your
telnet connection from perl look for the net:telnet perl module at
http://www.cpan.org/modules/by-module/Net/ , if you know PHP you will find
perl quite easy I think.

Good luck.

Warren Vail

-Original Message-
From: Mulley, Nikhil [mailto:[EMAIL PROTECTED]
Sent: Monday, October 11, 2004 9:54 PM
To: Vail, Warren; Mulley, Nikhil; [EMAIL PROTECTED]
Subject: RE: [PHP] Is there any way of knowing User Currently Logged On?

Hi Vail,

My Worry is that If a remote OS is not Windows, then this would throw out
garbage,
Where as this Perl Script would work well at a Windows Side ,Bcoz I am using
the 'Win32'  Module ,is there any other module such that .
We cannot even predict ( or I believe there is no exact way ) what the
remote OS could be :(



Nikhil.

-Original Message-
From: Vail, Warren [mailto:[EMAIL PROTECTED]
Sent: Monday, October 11, 2004 11:33 PM
To: 'Mulley, Nikhil'; [EMAIL PROTECTED]
Subject: RE: [PHP] Is there any way of knowing User Currently Logged On?


If you code in php something like the following, you just might be able to
use the perl script;

$ok = exec(path/to/Perl myperscriptname.pl server, $result);   // you may
have to straighten out syntax
Foreach($result as $line) {
echo $line;   // or you could process the results
}

Hope this helps,

Warren Vail


-Original Message-
From: Mulley, Nikhil [mailto:[EMAIL PROTECTED]
Sent: Monday, October 11, 2004 9:52 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Is there any way of knowing User Currently Logged On?


Hi Guys,

Is there any way of finding the current user logged on the remote system

I have a perl script which gets the user name who is currently logged on a
remote Windows Machine





#LoggedOnUsers(server, userRef).pl
use Win32::NetAdmin;
use strict;
use vars qw($server @users_list);
if(@ARGV0){
$server=$ARGV[0];
}
else{
print \n\nEnter a valid Hostname  or IP Address : ;
chomp($server=STDIN); }
Win32::NetAdmin::LoggedOnUsers($server,[EMAIL PROTECTED]);
foreach(@users_list) {
print \n$server-- $_;
}


This one gets the users logged in on a remote Windows machine , Is there a
similar way of finding / doing the same regardless of an OS, Can it be done
through a Web Browser 

Any Clues ??

--Nikhil.

--
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] Help needed Postgresql and PHP

2004-10-05 Thread Warren Vail
Extracting name and addresses from postgres as a comma separated values
CSV file should be doable with postgress utilities or scripts.  Assuming
you have access to a word processor like Microsoft Word, that has a Mail
Merge capability, where your letter can be merged and printed with names
and addresses from your CSV file.

Factors affecting the wisdom of this approach are;
* The volume of letters you expect to print and the printers you expect to
use (bubble jet ink cartridges are expensive).
* If name and address are the only substitutions in the letter.  Greetings,
additional content may require more that a CSV solution.
* Special bulk mail requirements like zip code sort and selections should be
doable in postgres.
* For really large volumes you will need to break down the workload for
multiple printers in a fashion that makes sense.

If you want to reinvent the wheel by developing your own mail merge process,
I would recommend against it, unless there is some significant gain by doing
that.  I'm guessing that your have already considered this, but are looking
for some other solution for some reason that is not apparent to me.

Good Luck,

Warren Vail


-Original Message-
From: suma parakala [mailto:[EMAIL PROTECTED]
Sent: Monday, October 04, 2004 11:23 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Help needed Postgresql and PHP

Hi
I am developing an application using php and postgresql . My problem is I
need to retrieve name and addresses from table(postgres sql table)  and
print letter (body of letter will be same). Kindly help /Suggest how i can
do this
Thanks
Suma

_
Looking for a soulmate?  http://www.shaadi.com/ptnr.php?ptnr=hmltag Log onto
Shaadi.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] Best and easy html text area replacement tool?

2004-10-04 Thread Warren Vail
I guess I have no patience with the topic police since it's difficult to
develop a good PHP user interface without the use of JavaScript, and I
consider anything that involves getting the most out of PHP on topic, but
since I'm in charge of absolutely nothing, all I can do is provide a little
information.

I've actually used a couple of these JavaScript add-on's and like the
structure and reliability of HTMLAREA.

http://www.interactivetools.com/products/htmlarea/

It provides a nice plug-in interface that other developers have used to make
JavaScript extensions available that includes;
* Image Upload Manager
* Spell Checking (On a Unix/Linux host)
* Enhanced Table Formatting
* Multiple Language Capability (haven't look too close at this one)
* Even something for Audio (haven't looked at this, either)
* And probably some that I haven't mentioned (doing this from memory).

And the price is the same as PHP (free).

Good luck,

Warren Vail

-Original Message-
From: Bosky, Dave [mailto:[EMAIL PROTECTED]
Sent: Monday, October 04, 2004 1:50 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Best and easy html text area replacement tool?

I'm looking for an easy to use html textarea replacement script and figured
this was the place to locate the most popular.



Thanks,

Dave









HTC Disclaimer:  The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of this
message is not the intended recipient, or an employee or agent responsible
for delivering this message to the intended recipient, you are hereby
notified that any dissemination, distribution or copying of this
communication is strictly prohibited.  If you have received this
communication in error, please notify us immediately by replying to the
message and deleting it from your computer.  Thank you.

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



RE: [PHP] thumbnail of webpage

2004-09-22 Thread Warren Vail
I may have found something, a perl script that with all the appropriate
pieces turns a page into a jpg image.

http://marginalhacks.com/Hacks/html2jpg/

from there resizing using GD is a snap.

Warren Vail

-Original Message-
From: Vail, Warren [mailto:[EMAIL PROTECTED]
Sent: Friday, September 17, 2004 6:48 PM
To: 'Jason Davidson'; Michael Mao; [EMAIL PROTECTED]
Subject: RE: [PHP] thumbnail of webpage

I have been looking into this over the last week and have come up blank as
well.  Doing this manually is simple, point your browser to your URL, and in
windows use altprint Scrn to copy an image of the rendering in the
browser to the scratch-pad, then paste the image into a tool like paint to
cut out the part of the image you want, and use the skew/stretch tool in
paint to create the thumbnail (GD is a good solution as well) saving the
file as a jpg image.

The difficulties with php is that opening the URL with fopen or using CURL
allows getting the content of a page in html form, but provides no bitmap
rendering of all that, let alone allowing JavaScript to alter the
presentation as it would in a browser.

What would be useful, if there were a way to open the URL in an IFRAME, and
with JavaScript somehow capture a bitmap of the rendering of the web page,
perhaps encoding the bitmap as mod64 characters and placing the result in a
textarea for posting as input to a php script.  This was the best solution
that I could come up with but I don't have the skills to make this happen,
yet.  Question for anyone here, is does this sound like a path that might
work?  Can JavaScript access the rendered content of a webpage in window
bitmap form?

In my travels, someone had suggested coding something using mozilla and
invoking it from a php script, but no one has done this yet that I can
determine.

Warren Vail


-Original Message-
From: Jason Davidson [mailto:[EMAIL PROTECTED]
Sent: Friday, September 17, 2004 6:08 PM
To: Michael Mao; [EMAIL PROTECTED]
Subject: Re: [PHP] thumbnail of webpage


First, im not sure how you would capture a snapshot of the page, sinse the
page is rendered by the browser, and php is completely server side.
Possibly there is a way to fopen a page or something, but... i dunno..

as for making thumbnail, using the gd extension, is quite easy. check the
manual for GD.

Jason


Michael Mao [EMAIL PROTECTED] wrote:

 Is there a way to capture a snapshot of a html page and save it as a
 jpg
 using php?

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



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

--
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: PHP Sessions Question

2004-07-09 Thread Warren Vail
I have a suggestion that would allow you to take charge of what is going on
with your sessions.  Install your own session handler routines, storing your
own session data in your own database table.  These functions would need to
be loaded on each page before you execute the session_start() function on
each page.

http://www.php.net/manual/en/function.session-set-save-handler.php

Since the Garbage Cleanup and session read function is now under your
control, you can establish the session expiration that is appropriate for
your application, independent from the PHP default for the site.  Be
careful, however for the parameters that control the life of the cookie in
the browser, they can also cause the session to be lost if not set properly.

http://www.php.net/manual/en/function.session-set-cookie-params.php

This may sometimes seem intermittent, since the cookie will expire from the
time first established in the browser, and if you are only aware of the time
from the last page, and the cookie goes away, the session will appear to
have been destroyed.

good luck,

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Jason Barnett [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 08, 2004 11:23 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: PHP Sessions Question


 On garbage collection, it happens sometimes within seconds and sometimes
 within minutes.  It tends to occur in batches with lulls of 20 to 30
 minutes.  So, for example, I can login, navigate through 11 different
pages
 to generate the problem, navigate 2 pages to generate the problem, and
then
 not see the problem again for another 5 minutes.  Does that fall in line
 with what you're thinking?


Actually, no.  Garbage collection would destroy the sessions, so if
they're only temporarily disappearing then load balancing seems even
more likely.

I'm going to assume not, but are you using a non-default session
handler?  If for instance you were storing sessions in another database,
or simply on a different machine then connections can fail.  This would
most likely only be set up through the set_session_handler directive I
mentioned before... but you should also check your php.ini values for
session.save_handler and session.save_path

--
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: PHP doesnt work!

2004-07-04 Thread Warren Vail
PHP relies on a server side interpreter that normally runs under an apache
web server and you reference those files by having your browser fetch those
files through a URL that maps to your PHP files, beginning with something
like http://hostname.com/program.php.  If you opened the files directly with
your browser, you have bypassed the apache server and PHP interpreter, which
of course, would not allow the PHP code to actually be executed.  Not real
sure this is what you might have done, but it's a common mistake.

good luck,

Warren Vail
[EMAIL PROTECTED]

-Original Message-
From: Jason Barnett [mailto:[EMAIL PROTECTED]
Sent: Saturday, July 03, 2004 9:13 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: PHP doesnt work!


Gmo Baez wrote:
 Hello, I have a Freebsd server 5.2.1 with Apache 2.0.48 and PHP 4.3.4.

 After the installation everything looks normal, but after i created some
PHP
 web files to test it, I found that  PHP is not working.
 When i open de PHP document with the browser i only receive a blank page.
 But if i check the source code, all the PHP code is in there.

What kind of code are you using to test the script?  Not every script
outputs html... have you tried phpinfo()?  It is unclear what your
problem may be from what you've given us.

Jason

--
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] Hierarchies and MySQL with PHP

2004-06-27 Thread Warren Vail
I did one once where the key to the table was a string, and the string
contained 1 to n Node Numbers separated by a separator character.

1
1.1
1.1.1
1.2

select data from table where node between (1 and 2)

resulted in an entire limb of the tree being retrieved.  Limitations were
the size of the string, depth of the tree (the string was truncated), and
the number of digits in each node number.  Problem also with ordering node
numbers, node number 1 tended to be followed by node number 10, 11, 12, etc,
then number 2, until I pre-determined the number of leading zeros for each
node.

Not pretty, but it works well for small trees.

Warren Vail

-Original Message-
From: Mattias Thorslund [mailto:[EMAIL PROTECTED]
Sent: Sunday, June 27, 2004 9:59 AM
To: PHP General Mail List
Subject: [PHP] Hierarchies and MySQL with PHP


Hi,

I wonder what you think are the best (or least worst) strategies to
store and retrieve hierarchial data (such as a threaded discussion or
a multi-level menu tree) in MySQL using PHP?

I have been using table structures where each row contains a parent
reference, such as:

Table Example:

Field namedata type/db flagsComents
=
RowID int unsigned auto_increment not null  (primary key)
ParentRowID   int unsigned  0 (or NULL if at top
level)
Name  varchar(50)


... which is OK for *defining* the hierarchy.  However, it's a pain to
retrieve the data so that it can be displayed in a nice threaded/sorted
way, where children are sorted directly below their parents.  I also
want the items to be nicely sorted within their own branch, of course.

On MS SQL, I successfully used stored procedures that employ temporary
tables and while statements and the like.  That method is not available
in MySQL (yet), so I'll have to do a lot of the manipulation on the web
server instead, using PHP.

Any suggestions?

/Mattias

--
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] FW: Resizing Pictures

2004-04-19 Thread Warren Vail
If you don't mind doing them by hand, Window Paint can, use
Image-Stretch/Skew and Stretch by the same percentage for horizontal and
vertical dimensions to keep the same perspective (less than 100% will reduce
the picture and more than 100% will stretch, but clarity of the image will
suffer from enlarging the image).  I would also suggest save a .bmp in the
original size for future resizing and adjusting, and save as jpg for
transferring to your website (your visitors will appreciate the smaller jpg
format).

good luck

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Ryan Schefke [mailto:[EMAIL PROTECTED]
Sent: Monday, April 19, 2004 8:06 PM
To: Php-General-Help
Cc: 'Ryan Schefke'
Subject: [PHP] FW: Resizing Pictures




How do you resize pictures once they're in a certain directory?  I have the
script to upload a picture, that's working fine.  I just need some help with
resizing it.  Can someone help?



Thanks!

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



RE: [PHP] Installing PHP on 2nd Windows Drive

2004-01-14 Thread Warren Vail
There is only one port 80 (the port used by your browser by default to
connect to apache), choose a different port for the second instance, and you
should be ok, but all url's will have to have a non-standard port number.

Same is true for MySQL (different port number, but same conflict).
Configure your 2nd MySQL to listen to a different port, and make sure that
all your PHP code connects to MySQL using the different (non-standard) port
number.

I'm guessing two things; 1) if there are other common dependencies, like
system registry (there is only one per machine) you will run into those and
2) other configuration dependencies (like things that need to be on the C:
drive) will pop up (like php.ini?).

My recommendation would be to get a 2nd cheap machine, and network them.  My
experience at doing this tells me machines are less expensive than the
headaches you are going to have with conflicts.  But you do stand to learn a
lot, or at the very least a lot of things that you will never use again.

good luck,

Warren Vail


-Original Message-
From: Freedomware [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 13, 2004 1:08 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Installing PHP on 2nd Windows Drive


I got a preconfigured package - Apache 2.0/PHP/MySQL - up and running,
then I installed Apache 1.3. Everything seems to be working fine, and
I'm ready to start tweaking it.

In the meantime, I bought a book about Apache, PHP and MySQL, which
includes tutorials on downloading the programs individually.

I don't want to mess up what I've already installed, but I have an
external hard drive that I use for backing up my documents. Could I
install new Apache, PHP and MySQL programs on that drive? They wouldn't
interfere with the equivalent programs on the C drive, would they?

In fact, is it possible to have PHP programs from two hard drives open
at the same time? After all, I can open up documents on both drives with
Windows Explorer.

Of course, I guess I'd have to install Dreamweaver on the second drive,
too, so I'd be able to test PHP and make sure it's working.

Thanks.

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

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



[PHP] Comparison PHP to Perl

2004-01-05 Thread Warren Vail
I am looking for a comparison of features supported by PHP vs those
supported by Perl.

My gut tells me PHP is more robust, but we are trying to implement something
in a company that has long had a standard allowing Perl as a sanctioned
language, but current management does not want to fight for PHP as a new
sanctioned language (most managers there have never heard of PHP and the
resident Java zealots have almost established a monopoly).  The kind of
thing I am looking for is SESSION support, I know it's supported by PHP, but
not sure about Perl.  I don't want to have to grow my own session manager.
One alternative is mainframe COBOL, which clearly will not support what we
want to do.

What would I lose by implementing in Perl (other than my mind)?

thanks in advance,

Warren Vail
[EMAIL PROTECTED]


RE: [PHP] Calling PHP functions from within javascript

2003-11-13 Thread Warren Vail
I suspect you need to be careful how you use the term call.  It is
possible for javascript, which runs on the client side or in the browser,
to cause the browser to perform a form submit, and if the action field of
the form points to a php script on a server server side, then the php code
will execute on the server, processing the form content on the server and
sending new results in the form of html and javascript back to the browser
client side.

That may have appeared to you as a call but most PHP developers would not
use that term.  Two items you may not have control of yet, is that in this
case the PHP always runs on the server machine, and javascript always runs
on the browser machine, and the only way they can both execute on the same
machine, is if the server and browser are both on the same machine.  The PHP
will always run in the memory space of the server, and the javascript runs
in the memory space of the browser.

The only exceptions to the last statement is when the PHP runs from the
command line, at which time it is not communicating to a browser (often
referred to as a CGI, even though it isn't) and the only time, I believe,
that javascript can execute on a server is using an old product, that I have
only heard of but never used, referred to as server side javascript.

hope this helps,

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Nitin [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 12, 2003 10:52 PM
To: Jake McHenry; [EMAIL PROTECTED]
Subject: Re: [PHP] Calling PHP functions from within javascript


First thing is, it's possible, i've done it in the past myself, it's just
not working due to some reason. Second, functioning cann't be achieved with
javascript, cauz it's DB related.

anyway thanx for ur reply
Nitin

- Original Message -
From: Jake McHenry [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, November 13, 2003 12:16 PM
Subject: RE: [PHP] Calling PHP functions from within javascript


  -Original Message-
  From: Nitin [mailto:[EMAIL PROTECTED]
  Sent: Thursday, November 13, 2003 1:35 AM
  To: PHP-General
  Subject: [PHP] Calling PHP functions from within javascript
 
 
  Hi all,
 
  can anybody tell me how to call PHP functions from within
  javascript, as I want my PHP function to be interactive. I
  need to call the function written in the same page, with the
  values selected by the user
 
  Thanx in advance
 
  Nitin
 

 Someone correct me if I'm wrong, but this isn't possible unless you
 have your javascript continuously refreshing the page, and changing
 the url, or posting data. PHP is server side, so the only way for php
 script to be executed is when the page loads. It might be more
 productive if you create the functions you want executed in javascript
 instead of php.



 Thanks,

 Jake McHenry
 Nittany Travel MIS Coordinator
 http://www.nittanytravel.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

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



RE: [PHP] ssh command in php script

2003-11-11 Thread Warren Vail
Don't know if this will help, but I worked on one implementation that
involved writing a daemon (we used perl, but php would work as well) which
runs as a user privileged script (started from cron), and waits for a
connection from my web app, and verifies that the request is coming from the
proper server and script, executes the ssh, and returns the controlled
result to the web app.  We also used this daemon to fork some processes and
create multi-threaded collection process (but that's another nut).

In my case the apache web server tasks ran as a user named nobody, which
had no system privileges at all, a common safeguard, on RH Linux.

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Robert Cummings [mailto:[EMAIL PROTECTED]
Sent: Monday, November 10, 2003 10:38 PM
To: tirumal b
Cc: PHP-General
Subject: Re: [PHP] ssh command in php script


On Tue, 2003-11-11 at 01:34, tirumal b wrote:
 Hello All

 I have written the following command in PHP script
 echo `ssh ipaddr command`. I have the remote ip
 addr as trusted, dont ask for the password at all.
 when the execute the php file from the browser it does
 not go to the remote ip at all though this command
 works fine in a normal bash script. what is the
 problem. Thanks in advance.

Shell commands run from the browser inherit the browser's user -- this
is usually httpd or apache.

Cheers,
Rob.
--
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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

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



RE: [PHP] Mailing List

2003-11-02 Thread Warren Vail
Allowing scripts to run without some kind of time limit may not be prudent,
but settling for the timelimit imposed on online web pages is not reasonable
either.  I would recommend you reset the time limit to something reasonable
to perform your email tasks on the computer you have available.

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

As long as you don't have a run away program, I can't think of any reason
not to allow it to have the time it needs to get the job done.

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: PHPLover [mailto:[EMAIL PROTECTED]
Sent: Sunday, November 02, 2003 10:18 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Mailing List


Dear All,

I would like to setup a mailing list for my company.
I have a database containing email address of my clients along with other
details.
How can I send them mails ?
If i write a script containing the mail function and loop the address, I
think that might generate a script timeout error. I feel increasing the
script timeout is not a good solution. I would like to know how you manage
such situations. I feel this is a common problem but i didnt find any
solution on the net. Do I need to use any sw or are there any already
available scripts.

Thanks a Lot !!
Long Live PHP !!

Thanks  Regards,
___
PHPLover
Göd döësn't pläy dícë.
- Älbërt Ëínstëín

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



RE: [PHP] Reading URL is changed

2003-09-19 Thread Warren Vail
What Dan says is true,,, IF there are other form fields on the form where
your user is making his choices.  Since the hotlink fakes a Get type of
header, and does NOT cause the other fields be submitted as well, any last
minute changes to those formfields will be ignored by your form processing
routine.

On the other hand, if the click is the only value to be transfer the hotlink
technique should be adequate.

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Dan Anderson [mailto:[EMAIL PROTECTED]
Sent: Friday, September 19, 2003 5:58 PM
To: Dan J. Rychlik
Cc: PHP List
Subject: Re: [PHP] Reading URL is changed


First of all, you can use Javascript to submit a form when the link is
pressed.

Andu has a good idea too, but I figured I'd elaborate:

If you create a form like:
FORM METHOD=GET ACTION='http://www.foo.com'
  INPUT TYPE=HIDDEN NAME='foo' VALUE='bar'
  INPUT TYPE=HIDDEN NAME='bar' VALUE='foo'
  INPUT TYPE=SUBMIT VALUE='submit'
/FORM

The browser visits the URL:

http://www.foo.com?foo=barbar=foo

This is called GET method in a form.  Do a google search.

Note that you will have to URL encode all variables and data.  PHP
manual has a good section.

-Dan

--
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] CPanel adding POP account

2003-09-14 Thread Warren Vail
Try;

http://www.cpanel.net/docs/cp/

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Dasmeet [mailto:[EMAIL PROTECTED]
Sent: Sunday, September 14, 2003 11:50 AM
To: [EMAIL PROTECTED]
Subject: [PHP] CPanel adding POP account


I am having a server that runs CPanel/WHM... I wish to create a free 
email service... Are there any PHP scripts available for the same??
Thanks in advance
Dasmeet

-- 
--
Domainwala.com
Domain Names from $7.99 at http://www.domainwala.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] CPanel adding POP account

2003-09-14 Thread Warren Vail
found a better programming resource at

http://cpanel.net/docs.htm

Seems you may be able to access each cpanel function (see the sample PHP
script).

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Warren Vail [mailto:[EMAIL PROTECTED]
Sent: Sunday, September 14, 2003 11:59 AM
To: Dasmeet; [EMAIL PROTECTED]
Subject: RE: [PHP] CPanel adding POP account


Try;

http://www.cpanel.net/docs/cp/

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Dasmeet [mailto:[EMAIL PROTECTED]
Sent: Sunday, September 14, 2003 11:50 AM
To: [EMAIL PROTECTED]
Subject: [PHP] CPanel adding POP account


I am having a server that runs CPanel/WHM... I wish to create a free
email service... Are there any PHP scripts available for the same??
Thanks in advance
Dasmeet

--
--
Domainwala.com
Domain Names from $7.99 at http://www.domainwala.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

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



RE: [PHP] Some SESSION Vars not Registering

2003-07-22 Thread Warren Vail
Don't all variables registered to a session need to be declared as global?

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Tom Rogers [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 22, 2003 6:15 PM
To: Jeff Stillwall
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Some SESSION Vars not Registering


Hi,

Wednesday, July 23, 2003, 6:22:58 AM, you wrote:
JS I have a function that assigns some session variables I need available
JS during a user's visit.  Oddly enough, as I assign about 7 variables, I
JS noticed that not all had data.  This is the function:

JS function setupUserEnv ($userArray) {
JS $_SESSION['loggedIn'] = 1;
JS $_SESSION['id'] = $userArray['id'];
JS $_SESSION['uid'] = $userArray['uid'];
JS $_SESSION['fname'] = $userArray['fname'];
JS $_SESSION['lname'] = $userArray['lname'];
JS $_SESSION['dateapproved'] = $userArray['dateapproved'];
JS $_SESSION['email'] = $userArray['email'];
JS }

JS Pretty straight forward.  I've used var_dump as soon as I enter the
function
JS to make sure $userArray is populated the way I expect - it always is.
Only
JS the session variables for 'loggedIn', 'uid' and 'dateapproved' stay set
JS outside of this function.  However, I can set a session var not used in
my
JS program in this function, and it'll stick: $_SESSION['justTesting'] =
JS test; will stay set outside of this function.

JS If I put a var_dump at the end of the function for $_SESSION, I see all
JS session vars are set within the scope of the function.  Once outside of
the
JS function, some stay set, some do not.

JS I've read the chapter in the manual about variable scope, and it seems
JS pretty clear that $_SESSION is a superglobal, and I do not have to
declare
JS it with the 'global' keyword.

JS I've tested this on three separate installations of PHP/Apache, and I
get
JS the same behavior each time.

JS Anyone clue me in to what I'm doing wrong?  Thanks!
JS --
JS Jeff Stillwall

Try passing a reference to the array like this

function setupUserEnv ($userArray) {
$_SESSION['loggedIn'] = 1;
$_SESSION['id'] = $userArray['id'];
$_SESSION['uid'] = $userArray['uid'];
$_SESSION['fname'] = $userArray['fname'];
$_SESSION['lname'] = $userArray['lname'];
$_SESSION['dateapproved'] = $userArray['dateapproved'];
$_SESSION['email'] = $userArray['email'];
}

Otherwise no idea at this point :)
--
regards,
Tom


--
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] PHP Certification

2003-06-26 Thread Warren Vail
Certification programs, imho, exist primarily for two reasons;

1. it allows developers with little experience to add credibility to their
claims that they know how to develop software.

2. it allows non-technical people involved in the hiring chain to make
judgements when they have no clue at all how to judge good technical
competence.  Course, after you've been around a while, you learn that you
cannot do a proper job of judging anyone's competence, even after many hours
of interviews.  The proof is in the project outcome.

3. Ok, I forgot the third reason... Someone will make lots of money selling
training materials and administering the tests.  Did you really think
Microsoft got into this side of the business just to improve the quality of
technical consulting.

my 2 cents (ok, maybe 4 cents),

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 26, 2003 8:15 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] PHP Certification


 I find the value of such certification programs
 extremely questionable.

here here :D



--
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] PHP Certification

2003-06-26 Thread Warren Vail
A working public website, that solves a business problem, is a good
credential.  I can't help but wonder if it takes more hours to develop a
respectable site or to study and take an exam.  Do you suppose the
certification exam might actually be an easier option?

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 26, 2003 8:59 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: RE: [PHP] PHP Certification


yeh well these exams come in modules , and are extremely pricey , i think
good web examples, screenshots and experience should be enough, sadly i
have not done uni so am frowned upon when looking for work but have
experience in the work force, 4 years in IT now ok thats not enough but i
have fine tuned my programming skills, i am wanting to move in java also
now, i contract also but dont have much on my portfolio to show to get the
jobs , just starting the business side of things and may have to work for
near nothing just to get examples up, so i think portfolio examples are
more important than certification.


 Certification programs, imho, exist primarily for two reasons;

 1. it allows developers with little experience to add credibility to
 their claims that they know how to develop software.

 2. it allows non-technical people involved in the hiring chain to make
 judgements when they have no clue at all how to judge good technical
 competence.  Course, after you've been around a while, you learn that
 you cannot do a proper job of judging anyone's competence, even after
 many hours of interviews.  The proof is in the project outcome.

 3. Ok, I forgot the third reason... Someone will make lots of money
 selling training materials and administering the tests.  Did you really
 think Microsoft got into this side of the business just to improve the
 quality of technical consulting.

 my 2 cents (ok, maybe 4 cents),

 Warren Vail
 [EMAIL PROTECTED]


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 26, 2003 8:15 PM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: [PHP] PHP Certification


 I find the value of such certification programs
 extremely questionable.

 here here :D



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




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




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



[PHP] remote file moddatetime

2003-06-08 Thread Warren Vail
I am trying to upload a file using php's ftp functions between two RedHat
7.3 systems.  I'd like to make sure the destination file has the same
modification date as the source file, so that I can later compare to see if
it has been modified on the remote machine, but not sure how to approach
this.  I tried to use the SITE command to pass a touch command, but that
didn't work.
Other than the obvious places, where do I go from here?

thanks in advance,

Warren Vail
[EMAIL PROTECTED]


RE: [PHP] Still having a problem with IF/ELSE Statement

2003-03-06 Thread Warren Vail
Jess,

In your statement;

if($status=='active'){

the conditional inside quotations is treated as a string and not evaluated,
remove the outer double quotes :-

hope this helps,

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Ray Hunter [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 06, 2003 8:02 AM
To: Hunter, Jess
Cc: PHP Mailing List
Subject: Re: [PHP] Still having a problem with IF/ELSE Statement


Maybe throw in the code where $status or $Row[status] get initialized.

but i would do it like this:

if( $status == 'active' ) {
echo active line\n;
} else {
echo inactive line\n;
}

or

if( $Row['status'] == 'active' ) {
echo active line\n;
} else {
echo inactive line\n;
}

One of those should work based on the code.  However, based on the
variables $Row and $status that might not be the case.

--
Ray


On Thu, 2003-03-06 at 05:31, Hunter, Jess wrote:
 I want to tahnk those that responded to my previous post, seems I was
doing
 this all the wrong way.  I am still having an issue with the syntax:

 if($status=='active'){
 echo(active line\n);
 }else{
 echo(inactive line\n);
 };

 When I display an employee record that has the employment status
 $Row[status] of active, then the active line displays no problem, when I
 display an employee record of an inactive employee, I still get the
active
 line.

 I have also tried to do it this way but to no avail:

 if($Row[status]=='active'){
 echo(active line\n);
 }else{
 echo(inactive line\n);
 };


 Not to mention numerous ways of adding/removing/changing double quotes and
 single quotes around.

 Any and all help would be greatly appreciated

 Jess

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



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




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



RE: [PHP] Controlling browser windows with php?

2003-02-09 Thread Warren Vail
Since PHP executes server side and not in the browser, you may want to
resort to something that runs in the browser, like Javascript, which PHP can
output as part of the html it feeds to the browser.

check out http://www.hotscripts.com/ for lots of handy examples of how
Javascript opens an additional window on the browser, note that the URL for
the new window can point to another PHP (server side) script to fill it with
information.

You might want to check out the PHP section as well, there are lots of
useful routines there.

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: Geoff Lists [mailto:[EMAIL PROTECTED]]
Sent: Sunday, February 09, 2003 10:37 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Controlling browser windows with php?


Hi,
I'm relatively new to php and neither of the books I am using for
reference mention anything about controlling a child window.

What is the correct syntax to:
open window( width, height, menu, scrollbars)  and position it on the
screen?

Any help would be gratefully and humbly accepted I need to know how to
do this now!
OR
How to call an existing javascript to do it for me.

Thank you.
Heff.


--
Geoff Hill
Information Technology Training  Solutions
A.B.N. 28 712 665 728

P.O. Box 7156
Lismore Heights, NSW, 2480.

Ph:  02 6688 6381


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




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




[PHP] Access to Pear

2003-01-27 Thread Warren Vail

I know how to load extensions if they are not included in PHP.ini (dl
function), but how do I gain access to PEAR?

I can see the directory /apache/php/pear/ on my test machine, but when I try
to reference via

include_once(DB.php);

not found on include list error, can I dynamically change include list,
and what kind of security hole would that represent?  my test machine is
windows, and my production machine is Redhat Linux, so I need to find a way
to gain access to pear in both environments.

Warren Vail
[EMAIL PROTECTED]



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




RE: [PHP] File information JPEG Files

2003-01-12 Thread Warren Vail
I you are into bit crunching, check out

http://www.dcs.ed.ac.uk/home/mxr/gfx/2d/JPEG.txt

if not, somehow view the jpeg in ie, right click on the picture, and select
properties, look under dimensions.

Warren Vail
[EMAIL PROTECTED]


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Sunday, January 12, 2003 8:11 AM
To: [EMAIL PROTECTED]
Subject: [PHP] File information JPEG Files


How can i get the file information of a uploaded jpeg-file.
i need the heigt and width in pixel and the resolution.
Thanks Harry



--
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] Writing to files

2002-02-27 Thread Warren Vail

Not sure I understand how you concluded that web server should not create
files, it certainly should not be able to create files on client machines
without permission of user (which it cannot do).  Users should not be able
to upload files to the server without the permission of the web application,
but if a web application performs the upload and controls where the file
goes and what is in the file, that would be safe.  If the web application
completely controls where temporary files go and what goes in them
(variables) then how is that unsafe?

On the subject of using the database, check out which environment variables
that actually control session management (you can do this by running the
phpinfo() function.  There are two major configuration options which you
have full control over; 1. If the sys admin controls the default
configuration of where to write the session data (usually points to /tmp
directory), then the session_set_save_handler function is your way to
override those parameters.  2.  In fact if you read the routine that
performs garbage collection (deletes expired session data) session
management will pass to that routine the parameter that controls the default
lifetime from the sysadmin's setup data, which you as the writer of the
routine are free to ignore and use your own.  Only caveat is you need to
include these routines in every page that records data to a session (no big
deal).

I wish you luck on this, you seem to have been advised on some rules, by
people who didn't know what they were talking about, or perhaps you
understood their recommendations out of context, and that makes it hard for
you.  I really think session management is the way to resolve your problem.
It would be interesting for you to get a couple of opinions on the subject
of creating files on a server.  You could create routines that would write
to physical files in these save_handler functions and put them in your user
directory if you like, but I would not mix these files in the same directory
as your application code, perhaps a sub directory.  I would be willing to
bet there are log files that are updated on your server every time someone
accesses one of your web pages.

Good luck,

Warren Vail

-Original Message-
From:   Chris Kay [mailto:[EMAIL PROTECTED]]
Sent:   Wednesday, February 27, 2002 12:36 AM
To: 'Warren Vail'
Cc: [EMAIL PROTECTED]
Subject:RE: [PHP] Writing to files


I know I can do this with sessions, reason I am asking is

webserver should not be able to create file (for security reasons),
I would of maybe thought php could create a file as a different user.
php is not always used by the box owner. I find it strange that such a
option
Is only available if you run the box or the webserver is run as that
user.

Sessions and such need configurations that need to be configured by the
server admin
Ect I was hoping there was a way that didn't rely on a special
configuration
And stayed in the users directory

---
Chris Kay, Eleet Internet Services
[EMAIL PROTECTED]
---


-Original Message-
From: Warren Vail [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 27 February 2002 6:51 PM
To: Chris Kay
Subject: RE: [PHP] Writing to files


Suggest you understand how session management works.  Whether you store
in a file or database, the entries are removed if the user fails to
return after a limit amount of time, and are kept in a separate table in
the database. You can post the results to your actual data tables when
you are completed. If you don't want to store the data in files, or in a
database, what did you have in mind?  There is no rule that says you can
only store permanent data in a data base.

-Original Message-
From:   Chris Kay [mailto:[EMAIL PROTECTED]]
Sent:   Tuesday, February 26, 2002 11:43 PM
To: 'Warren Vail'; [EMAIL PROTECTED]
Subject:RE: [PHP] Writing to files


The data will be stored in mysql, but I don't wish to store in sql
untill its completed. In case a user leave the application before
completing it.

---
Chris Kay, Eleet Internet Services
[EMAIL PROTECTED]
---


-Original Message-
From: Warren Vail [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 27 February 2002 6:37 PM
To: Chris Kay; [EMAIL PROTECTED]
Subject: RE: [PHP] Writing to files


What you are describing is exactly how session management works, storing
things in a file in the /tmp directory.  Perhaps you could consider
using the session save handler functions to store the session data in
your protected database (MySQL?).

Warren Vail

-Original Message-
From:   Chris Kay [mailto:[EMAIL PROTECTED]]
Sent:   Tuesday, February 26, 2002 11:19 PM
To: [EMAIL PROTECTED]
Subject:[PHP] Writing to files


Question I have is, Anyway know of a better way to store temp
information?

I have a problem that a script I use, uses many pages and after each
page the information from the form Is stored and the next page is shown
ect

It uses more than 20

[PHP] Exchange Server Access

2002-02-26 Thread Warren Vail

I am trying to figure out how to access a Microsoft NT Exchange Server using
PHP on windows.  I have NOT found success using IMAP to connect to the
supposedly IMAP compliant server or trying to use COM to access that server
via Outlook.  I have considered trying to invoke the MAPI API, but not sure
how to go about that, and I have considered trying a JAVA API, but not sure
where to start here either.

My goal is to read email, and move that email between folders, from a CGI
app that runs every 5 minutes or so on a windows platform, updates a MySQL
database which is used to support Helpdesk analysts who respond to reports
of problems made via email.  Has anyone had any success with MS Exchange, I
will consider all options, but would prefer to use PHP.

Warren Vail



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




RE: [PHP] Writing to files

2002-02-26 Thread Warren Vail

What you are describing is exactly how session management works, storing
things in a file in the /tmp directory.  Perhaps you could consider using
the session save handler functions to store the session data in your
protected database (MySQL?).

Warren Vail

-Original Message-
From:   Chris Kay [mailto:[EMAIL PROTECTED]]
Sent:   Tuesday, February 26, 2002 11:19 PM
To: [EMAIL PROTECTED]
Subject:[PHP] Writing to files


Question I have is, Anyway know of a better way to store temp
information?

I have a problem that a script I use, uses many pages and after each
page the information from the form
Is stored and the next page is shown ect

It uses more than 20 variables so I can not store the data in cookies.
I could store the data in a temp file created but problem is that the
webserver would need to create
The file which is a security risk (I would like to find another way
other than this).
I don't really want to use sessions but if it's the last resort I guess
I will have to.

Other than the above any one have a better soluition?

Running php 4.1.1 on RH7.2

---
Chris Kay, Eleet Internet Services
[EMAIL PROTECTED]
---


--
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] installing php3 and php4 on the same server

2002-01-27 Thread Warren Vail

I have a follow-on question to this one.

I do implementations for clients in PHP and do my development and testing
under windows (OK, I know), and the systems are targeted for servers that
have PHP3 and others with PHP4.  I would think that I could direct files
with suffix php3 to use the php3 engine, and php to the php4 engine, but I
can't seem to get this to work.  Granted PHP4 will handle php3 code (as near
as I can tell), but I expect I will inject some php4 dependencies into the
code destined for a PHP3 server.  The clients using php3 don't control the
server so they can't their ISP to upgrade for them.  Moving them to a site
that will work with them is not the question here.  The question here is how
can PHP4 and PHP3 co exist, and where can I get information on how to set
that up on windows system.  I am running php4 successfully with apache and
mysql, trying to activate the php3 version, regardless of changes I have
made to httpd.conf, my php3 scripts invoke php4.

Thanks,

Warren Vail


-Original Message-
From:   Manu Verhaegen [mailto:[EMAIL PROTECTED]]
Sent:   Friday, January 18, 2002 12:59 AM
To: Alex Dowgailenko
Cc: [EMAIL PROTECTED]
Subject:Re: [PHP] installing php3 and php4 on the same server

We have the following problem, we have now apache 3 and php 3 ,we have
upgrade the apache and the php3 tot php4 evereting will working fine. 2
internetproviders in belgium will working with proxyservers if you want to
view a webpage on the lastversion of apache an php4 the page will not
correct viewed



Greetings,

- Original Message -
From: Alex Dowgailenko [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, January 18, 2002 8:44 AM
Subject: RE: [PHP] installing php3 and php4 on the same server



 Question is, why would you want to?

 php3 scripts will work fine under php4.
  -Original Message-
  From: Manu Verhaegen [mailto:[EMAIL PROTECTED]]
  Sent: January 18, 2002 2:39 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] installing php3 and php4 on the same server
 
 
  Hi,
  We have installed apache 3 and PHP3, can we install PHP4 on the
  same server
  the we can use PHP3 and PHP4
 
  Thanks,
 

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


RE: [PHP] Talkback or community type participation.....

2001-12-22 Thread Warren Vail

Deron,

By doing a Post to itself, this form will cause an error everytime someone
clicks the Back button on the browser (after the first post, of course).

What I do is have two forms, first invoked with a get via hot link or
redirect.

Form_1.php checks to see if variable $s has been passed (in the URL, of
course), if not it initializes and displays the form.  The Form action on
this displayed form indicates to Post to Form_2.php.

Form_2.php displays nothing, just processes variables on the form.  This one
would insert the row, and to avoid thread problems (multiple simultaneous
inserts, from multiple users) has a unique autoincrement variable as the
primary key to the table (MySQL will make the insert thread safe).  When
the insert is successful this routine redirects the browser back to form_1
like so;

Header(Location: Form_1.php?s=$insertid);
Exit;

When control is passed to Form_1.php again, this time the variable $s is set
and the row is retrieved from the table (instead of using initialization
values) and displayed in the form giving confirmation of the updates that
were done.

Because Form_2 redirects to Form_1, Form_1 is the only one on the browser
history list(each separate instance is tracked, of course), and it is always
entered via a Get, meaning that the browser does include the passed variable
values in the history list (it doesn't do this with a Post). And the Back
button works.  In the Post error you are working toward, the browser
complains that it does not have a record of the Post variable values (the
Data Has Expired).

There may be other ways to deal with this, but this is one way that I have
found that works.

Good Luck,

Warren Vail

-Original Message-
From:   Deron [mailto:[EMAIL PROTECTED]]
Sent:   Friday, December 21, 2001 11:38 PM
To: [EMAIL PROTECTED]
Subject:[PHP] Talkback or community type participation.

Hi there!

I have this script I just made based on a tutorial I found online and was
wondering if there was a better way to do this or not. Everything works
great so far except for a couple little things. Once the $submit is clicked
and runs the INSERT data into the table... I am looking to be able to have
the page auto refresh and display the new entry as well as the form again.
Here's my current code: (I have this built into the main review page via an
include. The entire page can be viewed here:

http://www.metalages.com/2002/reviews/reviews-test.php?band=Evergreyalbum=I
n%20Search%20of%20Truth

Feel free to post a dummy message, nothing is live yet, all in test mode :)

you'll notice once the entry is submitted also, if you try to refresh the
page it wants to readd the data again. any help or guidance appreciated, I
am a self professed still learning this stuff! kinda guy.


?php

  if ($submit) {

  // Process Form

  $DBconn = mysql_connect(localhost, user, pass);
  mysql_select_db(databasename, $DBconn);
  if (!$DBconn) {
echo( pUnable to connect to the  .
   database server at this time./p );
 exit();
  }

$sql = INSERT INTO talkback (band_id, album_id,
talkback_name,talkback_email,talkback_comments) VALUES
('$currentid[0]','$currentid[1]','$talkback_name','$talkback_email','$talkba
ck_comments');
$result = mysql_query($sql);
echo Thank you! Information entered.\n;
  } else {

  // display form

?

  form method=post action=?php echo $PHP_SELF . ?band=$band .
album=$album?
  div align=centerbName/Nickname:/bbr
input type=Text name=talkback_namebr
bEmail (optional):/bbr
input type=Text name=talkback_emailbr
bComments:/bbr
textarea name=talkback_comments cols=50 rows=5/textarea
br
input type=Submit name=submit value=Speak Your Metal!
  /div
/form

  ?php

} // end if

?


Deron
www.metalages.com



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Re: Empty form variables when uploading, Help please???

2001-11-13 Thread Warren Vail

Interesting because I have used multiple submit buttons on forms for years.
Each can have a different name, and even if I use the same name for all of
them, which I often do, each can have a separate value.  Each will cause all
other form fields to transmit their variables in their usual manner, but
obviously I will only receive one submit button( the one that was clicked).
If all are named go with different values (what displays on the button),
all I have to do is;

Switch($go) {
 Case Add:  something; break;
 Case Update:  something, break;
 Case Delete:  something else, break;
}


-Original Message-
From:   The Big Roach [mailto:[EMAIL PROTECTED]]
Sent:   Tuesday, November 13, 2001 8:19 AM
To: [EMAIL PROTECTED]
Subject:[PHP] Re: Empty form variables when uploading, Help please???

  File: [PHP] Re Empty form variables when uploading, Help please.txt 
In a form you can't really have 2 submit buttons.
Either a submit submits or it is just a button.
That's because the var name is already submit (check out your
http_post_vars).
And you have it twice!
Change one of them and make it just a button (HTML4).
Recheck your post-vars.
This should help.

Otherwise you're loosing your post vars somehwere in the fire-wall.
That's bad!


Sandra Rascheli [EMAIL PROTECTED] wrote in message
003601c16abd$3985ae70$c46223c8@srascheli">news:003601c16abd$3985ae70$c46223c8@srascheli...
Hi everybody,

I hope someone is able to help me with this, I've been having this problem
for  a couple of months now and I have not been able to find a solution. I
have a form to upload a file which submits to itself, and has two submit
buttons, one called eliminarfoto (deletephoto) and salvar (savephoto),
but for some weird and unexplainable reason (it only happens to some users,
not all of them) when they hit any of these two submit buttons, the form
returns empty variables.

This is part of my script, has anybody had a similar problem before??? Any
help would be greatly appreciated.

 FORM ENCTYPE=multipart/form-data ACTION=foto.php METHOD=POST
 TABLE border=0 cellPadding=2
 TR
  TD VALIGN=TOPPFONT face=Verdana size=1BFoto/B
  (opcional,brtamaño máximo: 20k,brformatos permitidos: JPEG,
GIF)/FONT/TD
  TD
  ? if ($foto)
  {
  echo IMG align=bottom border=0 width=140 height=160
src=\../fotos/$foto?nc= . time() .\br;
  }
  ?
  INPUT TYPE=hidden name=MAX_FILE_SIZE value=100
  INPUT NAME=userfile TYPE=file
  INPUT TYPE=submit NAME=eliminarfoto VALUE=Eliminar
  INPUT TYPE=hidden NAME=foto VALUE=? echo $foto ?
  /TD
 /TR
 TR
  TD VALIGN=TOP COLSPAN=2 ALIGN=CENTER
  font face=Verdana,Arial,Helvetica,Sans-serif size=2
  INPUT TYPE=SUBMIT NAME=salvar VALUE=Continuar -/TD

 /TR
 /TABLE
 /FORM







--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Dissapearing Session Variables (long post)

2001-09-05 Thread Warren Vail

Jason,

I had a similar problem using a php session table in MySQL to store session
data, turns out my  data item was too small to contain all my registered
session variables, I changed the definition of the data column to TEXT and
that seemed to do it.  I also found that I needed to run addslashes() before
updating the column and stripslashes() retrieving it (turns out some of my
variables contained characters that MySQL was sensitive to, and others that
caused serialize/unserialize problems).

Not sure this is your problem, but it's worth checking.

Warren Vail

-Original Message-
From:   Jason Bell [mailto:[EMAIL PROTECTED]]
Sent:   Wednesday, September 05, 2001 4:54 PM
To: PHP Users
Subject:[PHP] Dissapearing Session Variables (long post)

Hello! I'm trying to figure out why my session variables keep hiding

Background:

On my site, I have a login box, which allows you to login. This login box
works as expected. It authenticates the provided credentials against my
database, and then sets some pre-registered session variables to values
pulled from the DB. What I am experiencing, is that my session variables
will be defined, and then lose their values when the first link is followed.
I've placed a reference to $PHPSESSID into the title of the page, and note
that the $PHPSESSID remains constant. Is there something in my code that is
causing this? Is there a way that I can rewrite my code to help avoid this?

Here is my index.php, other relevent code to follow:

?
include(include/user.conf);
if (!$theme) { $theme = default; };
include(include/core_functions.php);
if ($AuthAction) {
 switch($AuthAction) {
  case login:
   include(include/db.conf);
 $sql = SELECT uid,username,password,first,last,acl FROM users
WHERE username='$username' AND password=PASSWORD('$password');
 $result = mysql_query($sql) or die ('Unable to execute SQL
Query.');
 $dberror=mysql_error();
 $dbnum=mysql_errno();
 if ($dberror) {
   $AuthErr = $dberror;
} else {
 $num = mysql_numrows($result);
 if ($num !=0) {
   $sess_uid = mysql_result($result,0,uid);
 $sess_acl = mysql_result($result,0,acl);
 $sess_fname = mysql_result($result,0,first);
 $sess_lname = mysql_result($result,0,last);
 $sess_uname = mysql_result($result,0,username);
 $sess_auth = 1;
  } else

   $AuthErr = FONT SIZE=-1 COLOR=REDLogin Incorrect!/FONT;
  };
};
   break;
  case logout:
   break;
 }
};
if (!$action) { $action = tba; };
if (!$title) { $title = $PHPSESSID; };
if (!$headline) { $headline = H2An E-Haven for Displaced
NorthpointersH2; };
include(Themes/.$theme./.$theme..theme);
?

Here is user.conf:

?php
if (!$PHPSESSID) {
  $sess_uid = ;
  $sess_acl = ;
  $sess_fname = ;
  $sess_lname = ;
  $sess_uname = ;
  $sess_auth = ;
  session_register('sess_uid');
  session_register('sess_acl');
  session_register('sess_fname');
  session_register('sess_lname');
  session_register('sess_uname');
  session_register('sess_auth');
  };
?


Shouldn't this work?  I reference the session variables within functions,
but that shouldn't effect anything. I always make sure to call global for
each variable before I use itany ideas?

Thanks in advance!

Jason Bell


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Problem: Sybase, PHP and multiple result sets

2001-08-16 Thread Warren Vail

I appreciate the clearer, more detailed description.  Unfortunately, I
probably cannot help as much with this one.  If it were my problem, I would
try finding and downloading the source for the Sybase modules, then look for
someone to contact in the notes.  I would also exhaust any contacts I have
with Sybase, mostly because much of the original code for the interface
modules probably came from them originally (derived from their old C
interface modules).

Another approach would be to try to unload the source for the Stored
Procedure, and try to split up the queries (I believe the results you are
seeing are produced by a UNION, but I'm not certain).  Sybase can compile
its query procedures on the fly, with only slightly longer run times, or you
could create a new procedure from what you find and store that one.

Good Luck,

Warren Vail

-Original Message-
From:   Herouth Maoz [mailto:[EMAIL PROTECTED]]
Sent:   Wednesday, August 15, 2001 12:19 AM
To: Warren Vail; [EMAIL PROTECTED]
Subject:Re: [PHP] Problem: Sybase, PHP and multiple result sets

On Wednesday 15 August 2001 10:07, Warren Vail wrote:
 The ability to select a set from a previously selected set is
 possible in Sybase because the database supports creation of
 temporary tables and the select insert.

No, you seem to have missed my point entirely. So I'll explain in a
little more detail.

I run a stored procedure. Let's assume I run it from the interactive
utility and not from PHP for the moment.

 SP_SOMETHING_OR_OTHER PARAM1 PARAM2 PARAM3

The database returns:

foo   bar
===   ===
1020
3040

field1   field2   field3
==   ==   ==
string   bla  15
nothing  bla  12

As you can see, it returns TWO result sets. One with two numeric
columns. The next with three columns, the first two string and the
last numeric.

This is, of course, just an example.

Now back to the web interface.

If I use PHP, I get only the first result set. That is, I write
something along the lines of:

$rs = sybase_query( SP_SOMETHING_OR_OTHER PARAM1 PARAM2 PARAM3,
$conn );

while ( $row = sybase_fetch_row( $rs ) ) {

   echo $row[0]; // and so on

}

This will only display the results of the first result set - the one
with the two fields, foo and bar.

There is no way for me to reach the second table generated by the
query. This is supposed to be the significant table.

Now, in ASP, there is something like

set rs = rs.NextResultSet

Which sets the rs to the second result set, the one with the three
fields of mixed types, at which point you loop, just like above, and
retrieve the new information. This method or an equivalent of it is
not in the PHP documented set of Sybase functions.

I hope I made myself clearer. And by the way, you don't have to sell
me on the uselessness of ASP, the general uselessness of Microsoft
etc. - I don't use any Microsoft products, even at work.

Herouth


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Problem: Sybase, PHP and multiple result sets

2001-08-15 Thread Warren Vail

The ability to select a set from a previously selected set is possible in
Sybase because the database supports creation of temporary tables and the
select insert.

PHP (which is often packaged with MySQL) does not attempt to mix database
(SQL) with it's own scripting language (unless someone is working on this).
ASP on the other hand will sell you anything that consumes resources thereby
encouraging you to buy the bigger software, requiring bigger hardware (An
old IBM marketing plan, and my personal opinion).  When you talk about a
result set in PHP you must be referring to what is returned by MySQL, not
PHP.  Perhaps someday MySQL will have temp tables and SELECT INSERT
capability.

On the other had PHP does a very nice job of looping thru the result set.

Warren Vail

-Original Message-
From:   Herouth Maoz [mailto:[EMAIL PROTECTED]]
Sent:   Tuesday, August 14, 2001 11:35 PM
To: [EMAIL PROTECTED]
Subject:[PHP] Problem: Sybase, PHP and multiple result sets

I have started working with Sybase lately, and it has come to my
knowledge that a single query can return multiple result sets in
Sybase, especially when using stored procedures.

Now, in ASP (sorry...), there are calls that allow retrieving the
next result set from the current result set. So in effect the result
sets are a linked list and you can access all of them.

In PHP, however, the result set returned is the first one, and I
don't see any method for retrieving the next result set. Does anybody
know of such a method? Does anybody have a suggestion for workaround?

Basically, in most of these cases, the important result set is
actually the last one, not the first, as the intermediate result sets
are mostly temporary results.

Herouth


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Re: storing array in mysql

2001-07-31 Thread Warren Vail

What I have used to store an array in mysql is;

$value = addslashes(serialize($array));
$query = INSERT INTO table (column) VALUES (\$value\)

and upon retrieval
$query = SELECT column FROM table;
..
while($row = mysql_fetch_array($result)) {
$value = unserialize(stripslashes($row[column]));
}

Note: serialize allows me to store the array in a single column and
addslashes makes the data mysql safe (i.e. allows me to store quotes in the
column, just in case they are in the array).

Warren Vail

-Original Message-
From:   elias [mailto:[EMAIL PROTECTED]]
Sent:   Tuesday, July 31, 2001 4:05 AM
To: [EMAIL PROTECTED]
Subject:[PHP] Re: storing array in mysql

when you submit this form, PHP will give a array variable called $name

you can store in in MySql as:

?
// will make the $name as a comma seperated string
$str = join(,, $name);
insert into tablename(id, value) VALUES(null, '$str');
?

now to reget the array, you can select it back from MySql and split it as:
?
  $name = split(,, $str);
?

//elias
Matthew Delmarter [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi all,

 I want to store the results of a multiple select input box in a mysql
 db. The box looks like this:
 select name='name[]' size='5' multiple
 option value='id'name/option
 /select

 I cannot seem to store the array in a database and then output the
 result using foreach. Any tips?

 Regards,

 Matthew Delmarter
 Web Developer

 AdplusOnline.com Ltd
 www.adplusonline.com

 Phone: 06 8357684
 Cell: 025 2303630




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Re: storing array in mysql

2001-07-31 Thread Warren Vail

I never seem to be lucky enough to be sure of the type of data stored in a
php array, since php handles mixtures of types so forgivingly, and because
most of my data comes from forms, with users key in what they like,
including double and single quotes, parentheses (and especially commas, how
do you prevent breaking up your array and putting it back together with a
different row count because someone keyed in a comma?), etc.  I would think
you would have to go to a lot of trouble to make sure that an array contains
only numeric data, or only strings that did not contain problem causing
characters.

You are right about more space being required for serialize, I often have to
resort to TEXT data types to provide enough space in the column for data
(65k runs out fast), and that is a bit slower as well.

Warren

-Original Message-
From:   elias [mailto:[EMAIL PROTECTED]]
Sent:   Tuesday, July 31, 2001 8:09 AM
To: [EMAIL PROTECTED]
Subject:Re: [PHP] Re: storing array in mysql

Yes true, you can use serialize.

But since you know the format of your $array variable (which is simply
holding one data type) you can safely use split() and join()
better and smaller when stored in that field because they are comma
seperated.

Warren Vail [EMAIL PROTECTED] wrote in message
001701c119c8$562b0ca0$b5887ed8@nicker">news:001701c119c8$562b0ca0$b5887ed8@nicker...
 What I have used to store an array in mysql is;

 $value = addslashes(serialize($array));
 $query = INSERT INTO table (column) VALUES (\$value\)

 and upon retrieval
 $query = SELECT column FROM table;
 .
 while($row = mysql_fetch_array($result)) {
 $value = unserialize(stripslashes($row[column]));
 }

 Note: serialize allows me to store the array in a single column and
 addslashes makes the data mysql safe (i.e. allows me to store quotes in
the
 column, just in case they are in the array).

 Warren Vail

 -Original Message-
 From: elias [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, July 31, 2001 4:05 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: storing array in mysql

 when you submit this form, PHP will give a array variable called $name

 you can store in in MySql as:

 ?
 // will make the $name as a comma seperated string
 $str = join(,, $name);
 insert into tablename(id, value) VALUES(null, '$str');
 ?

 now to reget the array, you can select it back from MySql and split it as:
 ?
   $name = split(,, $str);
 ?

 //elias
 Matthew Delmarter [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi all,
 
  I want to store the results of a multiple select input box in a mysql
  db. The box looks like this:
  select name='name[]' size='5' multiple
  option value='id'name/option
  /select
 
  I cannot seem to store the array in a database and then output the
  result using foreach. Any tips?
 
  Regards,
 
  Matthew Delmarter
  Web Developer
 
  AdplusOnline.com Ltd
  www.adplusonline.com
 
  Phone: 06 8357684
  Cell: 025 2303630
 



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] search array for value

2001-07-30 Thread Warren Vail

How about;

$valuelist = explode(, , $array);
$query = select * from table where column in ($valuelist);
etc.

Warren Vail 

-Original Message-
From:   Matthew Delmarter [mailto:[EMAIL PROTECTED]]
Sent:   Monday, July 30, 2001 9:41 PM
To: PHP Mailing List
Subject:[PHP] search array for value

How do I search an array? 

For example if I want to know if $array contains 1...

Regards,

Matthew Delmarter

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] search array for value

2001-07-30 Thread Warren Vail

Sorry, mixed this up with your other query;

For this

If(in_array(1, $array))  {
}

Warren Vail

-Original Message-
From:   Warren Vail [mailto:[EMAIL PROTECTED]]
Sent:   Monday, July 30, 2001 9:57 PM
To: Matthew Delmarter; PHP Mailing List
Subject:RE: [PHP] search array for value

How about;

$valuelist = explode(, , $array);
$query = select * from table where column in ($valuelist);
etc.

Warren Vail 

-Original Message-
From:   Matthew Delmarter [mailto:[EMAIL PROTECTED]]
Sent:   Monday, July 30, 2001 9:41 PM
To: PHP Mailing List
Subject:[PHP] search array for value

How do I search an array? 

For example if I want to know if $array contains 1...

Regards,

Matthew Delmarter

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] can't get gd working at all

2001-07-25 Thread Warren Vail

If the gd extension is not loaded each time php is loaded you will need to
cause it to be loaded from your script.

http://www.php.net/manual/en/function.dl.php

I keep my extensions in a separate directory, off the php root directory, so
to load my gd I use the following;

dl(extensions/php_gd.dll);

good luck.

Warren Vail

-Original Message-
From:   Matt Greer [mailto:[EMAIL PROTECTED]]
Sent:   Wednesday, July 25, 2001 6:55 AM
To: php-gen
Subject:[PHP] can't get gd working at all

I'm trying to get a simple piece of code involving gd functions to work just
to ensure gd is working properly on my server. I took this straight from my
book. All that comes up is a broken image. I talked with my host and they
assured me gd is installed and working properly on the server. Any ideas?

Here's what I'm trying to do:

?php
//draw1.php
Header(Content-type: image/jpeg);
$image = ImageCreate(200,150);
$gray = ImageColorAllocate($image,204,204,204);
$blue = ImageColorAllocate($image,0,0,255);
ImageLine($image,10,10,150,30,$blue);
ImageJPEG($image);
ImageDestroy($image);
?

This is from chapter 16 of Beginning PHP4 from Wrox press.

Thanks,
Matt


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] NT Authentication

2001-07-18 Thread Warren Vail

I am running php4/mysql/apache in a large NT complex, behind a firewall.
How can I authenticate users to my site using NT authentication?  Has anyone
done this?

thanks,

Warren Vail


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] What the heck is this

2001-07-11 Thread Warren Vail

When all else fails, check the mainual;

http://www.php.net/manual/en/language.oop.php

appears to be an instance reference (not sure that is the term).

Warren Vail

-Original Message-
From: Adam [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 10, 2001 11:35 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] What the heck is this


I've done quite a bit of php coding in the past few months but never had the
need to use this and therefore never learned anything about it. It's hard to
ask about it because i have NO idea what it is at all. Is it to give
spanning values? I was woundering if anyone knew specifically what it did.

-Adam



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] File Download Mouse Behavior

2001-07-11 Thread Warren Vail


When using PHP to generate a download file, the PHP program generates the
headers and the actual text content of the file and this all works just
fine.  However, after the file download is complete, positioning the mouse
anywhere over the browser (still showing the previous page) it appears as an
hour glass, even though the mouse is active and still allows further clicks
on the page.

Has anyone come up with a method of cleaning up this behavior?

Browser is IE on NT.

Warren Vail


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] File Download IE behavior

2001-07-11 Thread Warren Vail


When generating a download file from PHP to IE (Netscape is not used by my
client base) the browser prompts with an option to download the file or open
the file where it is.  Opening the file fails and I am forced to download
the file to my local drive before receiving another prompt to open the file
where the second Open works just fine.

Is there a way to allow this first open to work, or cause the open option on
the first download window to be removed?

Warren Vail


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Can any one spot the Parse error Here

2001-07-03 Thread Warren Vail

I use indentation to check out the form; missing brace at end?  Check it
out.

?php
$usersfile = users.php;
session_start();
session_register(user,pass);
if(isset($user)) $username = $user;
if(isset($pass)) $password = $pass;
if(!$username) {
?
 form
  User : input type=text name=usernamebr
  Password : input type=password name=passwordbr
  input type=submit value=Login
 /form
?php
} else {
$user = $username;
$pass = $password;
$userslist = file($usersfile);
for($i = 1; $i  sizeof($userslist); $i++) {
$userline = explode(||, $userslist[$i]);
if($usersline[0] == $username) {
if($password != rtrim($usersline[1])) {
die(Incorrect Username);
} else {
$i = sizeof($userslist) + 1;
}
}
}
if(!$action) $action = main;
switch($action) {
case main:
?
 a href=?action=postPost News/abr
 a href=?action=editEdit News/abr
 a href=?action=deleteDelete News/abr
 a href=?action=adduserAdd User Account/abr
 a href=?action=deluserDelete User/a
?php
break;
case adduser:
?
   form
   input type=hidden name=action value=process
   input type=hidden name=process value=adduser
   Username : input type=text name=unamebr
   Password : input type=password name=pwordbr
   input type=submit value=Add User
/form
?php
break;
case deleteuser:
$userslist = file($usersfile);
for($i = 0; $i  sizeof($userslist); $i++) {
$userline = explode(||, $userslist[$i]);
echo a href=\?action=processprocess=deluseruname=;
echo $userline[0]..$userline[0]./abr;
}
break;
case post:
?
   form
   input type=hidden name=action value=process
   input type=hidden name=process value=post
   Title : input type=text name=titlebr
   textarea name=text/textareabr
   input type=submit value=Post
   /form
?php
break;
case edit:
$dir = dir(./news);
while($file=$dir-read()) {
if(is_file(./news/.$file)) {
$name = str_replace(.txt, , $file);
echo a href=\?action=processprocess=viewnews=;
echo $file.\.$name./a;
}
}
$dir-close();
break;
case delete:
$dir = dir(./news);
while($file=$dir-read()) {
if(is_file(./news/.$file)) {
$name = str_replace(.txt, , $file);
echo a href=\?action=processprocess=confimnews=;
echo $file.\.$name./a;
}
}
$dir-close();
break;
case process:
switch($process) {
case adduser:
$fp = fopen($usersfile, w);
for($i = 0; $i  sizeof($userslist); $i++)
fwrite($fp, $userslist[$i]);
fwrite($fp, \r\n.$uname.||.$pword);
fclose($fp);
echo bUser Added!/b;
break;
case deluser:
$fp = fopen($usersfile, w);
for($i = 0; $i  sizeof($userslist); $i++) {
$userdetails = explode(||, $userslist[$i]);
if($userdetails[0] != $uname)
fwrite($fp, $userslist[$i]);
}
fclose($fp);
echo bUser Deleted!/b;
break;
case post:
$fp = fopen(./news.$title..txt, w);
fwrite($fp, $title.\r\n);
fwrite($fp, $text);
echo bNews Posted!/b;
break;
case view:
$newsdata = file(./news/.$news);
$title = rtrim($newsdata[0]);
echo Title: b.$title./b
?
   br
   form
input type=hidden name=process value=post
input type=hidden name=action value=process
input type=hidden name=tittle value=?php echo $tittle; ?
   textarea name=text
?php
for($i = 1; $i  sizeof($newsdata); $i++) {
echo $newsdata[$i];
}
?
/textarea
input type=submit value=Edit
   /form
?php
break;
case 

RE: [PHP] Telnet and PHP

2001-07-01 Thread Warren Vail

Jon,

Looked like a nice solution, but couldn't get the code to work.  Kept going
into an endless loop or wait state somewhere.

still forced to use rexec.

Warren Vail

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Saturday, June 30, 2001 11:06 AM
To: Warren Vail
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Telnet and PHP


Instead of performing a send for each stroke, the user code type in a whole
string in a text box, and then submit that string. I have found this code at
http://www.phpbuilder.com/mail/php-general/2001051/1479.php:

?
error_reporting(-1);


class Telnet {
/* (c) [EMAIL PROTECTED] */


var $sock = NULL;


function telnet($host,$port) {
$this-sock = fsockopen($host,$port);
socket_set_timeout($this-sock,2,0);
}


function close() {
if ($this-sock)
fclose($this-sock);
$this-sock = NULL;
}


function write($buffer) {
$buffer = str_replace(chr(255),chr(255).chr(255),$buffer);
fwrite($this-sock,$buffer);
}


function getc() {
return fgetc($this-sock);
}


function read_till($what) {
$buf = '';
while (1) {
$IAC = chr(255);


$DONT = chr(254);
$DO = chr(253);


$WONT = chr(252);
$WILL = chr(251);


$theNULL = chr(0);


$c = $this-getc();


if ($c === false)
  return $buf;


if ($c == $theNULL) {
continue;
}


if ($c == \021) {
continue;
}


if ($c != $IAC) {
$buf .= $c;


if ($what ==
(substr($buf,strlen($buf)-strlen($what {
return $buf;
} else {
continue;
}
}


$c = $this-getc();


if ($c == $IAC) {
$buf .= $c;
} else if (($c == $DO) || ($c == $DONT)) {
$opt = $this-getc();
// echo we wont .ord($opt).\n;
fwrite($this-sock,$IAC.$WONT.$opt);
} elseif (($c == $WILL) || ($c == $WONT)) {
$opt = $this-getc();
// echo we dont .ord($opt).\n;
fwrite($this-sock,$IAC.$DONT.$opt);
} else {
// echo where are we? c=.ord($c).\n;
}
}


}
}


$tn = new telnet(192.168.255.100,23);
echo $tn-read_till(ogin: );
$tn-write(admin\r\n);
echo $tn-read_till(word: );
$tn-write(thieso\r\n);
echo $tn-read_till(: );
$tn-write(ps\r\n);
echo $tn-read_till(: );
echo $tn-close();
?





- Original Message -
From: Warren Vail [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Saturday, June 30, 2001 2:01 PM
Subject: RE: [PHP] Telnet and PHP


 By active user input, I would assume that you mean every time the user
 makes a keystroke, the keystroke is sent to the host machine.  This is not
a
 characteristic of html which only sends information to the host machine
when
 some form of submit is clicked.  The advantage of the applet for this sort
 of thing is it runs on the browser client, and has the capability of
sending
 every keystroke directly to the host, bypassing the server side.

 On the server side, once the (PHP) application is done sending the
requested
 files to the web browser for one user, it moves on to handling the
requests
 for other users.  Can you imagine the load on a server if it had to reload
 your application every time, your user pressed a key.

 You never really made it clear where you expected this client to run,
 although PHP, at this point, can only run on the server.  Now if you are
 looking for something that your PHP code could use to 1. signon to a host
 somewhere, 2. execute some commands, 3. capture and process the results
and
 4. disconnect before completing a single page to a web browser client (it
 will probably never do active user input, because of the nature of PHP
and
 the web server), then I would suggest you consider rexec, rcp, rsh
or
 if what you want is in a file on the host machine, you could use the ftp
 functions.  These are not telnet, and do require special deamons running
on
 the host machine, but may do the trick.

 I have been looking for your telnet client for a long time as well, and if
 you find one, please remember

RE: [PHP] Telnet and PHP

2001-06-30 Thread Warren Vail

By active user input, I would assume that you mean every time the user
makes a keystroke, the keystroke is sent to the host machine.  This is not a
characteristic of html which only sends information to the host machine when
some form of submit is clicked.  The advantage of the applet for this sort
of thing is it runs on the browser client, and has the capability of sending
every keystroke directly to the host, bypassing the server side.

On the server side, once the (PHP) application is done sending the requested
files to the web browser for one user, it moves on to handling the requests
for other users.  Can you imagine the load on a server if it had to reload
your application every time, your user pressed a key.

You never really made it clear where you expected this client to run,
although PHP, at this point, can only run on the server.  Now if you are
looking for something that your PHP code could use to 1. signon to a host
somewhere, 2. execute some commands, 3. capture and process the results and
4. disconnect before completing a single page to a web browser client (it
will probably never do active user input, because of the nature of PHP and
the web server), then I would suggest you consider rexec, rcp, rsh or
if what you want is in a file on the host machine, you could use the ftp
functions.  These are not telnet, and do require special deamons running on
the host machine, but may do the trick.

I have been looking for your telnet client for a long time as well, and if
you find one, please remember to post it here, but I would suspect that one
of the problems in doing a telnet client in php is that the telnet client
needs to be multi-threaded.  Perhaps someone will someday take open source
like Dave's Telnet and fashion an extension to PHP.

Til then, try the options above,

Warren Vail


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Saturday, June 30, 2001 10:36 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Telnet and PHP


I was doing some research on creating a webbased telnet client and I am
unsatisfied with Java applets. I would like to create a server side telnet
client, so the user side is only required to have a working web browser that
supports HTML.

Thus, I turned to PHP. I found one example, but it does not allow for active
user input. While I will sit down this evening and work with the code, I was
wondering if anyone had/knew of a good example of a PHP telnet client.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] reading records alphebetically

2001-06-30 Thread Warren Vail

If you are planning to have a lot of records, you may want to create a
column with just that letter and index it, followed by the full name.

SELECT name from Table
WHERE first_letter = $letter
ORDER by name

should produce pretty fast results if first_letter, name is indexed.

Warren Vail

-Original Message-
From: Jamie Saunders [mailto:[EMAIL PROTECTED]]
Sent: Saturday, June 30, 2001 10:30 AM
To: [EMAIL PROTECTED]
Subject: [PHP] reading records alphebetically


Hi,

I have a MySQL database set-up containing a few hundred records.  I'm trying
to make a script that reads the 'name' field of the records and displays
only the records of which the name field begins with a specific letter:

if ($letter = A) {
display all records of which field 'name' beings with A
} else if ($letter = B) {
...

I'm just starting out on this, so please excuse my ignorance :)

Jamie Saunders
[EMAIL PROTECTED]



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] newbie algorithm help!!!!!

2001-06-23 Thread Warren Vail

You'll probably get as many approaches as replies.  How about the following;
after you have connected to mysql and selected the database;

$query  = SELECT * FROM table;

$result = mysql_query ($query)
or die (Query b$query/b failed. The error message was
.mysql_error ());

// The following wipes out any trace of a memory table in the working $table
element
$table = '';
while ($rows = mysql_fetch_row ($result)) {
$table[] = $rows[0];// add the row to a working table
}
mysql_free_result($result)  // always do this as soon as you can

$top = sizeof($table);
$halfway = ceil($top/2);// round up if odd
$col2 = $halfway;
echo TABLE;
for($col1 = 0; $col1  $halfway; $col1++) {
echo TRTD$table[$col1]/TD;
if($col2  $top) echo TD$table[$col2++]/TD/TR;
else echo TDnbsp;/TD/TR;   // this avoids that hole in your grid
}
echo /TABLE;



-Original Message-
From: Zak Greant [mailto:[EMAIL PROTECTED]]
Sent: Saturday, June 23, 2001 1:22 PM
To: McShen
Cc: Php-General
Subject: Re: [PHP] newbie algorithm help!


McShen wrote:
  hi
  i have a mysql table with approx. 30 entries.
 
  I wanna get them(i know how to do that) and list them in a 2-column
table.
 I
  have been trying to use a loop to do it. But it will only produce a
 1-column
  table. it's like
 
  entry 1
  entey 2
  entry 3
  entry 4
  etc
 
  Please help me so that i can get this :
 
  entry1 entry2
  entry3 entry4


The code is easier to understand than the explanation! :)

$query  = SELECT * FROM table;

$result = mysql_query ($query)
or die (Query b$query/b failed. The error message was  .
mysql_error ());

// Initialize a value to stored the table rows
$table = '';

// Initialize a counter for the column number
$column = 0;

// Loop through the query results
while ($rows = mysql_fetch_row ($result)) {

// Put the contents of the field into a cell
$cell = td$rows[0]/td;

// If we are in column 0
if (0 == $column) {
// Start the row
$table .= tr$cell;
} else {
// End the row
$table .= $cell/tr\n;
}

// Make the column number equal to
// The whole number remainder left over
// from dividing the value of $column
// plus one by two

$column = ($column + 1) % 2;
}

// Handle dangling rows
if (1 == $column) {
$table .= td/td/tr\n;
}

echo table$table/table;


Good Luck!

--zak


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Code check please

2001-06-21 Thread Warren Vail

Andreas,

I'm not sure about code that appears to be missing like an execute query
function or checking the number of affected rows to make sure that the
insert worked, but clearly your insert code is not properly formed.  The
query could also be impacted by whether the columns are defined with special
attributes like DATE, etc.  Assuming that all columns are defined as
character strings the query should look like;

$sql = INSERT INTO tabell (fornamn, efternamn, email)  .
VALUES(\$fornamn\, \$efternamn\, \$email\);

I've found that I often have problems trying to use single quotes in sql
queries so I avoid them.  I notice that you also included a semi-colon in
the query text, while this works when piping a file of queries into the
mysql command, it does not work from a program.  The semi-colon in a command
stream into the mysql command actually signifies a point to stop and execute
the preceding text as a query and after executing that query, continue on
from the next character.

hope you got it working,

Warren Vail

-Original Message-
From: Andreas Skarin [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 20, 2001 9:00 AM
To: PHP General
Subject: [PHP] Code check please


I've tried to get this working for over an hour
now, and it still won't. I don't even get an error
message to help me find the problem so I was
hoping that someone could check my code for me.

I'm fooling around with a basic form that is
supposed to send one's name, surname and e-mail
address to receive.php. receive.php is then
supposed to take the information and add it to a
table called tabell in a database called
databas, but it doesn't work. I think there
might be something wrong with my MySQL query.

- - - - - - - - - - - FORM - - - - - - - - - - - -
- -

form action=receive.php method=post
PFouml;rnamn:br
input type=text name=fornamn
size=25/p
pEfternamn:br
input type=text name=efternamn
size=25/p
pE-mailadress:br
input type=text name=email
size=25/p
input type=submit name=submit
value=Log in
/form

- - - - - - - - - - - - - - - - - - - - - - - - -
- - -

- - - - - - - - - - - RECEIVE.PHP - - - - - - - -
- - -

?php

// connection to MySQL
$connection = mysql_connect(localhost,
username, password);
if (!$connection) {
echo (PUnable to connect to the database
server at this time./P );
exit();
}

//select database
if (! @mysql_select_db(databas) ) {
echo (PUnable to locate the database at
this time./P);
exit();
}

// MySQL query
$sql = INSERT INTO tabell SET .
fornamn ='$fornamn', .
efternamn='$efternamn', .
email='$email';;
?

- - - - - - - - - - - - - - - - - - - - - - - - -
- - -

Thanks in advance!

// Andreas


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Code check please

2001-06-21 Thread Warren Vail

It just occurred to me that one thing that will kill a query is special
query characters imbedded in your strings, like quotes (single or double).
This can be resolved by the

$resultstring = addslashes($sourcestring);

this should escape special characters normally used to signal key components
to the mysql query processor.

of course when you select the column you need to run it thru;

$resultstring = stripslashes($dbcolumnvalue);

to get back your original value.

good luck,

Warren Vail

-Original Message-
From: Andreas Skarin [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 20, 2001 3:46 PM
To: PHP General
Subject: Re: [PHP] Code check please


I'm sorry guys, neither of the snippets work. I must have screwed something
else up
too. Is there any way I can provoke an error message from your code examples
below?
If anyone manages to find out what's wrong, please tell me. I'm not giving
up until
I smash this bug :-)

// Andreas

 Rich Cavanaugh wrote:

  try:
 
  $sql = INSERT INTO tabell (fornamn, efternamn, email) values
('{$fornamn}',
  '{$efternamn}', '{$email}');

 Sebastian Wenleder wrote:

  I'd use this SQL-query:
 
  $sql = INSERT INTO tabell \
  (fornamn,efternamn,email) \
  VALUES(.$fornamn., \
  .$efternamn., .$email.);




--
Andreas Skarin
Svenska Dream Theater-Sällskapet
http://www.sdts.nu - mailto:[EMAIL PROTECTED]



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Saving to a file

2001-06-20 Thread Warren Vail

Rosen,

Depends on where you want to save the file.

To get the manual http://www.php.net/docs.php.

To Save to a file on the machine running the browser;

make a form that outputs absolutely nothing except;

header(Content-Type: application/octet-stream);
header(Content-Disposition: attachment; filename=filename.txt);
while(list($key,$val) = each($prod)) {  // the echo below sends the file
contents
$id = $val[0];  // data was loaded to array $prod as follows;
$nm = $val[1];  // $prod[] = array($productNo, $productDescr);
echo($id,$nm\r\n);// use \r\n if going to windows browser \n if going to
unix
}

To Save a file to the server machine hosting your website;

use normal fopen, fputs, etc (see the manual)

good luck,

Warren Vail

-Original Message-
From: Rosen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 20, 2001 1:04 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Saving to a file


Hi,
Sorry for the stupid question, but i don't have at me a PHP manual
and I want to save some string to file from PHP.

Can someone tell me how ( with what function to do this ) ?

Thanks
Rosen







RE: [PHP] session_register()

2001-05-03 Thread Warren Vail

Jennifer,

I could be wrong but this is what I think you have;

When the session_register is executed the session contents are partially
updated.
Your first test actually executed the session_register that posted the
variable with 0 string length, because the variable had not yet been
initialized (the bad return is the only indication of this).
Your test that the variable is registered would seem to suggest this.
You then changed the variable value and failed to register this new value.

The second page found the only value you registered (the uninitialized
variable with zero length) and displayed that.

You can identify what actually happened by viewing the session file contents
after your two pages are displayed.

hope this helps,

Warren Vail

-Original Message-
From: Jennifer [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 02, 2001 10:55 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] session_register()


Johnson, Kirk wrote:

  -Original Message-
  From: Jennifer [mailto:[EMAIL PROTECTED]]
  Do you need to register a variable with the session before you
  assign it a value?

 Not in my experience.

  session_register should return true if the variable was
  successfully registered?

 It returns 1.

  The variable name and it's value should be written to the file
  with the same name as session_id()?

 Yes, here's a sample from a session file: superUser|s:3:Yes;
 Here's a sample session filename: sess_01bc2e24aa5291300887948f0af74899


This is all what I thought, but I am still having problems and I
don't have a clue what I am missing. Here's an example that I
have been paying with for testing.

page1.php contains
?php
session_start();
echo session id is .session_id().br\n;
if (session_register(testing)) {
echo session_register worked.br\n;
}
else {
echo session_register did not workbr\n;
}
if (session_is_registered(testing)) {
echo testing is a registered variablebr\n;
}
else {
echo testing is not a registered variablebr\n;
}
$testing = Let's see if this works.;
?
a href=page2.php??=SID?Go to next page./a


The output of the above page, gives me
session id is e35c2893382e28a14fa0455302edb06e
session_register did not work
testing is a registered variable
Go to next page.


and page2.php contains
?php
session_start();
echo session id is .session_id().br\n;
echo Testing: $testingbr\n;
?


The output of page2 gives me
session id is e35c2893382e28a14fa0455302edb06e
Testing:

I am totally confused.  First off, why isn't it registering the
variable? There is a file named e35c2893382e28a14fa0455302edb06e
in my /tmp directory, but it is empty.

Second, if it isn't registering the variable then why is
session_is_registered(testing) returning true?

Jennifer

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Incrementing dates

2001-04-22 Thread Warren Vail

If you are looking for a PHP only solution you might try hand calculating
the amount of time you want to adjust in seconds (i.e. 60 seconds x 60
minutes x 24 hours x 10 days = 864000)

$newdatetime = (strtotime($otherdatetime) + 864000;
I often use something similar to adjust for timezone differences.

There are lots of other datetime functions in the manual ;)

Warren Vail

-Original Message-
From: PHPBeginner.com [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 22, 2001 3:09 AM
To: Martin Skjoldebrand; [EMAIL PROTECTED]
Subject: RE: [PHP] Incrementing dates


you can then do this:

INSERT INTO table SELECT date+INTERVAL 10 DAYS AS date FROM table WHERE
bla=bla;

it is just a way to do it. you will definitely have to play with it.

However you can easily make two queries to read the previous date combining
it with INTERVAL and then do an insert.


Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-Original Message-
From: Martin Skjoldebrand [mailto:[EMAIL PROTECTED]]
Sent: Sunday, April 22, 2001 5:59 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Incrementing dates


PHPBeginner.com wrote:

 I am not sure on how your possibilities are,
 but doing this in PHP means literally "adding useless lines and loops"

 If possible, do it with SQL queries. Read the documentations on date
 datatypes, this is so much easier... almost magic.


AND

 You can (mySQL, right?) do the following:

UPDATE table SET date=(date+INTERVAL 10 DAYS);

so if date there was 04-28, it will be added 10 more days and so will
become
05-08

Use SQL for this things, it treats dates as 'dates' while PHP treats them
as
integers and strings.

Sounds even easier. But what if I'm not doing an UPDATE but an INSERT? Can
it read the previous date? I am inserting a batch of bookings at one time.

Martin S.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Telnet from PHP

2001-04-17 Thread Warren Vail

I've seen a number of requests for info on this subject with no answers.

Is anyone working on a tn (Telnet) screen scrapper connectivity toolset for
PHP?
How about tn3270?

Warren Vail
Availabletech.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




<    1   2