RE: [PHP] Detecting email bounces sent by the mail function?
What would php run as on a cobalt raq4 so I don't get the x header warning Best regards -Original Message- From: Michael Sims [mailto:[EMAIL PROTECTED]] Sent: 28 November 2002 19:51 To: [EMAIL PROTECTED] Cc: Ade Smith Subject: Re: [PHP] Detecting email bounces sent by the mail function? On Thu, 28 Nov 2002 17:54:46 -, you wrote: >Hello > >Is it possible to detect with PHP whether an email sent using the PHP >'mail' function has bounced back or has not been delivered? Hi, If you're using PHP on a unix/linux with sendmail you can set the envelope sender via the 5th parameter to the mail function, additional_parameters. Normally the envelope sender is the username that your web server process runs under (usually "nobody" if you're using Apache), but you can set it to either your email address or an email address you have setup specifically to catch bounces. Example: mail('[EMAIL PROTECTED]', 'Test email', 'This is a test', '', '[EMAIL PROTECTED]'); Most MTA in existence will route DSNs to the envelope sender, not the From: header. Note that sendmail will add an X-Warning header if the user your web server runs as isn't considered a sendmail "trusted user". The quickest way to fix this (on Redhat machines anyway) is to put the username in /etc/mail/trusted-users. Other systems and sendmail installations may differ, so YMMV. HTH... -- 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] prevent session_replay
hi I'm running PHP 4.2.3 as module with Apache 1.3.26 on OpenBSD 3.2 with the chroot turned off (as it stopped the php_mail() funtion working, but if anyone has the fix for that I will re-implement the jail again :o) I'm having some problems with sessions. I am not using cookies, as many people don't allow them to be set The main page starts a session, takes username and password, and if they are ok, it registers the users id from the db as a session variable using the $_SESSION['user_id'] = $user_id it then does a header redirect to another page, which at the moment for testing just displays the SID and all $_SESSION[vars] as the SID is being passed in the url, I am able to copy the http://url?SID from the browser window if I close the browser (which from reading the docs on sessions should end the session) and then re-open another browser (admittedly on the same machine/ip address) and post the http://url?SID back in, I get the page, and the $SESSION[vars] are still there !! it is reading them back out of the files in /tmp (if I edit these directly and paste the url?SID in, I get the new values I mannually put in !) :o( is there a official/approved method to prevent this from being done ? thankyou _scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem with forms and sessions
hi I'm having problems submitting forms while using sessions :o( I'm using -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] forms and sessions ?
hi I'm having some problems submitting forms while using sessions :o( I have a form, that will only display if the session vars exist and are not null or empty. I'm using this is the form handler -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Executing Shell Commands.
Hello, Does anybody know how to execute a shell command from PHP on a Linux system? Thanks, Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] multiple entry forms !!
hi looking for some advice I have a site in progress. user to it have to enter a LOT of information (it will contain a club directory) in order to try and make it a less unpleasant experience for the user, I want to give them 7 smaller input forms, each one following the other what would be the correct way to do this, one very large, complex coded php conditional form that does everything, or several smaller ones ? if I use one form, it will conatin rather a lot of code, but execution would all be handled by the form itself but if I use multiple smaller forms, each form would need to process the previous forms input, and then display it's inputs for entry I am also using sessions, which adds a little to complexity any general good coding practice tips/links would be helpful thanks _scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] trying to write sql query as a function
hi I'm trying to write a simple MySQL query in a php function so that I can just call it and pass arguments, but I'm missing something :o( there are 2 files, index.php and common.php, commom.php contains all the functions, and is included at the beginning of index.php the first function called in index.php is db_connect, which calls the function to create a connect to the MySQL database, this would seem to be working correctly the second part (here's where I crap out) is the actual query. the function is written as follows function query($strField, $strTable) { $sql = "select $strField from strTable"; $result = mysql_query($sql); return $result; } I call it with query(my_field, my_table) for example, and I would hope it would return $result back to the calling page for further us, but the rest of index.php print ""; while ($line = mysql_fetch_row($result)) { foreach ($line as $value) { print "$value"; } mysql_close($my_conn); print ""; simply renders an empty list box :o( if I take the code out of a function and place it in index.php like this $sql = "select my_field from my_table"; $result = mysql_query($sql); print ""; while ($line = mysql_fetch_row($result)) { foreach ($line as $value) { print "$value"; } mysql_close($my_conn); print ""; then it works fine ?? what am I missing here ? thanks _scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] automatic job execution
Depends on what system you are running, let us know and we can better answer the question. On Thu, 25 Jul 2002, Paul O'Neil wrote: > I have a php script I would like run like a cron job every so many minutes. > How is this done? > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] automatic job execution
On second thought, do you just want the script to run and sleep or actually schedule it as a job? You could just use sleep(). set_time_out(0); while ($i = 0){ your code sleep(60); } We use this at my company for a file parsing program, it runs, sleeps 15 minutes and repeats. -Scott On Thu, 25 Jul 2002, Paul O'Neil wrote: > I have a php script I would like run like a cron job every so many minutes. > How is this done? > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] automatic job execution
In order to run the script from the command line you need the cgi or executable version of PHP. You can have both on the machine, Apache uses mod_php and you use the cgi version for your scripts on the machine. On Thu, 25 Jul 2002, Negrea Mihai wrote: > and what happens if you restart apache... ? > > On Thursday 25 July 2002 04:25 pm, Scott wrote: > > On second thought, do you just want the script to run and sleep or > > actually schedule it as a job? You could just use sleep(). > > > > set_time_out(0); > > > > while ($i = 0){ > > your code > > > > sleep(60); > > } > > > > We use this at my company for a file parsing program, it runs, sleeps 15 > > minutes and repeats. > > > > -Scott > > > > On Thu, 25 Jul 2002, Paul O'Neil wrote: > > > I have a php script I would like run like a cron job every so many > > > minutes. How is this done? > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] automatic job execution
You can do that or just run the command: /usr/local/bin/php -q name_of_script.php If you want to call the script directly by name instead of calling php like that you will need to make to executable and add the # line at the top. On Thu, 25 Jul 2002, Paul O'Neil wrote: > I looked at some old posts and I found #!/usr/local/bin/php -q should be > included at the top of the script but I don't think I have permission on the > system I'm on. > > -Original Message- > From: Scott [mailto:[EMAIL PROTECTED]] > Sent: Thursday, July 25, 2002 6:25 AM > To: Paul O'Neil > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] automatic job execution > > > On second thought, do you just want the script to run and sleep or > actually schedule it as a job? You could just use sleep(). > > set_time_out(0); > > while ($i = 0){ > your code > > sleep(60); > } > > We use this at my company for a file parsing program, it runs, sleeps 15 > minutes and repeats. > > -Scott > > > > On Thu, 25 Jul 2002, Paul O'Neil wrote: > > > I have a php script I would like run like a cron job every so many > minutes. > > How is this done? > > > > > > > > > -- > 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 with msql_fetch_array() FIXED ! Now cookie problems:(
On Thu, 25 Jul 2002, Matthew Bielecki wrote: > session.save_path = "C:/Program Files/Apache > Group/Apache/web/php/dir/files/temp" Considering using something like: c:/temp, sure beats typing and remembering that path :) How are you setting the cookie in the code? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Protect PHP coding
On Sat, 3 Aug 2002, Acer wrote: > You'll never hear anything from the core php group since they are a tight > click so it's business as usual. You're kidding, right? When was the last time you saw one the creator of ASP on a mailing list personally answering code questions? For what it's worth, I just left a 50,000 employee company that would not let me use PHP in production until I showed them the Zend suite of products. When I asked for the money to buy their IDE and it arrived I was allowed to move my PHP code to production. Same deal as Sun now charging for Star Office, in corporate eyes they now see a company making money from a product which will give the company the ability to enhance the product and most important provide support. So, while we all may not be able to afford some of the tools that Zend is creating they continue to have a dedication to the open source community. I view it as the better Zend does, the more developers they can hire and the better all of the products will be including their contributions to PHP. -Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Include problems
I have PHP4 on both a windows IIS server and a windows apache server. The include function only works in the same directory of the file I wish to access. ex. www.include.com/default.php all files in same directory (i guess the root)? everything works fine. Here's where I have the problem. Now I want to store all my includes in one directory www.include.com/inc that doesn't work>>> Warning: Failed opening 'test.inc' for inclusion (include_path='') Can anyone help me with this??? Thanks scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include problems
Does this mean i have to do this to each site??? "Daniel Kushner" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > include 'inc/test.inc' will work fine if you add your root directory to your > include_path (in the c:\winnt\php.ini file). > > > Daniel Kushner > [EMAIL PROTECTED] > > Need hosting? http://www.TheHostingCompany.us/ > > > -Original Message- > > From: Scott [mailto:[EMAIL PROTECTED]] > > Sent: Saturday, August 03, 2002 3:11 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP] Include problems > > > > > > I have PHP4 on both a windows IIS server and a windows apache server. The > > include function only works in the same directory of the file I wish to > > access. > > > > ex. www.include.com/default.php > > all files in same directory (i guess the root)? > > > include 'test.inc' > > ?> > > > > everything works fine. Here's where I have the problem. > > > > Now I want to store all my includes in one directory www.include.com/inc > > > > > include 'inc/test.inc' > > ?> > > that doesn't work>>> > > Warning: Failed opening 'test.inc' for inclusion (include_path='') > > > > Can anyone help me with this??? > > > > Thanks > > scott > > > > > > > > > > -- > > 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] Copying a remote graphic to my server.
Hello there I am trying to copy a remote graphic from http://blah.com/blah.jpg to my server. How would I achieve this in php I have looked on the archives but can't seem to find the best way. I am running 4.1.2 on apache unix. I understand copy will not work on remote files (tried it) but I am not sure of the correct fopen fwrite etc code! Any sample code or pointers are most helpful Best regards Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Copying a remote graphic to my server.
Hello there I am trying to copy a remote graphic from http://blah.com/blah.jpg to my server. How would I achieve this in php I have looked on the archives but can't seem to find the best way. I am running 4.1.2 on apache unix. I understand copy will not work on remote files (tried it) but I am not sure of the correct fopen fwrite etc code! Any sample code or pointers are most helpful Best regards Scott -- 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] Unix passwd file
I apologize if this is might be OT. I have 5,000+ users in a unix passwd file that I would like to move to a MySQL table to build a login system with php. I could then use this table for Postfix and Radius. I know about the getpwent in perl, but does anyone know if I populate a MySQL table with the login/password can php then use that encrypted password to validate users? TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fatal error: Maximum execution time of 30 seconds exceeded
Hello Trying to send a html email to 5000 people on a list Keep getting Fatal error: Maximum execution time of 30 seconds exceeded Any pointers on the best way to achieve this lengthily operation without the script failing? Best regards Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] outgoing mail function freezing problem
Hello there Thanks for all with the help yesterday My mail function is sending out a few hundred or so mail address but keeps hanging when it gets to sending a mail form a certain domain. As the script hangs at this point I can't send anymore mails once the script encounters an address from x domain. What would be the best way to work around this? Why is mail() hanging? How would you suggest incorporating a timeout so that the script continues once mail() has not exited for more than say 5 seconds Thanks in advance for your help Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql question
Very slightly OT but great minds here I have a table with two columns and I need to get all the items that are not in the shop number I select, with the exception of items that are in the shop number I select. Table Shopnumber item 1 orange 1 banana 1 apple 1 pear 2 grape 2 coca cola 2 pepsi 3 orange 4 orange 4 pepsi 4 7 up 4 sunny delite I need to be able to work out all the items that are in the other shops. For example if a customer picks orange from shopnumber 1 I need to get a result that has all items in all shops except shop1 The problem is my query still picks items that are in shop1 if they are in another shop as well, which is not what I need My current query is select * from table where shopnumber!=$shoprvar. As an example if I use select * from table where shopnumber!=1 I would get grape, coca-cola,pepsi (x2),7 up, sunny delite and orange (x2). I don't want orange because it is in shop1! Help and BIG THANKS for the ANSWER? Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to find future date?
Thanks Can't get it to work, so open to other suggestions. Thanks anyway. -Original Message- From: 1LT John W. Holmes [mailto:holmes072000@;charter.net] Sent: 30 October 2002 21:16 To: ppf; [EMAIL PROTECTED] Subject: Re: [PHP] How to find future date? Take a look at mktime() www.php.net/mktime ---John Holmes... - Original Message - From: "ppf" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, October 30, 2002 4:01 PM Subject: [PHP] How to find future date? > > Hi All: > I like to know is there any metrhod to find future > date ( for example 15 days from the today [sys date]). Basically i am > looking for a method equivalent to datediff or dateadd in asp. I hope > PHP will have some thing corresponding to this, I will really > appricate u r help, thanks in advance > Prad > > __ > Do you Yahoo!? > HotJobs - Search new jobs daily now > http://hotjobs.yahoo.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
[PHP] Protecting your scripts
Hi there I wrote some php scripts that I want some friends to be able to use from there php scripts. Some on my server under different domains and some on other servers else where on the web How could I enable them to embed and use my scripts from within there php pages without them getting access to the source. Best regards Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] form with two actions
Hello I would like to know if it is possible to use Php to make a form perform 2 actions by having the user click on a single submit button. For instance, send data to a database and email it simultaneously. I would prefer not to use javascript. If someone could point me to an example I would appreciate it Thanks, S.W. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] form with two actions
I just realized I should have been more specific with my question. What I want to do is use php to submit registration data to the database and then send part of the data to a perl script to be encrypted and sent in an email. I have to use perl for the encryption because of user permissions on the server-Php and GPG run as different users. So I have to send the data in 2 different directions rather than keep it in the same script. I would like to be able to do it without having the user do double entries. If I can still do this without two submits, then I guess I do need an example. Thanks for the responses, SW On Wednesday 13 November 2002 07:16 am, you wrote: > For that example, you don't need two submits... the same script that > handles the submitted data for the database can send the email... > > usually it's only a problem if one form has to be submitted to two servers, > or something... > > do you need an example? > > > Justin > > on 13/11/02 3:05 PM, Scott ([EMAIL PROTECTED]) wrote: > > Hello > > I would like to know if it is possible to use Php to make a form perform > > 2 actions by having the user click on a single submit button. For > > instance, send data to a database and email it simultaneously. I would > > prefer not to use javascript. If someone could point me to an example I > > would appreciate it > > > > Thanks, > > S.W. > > Justin French > > Creative Director > http://Indent.com.au > Web Developent & > Graphic Design > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fwd: Re: [PHP] form with two actions
I just realized I should have been more specific with my question. What I want to do is use php to submit registration data to the database and then send part of the data to a perl script to be encrypted and sent in an email. I have to use perl for the encryption because of user permissions on the server-Php and GPG run as different users. So I have to send the data in 2 different directions rather than keep it in the same script. I would like to be able to do it without having the user do double entries. If I can still do this without two submits, then I guess I do need an example. Thanks for the responses, SW On Wednesday 13 November 2002 07:16 am, you wrote: > For that example, you don't need two submits... the same script that > handles the submitted data for the database can send the email... > > usually it's only a problem if one form has to be submitted to two servers, > or something... > > do you need an example? > > > Justin > > on 13/11/02 3:05 PM, Scott ([EMAIL PROTECTED]) wrote: > > Hello > > I would like to know if it is possible to use Php to make a form perform > > 2 actions by having the user click on a single submit button. For > > instance, send data to a database and email it simultaneously. I would > > prefer not to use javascript. If someone could point me to an example I > > would appreciate it > > > > Thanks, > > S.W. > > Justin French > > Creative Director > http://Indent.com.au > Web Developent & > Graphic Design > --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] running php as cgi script
I'm trying to run a simple test php script as a cgi script on my ISP's server and haven't been able to get it to work, although according them it is possible. I have an example from a book which gives the following steps: 1. Put the script in the cgi-bin 2. run chmod 755 3. include "#!/usr/bin/php" at the top. (I have checked that this is the correct location of php on the server) The test script they give looks like this: #!/usr/bin/php echo "This is a small CGI program." Doesn't look like the usual php syntax to me, but I guess this is different. Anyway I've tried it a bunch of different ways and it hasn't worked and I haven't been able to find much on the subject from Google. Can someone tell me where I'm going wrong? Thanks, SW -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] running php as cgi script
Forgot to include the error I'm getting is: CGIwrap Error: System Error: execv() failed Error: No such file or directory (2) Although the file and path are correct. On Friday 15 November 2002 10:52 pm, you wrote: > I'm trying to run a simple test php script as a cgi script on my ISP's > server and haven't been able to get it to work, although according them it > is possible. > > I have an example from a book which gives the following steps: > > 1. Put the script in the cgi-bin > 2. run chmod 755 > 3. include "#!/usr/bin/php" at the top. (I have checked that this is the > correct location of php on the server) > > The test script they give looks like this: > > #!/usr/bin/php > > echo "This is a small CGI program." > > Doesn't look like the usual php syntax to me, but I guess this is > different. Anyway I've tried it a bunch of different ways and it hasn't > worked and I haven't been able to find much on the subject from Google. > Can someone tell me where I'm going wrong? > > Thanks, > SW -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] running php as cgi script
I'm not intending to run the script from the shell. What I am trying to do is encrypt emails with Gnupg. The problem is Gnupg runs as my user name and php runs as nobody. So I'm trying to run a php script as cgi to deliver the data to Gnupg since a cgi script will run as my username. I am using a perl script right now and it works, but the rest of the application is in php, so its causing some me some design difficulties. I'm going to try some the suggestions posted and see if I can get it working. Thanks, SW On Friday 15 November 2002 11:04 pm, you wrote: > Joseph, I think he's trying to run the script from the shell--in which > case it looks okay to me (besides perhaps a terminating semicolon on the > last line) > > Marco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] running php as cgi script
Well, I've got a few test scripts to run by following the suggestions from the posts. There's just one thing that's not quite right yet. The "#!/usr/bin/php" line appears at the top of the page. For instance when I run the following script from the cgi-bin: #!/usr/bin/php The phpinfo page comes up fine, but "#!/usr/bin/php" appears at the top. This happens whether I call the script "test.php" or "test.cgi". Appreciate any tips on how to get rid of it or why it's there. Thanks, SW On Saturday 16 November 2002 12:17 am, you wrote: > I'm not intending to run the script from the shell. What I am trying to do > is encrypt emails with Gnupg. The problem is Gnupg runs as my user name > and php runs as nobody. So I'm trying to run a php script as cgi to > deliver the data to Gnupg since a cgi script will run as my username. I am > using a perl script right now and it works, but the rest of the application > is in php, so its causing some me some design difficulties. > I'm going to try some the suggestions posted and see if I can get it > working. Thanks, > SW > > On Friday 15 November 2002 11:04 pm, you wrote: > > Joseph, I think he's trying to run the script from the shell--in which > > case it looks okay to me (besides perhaps a terminating semicolon on the > > last line) > > > > Marco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php IDE for linux
I have been using Zend Studio on Windows and they have a Linux client. You can get a demo key at www.zend.com. I am pretty sure that xemacs has a php mode as well. -Scott On Tue, 4 Jun 2002, Pedro Jorge Dias Cardoso wrote: > > please tell me a good PHP editor for linux, wich one you prefer. > or a package for PHP in Xemacs. > > i try the bluefish but i dont like it. > Thanks, > > > Pedro Cardoso > > > > -- [EMAIL PROTECTED] Now Playing: Moby - We Are All Made Of Stars generated by ProWeb 1.0 Beta Uptime 168 days c2002 Exton Communications -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Number formatting
Hi gang- I am trying to format a number coming from a csv file that I am importing then sending to a database. Being the wonderful program that Excel is there is a column that contains a number that only has a decmimal if there is a value. So 3.05% will display, 3% will display as 3. It is throwing my calculations off, I have tried using number format like this: $aprTemp = number_format($apr, 2); which in the case of 3.05 will return 305.00 and 300.00 for 3%. Anyone have a snippet to test and display properly so that 3% would be 3.00, etc. Thanks, -Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Number formatting
Shane- Thank you for the response. This works, I also changed the column type to numeric with a scale of 2 in SQL Server. Thank you again. -Scott On Thu, 6 Jun 2002, Shane Wright wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi > > > $aprTemp = number_format($apr, 2); which in the case of 3.05 will return > > 305.00 and 300.00 for 3%. Anyone have a snippet to test and display > > properly so that 3% would be 3.00, etc. > > you could try this... > > $val = sprintf("%0.02f", $val); > > Cheers > > - -- > Shane > www.shanewright.co.uk > Public key: http://www.shanewright.co.uk/files/public_key.asc > -BEGIN PGP SIGNATURE- > Version: GnuPG v1.0.6 (GNU/Linux) > Comment: For info see http://www.gnupg.org > > iD8DBQE8/58q5DXg6dCMBrQRApb0AJsFZ7WxZK5PRguKZqNbRndVUnkl/QCgpafj > VWVFBaJ9ysYxJqNP3Bxm2EI= > =zrZI > -END PGP SIGNATURE- > -- [EMAIL PROTECTED] Now Playing: Moby - We Are All Made Of Stars generated by ProWeb 1.0 Beta Uptime 168 days c2002 Exton Communications -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: sending 1000 emails to subscribed members via php?
Is your mail server timing out? Do you need to put a set_time_limit() at the top of your script? Another possibiity is to only send a few at a time, some ISP's do not permit more than a set amount of messages to leave per minute. On Wed, 12 Jun 2002, andy wrote: > additional comment: > > some did recieve the email, some did not. > does anybody know a good solution? > > andy > > > "Andy" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hi there, > > > > I am wondering whats wrong with my php script. I am trying to write a > > newsletter to 150 members. Therefore I did seperate the adresses with a , > > After about 1 minute php gave up telling me mail has failed. > > > > Is there a restriction on sening mail via mail(xx) via php? > > > > Anyway what do I do if I would have 1 members. This might take lots of > > cpu?! So I would like to keep it via my webinterface, but be able to email > > to all members. > > > > Thank you for your advice guys, > > > > Andy > > > > > > > > -- Scott Parks www.scottah.com [EMAIL PROTECTED] www.extoncommunications.com Now Playing: Madonna - Holiday Server Uptime: 183 days -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Email howTo ?
Point the php.ini to a smart host that will accept the connections. We do that on our Linux boxes at the office. All mail passes to a Notes server. On Wed, 12 Jun 2002, Septic Flesh wrote: > any way to send an email with php without using SENDMAIL ??? in a linux > (slack8) ? > > thanks in advance.. > > -- > > > Sapilas@/dev/pinkeye > > > > > > -- - Now Playing: Sugar Ray - Answer The Phone Server Uptime: 187 days www.scottah.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Editor
I have been using Home Site since it came out in the 90's. Currently Macromedia Home Site 5.0. It is my number one choice because I have to often switch between PHP and ASP at our show during our conversion over to LAMP. We bought Zend Studio and I have been using more at times, but miss all the snippets and custom buttons I have been building in Home Site for years. On the Linux side I would check out XEmacs with the PHP add on. I think it was nedit that also worked well for me. -Scott On Thu, 13 Jun 2002, Daniele Baroncelli wrote: > Hi guys, > > Although any editor should be fine when coding PHP, I find that the standard > Notepad it's a real pain in the ass. Especially when the script gives you an > error at line 222 ! Each time I have to scroll and count each single line! > > Can anyone suggest me a different editor ? > > > Cheers > > Daniele > > > > -- - Now Playing: Sugar Ray - Answer The Phone Server Uptime: 187 days www.scottah.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: phpmyadmin - moving data from one database to another
Can't he just dump the db to a file and then load it on the new server? I do that all of the time between my laptop and work. Dump the db into a sql file (choosing data and structure for the dump) Create a new db on the server then run: mysql -u xxx -p xxx -D (database name) < name_of_dump_file On Tue, 18 Jun 2002, BB wrote: > dump all the data to csv and read it in the other end! > > "Phil Schwarzmann" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > The lazy and worthless a-holes at www.infinitehost.com (my host server) > > are forcing me to move all my MySQL data from one server to another > > because they are too dumb to fix it. > > > > I need to use phpmyadmin to move the data but i'm not %100 sure how to > > do it. There are some "view dump" commands. It looks like I can > > somehow download all the data and structure to my local computer, then > > upload it to the new server. > > > > Anyone have any info on this? > > > > THanks! > > > > > > -- - Now Playing: Simple Minds - All The Things She Said Server Uptime: 189 days www.scottah.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] linux: how can I check if php/mysql is working properly?
If you told RH to install PHP/MySQL/Apache then everything should be ok. I forget the default document root, but what happens if you put a test.php with this in it: Other than that it should work out of the box, just make sure you get the patches. On Tue, 18 Jun 2002, Phil Schwarzmann wrote: > i have some php files in /var/www/html/ and none of the php is working > properly. > > all i've done so far is installed Linux Red Hat 7.2 and > php/mysql/apache is supposedly already installed with Redhat. How do I > get this stuff configured? Anyone have a nice link? > > > -- - Now Playing: Simple Minds - All The Things She Said Server Uptime: 189 days www.scottah.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to read the Exchange databases?
I think there is a way to export the user list in the Exchange Server Manager into a csv file. It would not be real time, but would get you the list. On Thu, 20 Jun 2002, Barajas, Arturo wrote: > Hi, list. > > I'm starting an application, running Apache + PHP + MySQL under WinNT. > > I need a user database, and all the users are on the Exchange > Server database. Does anyone know how can I read that > database or connect to it? > > I'm already running the NTLM module, so I can validate my > users under an NT domain, and I just don't want to transfer > that Exchange database (unless there's no other way). > > TIA, any help will be greatly appreciated. > -- > Un gran saludo/Big regards... >Arturo Barajas >Sistemas PPG SJR >+52 (427) 271-9100, ext. 448 > > -- - Now Playing: Simple Minds - All The Things She Said Server Uptime: 189 days www.scottah.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] using PHP curl and a client cert
Hello, I am trying to post to a ste that requires me to use a client cert. I can get it to work for both windows and unix, but only on the command line. I have tried without success to use the PHP built-in methods for doing this. Here is the command line that works: curl -d " <_RESIDENCE _City='PRESCOTT' _State='AZ' _PostalCode='86305' BorrowerResidencyType='Current'> " -k -E myCert.pem:myPassword https://www.mysite.com/Listener.exe Any ideas of how to make this work with the curl_setopt methods? I tried variations of this: $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 2); curl_setopt ($ch, CURLOPT_SSLKEY, 'myCert.pem'); curl_setopt ($ch, CURLOPT_SSLKEYPASSWD, 'myPassword'); $result = curl_exec ($ch); Thanks, Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] client certs (how to)
Hello, I am trying to post to a site that requires me to use a client cert. I can get it to work for both windows and unix, but only on the command line. I have tried without success to use the PHP built-in methods for doing this. Here is the command line that works: curl -d "" -k -E myCert.pem:myPassword https://www.mysite.com/Listener.exe Any ideas of how to make this work with the curl_setopt methods? I tried variations of this: $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 2); curl_setopt ($ch, CURLOPT_SSLKEY, 'myCert.pem'); curl_setopt ($ch, CURLOPT_SSLKEYPASSWD, 'myPassword'); $result = curl_exec ($ch); Plus where does the data go? I know there is the POST_FIELDS option but I have XML. Any thoughts? Thanks, Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Want to change shell to bash for only one file
I am trying to temporarily change from tcsh to bash. I need to use bash for a particular command that I am doing a shell_exec on. Currently: _SERVER["SHELL"] = tcsh How do I execute my call using bash instead? Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Extracting random rows
Hello, Below is a boiled-down example of the problem I'm having. I'm trying to extract rows randomly from MySql, but I keep getting the same one. It works if I query MySql directly from the command line, so it seems like a php problem. Thanks, Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] processing arrays from forms
Hello, In page_1.php I have this form: "; } ?> On page_2.php I have this: $m"; } ?> Which gives me a list of values from each box that was checked -- but I haven't been able to figure out how to process it so that each iteration of the form on page_1.php prints in a new table row on page_2.php. Any help appreciated. Thanks, SW -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's wrong with this link?
Mike, Looks like your slashes are backwards use "\" instead of "/" to escape characters. You will notice that "/" is used in UNIX directories and HTML tags. Here is the corrected code: print "\">Click Here"; I assume "PID" is a variable. If so, it should be noted as "$PID". A really good book for learning PHP is "Beginning PHP4" by Wrox ISBN# 1-861003-73-0 - Scott > I realize my slashes are most likely in the wrong spot and i'm new to this > PHP stuff so a little help would be appreciated. I get a parse error > > print "/">Click Here"; > > Thanks, > Mike > > > > -- > 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] > > -- -- Scott A. Gerhardt P.Geo. Gerhardt Information Technologies [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] Profanity Filter
Just go to one of those raunchy porn sites and pull the words out of thier meta tags or "hidden" word list (i.e. white text on white background) buried in the HTML. ;-) > hey, > > does anyone have a big compiled list? like a profanity library? > > maybe even a multi-lingual one! > > hey, it would be fun to make :) > > _alex > > > -- > Alex Black, Head Monkey > [EMAIL PROTECTED] > > The Turing Studio, Inc. > http://www.turingstudio.com > > vox+510.666.0074 > fax+510.666.0093 > > Saul Zaentz Film Center > 2600 Tenth St Suite 433 > Berkeley, CA 94710-2522 > > > > > > From: [EMAIL PROTECTED] ("Sterling Hughes") > > Organization: Pentap Technologies > > Newsgroups: php.general > > Date: 19 Jan 2001 12:09:56 -0800 > > Subject: Re: [PHP] Profanity Filter > > > > > > > >> On Fri, 19 Jan 2001, Ignacio Vazquez-Abrams wrote: > >> > >>> On Fri, 19 Jan 2001, Sterling Hughes wrote: > >>> > >>>> I'm saying use the same method, but use an array and avoid the > > strpos() > >>>> function: > >>>> > >>>> $words = preg_split("//", $data); > >>>> foreach ($words as $word) { > >>>> if (in_array($prof, $words)) { > >>>> echo "BAD WORD"; > >>>> echo "BAD WORD"; > >>>> echo "I'M TELLING"; > >>>> } > >>>> } > >>>> > >>>> -Sterling > >>>> > >>> > >>> That method suffers from the dictionary problem that Egan brought up. > >>> > >> > >> Hey, wait a second... > >> > >> Does that code even make sense? I must be missing something... > >> > >> -- > > > > well if you have a concussion... :) > > > > Its a whip up of what I was talking about, I didn't mean it as real code > > :)... Switch $words to $word and then swith the argument order to in_array > > and yes, it makes sense... > > > > > $profanities = array("fuck", "shit"); > > > > $words = preg_split("/\s+/", $data); > > foreach ($words as $word) { > > if (in_array($word, $profanities)) { > > echo "you did a naughty thing"; > > break; > > } > > } > > ?> > > > > > > Would be the somewhat sane version... > > > > _Sterling > > > > > > -- > > 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] > > -- -- Scott A. Gerhardt P.Geo. Gerhardt Information Technologies [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] PHP Sessions Problem
I posted about this same problem over a year ago. I finally gave up and reverted back to PHP 3 techniques of 1)generating a sessid, 2)registering the session by storing the sessid and the variables in a mysql database and 3)passing the sessid in the url. This works like a charm. I'd be curious if anyone has any comments on this. JS PLauche in article [EMAIL PROTECTED], "Luke Muszkiewicz" at [EMAIL PROTECTED] wrote on 4/19/01 11:34 AM: > Hey Folks: > > I am using PHP sessions in IE 5.5 and NN 6 successfully, but I am not able > to retrieve the data from my registered variables in Communicator 4.7. I am > passing the session ID via SID and have turned off cookies in each browser > to simplify testing, although Communicator 4.7 doesn't work with cookies > enabled either. > > Research shows that with Communicator 4.7 the session ID is being carried > from one page to the next successfully; however, the registered variables > are not. Outside of the page where they are set and registered, they are > not registered nor set even though the session ID is carried successfully. > > session.save_path is set to /tmp. When I start a session in Communicator > 4.7, the session file is created in /tmp but it contains no data. When > using IE 5.5 or NN 6, the session file does contain the serialized data for > the registered variables, and everything works as it should. > > So, it looks like the problem is that in Communicator 4.7, the serialized > data is not being successfully written to the session file in /tmp. Has > anyone dealt with this problem? > > If you're still with me, THANK YOU! I created a simplified test app at the > following URL: > > http://puredev.com/session/test1.php > > If you would be so kind, open this URL and click on the test2.php link and > you should see the following if the data was retrieved: > > Test Results: The session data was transferred. > > The code for these two test pages is as follows: > > TEST1.PHP > > > session_start(); > session_register("test"); > $test = "The session data was transferred."; > echo "Click this link: test2.php"; > > ?> > > TEST2.PHP > > > session_start(); > echo "Test Results: ".$test; > > ?> > > You can also view the results of phpinfo() for me server at > http://puredev.com/session/phpinfo.php. > > Thank you in advance! > > -luke > > Luke Muszkiewicz > Pure Development, LLC > http://puredev.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] Sessions and header-redirect
Does anyone know of a way to use sessions and still be able to redirect with the header function. In the code below I test for the existence of the PHPSESSID and send the user to register if it doesn't exist. If it does exist I start a session to retrieve the session variables then call a class that tests for other conditions. If the test is successful then I try to redirect which fails because (as I understand it) session_start has already sent headers. I really don't like putting links on pages that say "Click here to continue" so I'm looking for a solution. Any ideas? http://www.blah.com/register.php"); } session_start(); if ($action == "update"){ include("../includes/update_class.php"); $my=new update_listing(); header("Location:http://www.blah.com mem_welcome.php?sid=$PHPSESSID"); } ?> JS Plauche -- 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] Secure authentication-Is this good?
Can anyone tell me if this example would be considered a secure method for authentication using sessions. The login page is a form to validate the user and begin the session. The second bit of code is at the top of every page to authenticate the user. I can't figure out if this is the best way. Thanks login page: --- if($action=="validate"){ // Form submitted so check userid and password against database $query="SELECT memberid,name,lastname from members WHERE userid = '$userid' and password = '$password'"; $result=mysql($database,$query); $rows=mysql_num_rows($result); if ($rows == 0){ $err_no=100; // bad userid or password header("Location:login.php?err_no=$err_no"); exit(); }else{ // Input validated issue session id $rs=mysql_fetch_array($result); $name=$rs["name"]; $lastnamename=$rs["lastname"]; $memberid=$rs["memberid"]; session_register("name"); session_register("lastname"); session_register("memberid"); header("Location:mem_welcome.php"); exit(); } } if ($err_no==100){ $login_header="User ID or Password do not match"; }else if ($err_no==200){ $login_header="Please Log In Again"; }else { $login_header="Please Log In"; } Print out the login form here 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] Real Simple, but i'm new!!
well, if your URL is index.php?links if (!empty($links)) is similar to what you'd want to use. > -Original Message- > From: Brian Clark [mailto:[EMAIL PROTECTED]] > Sent: Saturday, December 29, 2001 9:44 PM > To: PHP is not a drug. > Subject: Re: [PHP] Real Simple, but i'm new!! > > > * FiShcAkE ([EMAIL PROTECTED]) [Dec 29. 2001 13:07]: > > > Hey, > > Howdydo > > > I've just started learning php and I need to know this... What are the > > commands I use to get i.e. index.php?links and index.php?newsto > > work? > > You can use QUERY_STRING, but you could also use action=news, > action=links, action=asdfg and use a switch($action) > > I guess you're trying to make the URL as pretty as possible, right? > > -- > Brian Clark | Avoiding the general public since 1805! > Fingerprint: 07CE FA37 8DF6 A109 8119 076B B5A2 E5FB E4D0 C7C8 > A library is an arsenal of liberty. > > > -- > 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] index.php
well... a good first step is to think about what has changed with your configuration. did you turn on any output handlers/buffering? Compile a new version? Modify apache in any way? > -Original Message- > From: Caleb Carvalho [mailto:[EMAIL PROTECTED]] > Sent: Sunday, December 30, 2001 4:40 AM > To: [EMAIL PROTECTED] > Subject: [PHP] index.php > > > Hi all, > > all the sudden my apache 1.3.22 is not showing my index.php page > php-4.0.6, i have added the addtype .php inside httpd.conf > > not only that, i have also noticed that the is not > working also, this is not displaying the test page, > > I am using netscape as a browser, do you guys know about any issue related > to this? > > many thanks and happy x-mas/happy new year > > > > _ > Join the worlds largest e-mail service with MSN Hotmail. > http://www.hotmail.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] Holy Moly...
... and dont forget, download some free PHP scripts and dissect them. my method for learning a new language is just to throw myself head-first into it, and start writing something in that language, using online manuals and printed works to fill in the gaps along the way. > On Wed, 2 Jan 2002, Julie Hull wrote: > > > Could someone please direct a total novice to the best PHP beginner news > > group. Just to many to choose from ~:) > > > > Thank You, > > Julie ~:) -- 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] jukebox
Has anyone experimented with controlling an mp3 player like mpg123 from php? I want to build a radio automation system using a web interface, but not sure how I want to handle the actual playing of music. Basically I would have a mysql database that rotates the music based on categories and it would move down the list resetting every hour. If you have done an exec to mpg123 before, how did you control the output? I want the output to be on the local machine and not streamed across a network. Thanks in advance. -Scott -- 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] jukebox
On Sun, 6 Jan 2002, Meir Kriheli wrote: > A quick search at freshmeat shows several projects doing the same thing > already, you might want to check them out for reference: > > http://freshmeat.net/search/?q=jukebox%20php Thank you for the tip! I actually started working on the project last night (and gave up sleep because I was too excited to get it working). I guess the main difference between what I see out there and what I want to do is: most of the jukeboxes out there are using some sort of random play. I want mine to be more structured. I am in radio in the states and am used to listening to music that way. I am setting up categories, music rotations, etc. Thanks again! -Scott -- 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] Variables Limit
Check out arrays... especially if you're going to be dealing with 304 individual variables. your code will be MUCH happier :) > -Original Message- > From: Philip J. Newman [mailto:[EMAIL PROTECTED]] > Subject: Re: [PHP] Variables Limit > > I have to exchage over 304 different names, codes, and dates ... > > - Original Message - > From: "Nick Wilson" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Sunday, January 27, 2002 7:35 AM > Subject: Re: [PHP] Variables Limit > > > > -BEGIN PGP SIGNED MESSAGE- > > Hash: SHA1 > > > > > > * and then Philip J. Newman blurted > > > Is there any limit on the amount of variables that you can use? > > > > Well I certainly agree with Craig, but I'm interested to know why you > > ask? Is it just idle curiosity or some interesting project you're > > involved in? > > - -- > > > > Nick Wilson > > > > Tel: +45 3325 0688 > > Fax: +45 3325 0677 > > Web: www.explodingnet.com > > > > > > > > -BEGIN PGP SIGNATURE- > > Version: GnuPG v1.0.6 (GNU/Linux) > > > > iD8DBQE8UvbrHpvrrTa6L5oRAtrWAJwLocc8/xRHK5kTN2S1HY3BXmQ2NQCdELrK > > FfZO6YoOZUEXonb6fNz3Z10= > > =wuoa > > -END PGP SIGNATURE- > > > > -- > > 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] Re: Swapping for \n... ?
That regex is equivilent to: "/(\r\n)|(\r)|(\n)/", you don't need to use the numeric values. > -Original Message- > From: Jon [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 29, 2002 11:22 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Re: Swapping for \n... ? > > > Nevermind, I found some code at last which actually works : > > $txt = preg_replace("/(\015\012)|(\015)|(\012)/","",$txt); > > "Jon" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I'm processing a form but all the functions I've found on the web only > seem > > to add the after the \n. I need to remove the \n altogether - anyone > > know how I can kill the \n and put a in it's place? > > > > Cheers, > > Jon > > > > > > > > -- > 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] Need Urgent Help!!
All, I have just found out that the VB script that I have used to send email from my web site is null and void, apparently the server does not do VB or something along those lines (security) but that's not the issue. I have contacted my teh people who host my site and they told me I have to use PHP script. My website (Flash) needs to be able to send emails and membership applications from form I have already created, does anyone have any scripts and directions that some with absolutely no code writing skills can use. Your help is greatly appreciated!! Billy -- 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] What can I ask here?
Just want to make sure I am in the right forum... I am new to PHP and will be doing alot of coding with it in the near future. So I will be asking alot of newb questions... Thanks, Batch -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Stripping the first line of a file
Hi, I want to be able to open a file and then strip the first line of it off. Example, the first line contains the names for tables in a database and all I need is from the second line on. if I fopen a file can I strip the line or should I process it and then drop the data from the first row? Thanks, -Scott -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Stripping the first line of a file
Thank you! Works. I have a few more questions! I am working on converting a program from perl to PHP as it is the new language of choice at our office. I have been using printf statements in perl to format data. Is there a similar funtion in php? Here is an example from the perl program: printf NEW ("%-5.5s",$fields[14]); This will print exactly 5 characters, I also use this format to make sure the lines are exactly 255 characters long: printf NEW ("%-193.193s"); Is there something similar in php. Thanks for everyone's help and patience. -Scott On Fri, 8 Feb 2002, Jerry Verhoef (UGBI) wrote: > $aFile=file(); > > //$aFile[0] contains the unwanted line > echo $aFile[1]; // displays line 2 > echo $aFile[n]; // displays line n where n is an positieve interger and not > greater then the number of lines in the file -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Stripping the first line of a file
Thanks Jerry! In perl I was doing this: printf NEW ("%-193.193s"); Which I just read the manual and discovered it works in PHP as well. Basically prints 193 spaces to make sure the line is 255 after I filled the line with other characters. On Fri, 8 Feb 2002, Jerry Verhoef (UGBI) wrote: > Yes there is! > Try reading the manual? > http://www.php.net/printf > printf ("%-5.5s",$fields[14]); > for the other function to make a line exactly 255 char long? Do you have the > perl Example? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Creating an array with a file
Hi All, I am trying to create an array from a text file that I will process and rewrite in a new format. My question is, is it possible to read the file in one line at a time and then separate the tab-delimited fields and finally rewrite the new file? The fields are tab delimited and here is what I have attempted in code: $lines = fopen("oldfile.txt", "r"); $newfields = explode("\t", $lines); echo $newquotes[0]; I get a Resource ID #1 when I echo the line. Thanks, -Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Creating an array with a file--Fixed
Nevermind, I was able to figure it out using: $myfile = file("oldfile.txt"); for ($s=0; $s<=count($myfile)-1; $s++) { $fields = split("\t",$myfile[$s]); print("$fields[1]\n"); } -Original Message- From: Scott [mailto:[EMAIL PROTECTED]] Sent: Monday, February 11, 2002 12:33 PM To: [EMAIL PROTECTED] Subject: [PHP] Creating an array with a file Hi All, I am trying to create an array from a text file that I will process and rewrite in a new format. My question is, is it possible to read the file in one line at a time and then separate the tab-delimited fields and finally rewrite the new file? The fields are tab delimited and here is what I have attempted in code: $lines = fopen("oldfile.txt", "r"); $newfields = explode("\t", $lines); echo $newquotes[0]; I get a Resource ID #1 when I echo the line. Thanks, -Scott -- 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] Creating an array with a file
I am seeking some thoughts on if this is the way I should tackle this problem. I have two files, both of them tab delimited text files that I need to combine and then output a new file. My idea was to put both files in an array, calling the fields I need, i.e. $field[0], $field[1] and so on. I need to loop through the entire file and output on each loop. My concern is the overhead by creating the array's. Any thoughts. Thanks, -Scott -Original Message- From: Paul Roberts [mailto:[EMAIL PROTECTED]] Sent: Sunday, February 10, 2002 2:35 PM To: Scott Subject: Re: [PHP] Creating an array with a file try this, you need to get the line then explode that, fopen just returns a file handle. $file = fopen("oldfile.txt", "r"); while (!feof ($fd)) { $lines = fgets($file, 4096) $newfields = explode("\t", $lines); echo $newfields[0].""; } Paul Roberts [EMAIL PROTECTED] ++++ - Original Message - From: "Scott" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, February 11, 2002 5:32 PM Subject: [PHP] Creating an array with a file > Hi All, > > I am trying to create an array from a text file that I will process and > rewrite in a new format. My question is, is it possible to read the > file > in one line at a time and then separate the tab-delimited fields and > finally rewrite the new file? > > The fields are tab delimited and here is what I have attempted in code: > > $lines = fopen("oldfile.txt", "r"); > $newfields = explode("\t", $lines); > echo $newquotes[0]; > > I get a Resource ID #1 when I echo the line. > > Thanks, > > -Scott > > > -- > 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] file reading and array's
Hi gang: In my constant effort to improve my perl conversion project, I have a question regarding file reading. I am taking two files and combining them in an array and then writing out a new file. Is there a way to: a)strip out the first line of the second file b)test for conditions based on what is on the next line on the file An example, I start the array on file one, then mid-way I start another array on the second file (this array within in the first). I need to check the next line in the file for a condition to exist. I have tried this, but run into the pointer resetting on each pass. Any thoughts would be appreciated. Thanks in advance. -Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] exec on Windows
I am trying to develop a music scheduling system on Windows using the command line to fire off WinAMP. The first exec works fine, then it stops and says that program execution time has been exceeded. An example would be: exec ("winamp.exe M01.mp3"); a while loop kicks off the second. I tried to send the output to null winamp.exe >null or nul and no luck. Anyone else try this on Windows? Thanks, -Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Text editor for linux
Nedit, Bluefish are also good under X -Original Message- From: Greg Donald [mailto:[EMAIL PROTECTED]] Sent: Saturday, February 16, 2002 7:22 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Text editor for linux > Anyone know of a good text editor for linux, WITH syntax highlighting for > php/html + other languages? Vim - http://www.vim.org/ If you use X, then use gvim. Greg Donald - http://destiney.com/ http://phprated.com/ | http://phplinks.org/ | http://phptopsites.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] file reading and array's
Perfect! Thank you, my mind was out in left field somewhere. On Tue, 12 Feb 2002, DL Neil wrote: > Hi Scott, > > > In my constant effort to improve my perl conversion project, I have a > > question regarding file reading. I am taking two files and combining > > them in an array and then writing out a new file. Is there a way to: > > a)strip out the first line of the second file > > b)test for conditions based on what is on the next line on the file > > > > An example, I start the array on file one, then mid-way I start another > > array on the second file (this array within in the first). I need to > > check the next line in the file for a condition to exist. > > > > I have tried this, but run into the pointer resetting on each pass. > > > > Any thoughts would be appreciated. Thanks in advance. > > > Use explicitly array pointers instead of the 'built-in' ones, then: > > your need to look-ahead becomes array[$ptr + 1] > avoiding the first record becomes for ( $i=1; $i<$last; $i ++ ) //instead of $i=0 > > Does that cover things? > =dn > > -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] exec on Windows
Thanks guys, this works, but found the problem to be the fact that Winamp does not shut down, therefore the script sits and waits. If I close Winamp the script will fire off the next event. I might try mpg123 for Win. -Scott -Original Message- From: Stephano Mariani [mailto:[EMAIL PROTECTED]] Sent: Sunday, February 17, 2002 10:49 AM To: 'DL Neil'; 'Scott'; [EMAIL PROTECTED] Subject: RE: [PHP] exec on Windows Importance: High Try exec "cmd /c start winamp.exe M01.mp3" to avoid blocking... Stephano Mariani > -Original Message- > From: DL Neil [mailto:[EMAIL PROTECTED]] > Sent: Sunday, 17 February 2002 2 3 > To: Scott; [EMAIL PROTECTED] > Subject: Re: [PHP] exec on Windows > > Scott, > > > I am trying to develop a music scheduling system on Windows using the > > command line to fire off WinAMP. The first exec works fine, then it > > stops > > and says that program execution time has been exceeded. > > > > An example would be: > > > > exec ("winamp.exe M01.mp3"); > > > > a while loop kicks off the second. I tried to send the output to null > > winamp.exe >null or nul and no luck. Anyone else try this on Windows? > > > Sounds interesting. > I take it that it is the PHP script that stops (not the winamp player)!? Looks like you are running > into > problems with the script execution time limit. Herewith a couple of theories: > > 1 what happens if you specify that the winamp is to run in its own cmd shell - will control return > to PHP > 'immediately'? > 2 if the problem is time-out, and you can only play one .mp3 at a time, so looping to 'the next' > must be > dependent upon the preceding track finishing first, what happens if you adjust the set_time_limit > to 0/no limit? > (RTFM: http://www.php.net/manual/en/function.set-time-limit.php) > > Regards, > =dn > > > > -- > 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] zend studio 2.0
FYI- My two cents. I have been running the demo version since a day or two after it was released. On Windows 2000 it has been solid as a rock. I have not tried it on my XP laptop yet, but will soon. Zend Studio is really helping to make PHP 'legitimate' in the corporate world since it now has a great tool! Home Site is ok, but not PHP specific, only color codes. Matter of fact my boss was so impressed he is ordering 4 copies for our staff! Nice job guys! -Scott On Mon, 18 Feb 2002, Zeev Suraski wrote: > At 19:53 18/02/2002, DL Neil wrote: > >Zeev, > > > >Didn't experience any stability problems with the beta per-se, but using a > >Windows box was an exercise in > >Unix-ification. Has the released version for Win32 seen significant > >alterations to the GUI? > > I'm not sure which beta you've seen, but the GUI is very Windowish (I use > Windows as my desktop OS). > > Zeev > > > -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Logging Users In - What is the Best Way
A way i've done things like this is to setup sessions, and when a user logs in correctly, issue a randomly generated value "id" and set that as a cookie. in the database, there's a row "id" (same as the cookie) that holds the user name and any other data that i might want to store. Since none of the user's information is being saved as cookies, and the "id" number is mostly random, it seems to be a pretty secure way of knowing who is valid. > -Original Message- > From: Phillip S. Baker [mailto:[EMAIL PROTECTED]] > Sent: Monday, February 18, 2002 9:18 PM > To: PHP Email List > Subject: [PHP] Logging Users In - What is the Best Way > > > Okay Gents and Ladies, > > I am looking for more information on how best to do this. > > I have a MyQSL back end. > It houses a users user_name and password. > > I have a secure area of the site that I only want members to view. > > The way I have it now is that the user logs in. > If user_name and password match cookies are set. > > Each page in the secure are checks for a variable in the cookie. If set the > user can view the page, if not set the page redirects back to the login page. > > Now first question is - how secure is this? > > Second question - what is a better more secure way to handle this. Then > most importantly where do I get information on how to go about doing that? > I know nothing about sessions and would need some good links for that arena. > > Also I do not know much of anything about Object Oriented Programming. > > Thanks for the feedback. > > Phillip > > > -- > 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] Retaining data across multiple sites
They can... i've used the same code and the same database server for two domains with no prob's. The problem is cookies (as was mentioned previously) If domainx.com writes a cookie, then no other domain can (theoretically) access it. > -Original Message- > From: Chris Boget [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 20, 2002 11:43 AM > To: Ben Sinclair; [EMAIL PROTECTED] > Subject: Re: [PHP] Retaining data across multiple sites > > > > I could do that, but how would I keep track of the users? I don't think IP > > addresses are reliable. I would also prefer to limit my database access. > > Are you using sessions? If so, you can keep track of users that way. > I believe this would be the only solution available to you. I am not sure > that multiple domains can access server side variable space. > > Chris > > > -- > 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: preg_replace("/^\//".. doesnt work?
Also note: "^" matches the beginning of the string, so "^\/" will only match a "/" at the beginning of the string (not the first occurence of "/") > -Original Message- > From: Philip Hallstrom [mailto:[EMAIL PROTECTED]] > Subject: [PHP] Re: preg_replace("/^\//".. doesnt work? > >$a = "/test/"; >$a = preg_replace("/^\//", "", $a); >echo $a; > > On Wed, 20 Feb 2002, John Ericson wrote: > > > > I want preg_replace to replace the first '/' in $a with '' so that the > > echo function echoes "test/", but instead it echoes "/test/" as if > > preg_replace didnt worked? What am I doing wrong? > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: preg_replace("/^\//".. doesnt work?
that's probably what he meant... but what he asked for was how to "replace the first '/' in $a" if you have $a="abc/def", the regex "^/" will not replace the first "/" in your string, which was my point :-) > -Original Message- > From: James Taylor [mailto:[EMAIL PROTECTED]] > Subject: Re: [PHP] Re: preg_replace("/^\//".. doesnt work? > > Err, that's what he wanted > > On Wednesday 20 February 2002 12:13 pm, you wrote: > > Also note: > > > > "^" matches the beginning of the string, so "^\/" > > will only match a "/" at the beginning of the > > string (not the first occurence of "/") > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parsing file's
I have a csv file that I am parsing, formatting and then writting to a new file. I am currently using an array, but I have some lines that might contain more data than others. I know for sure that columns 0-33 will always be there, but the customer has the option to add another set of columns to the row if needed. I do know that the addition's will always be 18 columns and I do know that they can add up to 15 set's of 18. So, the row length could be 0-33 or 0-51 if they add one additional set or 303 columns if they go up to 15. The tricky part is I have to format each column for the new file that is created, I do this using sprintf. I have so far tried to use array_slice for the first 18 columns, then I do another array_slice starting at 18 and using the column count to get the last column in the row. Here is the code: array_slice($fields, 18,$lineCount); foreach ($fields as $key => $value){ print "$key|$value\r\n"; } The format of the new file will be this: 01-Customer information 02-Other information 03a Required Info (that can repeat up to 15 times per line) 03b "" 04b "" 04-Close Customer Record Repeat cycle for each row. The inner loop happens between the 02 and 04 records. Remember, I need to format each individual column, they are different format options. If you have some thoughts, I would be all ears as I have been starring at this too long and too hard. Thanks, -Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Parsing file's
That's what I mean by starring at this too much :) I tried writting to a seperate file, but is there a way to take an array and split it every so many records within another loop? Let's say the first row contains the first 18 columns which I already parsed, I then want to grab the next 5 15 columns, but need to seperate them in groups of 15. I tried this: foreach ($output as $key => $value){ $policyWriter = "$quoteKey|$key|$value"; fwrite ($policyFile,"$policyWriter\r\n"); } Which will take and print the rest of the row, but I needo split the columns into groups of 15. -Scott On Fri, 31 May 2002, Michael Davey wrote: > You should normalise your data - have a field in the second csv that links > to the first csv and then you can have as many rows as you want associated > with the record in the first file. > > Mikey > > "Scott" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I have a csv file that I am parsing, formatting and then writting to a new > > file. I am currently using an array, but I have some lines that might > > contain more data than others. I know for sure that columns 0-33 will > > always be there, but the customer has the option to add another set of > > columns to the row if needed. I do know that the addition's will always > > be 18 columns and I do know that they can add up to 15 set's of 18. So, > > the row length could be 0-33 or 0-51 if they add one additional set or 303 > > columns if they go up to 15. > > > > The tricky part is I have to format each column for the new file that is > > created, I do this using sprintf. I have so far tried to use array_slice > > for the first 18 columns, then I do another array_slice starting at 18 > > and using the column count to get the last column in the row. Here is the > > code: > > > > array_slice($fields, 18,$lineCount); > > foreach ($fields as $key => $value){ > > print "$key|$value\r\n"; > > } > > > > The format of the new file will be this: > > 01-Customer information > > 02-Other information > > 03a Required Info (that can repeat up to 15 times per line) > > 03b "" > > 04b "" > > 04-Close Customer Record > > > > Repeat cycle for each row. The inner loop happens between the 02 and 04 > > records. Remember, I need to format each individual column, they are > > different format options. > > > > If you have some thoughts, I would be all ears as I have been starring at > > this too long and too hard. > > > > Thanks, > > > > -Scott > > > > > > > > -- [EMAIL PROTECTED] Now Playing: Moby - We Are All Made Of Stars generated by ProWeb 1.0 Beta Uptime 168 days c2002 Exton Communications -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Parsing file's
Mark- Trying it now, I think I understand what you doing with the code below. I'll let you know. Thank you! -Scott -Original Message- From: Mark Heintz PHP Mailing Lists [mailto:[EMAIL PROTECTED]] Sent: Friday, May 31, 2002 4:43 PM To: Scott Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Re: Parsing file's You may have been heading in the right direction originally with array_slice... This is off the top of my head, I don't guaruntee it will work... $start = 34; $interval = 15; $max = 303; // hop across orig. array 15 columns at a time for($offset = $start; $offset < $max && isset($array[$offset]); $offset += $interval){ // slice off $interval many columns starting at $offset $sub_array = array_slice($array, $i, $interval); // handle your $interval many key-value pairs foreach ($sub_array as $key => $value){ $policyWriter = "$quoteKey|$key|$value"; // ... } } mh. On Fri, 31 May 2002, Scott wrote: > That's what I mean by starring at this too much :) I tried writting to a > seperate file, but is there a way to take an array and split it every so > many records within another loop? > > Let's say the first row contains the first 18 columns which I already > parsed, I then want to grab the next 5 15 columns, but need to seperate > them in groups of 15. I tried this: > > foreach ($output as $key => $value){ > $policyWriter = "$quoteKey|$key|$value"; > fwrite ($policyFile,"$policyWriter\r\n"); > } > > Which will take and print the rest of the row, but I needo split the > columns into groups of 15. > > -Scott > > > > > > On Fri, 31 May 2002, Michael Davey wrote: > > > You should normalise your data - have a field in the second csv that links > > to the first csv and then you can have as many rows as you want associated > > with the record in the first file. > > > > Mikey > > > > "Scott" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > I have a csv file that I am parsing, formatting and then writting to a new > > > file. I am currently using an array, but I have some lines that might > > > contain more data than others. I know for sure that columns 0-33 will > > > always be there, but the customer has the option to add another set of > > > columns to the row if needed. I do know that the addition's will always > > > be 18 columns and I do know that they can add up to 15 set's of 18. So, > > > the row length could be 0-33 or 0-51 if they add one additional set or 303 > > > columns if they go up to 15. > > > > > > The tricky part is I have to format each column for the new file that is > > > created, I do this using sprintf. I have so far tried to use array_slice > > > for the first 18 columns, then I do another array_slice starting at 18 > > > and using the column count to get the last column in the row. Here is the > > > code: > > > > > > array_slice($fields, 18,$lineCount); > > > foreach ($fields as $key => $value){ > > > print "$key|$value\r\n"; > > > } > > > > > > The format of the new file will be this: > > > 01-Customer information > > > 02-Other information > > > 03a Required Info (that can repeat up to 15 times per line) > > > 03b "" > > > 04b "" > > > 04-Close Customer Record > > > > > > Repeat cycle for each row. The inner loop happens between the 02 and 04 > > > records. Remember, I need to format each individual column, they are > > > different format options. > > > > > > If you have some thoughts, I would be all ears as I have been starring at > > > this too long and too hard. > > > > > > Thanks, > > > > > > -Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Parsing file's
Ok, this did not work, but I have a new idea. From the top 1)Read in the csv file, take the first 18 records and insert them into a temp db.Ie: $output = array_slice ($fields, 0, 17); 2)Then do a count on the line to see how many records are after 17 and somehow loop through them 34 at a time. It is easy if there is only one set, but I am not sure how to take the remaining elements in the array and break them out 34 at a time until I reach the end of the line. Help, my head hurts and I have a habit of over thinking :) -Scott -Original Message- From: Mark Heintz PHP Mailing Lists [mailto:[EMAIL PROTECTED]] Sent: Friday, May 31, 2002 4:43 PM To: Scott Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Re: Parsing file's You may have been heading in the right direction originally with array_slice... This is off the top of my head, I don't guaruntee it will work... $start = 34; $interval = 15; $max = 303; // hop across orig. array 15 columns at a time for($offset = $start; $offset < $max && isset($array[$offset]); $offset += $interval){ // slice off $interval many columns starting at $offset $sub_array = array_slice($array, $i, $interval); // handle your $interval many key-value pairs foreach ($sub_array as $key => $value){ $policyWriter = "$quoteKey|$key|$value"; // ... } } mh. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Parsing file's (SOLVED)
The next time I stare at something so long I can't think straight remind me to take a walk and pull out Rasmus' book! Page 121 array_chunk is my friend! Code is ugly, but I am smiling now! Thank you everyone! $policy = array_slice ($fields, 18, $lineCount); // I am taking the array from position 18 to the end $chunks = array_chunk ($policy, 34); // Using array_chunk I break the array into pieces of 34 foreach ($chunks as $key => $value){ print_r($chunks); sleep(5); } // The sleep is for me to watch it fly by the screen :) Thanks again everyone. -Scott -Original Message- From: Scott [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 02, 2002 4:57 PM To: 'Mark Heintz PHP Mailing Lists' Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Re: Parsing file's Ok, this did not work, but I have a new idea. From the top 1)Read in the csv file, take the first 18 records and insert them into a temp db.Ie: $output = array_slice ($fields, 0, 17); 2)Then do a count on the line to see how many records are after 17 and somehow loop through them 34 at a time. It is easy if there is only one set, but I am not sure how to take the remaining elements in the array and break them out 34 at a time until I reach the end of the line. Help, my head hurts and I have a habit of over thinking :) -Scott -Original Message- From: Mark Heintz PHP Mailing Lists [mailto:[EMAIL PROTECTED]] Sent: Friday, May 31, 2002 4:43 PM To: Scott Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Re: Parsing file's You may have been heading in the right direction originally with array_slice... This is off the top of my head, I don't guaruntee it will work... $start = 34; $interval = 15; $max = 303; // hop across orig. array 15 columns at a time for($offset = $start; $offset < $max && isset($array[$offset]); $offset += $interval){ // slice off $interval many columns starting at $offset $sub_array = array_slice($array, $i, $interval); // handle your $interval many key-value pairs foreach ($sub_array as $key => $value){ $policyWriter = "$quoteKey|$key|$value"; // ... } } mh. -- 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] php and javascript
I have some image urls that I have stored in a mysql database. I want to be able to display the images in a popup window using javascript. But I haven't been able to figure out how to get the get the info to mysql so that the image loads when the popup window appears. Below is an example of the form without any javascript. "> Any help appreciated. Thanks, SW -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using PHP for server utilities
Hello- I am dreading having to break out my perl books, so here is a thought about using PHP on the server to handle a chore for me. I have a Linux ftp server that accepts files from a mainframe every night. I need to take those files, determine when the transfer is done and then re-send them to another machine across a wan. When that transfer is complete I need to make a new directory (date would be ok) and move all of the files into that directory, tar them and finally produce a status page. Thoughts? Has anyone tried this with php? BTW--it has to be automatic as a cron job. Thanks in advance. -Scott -- 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] fopen for ftp transfers
Hi- I am attempting to transfer files from one server to another via ftp. I am wondering if this is the best method to transfer files within PHP or should I seek other methods. Here is the way I am doing it now: $sendfile = fopen("ftp:user:[EMAIL PROTECTED]/testfile", "w"); 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] basic mcrypt questions
I'm working on my first shopping cart web application (done in php) and have started to look into ways to secure it. After reading up a little bit on mcrypt I have some basic questions about it: 1. If I use mcrypt to encrypt user input before storing it in a database, do I have to use it in conjunction with a utility like PGP, or is mcrypt a self-contained encryption and decryption tool. 2. One article I read almost immediately started talking about public and private keys, another did not mention them at all. Does mcrypt require the use of 3rd party keys? 3. If php scripts are used to decrypt data, where are these scripts kept? Thanks, SW -- 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] a big thank you
A big thank you to everyone with the help on the ftp module. I was able to finish my project in a few days and my boss thinks I am a hero. Of course he thinks I am using perl too. :) -Scott -- 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] php and mcrypt
I'm trying to get mcrypt to work with php, but haven't been able to reconfigure php to work with it. I'm using the version of php that came with Mandrake 8.0 and I have downloaded and installed the 2.5.7-1 mdk rpm of mcrypt. So now I should cd into my php directory and reconfigure php to work with mcrypt like this: ./ configure --with-mcrypt make make install Right? But this isn't working and I think the problem may be something as dumb as that I don't have the right directory. All I get is a message that there is no such directory when I run the command. As far as I can tell php is installed in /usr/bin and that is the directory I tried. There is not a php directory there though, but a php executable file. How do I find the right directory? Anything else I have to do to get this working? Thanks SW -- 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] php and mcrypt
This is my output from $ locate *php*so: /usr/lib/apache-extramodules/libphp4.so /usr/lib/php/extensions/dba_gdbm_db3.so /usr/lib/php/extensions/gd.so /usr/lib/php/extensions/imap.so /usr/lib/php/extensions/ldap.so /usr/lib/php/extensions/mysql.so /usr/lib/php/extensions/pgsql.so /usr/lib/php/extensions/readline.so /usr/lib/php/extensions/tclink.so /usr/lib/libphp_common.so This is the rpm install of php that came with M8.0. Which is the real php directory? Can it be reconfigured with mcrypt? Thanks, SW -- 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] fopen for ftp transfers
Perfect and just what I was looking for! I was able to finish my program today using it and the boss is wondering how I did it so fast! HINT: he thought I was using perl. At 01:59 PM 10/29/2001 -0400, Frewuill Rodriguez wrote: >what about using ftp functions from PHP? > >http://www.php.net/manual/en/ref.ftp.php -- 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] how to echo data in a textarea
Could someone please show me how to echo data into a textarea field of a form? e.g. I have used the following in text fields: " size=3 maxlength=3>, but textareas don't have the "value" attribute and I haven't been able to come up with a way that works or find a working example. Thanks, SW -- 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] gnupg, running php as a cgi script
I am trying to use php and gnupg on my virtual host to send user input to myself in encryptd form. The problem I am having is that I have installed gnupg in my user account and it is functional, but the keyring and keys that I have generated are under my user name for the account. Php runs under the user name "nobody" and does not have access to the keys for encryption. I have spoken to a tech at the company who said that I would not be allowed to install keys under "nobody". I'm not quite sure I believe this. Anyway, as a way to get around this, I have tried to run the php script as cgi, by putting the script into the cgi-bin in my user directory. This way the scripts should run as my username. Here is the script: #!/usr/local/bin/php $filename = "/home/gildedpg/public_html/mydata.txt"; $newfile = fopen($filename, "w+") or die("Couldn't create file."); fclose($newfile); $msg = "File created!"; This is the error I get: CGIwrap Error: System Error: execv() failed Error: No such file or directory (2) If anyone could tell me why this script will not run, or better yet, make any suggestions to make this process workwithout using cgi, I would appreciate it. Thanks, SW -- 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] Access rights for php files on Linux?
For a little bit more security, you could find out what user apache is running as (look in httpd.conf), and chown the file to that user:group and set permissions 400. (So that only the apache process can read the file) However, this is not very secure, becuase a CGI script could still read your file. (Any file that is readable by the webserver is, in essence, readable by any script being executed by that webserver - which, to say the least, can be a rather large security problem) > -Original Message- > From: Michael Geier [mailto:[EMAIL PROTECTED]] > Subject: Re: [PHP] Access rights for php files on Linux? > > Use include files to pass your authentication information. > > include('auth.php'); > ?> > > auth.php: > $username="foo"; > $password="bar"; > ?> > > put auth.php in your home directory with you as owner and apache group id > as group, or create a group that contains you and apache user (probably > 'nobody'). > > $> chmod 740 /your/home/dir/auth.php > > On Wed, 19 Dec 2001, Daniel Fassnauer wrote: > > > Well, I have encounterd a problem which is quite big (for me), so I hope > > I find help here. > > My setup is a Linux Machine, running Apache with php as a module. > > In order for the webserver to parse the file, i have to give read > > permission to world. > > This is a problem, because about 100 people have shell access and could > > then just cat /www/myphpfile.php, and would thus get passwords which i > > dont want to share (like mysql password in the phpmyadmin config file) > > and general access to my code. Also, the different users on the machine > > want to be able to host php files with everyone else being able to read > > them. Is there any way i can actually do that? > > I must say that i am rather new to all this stuff, so i am really > > confused as what to do, and i would appreciate any help.. > > Thanks in advance... > > > > Daniel -- 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] konquerer and php
I have a database browser that I made with php and mysql. When I use it in Netscape it behaves normally. However when I view it using Konquerer, all kinds of php code shows up on the screen when I execute a php page. I thought that Konquerer might not be recognizing the start and end tags so I tried and . However if I use these nothing at all shows up on the screen. Can someone tell me what the problem is? Thanks, SW -- 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] konquerer and php
What's happening specifically is that I have an html form with action "whatever.php" and when I click on submit I get code echoed to the screen. As I said it works normally in Netscape, I get the php page with all the data displayed perfectly. Thanks, SW On Thursday 23 August 2001 20:28, you wrote: > > I have a database browser that I made with php and mysql. When I use it > > in > > > > Netscape it behaves normally. However when I view it using Konquerer, > > all > > > > kinds of php code shows up on the screen when I execute a php page. I > > thought that Konquerer might not be recognizing the start and > > end > > > tags so I tried and . However if I use > > these nothing at all shows up on the screen. Can someone tell me what > > the > > > > problem is? > > PHP files are parsed by the web server, not the web browser. > > You can't load a PHP file directly (ie, file:///) into Konqueror, nor > any other browser. If you do, what you describe above will happen - you > will see the source code. > > Jason -- 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] konquerer and php
I should probably just forget I ever sent this post, but in case anyone is curious, the problem was that I was using the address cached in the address bar in Konqueror to open the home page of the application. For some reason this address was "file: /var/ww/html/homepage.html" instead of http://localhost/blahblahblah.html and I never noticed. So the html pages looked normal, but without the server, the php pages left something to be desired. Thanks, SW On Friday 24 August 2001 09:15, you wrote: > > From: Scott <[EMAIL PROTECTED]> > Date: Thu, Aug 23, 2001 at 08:29:07PM -0400 > Message-ID: <[EMAIL PROTECTED]> > Subject: [PHP] konquerer and php > > > I have a database browser that I made with php and mysql. When I use it > > in Netscape it behaves normally. However when I view it using Konquerer, > > all kinds of php code shows up on the screen when I execute a php page. > > I thought that Konquerer might not be recognizing the start and > > end tags so I tried and . However if I > > use these nothing at all shows up on the screen. Can someone tell me > > what the problem is? > > Thanks, > > SW > > > > -- > > 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] > > > > > > For the script execution it doesn't matter at all which browser you > use. PHP is processed server-side, so the browser just gets 'plain' > HTML. I guess something else is wrong than using a different > browser. > > -- 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] include question
Hello everyone- I am working on a project where a client can upload a template into a database table and manage it. The actual HTML code and dynamic code will be in the template as well. My hope is to build the page using an include that will echo the code to the page and then also fill in the dynamic variables. So, I would grab the template_content from the template database and print out the template file, then I would also grab the dynamic content from the content table and it would fill in the template file. I would prefer to do it with the template in the table so they can manage it, but I might need to actually write a file out and include it when I create the page. Any thoughts? -- 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] include question
At 02:03 AM 9/18/2001 +0200, Chris Hayes wrote: > 2) let them make a real template, either a file or a database >cell, for instance > fhkhfsahehfaa[DATA1] >and do a str replace [DATA1] parts --> database content. Chris- YOU ROCK! Thank you for the thought starter, I have been beating my head on this most of the day. I have to confess that this site was done in ASP and I have been moving parts over to PHP and was not thinking clearly. I was thinking I was still under the ASP limitations :) Anyway, here is the code I am using. I will keep the templates in the db and call them, but I put a [BODY DATA] block in the template file, and then do a string replace as such: $temp = str_replace("[BODY DATA]", $body,$template); echo $temp; Can anyone tell me the limit or format to do multiple replaces, example: I have 5 fields that I need to replace, do I create a variable for each replacement? $temp = str_replace("[BODY DATA]", $body,$template); $temp2 = str_replace("[TOP_GRAPHIC]",$top_graphic, $temp); and so on -OR- can I do it in one statement? -- 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] replace with display function
Hi, I am working on replacing strings in a navigation file. I need to be able to assemble the left navigation from a table. My problem is the function code gets placed above where it should appear in the template. Here is what I have: $temp5 = str_replace("[LEFT NAV]",call_leftnav(),$temp4); echo $temp5; function call_leftnav() { print (" "); $connection = mssql_connect("localhost","webuser",""); $db = mssql_select_db("wmn_test",$connection); $sql = "select bp_section_id,bp_section_name from bp_sections order by bp_section_name"; $sql_result = mssql_query($sql); while ($row = mssql_fetch_array($sql_result)){ $bp_section_id = $row["bp_section_id"]; $bp_section_name = $row["bp_section_name"]; print ("$bp_section_name"); }; print (""); }; ?> -- 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] Array question
Ok, I think I have my template and includes problem worked out, but making an array out of the data returned. My question is how do I make an array out of a returned result. Here is the code: $sql = "select bp_section_id,bp_section_name from bp_sections order by bp_section_name"; $sql_result = mssql_query($sql); while ($row = mssql_fetch_array($sql_result)){ $bp_section_id = $row["bp_section_id"]; $bp_section_name = $row["bp_section_name"]; $ln = "$bp_section_name"; }; I need to create an array of the data returned and store it in a variable that I can call. Thanks in advance. -- 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] PHP Site
The net is slow right now as there is another Microsoft IIS worm/virus floating around. This one is worse than Code Red in the amount of traffic it generates, something to effect of 10 requests a second, compared to one with Code Red. While php.net is not running IIS, it is subject to these probes and it is bringing traffic to a crawl. I have two servers here, one runs IIS for my ASP clients and the other runs Mandrake for the real work. The IIS box is (while not affected) getting hammered, but the Mandrake box just ignores it, still it is traffic we don't need. At 04:28 PM 9/18/2001 -0700, Jason Bell wrote: >is it just me, or is php.net down right now? -- 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] PHP Site
http://www.zend.com/manual/ At 04:37 PM 9/18/2001 -0700, Jason Bell wrote: >Thanks. I suppose really need to download the docs to my machine. :) > > >- Original Message ----- >From: "Scott" <[EMAIL PROTECTED]> >To: "Jason Bell" <[EMAIL PROTECTED]>; "PHP Users" ><[EMAIL PROTECTED]> >Sent: Tuesday, September 18, 2001 4:34 PM >Subject: Re: [PHP] PHP Site > > > > The net is slow right now as there is another Microsoft IIS worm/virus >floating > > around. This one is worse than Code Red in the amount of traffic it > > generates, something to effect of 10 requests a second, compared to one > > with Code Red. While php.net is not running IIS, it is subject to these > > probes and it is bringing traffic to a crawl. I have two servers here, >one > > runs IIS for my ASP clients and the other runs Mandrake for the real work. > > The IIS box is (while not affected) getting hammered, but the > > Mandrake box just ignores it, still it is traffic we don't need. > > > > At 04:28 PM 9/18/2001 -0700, Jason Bell wrote: > > >is it just me, or is php.net down right now? > > > > > > -- > > 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] re: array question
Oh, that works wonders and for the first time in 24 hours I am smiling! One more thing to make it complete. Is there a way to loop through the display of that array? In other words, I now have an array called $new_data and can call each element in the array by doing $new_data[0], etc, but I need to loop through everything in the array to display the navigation. >At 08:54 PM 9/18/2001 -0400, you wrote: >so then that last line in the loop should be >$new_data[] = $ln; >During the loop, everytime it comes to this line, $ln is added to the array new_data. Eventually, you will be >able to call on the array elements by $new_data[0], $new_data[1], etc -- 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]