Re: [PHP] Running a PHP script everyday
At 04:54 AM 8/1/2005, you wrote: Shit shit shit!!! I completelly forgot! #!/usr/local/bin/php -q Notice the -q, it's important. Sorry :( What is the -q for? I can't find any documentation on it. If I do a php -h or man php, it is not listed. I am running php 5.0.3 on RHEL ES 4 Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Running a PHP script everyday
At 09:56 AM 8/1/2005, you wrote: [snip] What is the -q for? I can't find any documentation on it. If I do a php -h or man php, it is not listed. I am running php 5.0.3 on RHEL ES 4 [/snip] It means 'quiet'...in other words do not send anything to standard out. Thank You. I guess they are keeping quiet about letting people know about it. I would have thought that a php -h or man php would have given me the answer to that one. And since the poster said that he needed that to run the program, it never occurred to me that it was for quiet since that should not hinder him from running a program. Just keep him from getting a bunch of output. Of course, I might have total mis-understood him too. I have to much going on right now to remember. Anyway, thanks. Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Changing directory permissions???
At 02:13 PM 7/11/2005, you wrote: Philip Hallstrom wrote: Is there a way to change directory permissions with pre php5.0? Linux/Apache I'm designing a CM application and would like my code to enable non-techies to be able to create a simple text file. [e.g., directory temporarilly from 755 to 757 and then back again.] PHP5.0 has a chmod; but not, 4.3.x Huh? chmod has been around since V3... http://us2.php.net/chmod chmod (PHP 3, PHP 4, PHP 5) chmod -- Changes file mode The key word is directory chmod only works for files PHP5 has a ftp_chmod; but not 4.3.x Chmod does NOT only work for files. Not sure about pre 4.1.2, but from 4.1.2 and up, it appears that on a linux/unix system, php's chmod treats directories like they where filesfor the most part. My php code did not make the directory, but was run by the user that did make the directory. Yes, I can see where there would be a problem if the directory was created by one user and the php script was executed by another userlike apache. But in the case where a user created a file with certain permissions and the script was run by another user, like apache, then it is understandable that php's chmod wouldn't work on it. That doesn't mean that php's chmod will only work on files. It only means that it has to have permission on the file to make the changes. Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reservation/booking script for a hotel
Go to http://www.hotscripts.com and type in hotel reservation in the Search For text box, change the category to PHP and then click on Search. Steve At 08:10 AM 4/25/2005, you wrote: yes it will be real time and yes open source is what we're looking for. For this hotel there are only 15 rooms so performance issues wont really come into play. Devraj Mukherjee wrote: Is your system going to be real time? We worked with some reservation products in the past but the project is commerical, obviously you are looking for something open source/free. Also I would be interested to know if performance of PHP is an issue for a critical system such as this and how you measure performance? Devraj Angelo Zanetti wrote: Hi all. I have searched the net for some PHP scripts to do reservations for hotels. Where there are multiple rooms which can be booked for a single day or multiple days. However what I've found is not good enough and am considering writing my own customing booking scripts, but before I start I dont want ro reinvent the wheel so I was wondering if anyone has encountered any really good scripts for the above? thanks in advance. Angelo Zanetti Z Logic [c] +27 72 441 3355 [t] +27 21 464 1363 [f] +27 21 464 1371 www.zlogic.co.za Devraj Mukherjee wrote: Is your system going to be real time? We worked with some reservation products in the past but the project is commerical, obviously you are looking for something open source/free. Also I would be interested to know if performance of PHP is an issue for a critical system such as this and how you measure performance? Devraj Angelo Zanetti wrote: Hi all. I have searched the net for some PHP scripts to do reservations for hotels. Where there are multiple rooms which can be booked for a single day or multiple days. However what I've found is not good enough and am considering writing my own customing booking scripts, but before I start I dont want ro reinvent the wheel so I was wondering if anyone has encountered any really good scripts for the above? thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re:Re: [PHP] help for me about session
At 10:29 PM 4/23/2005, Josephson Tracy wrote: At 09:35 PM 4/23/2005, Josephson Tracy wrote: hi everyone, when i study php, i have a problem as following: - file1.php ? if($NextCourse == 1){ do something;} else($NextCourse ==){do something other } ? - but when the 2ed access the file1.php the value of $NextCourse is the $NextCourse in the ? and ?, Not the value of document.form1.NextCourse.value. could someone tell me why?thanks I believe it should be: ? if($NextCourse == 1){ do something; } elseif(!$NextCourse){ do something other; } ? By the way you have your statement, I think you are only looking for the 1. You might try the following instead. ? if($NextCourse == 1){ do something; }else{ do something else; } ? ok. the key problem is when I click the button to submit. the value of $NextCourse is not the value of value of document.form1.NextCourse.value. just is the pre page's $NextCourse,that's say null; how can i get document.form1.NextCourse.value? How are you passing the variable $NextCourse to this script? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help for me about session
At 09:35 PM 4/23/2005, Josephson Tracy wrote: hi everyone, when i study php, i have a problem as following: - file1.php ? if($NextCourse == 1){ do something;} else($NextCourse ==){do something other } ? - but when the 2ed access the file1.php the value of $NextCourse is the $NextCourse in the ? and ?, Not the value of document.form1.NextCourse.value. could someone tell me why?thanks I believe it should be: ? if($NextCourse == 1){ do something; } elseif(!$NextCourse){ do something other; } ? By the way you have your statement, I think you are only looking for the 1. You might try the following instead. ? if($NextCourse == 1){ do something; }else{ do something else; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IRC from PHP - help
You might want to go to http://www.hotscripts.com and search for irc in the php category. Steve At 08:47 AM 4/1/2005, Matthew Fonda wrote: You might want to check out PEAR::Net_SmartIRC http://pear.php.net/package/Net_SmartIRC hello i'm a newcomer to this list, fairly experienced PHP programmer but coding mostly for personal web sites or hobbies. I also run an irc chat network and am curious as to if I can integrate php into it somehow. for example: I want to have a webpage that can present a list of all connected users to my irc network, or maybe a webpage to facilitate nickname registration/activation. my idea is to somehow connect a randomly-nicknamed client to the server like PHP-19942333 or something, which would execute the commands. I fully understand the irc protocol and have written a working irc client in VB. i don't have experience enough to know if PHP has some sort of event mechanism, for example, to be like on ircNamesList($names) { echo $names['1']; } or something. (pseudo-code) does anyone have an idea as to how this stuff could be done? Here's a sort of pseudo-code of what I'd want, PHP-style but obviously most of the functions are fake. // Begin pseudo-code. ?php echo Activating nickname...; $php_nickname = PHPInterface // or have it generate a random number irc_connect(192.168.1.1,6667,$php_nickname) $nick_command = REGISTER $_GET['nick'] $_GET['email'] $_GET['pass']; irc_send_privmsg(NickServ,$nick_command); // some way to hold processing until the response is received... wait_for_response(); // or maybe a while loop, like while $success = false... // after response, die exit(Finished); // parse response on event irc_privmsg($nick,$msg) { if ($nick == NickServ) { if ($msg == Your nickname has been successfully registered.) { echo Registration succeeded!; } elseif ($msg == Invalid syntax) { echo Error.; } irc_quit(PHP Script finished.); } ? obviously I'd also have to dress that page up a lot more, adding HTML code and such. This would also need a lot of error-trapping. Like if IRC couldn't connect for whatever reason, or if NickServ wasn't available, or who knows what. Well that's basically what I'm after. IDEAS??.. Flint -- 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] reg expressions
Ok. I am really bad at regular expressions. I have to search through some files and put the contents into an array. A file could look like this: $aliases=`cat /home/virtual/site$site_id/fst/etc/mail/local-host-names`; start of file # local-host-names - include all aliases for your machine here. # Please do not add any domain names in this file. domain.net domain.com end of file In $aliases, I need to ignore the lines that start with a # sign. It is possible, but not probably that it will be more than just the first 2 lines and possible that it isn't even the first two lines. After done, $aliases should have just the two domain names in it. One per line. Then I need to loop through the lines in $aliases and do stuff with each line. Any help would be GREATLY appreciated. It would also be fine to just do a loop that checks each line. Since I guess that would be quicker. If the line starts with a #, then ignore it, otherwise, do some other stuff. Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reg expressions
At 01:50 PM 3/25/2005, you wrote: Ok. I am really bad at regular expressions. I have to search through some files and put the contents into an array. A file could look like this: $aliases=`cat /home/virtual/site$site_id/fst/etc/mail/local-host-names`; start of file # local-host-names - include all aliases for your machine here. # Please do not add any domain names in this file. domain.net domain.com end of file In $aliases, I need to ignore the lines that start with a # sign. It is possible, but not probably that it will be more than just the first 2 lines and possible that it isn't even the first two lines. After done, $aliases should have just the two domain names in it. One per line. Then I need to loop through the lines in $aliases and do stuff with each line. Any help would be GREATLY appreciated. It would also be fine to just do a loop that checks each line. Since I guess that would be quicker. If the line starts with a #, then ignore it, otherwise, do some other stuff. Ya know. You can look all you want, but for some reason, you never find what you are looking for until you ask somebody and then keep looking. Anyway, I found the answer. here it is: $fc=file(/home/virtual/site$site_id/fst/etc/mail/local-host-names); $key=#; foreach($fc as $line){ if(!strstr($line,$key)){ }else{ echo $line; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] opendir
So that I could use the opendir feature with an ftp url, I downloaded php-5.0.3 and used the following to make the cgi version: ./configure --enable-ftp make cp ./sapi/cgi/php /root Here is my script: start of script /root/z.php #!/root/php ?php if ($handle = opendir('ftp://login:[EMAIL PROTECTED]/SHARE1/')) { echo Directory handle: $handle\n; echo Files:\n; while (false !== ($file = readdir($handle))) { echo $file\n; } closedir($handle); } ? end of script When I run the script, I get the following error. I am root doing this and can ftp normally into the server with ncftp. I have another script (shell script /bin/sh) that I have been doing ftp with, but want some added features that php 5.0.3 will allow. start z.php output- # /root/z.php Content-type: text/html X-Powered-By: PHP/5.0.3 br / bWarning/b: opendir(ftp://[EMAIL PROTECTED]/SHARE1/) [a href='function.opendir'function.opendir/a]: failed to open dir: not implemented in b/root/z.php/b on line b3/bbr / end z.php output Any help in this would be greatly appreciated. I really would like to get this running. I am assuming that there is a compile option that I need to add. Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if table not exists
http://dev.mysql.com/doc/mysql/en/create-table.html At 03:29 PM 3/15/2005, John Taylor-Johnston wrote: How do I get PHP to create a table, if one does not already exist? I have to do something with: $news = mysql_query($sql) or die(print mysql_error()); What can I also add something to $sql? $sql = if not exists CREATE TABLE `demo_assignment1` ... John snip $server = localhost; $user = myname; $pass = mypass; $db = mydb; $table = demo_assignment1; ## What do I add here? $sql = CREATE TABLE `demo_assignment1` ( `StudentNumber` varchar(8) NOT NULL default '', `Exercise1` varchar(100) NOT NULL default '', `Exercise2` varchar(100) NOT NULL default '', `TimeStamp` timestamp(14) NOT NULL, PRIMARY KEY (`TimeStamp`) ) TYPE=MyISAM COMMENT='place something here';; $myconnection = mysql_connect($server,$user,$pass); mysql_select_db($db,$myconnection); ## What do I do here? $news = mysql_query($sql) or die(print mysql_error()); #if table exists, I will now $sql = INSERT INTO $table (StudentNumber,Exercise1,Exercise2) values ('$StudentNumber','$Exercise1','$Exercise2'); mysql_select_db($db,$myconnection); mysql_query($sql) or die(print mysql_error()); -- 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] incrementing a number from a text file
At 03:14 PM 3/10/2005, Richard Lynch wrote: I want to read a number from an external (txt) file and increment it.then save the number back on the text file. I know this is possible but want a simple amd economical way to do this. That's what you *THINK* you want to do :-) But what happens when *TWO* users hit that same script at exactly the same time. Richard has a good idea about using mysql to do this. Some things I have not tried, but might also do for you is php's flock http://www.php.net/flock . Or go to http://www.php.net/fopen and search the page for lock (no quotes). The example you might want was the 4th instance of that word that I found. ?php #going to update last users counter script since #aborting a write because a file is locked is not correct. $counter_file = '/tmp/counter.txt'; clearstatcache(); ignore_user_abort(true); ## prevent refresh from aborting file operations and hosing file if (file_exists($counter_file)) { $fh = fopen($counter_file, 'r+'); while(1) { if (flock($fh, LOCK_EX)) { #$buffer = chop(fgets($fh, 2)); $buffer = chop(fread($fh, filesize($counter_file))); $buffer++; rewind($fh); fwrite($fh, $buffer); fflush($fh); ftruncate($fh, ftell($fh)); flock($fh, LOCK_UN); break; } } } else { $fh = fopen($counter_file, 'w+'); fwrite($fh, 1); $buffer=1; } fclose($fh); print Count is $buffer; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] FTP info in a variable
I have to write a little program that pulls information from a database, formats it into csv format for importing into excel and ftps it to another server. I have everything worked out except for the ftping. I have read through http://us4.php.net/manual/en/ref.ftp.php and I know I can get the data from the database, save it to a file and ftp it. Does anybody know if I can skip the step of saving it to a file and ftp/stream it directly to a filename on another server? Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] FTP info in a variable
original message I have to write a little program that pulls information from a database, formats it into csv format for importing into excel and ftps it to another server. I have everything worked out except for the ftping. I have read through http://us4.php.net/manual/en/ref.ftp.php and I know I can get the data from the database, save it to a file and ftp it. Does anybody know if I can skip the step of saving it to a file and ftp/stream it directly to a filename on another server? end of original message Ok. Looking for something else, I was reminded that fopen is what I needed. Since I am uploading a file every night with the same file name. I had to use the ftp options to delete the old file first since I cant use: $handle = fopen(ftp://user:[EMAIL PROTECTED]/somefile.txt, w); It won't allow for truncating the file to zero length. My message original message has still not be sent back to me from the list. Hopefully this one will get through and everybody will see that I have solved the problem. I will read other responses if I ever get anymore mail from the list :) . Maybe one of the responses will work even better for me. Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php.ini file
At 06:16 AM 2/25/2005, H. Postel wrote: I am setting up a database for the first time. I have to change some settings to my php.ini file, but I can not find it. I work with MySQL 3.23.49 It is normally in the /etc directory. If you do not have access to the /etc directory, then you will need to talk to whomever has root access to your server. Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FTP info in a variable
At 11:07 AM 2/25/2005, you wrote: Steve Buehler wrote: I have to write a little program that pulls information from a database, formats it into csv format for importing into excel and ftps it to another server. I have everything worked out except for the ftping. I have read through http://us4.php.net/manual/en/ref.ftp.php and I know I can get the data from the database, save it to a file and ftp it. Does anybody know if I can skip the step of saving it to a file and ftp/stream it directly to a filename on another server? What you just described is pretty much the entire PURPOSE of http://php.net/manual/en/ref.ftp.php Now that you know that, re-read that, and you'll realize just how easy this is gonna be. :-) PS You may find it easier to go ahead and use a local temporary file, just to use fputcsv() instead of rolling your own. Or not, as rolling your own CSV writer isn't exactly rocket science. Maybe I missed it the second time through, but I still can't find anything that makes that the entire PURPOSE of what you referred too. Like I said, I might have missed it though, that one is for ftping a file. What I was hoping for is to NOT have to create the file locally first before uploading it. Right after sending this email, I was looking for something else and found out that fopen is what I was looking for. I still have to use the ref.ftp.php ftp functions to delete the file on the remote server first though because fopen can not open an existing file on a remote server, zero it out and then write to it and it can't just delete a remote file.that I know of. So I have to delete it first with the ftp functions, then ftp it over from the variable into a remote file. At least I don't have to create a temporary file on the local server first. That is what I was really trying to avoid. Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Student Suspended Over PHP use.
Shouldn't have taken your Cat to school with a bag of catnip. That was asking for trouble. :) Steve At 08:44 PM 2/9/2005, Dotan Cohen wrote: Maybe it's not People Hate Perl after all... Pot, Heroin, Pussy?!? I think I got suspended for at leat two of those on campus grounds at some point or another. Dotan On Thu, 10 Feb 2005 01:31:43 +1100 (EST), [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: PHP is bad Mkay. I just ran across this interesting article from awhile back. Pretty funny http://bbspot.com/News/2000/6/php_suspend.html http://bbspot.com/News/2000/6/php_suspend.html Topeka, KS - High school sophomore Brett Tyson was suspended today after teachers learned he may be using PHP. A teacher overheard him say that he was using PHP, and as part of our Zero-Tolerance policy against drug use, he was immediately suspended. No questions asked, said Principal Clyde Thurlow. We're not quite sure what PHP is, but we suspect it may be a derivative of PCP, or maybe a new designer drug like GHB. php_logoParents are frightened by the discovery of this new menace in their children's school, and are demanding the school do something. We heard that he found out about PHP at school on the internet. There may even be a PHP web ring operating on school grounds, said irate parent Carol Blessing. School is supposed to be teaching our kids how to read and write. Not about dangerous drugs like PHP. In response to parental demands the school has reconfigured its internet WatchDog software to block access to all internet sites mentioning PHP. Officials say this should prevent any other students from falling prey like Brett Tyson did. They have also stepped up locker searches and brought in drug sniffing dogs. Interviews with students suggested that PHP use is wide spread around the school, but is particularly concentrated in the geeky nerd population. When contacted by BBspot.com, Brett Tyson said, I don't know what the hell is going on dude, but this suspension gives me more time for fraggin'. Yee haw! PHP is a hypertext preprocessor, which sounds very dangerous. It is believed that many users started by using Perl and moved on to the more powerful PHP. For more information on how to recognize if your child may be using PHP please visit http://www.php.net http://www.php.net . HTC Disclaimer: The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- 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] Copy mySQL database...
At 08:52 AM 2/3/2005, you wrote: I just need to make a duplicate copy of a mySQL database (I have to reinstall some web software and I am afraid it will overwrite the existing database, so i would like to make a backup of it)... Any classes, scripts, etc out there to do this? This is more of a question for the mysql mailing list unless you MUST use PHP to do it. In that case, I would suggest phpmyadminjust my preference. Besides mysqldump and a few other things. You can also just copy the directory to a new directory if you have root access. Just make sure that you keep the same permissions. cd /var/lib/mysql (assuming this is where your databases are) mkdir backuptest (this would be the name of the new directory) cp -pr test/* backuptest (this would copy the database test to the new directory you just created) It would be a good idea to stop the database first then do a myisamchk. myisamchk --silent --force --fast --update-state -O key_buffer=64M \ -O sort_buffer=64M -O read_buffer=1M -O write_buffer=1M \ /var/lib/mysql/*/*.MYI Those \ backslash characters are to tell you that the command is all one line (without the backslashes). After you have done all of this, then restart the database. If you are moving to a new machine with the data, then you can either use the mysqldump of the database or tar/gzip up the directory before you restart mysqld and untar/ungzip it onto the new machine. I am not going to guarantee that the last method will always work for you, but I have done it in the past from linux to linux, linux to windows and windows to linux with no problem. If you are moving it to a new server, you will need to make sure to setup the access permissions again in the mysql database. Also, you can use the backuptest database by doing the same thing if you are not root and root doesn't have full privileges on every database. Strange, but I have seen a setup like that. Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Link to content of Directory
At 10:52 AM 2/2/2005, Marquez Design: Steve Marquez wrote: Greetings all, I am currious if someone could point me to a script to list the content of a directory, then link to each file in that directory. Example: The directory contains 80 .GIF files. I want to create a page that will have links to each file. Is this possible? Go to http://www.php.net and search for direcotry listing in the whole site -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Date()
At 08:33 PM 1/15/2005, you wrote: Torsten, Whatever the combination, it echos February 02-2005brFebruary 02-2005brFebruary 02-2005. What is wrong with it? ?php $week5 = 2005-02-14; $firstDayTs = strtotime($week5); $lastDayTs = $firstDayTs + (4 * 86400); echo date('F', $firstDayTs) . ' ' . date('m', $firstDayTs) . '-' . date('Y',$firstDayTs) .br; echo date('F', $firstDayTs) . ' ' . date('m', $firstDayTs) . '-' . date('Y',$lastDayTs) .br; ? John It is outputing what you are asking it to: FA full textual representation of a month, such as January or March mNumeric representation of a month, with leading zeros YA full numeric representation of a year, 4 digits This is all documented at: http://us2.php.net/manual/en/function.date.php First you are asking for the Month as a name, then the month as a number then the year as a number. If you made $week5=2005-12-31 it would give you the following output: December 12-2005brDecember 12-2006br If you are wanting to make it echo February 14-18, then check out the 3rd echo statement in the below example. ?php $week5 = 2005-02-14; $firstDayTs = strtotime($week5); $lastDayTs = $firstDayTs + (4 * 86400); echo date('F', $firstDayTs) . ' ' . date('d', $firstDayTs) . '-' . date('Y',$firstDayTs) .br\n; echo date('F', $lastDayTs) . ' ' . date('d', $lastDayTs) . '-' . date('Y',$lastDayTs) .br\n; echo date('F', $lastDayTs) . ' ' . date('d', $firstDayTs) . '-' . date('d',$lastDayTs) .br\n; echo \n; ? Now, the problem with that is that if your $week5=2005-02-18 then your results will be wrongunless this is what you want, but the answer will be February 28-04. You are outputing the Month from $week5, the day from $week5 and the day+4 of $week5 which takes it into the next month. Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple POP accounts on Webmail Front
Well, Squirrelmail does.sort of. This might not be exactly what you are looking for, but you can add the fetchmail plugin to squirrelmail so that it can pull email from other pop3 accounts. http://www.squirrelmail.org/plugin_view.php?id=50 Steve At 10:26 AM 1/7/2005, James Nunnerley wrote: Hi All, Bit of a side question, but it's still php related. Does anyone know of a Webmail client, preferably open-source, that is able to support single login, to allow users to collect and use multiple POP3 or IMAP accounts? I'm currently using Ilohamail, and have used Squirrel in the past, but neither, I don't, think support multiple POP3 accounts on one login. Any ideas? Cheers James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP info: MySQL client API version: 3.23?
At 07:38 AM 11/24/2004, you wrote: In the phpinfo() output, the MySQL client API version is shown as 3.23.49. Shouldn't this be upgraded to 4.1 (generally available/stable)? To do so, you would need to upgrade it. I know I am being a smartaleck when I say this, but it won't upgrade on its own and it won't upgrade just because you upgraded just PHP itself. PHP only reads what the version is from what you have installed, not something that is internal to PHP itself. So if you upgrade your mysql, it will show you a different version when you run your phpinfo. Here is an rpm -qa result from one of my machines: [root]# rpm -qa|grep mysql php-mysql-4.3.2-14.ent mysql-server-3.23.58-1 libdbi-dbd-mysql-0.6.5-5 mysql-devel-3.23.58-2.3 mysql-3.23.58-2.3 My phpinfo client API shows: 3.23.58 Which would be because that is the version of mysql that I am running. My mysql, mysql-server and mysql-devel are all 3.23.58. Only my php-mysql module is 4.3.2-14 Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP info: MySQL client API version: 3.23?
At 10:59 AM 11/24/2004, you wrote: On Wed, 24 Nov 2004 10:37:19 -0600, Steve Buehler [EMAIL PROTECTED] wrote: At 07:38 AM 11/24/2004, you wrote: In the phpinfo() output, the MySQL client API version is shown as 3.23.49. Shouldn't this be upgraded to 4.1 (generally available/stable)? To do so, you would need to upgrade it. I know I am being a smartaleck ;- when I say this, but it won't upgrade on its own and it won't upgrade just because you upgraded just PHP itself. PHP only reads what the version is from what you have installed, not something that is internal to PHP itself. So if you upgrade your mysql, it will show you a different version when you run your phpinfo. Here is an rpm -qa result from one of my machines: [root]# rpm -qa|grep mysql php-mysql-4.3.2-14.ent mysql-server-3.23.58-1 libdbi-dbd-mysql-0.6.5-5 mysql-devel-3.23.58-2.3 mysql-3.23.58-2.3 My phpinfo client API shows: 3.23.58 Which would be because that is the version of mysql that I am running. My mysql, mysql-server and mysql-devel are all 3.23.58. Only my php-mysql module is 4.3.2-14 But on a up2date Debian Linux Sarge server with MySQL 4.0 and PHP 4.3.9, it still shows 3.23.56 On a Windows XP server with MySQL 4.1 and PHP 4.3.10 (RC1) it shows 3.23.49. So what exactly do I need to upgrade? I have already been corrected on what I said. I guess you learn something new and different every day. Anyway, John Nichel did the correction. You might want to read his email. I didn't think it worked that way, but maybe I am wrongI usually am. :) Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] delimiter question?
How can I make the following work on an apache 2.0.46/php 4.3.2 installation? /dist/gogo.php/order-inventory-form.php Right now, unless it is a question mark after the gogo.php script, it will not run. Thank You Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] path info question. Was delimiter question?
Thank You. I didn't know where to start looking. Anyway, putting the following lines in an .htaccess file in the directory worked like a charm: IfModule mod_rewrite.c AcceptPathInfo On /IfModule Thanks to all who helped. Steve At 02:02 PM 8/24/2004, you wrote: How can I make the following work on an apache 2.0.46/php 4.3.2 installation? /dist/gogo.php/order-inventory-form.php Right now, unless it is a question mark after the gogo.php script, it will not run. Apache 2.0 differs from 1.3.x in its handling of path info. See: http://httpd.apache.org/docs-2.0/mod/core.html#acceptpathinfo - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple URL Redirection
At 06:39 PM 6/5/2004, you wrote: Hi I have the following situation: I've got a domain that is hosted at a certain host. This host allows me to create subdomains, and also to add several domains to the same account. The thing is if I add a domain like xxx.com to my yyy.com both will be directed to my index.php page. I want to know if there is a way to recognize if the user typed to the url xxx.om or yyy.com and then send it to a certain folder. I thank any word of wisdom from you guys. Rodrigo Try: if($_SERVER[HTTP_HOST]==xxx.com){ header(Location: http://www.xxx.com/xxxdir;); }elseif($_SERVER[HTTP_HOST]==yyy.com){ header(Location: http://www.yyy.com/yyydir;); }else{ echo Huh?; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] string replace in files
I am trying to write a script that will replace a string in a file. Actually, about 3000 files. And I am stuck. I can get the list of files, but then I pretty much become stuck. I wanted to try str_ireplace (not sure if that is what I should use or not), but I can't even get far enough to do that. I am hoping that someone out there has an easy response to this. Below is the code that I have so far. Thanks Steve #!/usr/bin/php ? $strtoreplace=require \http://www.domain.com/;; $replacewithstring=require \/home/domain/www/; replacestring(); function replacestring(){ GLOBAL $strtoreplace,$replacewithstring; $FILES=array(`ls -1 */*|grep .php`); foreach($FILES as $value){ if($value){ echo file $value\n; $handle=fopen($value,'a'); } } } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] string replace in files
At 11:27 AM 4/30/2004, John W. Holmes wrote: From: Steve Buehler [EMAIL PROTECTED] #!/usr/bin/php ? $strtoreplace=require \http://www.domain.com/;; $replacewithstring=require \/home/domain/www/; replacestring(); function replacestring(){ GLOBAL $strtoreplace,$replacewithstring; $FILES=array(`ls -1 */*|grep .php`); foreach($FILES as $value){ if($value){ echo file $value\n; $content = file_get_contents($value); $content = str_replace($strtoreplace,$replacewithstring,$content); $fp = fopen($value,'w'); fwrite($fp,$content); fclose($fp); } } } ? You could use glob() to get the list of files, too. $FILES = glob('*.php'); ---John Holmes... John Thank you so much for this. I was thinking of it all wrong when doing this. I have a couple of other questions to go along with this. 1. How would I change this to do a recursive search for the .php files instead of just the *.php or */*.php in the glob? 2. I also have some dns zone files that I was going to modify this script to replace some information in them. What it would have to do is to delete all lines that have white space (could be a space or a tab) NS more white space and then add specific lines that I want in place of the deleted lines. 2.a. There will normally be between 2 and 4 lines that I want deleted and 2 to replace them. If you don't want to answer this one, that is fine. There are only about 200 zone files and that wouldn't take as long for me to do manually as it would have for the .php file changes. Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Quote for Job
Was wondering if anybody who needs some money can give me a quote on a job. It is over my head to do. We need a Web Based Email program for an internal server written in PHP if at all possible but will consider other languages if needed. They liked Squirrelmail, but they need it to do something that Squirrelmail doesn't do. No it doesn't need to be even close to the functionality of Squirrelmail. The program will reside on the same server and run over the web. The server will be: 1. RHEL ES 3.x 2. Dual Xeon 2.4ghz 3. 2 gig of ram 4. php 4.3.2 or above (version can be changed if absolutely needed) 5. Sendmail version 8.12.10 or above. 6. Apache 2.0.46 or above If you need any other details, please ask. This is what it needs to do: 1. Be able to receive mail. (pop into their account on this server only). 2. Be able to reply to mail. 3. Be able to send and receive attachments. 4. Be able to CC: and BCC: 5. Login with just the username password of the user on the server. (not [EMAIL PROTECTED]) 6. Be able to send out to ONLY users specified in a MySQL database. What that basically will be is 15,000 email clients on the server. There will be a criteria that if they are from missouri, they will only be able to email to other users that are from missouri or to the main email address of the company headquarters. They will not be able to email out from the server to anyplace else on the internet and can not POP in from anyplace else. They will have to come through this program. This is where the MySQL database comes in. When they go to send out an email, it must check the (probably) state field to make sure that who they are sending to matches the same state as theirs. 7. The main company's login needs to be able to email to all users on the system or to just specific users. 8. When an email is deleted, it does not go into a trash can, it is just gone with no possibility of retrieval. 9. Anything else that you can think of might be something they would think of. But before it is added you would need to consult with me first to see if it is needed. For instance. I almost forgot to add #4 above to allow for CCing and BCCing. Knowing this company, they will want to be able to change it in the future. So we would probably go back to the person who writes it in the future to make changes. For instance..They might decide that they want to allow one of the users from missouri to be able to email one or more of the users from Kansas. Basically it needs you or I to be able to change it half way easily. If you need any other details, please ask. Please send your quotes (price and time required) directly to [EMAIL PROTECTED] with a subject of Quote for Job. If it weren't for the receiving part of this, I could write it myself because it would be a simple form to me then. If it weren't for the limitation on the people that a person can send to, Squirrelmail or many of the other email clients out there would work just fine. Thank You Steve Buehler -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] making 1 pdf file from 2
I hope someone here can help me because for some reason I can't receive any mail from the pdflib mailing list. I have PDFlib + PDI 5 using php to create my pages. This is the first time that I have had to do this and just can't figure it out. I have two files: ChurchCalendarFrontPage.pdf Church.pdf What I am trying to do is to have a page (cal.php) that someone goes to and it will create just one pdf document output with the two pdf documents. I can do it if I designate which page(s) that I want to display from each document, but they don't always have the same amount of pages. At the moment, the ChurchCalendarFrontPage.pdf has only one page and the Church.pdf has 13 pages to it. Hopefully someone here will know what I am asking for and be able to help me by either showing me where to go for examples, or show me the code for this. I am pretty new to PDFlib. Thanks in Advance Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] stepping through alphabet
I am using PHP 4.3.4 and am trying to come up with a function that will step through the alphabet so that I get a menu/links that can be clicked on like below: a href=?action=alphabetletter=AA/a a href=?action=alphabetletter=BB/a a href=?action=alphabetletter=CC/a etc... I am sure that this has been done and is probably pretty easy. Any help here would be appreciated. I know that I could just create a link for each letter, but I would like to learn to do this so that I can make code shorter. Putting each letter into an array and steping through the array will work, but can it be done by telling a loop to start at A and end at Z? Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] stepping through alphabet
Yes, I found that the loop was written kind of backwards and would create a never ending loop. I never thought to try setting $letter='A' before. I didn't think you could loop through the Alphabet like that. But I did a little changing to your loop and it works fine like this now: $letter='A'; for($i=0;$i=25;$i++){ echo $letter++. ; } Thank You So Much Steve At 08:24 AM 11/19/2003, you wrote: [snip] for ($letter = 'A'; $letter++; $letter = 'Z') echo a href=\?action=alphabetletter=$letter\$letter/a\n; [/snip] I tested this and found two small problems. The code works if you do this (I was myself amazed that letters would increment) for($letter = 'A'; $letter 'Z'; $letter++){ echo $letter . \n; } The problem seems to be that you cannot use ='Z' for some reason, as the array becomes quite lengthy, as if 'Z' doesn't work properly. But, if I do this for($letter = 'A'; $letter 'Z'; $letter++){ echo $letter . \n; } echo $letter . \n; The second echo statement echos the 'Z' properly. -- 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] stepping through alphabet
YES That is the kind of code that I was looking for. I never thought you could do it like that either. Meaning putting 2 things to do ($letter++ and $i++) into the loop in this fashion. This looks so much cleaner to me. Here is my final function now. for($letter = 'A', $i = 0; $i = 25; $letter++, $i++ ){ echo a href=\?action=alphabetletter=$letter\$letter/a ; } Thank You So Much Steve At 08:27 AM 11/19/2003, you wrote: Sophie Mattoug wrote: Maybe you can try this for ($letter = 'A'; $letter++; $letter = 'Z') echo a href=\?action=alphabetletter=$letter\$letter/a\n; Hope this helps The for loop is backwards for ($letter = 'A'; $letter = 'Z'; $letter++) However, I don't think that will work, you probably need to do something like this (untested) for ( $letter = 'A', $i = 0; $i = 25; $letter++, $i++ ) Steve Buehler wrote: I am using PHP 4.3.4 and am trying to come up with a function that will step through the alphabet so that I get a menu/links that can be clicked on like below: a href=?action=alphabetletter=AA/a a href=?action=alphabetletter=BB/a a href=?action=alphabetletter=CC/a etc... I am sure that this has been done and is probably pretty easy. Any help here would be appreciated. I know that I could just create a link for each letter, but I would like to learn to do this so that I can make code shorter. Putting each letter into an array and steping through the array will work, but can it be done by telling a loop to start at A and end at Z? Thanks Steve -- By-Tor.com It's all about the Rush http://www.by-tor.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] stepping through alphabet
I was hoping for something that looked (at least to me) a little cleaner. Someone else gave me the answer and here is my final code that works out just great for me. for($letter = 'A', $i = 0; $i = 25; $letter++, $i++ ){ echo a href=\?action=alphabetletter=$letter\$letter/a ; } Amazing what I learned today. :) I love this list and its people. Thanks for your help Steve At 08:15 AM 11/19/2003, you wrote: Create a $letters array and the loop through it like this: $letters=array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'); foreach($letters as $letter) { echo a href=\?action=alphabetletter=$letter\$letter/a\n; } Luis -Original Message- From: Steve Buehler [mailto:[EMAIL PROTECTED]mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 8:03 AM To: PHP Subject: [PHP] stepping through alphabet I am using PHP 4.3.4 and am trying to come up with a function that will step through the alphabet so that I get a menu/links that can be clicked on like below: a href=?action=alphabetletter=AA/a a href=?action=alphabetletter=BB/a a href=?action=alphabetletter=CC/a etc... I am sure that this has been done and is probably pretty easy. Any help here would be appreciated. I know that I could just create a link for each letter, but I would like to learn to do this so that I can make code shorter. Putting each letter into an array and steping through the array will work, but can it be done by telling a loop to start at A and end at Z? Thanks Steve -- PHP General Mailing List (http://www.php.net/http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phphttp://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with session_id() in Windows?
Check your php.ini file and see where it is trying to save your sessions at. I think it is trying to save them to /tmp. You might have to make sure that directory exists. You might also have to put it in as the full path. ex.C:\tmp. Make sure to restart your apache, or whatever Web Server you are running after making this change. Steve At 12:10 AM 11/9/2003, you wrote: Hello all: We recently ported an application from Linux to Windows and had a few sessions-handling issues (we were going from PHP 4.1.2 Linxu to PHP 4.3.3 Windows). We traced this to PHP's session_id() function. It worked fine in Linux, but apparently not at all in windows, or not as expected. Has anyone seen or heard of this? The notes in the docs didn't tell me anything special about this. -- steve lane -- 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] single quotes in database
I am using PHP/MySQL and am having a problem. We have some names and addresses in the database that have single quotes in them. For instance. There is a town around here called Lee's Summit. Also names like O'connel. When I pull from the database it skips these because of the quotes. I know there is something that I have seen before about this, but can't find it now. Can anybody help me? I really hope this makes since because I am sick today and am having a hard time thinking straight. Is it something that I will have to fix when putting things into the database? I am hoping on being able to fix this when going in and when coming out of the database so that I don't have to go back and redo all the ones that are already in the database. Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Error 1148 and 1045
I have upgraded my mysql version to 3.23.58 and am coming up with a couple of errors using phpmyadmin to Insert data from a textfile into table I didn't get this on the previous versions of mysql. Here are the errors: SQL-query : LOAD DATA INFILE '/tmp/phpKFlQ2b' INTO TABLE `annsubscribers` FIELDS TERMINATED BY ',' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\r\n'( `email` ) MySQL said: #1045 - Access denied for user: '[EMAIL PROTECTED]' (Using password: YES) --- SQL-query : LOAD DATA LOCAL INFILE '/tmp/phpsj1WGM' INTO TABLE `annsubscribers` FIELDS TERMINATED BY ',' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\r\n'( `email` ) MySQL said: #1148 - The used command is not allowed with this MySQL version --- Can anybody shed some light on how to fix this? I presume the first is a permission problem that is from the new way that MySQL handles things. The second is just a mystery to me. Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n \t don't work!!!
If you want it to work with \n, then you will need to use the pre/pre tags. Otherwise you need to translate the \n's into br tags. \n is NOT an html tag so when you print them to the browser, it adds lines to the source, but as you might already know, a new line in the source of an html page does NOT give a new line in the output unless you use an html tag that would give the new line. Steve At 06:39 AM 10/13/2003, you wrote: They do work but you will not see that in the rendered html page (in a browser). Have a look at the source of the produced page and you will see the linebreaks. The page source shows: I suppose your manual was not intending on making html pages, or it was a very lousy one. I do want to just make a html page. The following is my source code, and what I expect is to see the new lines when the \n appears, ok? * body ?php echo (this is the simplest, an SGML processing instruction\n); echo This spans multiple lines. The newlines will be output as well; echo This spans\nmultiple lines. The newlines will be\noutput as well.; ? /body /html ** So, what's the problem here? cheers, feng -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by the MailScanner at ow4, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n \t don't work!!!
Do what I do, use both the \n and the br tags. I am not worried about anybody else thinking the source is nice looking, I do it for debugging so that I can see how the source comes out in a readable format. Steve At 06:48 AM 10/13/2003, you wrote: Ok, Now I see what happen (maybe). So, the \n is not for the browser output, but for the *view source*? So, it's different from the echo br? If so, what's the deal to do that? --- Makes it look nice if the user view the source code? cheers, feng - Original Message - From: Chris Hayes [EMAIL PROTECTED] To: Wang Feng [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, October 13, 2003 9:29 PM Subject: Re: [PHP] \n \t don't work!!! At 13:22 13-10-03, you wrote: Guys, These codes are copied from the manual: * echo (this is the simplest, an SGML processing instruction\n); echo This spans multiple lines. The newlines will be output as well; echo This spans\nmultiple lines. The newlines will be\noutput as well.; ** None of them works. They do work but you will not see that in the rendered html page (in a browser). Have a look at the source of the produced page and you will see the linebreaks. I suppose your manual was not intending on making html pages, or it was a very lousy one. I would recommend reading the first chapters of the manual on www.php.net to get a general idea of PHP. Then read some tutorials on for instance phpfreaks.com. I mean there're not any new lines generated in my browser and I have to use the echobr to print a new line. But why doesn't the \n work? BTW, the \t doesn't work either. (WindowsXP Pro + PHP Version 4.1.1) Please advise. cheers, feng -- 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 -- This message has been scanned for viruses and dangerous content by the MailScanner at ow4, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] \n \t don't work!!!
To give tabs in html, you might want to try using nbsp; nbsp; nbsp; instead of \t Steve At 06:57 AM 10/13/2003, you wrote: Wang Feng wrote: The page source shows: htmlbody/body/html The problem might be right here --+ (closing html tag)| html | headtitleHello World Program/title/html body ?php echo (this is the simplest, an SGML processing instruction\n); echo This spans multiple lines. The newlines will be output as well; echo This spans\nmultiple lines. The newlines will be\noutput as well.; ? /body /html ** Simple: ?php echo (this is the simplest, an SGML processing instruction ); echo This spans multiple lines. The newlines will be output as well; echo This spans multiple lines. The newlines will be output as well.; ? In html you cannot use newlines for formating, use br if you need newline. You can use pre tag for preformated text however. So, what's the problem here? cheers, feng -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by the MailScanner at ow4, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] duplicating databases
I am running PHP/MySQL for a program that I am writing. We will have 100's or 1000's of databases that will be duplicates in structure. The problem is when I make a change to the database, I have to go to every database manually and make the change. All of the databases start with a_ and are on the same server. I would like to be able to have one master database and then run a script when I make a change to it that will get the structure of the master database and check all of the other databases to make sure that their structures match. If not, it will make the change to the other databases. Does anybody know if there is all ready a program out there that would do this? Can anybody point me in the right direction? Or if it is only a few lines of script that somebody all ready has to do this, can you share it? Thank You Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] attach file with mail() function??
At 06:34 PM 10/5/2003, Roy W wrote: Is there a way to attach a file with the mail() function? Thanks! Yes. Take a look at http://www.php.net/mail Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] if statement
I have an if statement that I would like to make a little bit more generic. This is how the statement looks now. if($k2b==/etc/bind/options.conf.wp || $k2b==/etc/bind/rndc.conf.wp || $k2b==/etc/bind/keys.conf.wp){ do this1 }else{ do this2 } What I would like to do is to have an array earlier in the script of just the items that it is checking for so that it can be more easily changed if I put this out as free or shareware software. Here is what it might look like, but I know that if this is possible, it probably won't look at all like this: $array=(/etc/bind/options.conf.wp,/etc/bind/rndc.conf.wp,/etc/bind/keys.conf.wp); if($k2b==$array){ do this1 }else{ do this2 } I think that might make enough since to see if someone can help me on this. This would be real nice for me in use in a lot of scripts. Thanks Steve PHP / MySQL -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if statement
To Brad, Marek and Curt (and anybody who responds after this) Thank you so much for your help. This is going to help me out so much in a lot of my scripts. It will sure make them a little.Noa LOT more portable now. Thanks Steve At 11:26 AM 9/30/2003, you wrote: Steve Buehler wrote: [snip] $array=(/etc/bind/options.conf.wp,/etc/bind/rndc.conf.wp,/etc/bind/keys.conf.wp); if($k2b==$array){ do this1 }else{ do this2 } You are close. Check out in_array(). http://us4.php.net/in_array if (in_array($kb2, $array)) - Brad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php,up2date and mcrypt
I have a new RedHat Linux v.9 server that gets its php through 'up2date'. I want the ability to use mcrypt with php. I thought that I read somewhere a way to do this without having to recompile PHP. Can anybody point me to the right place or explain to me how to do this? Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] case insensitive sort
I am using the following function for a sort on an array. I hope someone can help me out here and let me know how to change it to make it a case insensitivie sort. Right now, it is case sensitive so the sort of the array will put the Capital letters first. Here are the results of the search: Buehler, Steve Buehler, Steve Teste, Teste a, a asdf, adsf asdf, asdf dsdlkj, sd Here is the code to sort: $GLOBALS[sortterm]=cont_name; usort($logins, cmp); function cmp ($a, $b) { GLOBAL $sortterm; return strcmp($a[$sortterm], $b[$sortterm]); } Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] case insensitive sort
Ok. Now I REALLY feel like an idiot. Thanks so much for your help. Steve At 05:46 PM 8/26/2003 +0200, you wrote: It right there under your nose: strcasecmp() Steve Buehler wrote: I am using the following function for a sort on an array. I hope someone can help me out here and let me know how to change it to make it a case insensitivie sort. Right now, it is case sensitive so the sort of the array will put the Capital letters first. Here are the results of the search: Buehler, Steve Buehler, Steve Teste, Teste a, a asdf, adsf asdf, asdf dsdlkj, sd Here is the code to sort: $GLOBALS[sortterm]=cont_name; usort($logins, cmp); function cmp ($a, $b) { GLOBAL $sortterm; return strcmp($a[$sortterm], $b[$sortterm]); } Thanks Steve -- This message has been scanned for viruses and dangerous content by the MailScanner at ow4, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Cookies on WinXP
I still can't figure something out. I am using WinXP/Apache 1.3.24/PHP 4.2.3 on my laptop and my cookies still don't work like they should. Hopefully someone can explain to me why. ? $cookhost=$_SERVER[HTTP_HOST]; header(Set-Cookie: aa_host=$cookhost;); setcookie (aa_host, $cookhost,0,/,$cookhost); setcookie (aa_host, localhost,0,/,localhost); setcookie ('aa_host', 'localhost',0,'/','localhost'); ? I can set the cookie with the header line with no problem, but either one of the setcookie lines will not set the cookie. Has anybody seen this? Does anybody know why this might be happening? BTW, no, I do not try to set all of these at once. Just showing the lines that I use. The header line and the first two setcookie lines work just fine on a RedHat 7.3/Apache 1.3.27/PHP 4.2.2 machine. Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cookies on WinXP
h. Just found out what was wrong. These are the specs that php.net says a setcookie function can have: setcookie ( string name [, string value [, int expire [, string path [, string domain [, int secure]) Well, if I take off the string domain part, it will work just fine. The problem is that I can't use the int secure. No biggy right now, but I might want to do that in the future. So the following works just fine now: setcookie(aa_host,$cookhost,'0','/'); Can anybody explain this now? BTW, I put on an actual domain name to my laptop and put that domain name in the string domain parameter and it still didn't work. Steve At 05:53 PM 7/31/2003 -0500, Steve Buehler wrote: I still can't figure something out. I am using WinXP/Apache 1.3.24/PHP 4.2.3 on my laptop and my cookies still don't work like they should. Hopefully someone can explain to me why. ? $cookhost=$_SERVER[HTTP_HOST]; header(Set-Cookie: aa_host=$cookhost;); setcookie (aa_host, $cookhost,0,/,$cookhost); setcookie (aa_host, localhost,0,/,localhost); setcookie ('aa_host', 'localhost',0,'/','localhost'); ? I can set the cookie with the header line with no problem, but either one of the setcookie lines will not set the cookie. Has anybody seen this? Does anybody know why this might be happening? BTW, no, I do not try to set all of these at once. Just showing the lines that I use. The header line and the first two setcookie lines work just fine on a RedHat 7.3/Apache 1.3.27/PHP 4.2.2 machine. Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cookies on WinXP
Something else I found out now. I think it was Cpt John W. Holmes (not sure though) that said I couldn't have a cookie as an array like this the following. So i am not sure if it is something that is going away or not. setcookie (admin_access[host], $cookhost,0,/,$cookhost); setcookie (admin_access[hostName], $hostName,0,/,$cookhost); But I found the following on the php site at: http://us3.php.net/manual/en/function.setcookie.php -snip- * Cookies names can be set as array names and will be available to your PHP scripts as arrays but seperate cookies are stored on the users system. Consider http://us3.php.net/manual/en/function.explode.phpexplode() or http://us3.php.net/manual/en/function.serialize.phpserialize() to set one cookie with multiple names and values. ?php // set the cookies setcookie (cookie[three], cookiethree); setcookie (cookie[two], cookietwo); setcookie (cookie[one], cookieone); // after the page reloads, print them out if (isset($_COOKIE['cookie'])) { foreach ($_COOKIE['cookie'] as $name = $value) { echo $name : $value br /\n; } } /* which prints three : cookiethree two : cookietwo one : cookieone */ ? -end snip I want to thank everybody for your help. Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] cookies on localhost WinXP
I have PHP/Apache/MySQL installed on my WinXP laptop. I do this so that I can write programs when not connected to the Internet (like when traveling). I am trying to set a cookie from the http://localhost site on my computer and it doesn't get set. Does this sound like something wrong in my php.ini file or my browsers? The program works fine on my RedHat/Apache/PHP/MySQL server. Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cookies on localhost WinXP
Sorry about that. Here is my code: if(isset($coach_access[login_id])){ }elseif(($lusername) ($lpassword)) { if(($lusername==me) AND ($lpassword==apass)){ $cookhost=$_SERVER[HTTP_HOST]; setcookie (coach_access[login_id], coach,0,/,$cookhost); }else{ $result=get_mysql_query(SELECT `login_id`,`cont_id` FROM `login_coach` where `login`='$lusername' AND `login_passwd`='$lpassword'); if($row=mysql_fetch_row($result)){ $cookhost=$_SERVER[HTTP_HOST]; setcookie (coach_access[login_id], $row[0],0,/,$cookhost); }else{ login_page(); } } }else{ login_page(); } I have put in the if(($lusername==me) AND ($lpassword==apass)) statement so that I can bypass the database lookup. I have also tried to just set a cookie on a page like this: ? setcookie (coach_access[login_id], coach,0,/,localhost); ? That doesn't seem to work either. I am using two browsers for testing. Netscape 7.1 and MS IE 6.0.2800. Netscape 7.1 has a cookie manager that will let me see all cookies that are set and it doesn't show up in there after I try to set it. Again, the program will set the cookie if run from my RedHat/Apache/PHP/MySQL server. Thanks Steve At 02:54 PM 7/30/2003 -0400, CPT John W. Holmes wrote: I have PHP/Apache/MySQL installed on my WinXP laptop. I do this so that I can write programs when not connected to the Internet (like when traveling). I am trying to set a cookie from the http://localhost site on my computer and it doesn't get set. Does this sound like something wrong in my php.ini file or my browsers? The program works fine on my RedHat/Apache/PHP/MySQL server. HOW are you trying to set it? What browser are you using? How do you know it's not set? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cookies on localhost WinXP
h. This seemed to set the cookie just fine. Does this mean that either localhost in the browser or Apache/PHP on a windows box has to set the cookie differently than on RedHat/Apache/PHP? I am going on vacation next week and need to keep working on a project that is working fine on the RedHat server, but not on my localhost. Basically, by this test, it sounds like on my laptop I have to use a header('Set-Cookie: ...); instead of setcookie (coach_access[login_id], coach,0,/,$cookhost); If so, I can't seem to get it to work with coach_access[login_id] as the cookie name. On another note, why would this work on the RedHat, but not the WinXP Apache/PHP? Thanks Steve At 12:34 PM 7/30/2003 -0700, Chris Shiflett wrote: Can you try this example? Let's call the file cookie_test.php ? if (!empty($_COOKIE['test'])) { echo The test cookie was sent by the browser\n; } else { header('Set-Cookie: test=true'); echo Trying to set the test cookie.br /\n; echo a href=\./cookie_test.php\Test/a\n; } ? I think it's best to start simple. Hope this helps. Chris = Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cookies on localhost WinXP
hm. Looks like on my localhost I can't seta cookie like this: setcookie (coach_access[login_id], coach,0,/,$cookhost); if I change it to just: setcookie (coach_access_login_id, coach,0,/,$cookhost); it will work. But then my script won't work without a lot of re-writing because it uses $coach_access[login_id] instead. Any help here? Am I just doing something wrong? I can't set it with the following either. header('Set-Cookie: coach_access[login_id]=coach'); But can as: header('Set-Cookie: coach_access_login_id_=coach'); but again, I would have to re-write a lot of script. Thanks Steve At 12:34 PM 7/30/2003 -0700, Chris Shiflett wrote: Can you try this example? Let's call the file cookie_test.php ? if (!empty($_COOKIE['test'])) { echo The test cookie was sent by the browser\n; } else { header('Set-Cookie: test=true'); echo Trying to set the test cookie.br /\n; echo a href=\./cookie_test.php\Test/a\n; } ? I think it's best to start simple. Hope this helps. Chris = Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cookies on localhost WinXP
That still won't work for me for some reason. I am just going to rewrite parts of the script to use a cookie name with out a [something] IN the name. I will rename it to ca_id or something like that. Thanks for your help Steve At 01:38 PM 7/30/2003 -0700, you wrote: --- Steve Buehler [EMAIL PROTECTED] wrote: header('Set-Cookie: coach_access[login_id]=coach'); Well, that is ugly, but it is actually a valid name. The name of a cookie, as described by http://wp.netscape.com/newsref/std/cookie_spec.html, is a sequence of characters excluding semi-colon, comma and white space. Now, when a browser sends this, it will be something like this: Cookie: coach_access[login_id]=coach PHP, in an effort to interpret this coach_access[login_id] as a valid variable name, will actually translate it into an array, so this will be similar to: $_COOKIE['coach_access']['login_id'] = 'coach'; Is this what you mean to do? It is best (in my opinion) to stick with normal names for your cookies - names that would make valid variable names. Hope that helps. Chris = Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by the MailScanner at ow4, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cookies on localhost WinXP
At 04:37 PM 7/30/2003 -0400, you wrote: You'd be better of if you re-wrote your code to make it correct, but you could just put: $coach_access['login_id'] = $_COOKIE['coach_access[login_id]']; I guess I will rewrite my code. I still can't understand it working on the RedHat and not the Windows, but that's programming. The way it was, it was keeping it in an array for me because I would have other cookies like: coach_access[team] Please don't tell us that you're storing login IDs in a cookie and actually depending upon them for anything?? Yes, but not the type you are thinking of. It is just the name of a column in a table. I haven't figured out how to use session id's yet. Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] check for duplicate databases
I have a program that I am writing in PHP/MySQL. I have made some upgrades to the database and like an idiot, forgot to write down the changes or to make the changes in several other databases for the other clients that are using the program also. What I am trying to do is to have a program, (preferably in PHP) that will look at the structure of the main database that I changed, then it will check the other databases to make sure that the structure is identical and if not, it will change them to make them identical. Is there a program already out there that would do this? Or is there someone out there that can help me to write it? Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] strip white space
I am not sure how to go about this and hope that someone can help here. I have a variable like the following: $team_name=BV Stars Black; it has two spaces between the words Stars and Black. What I am trying to do is to take this variable, check for and strip the following: 1. Leading spaces 2. Ending spaces 3. Double (or more) spaces in the variable leaving only one space between words. Does php have any built in function that I can not find that will do this? Thank You in Advance Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strip white space
Figures, right after I emailed this, I found it after looking for over an hour. Here is the result and some people had emailed me parts of this: $team_name= BV Stars Black; wsstrip($team_name); function wsstrip($str) { $str=ereg_replace (' +', ' ', trim($str)); $str=ereg_replace([\r\t\n],,$str); } echo $team_name; // Would produce the following line BV Stars Black Thank you all for helping on this. I found the answer by David Gillies at: http://us4.php.net/trim Another question is this. The in wsstrip($str). Does that mean that it takes the input to the function as Global and changes it Globally? I am assuming that because that is what the whole function seems to do for me. Thanks again everybody Steve At 11:49 AM 7/2/2003 -0500, you wrote: I am not sure how to go about this and hope that someone can help here. I have a variable like the following: $team_name=BV Stars Black; it has two spaces between the words Stars and Black. What I am trying to do is to take this variable, check for and strip the following: 1. Leading spaces 2. Ending spaces 3. Double (or more) spaces in the variable leaving only one space between words. Does php have any built in function that I can not find that will do this? Thank You in Advance Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by the MailScanner at ow4, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cannot get php through apache to write to my home dir on shared server
Another option might be to create a directory in your web space to hold your file and open up just that directory as 777. Steve At 08:17 AM 6/26/2003 -0400, you wrote: From: frank reeves [EMAIL PROTECTED] I have an account on shared server and am trying to write a logfile (a dump of an email which i use mail() to send) to a logfile in my home dir. This logfile will grow with all emails send by my app and will thus give me an archive of sorts. However, because php is executed through apache as user nobody it does not have permission to write to my linux home dir (fopen(log.file,a)) fails with permission denied). I dont want to open my home dir to the world to allow this operation but I also dont want to write my log to /var/tmp as user nobody. Does anyone know how I can get php to write as me to my home dir ? You can only get this with PHP as a CGI. I suppose i could write a shell script and have my app call this but that seems a bit convoluted. Other option is to read/write the file over FTP, since you'll be able to log in as you. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by the MailScanner at ow4, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] greater than question
Hopefully someone has done this and has an easy answer. I know that I can do what I need with a LOT of code, but am trying to come up with something a little shorter that 50 lines of code. Here is the problem. I have 4 variables that each have a number in them. I need to find which one has the highest number. I then just need to do something with that number. If two or more have the same highest number, than I need to do the same thing with them. So.. $a=5 $b=1 $c=5 $d=3 $a and $c are the highest number. I need to run something on those two variables. Thanks in Advance Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sorting an array
I am having problems sorting a multi-dimensional array. I am hoping that somebody can help me figure out what I am doing wrong. It should sort on the field than on the fac. Here is my code: -start code- $sortterm; get_locations(); function cmp ($a, $b) { GLOBAL $sortterm; return strcmp($a[$sortterm], $b[$sortterm]); } function get_locations(){ GLOBAL $sortterm; $i=1; while(($row=mysql_fetch_object($result))){ $locs[$i][loc_id]=$row-loc_id; $locs[$i][fac]=$row-fac; $locs[$i++][field]=$row-field; } reset($locs); $sortterm=field; usort($locs, cmp); reset($locs); $sortterm=fac; usort($locs, cmp); reset($locs); while (list ($key, $value) = each ($locs)) { echo $locs[$key][loc_id]., .$locs[$key][fac]., .$locs[$key][field].br\n; } } -end code- Here is how it comes out when run: 12, Johnson County Community College, C 11, Johnson County Community College, B 13, Johnson County Community College, D 14, Johnson County Community College, E 10, Johnson County Community College, A 8, Johnson County Girls Athletic Assoc, D 6, Johnson County Girls Athletic Assoc, B 7, Johnson County Girls Athletic Assoc, C 5, Johnson County Girls Athletic Assoc, A 9, Shawnee Civic Center, 1 1, Tomahawk Sports Dome, 1 2, Tomahawk Sports Dome, 2 3, Tomahawk Sports Dome, 3 4, Tomahawk Sports Dome, 4 As you can see, the fac is sorted correctly, but the field isn't. Thanks Steve -- This message has been scanned for viruses and dangerous content by the MailScanner at ow5, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] delete from array
Not sure if there is a function that I missed when I did a search on this at php.net, but here is the situation: I have an array that looks something like this: 12:00:00 12:05:00 12:10:00 12:15:00 Bascially, it just has all times in it for a day in 5 minute increments. This is more of a template array for other things that I am doing. How do I delete a specific time out of the array or how do I delete a range of times out of the array? I would like to be able to delete 12:05:00 but if I want, delete a range like 12:05:00 to 12:10:00. I have other arrays that do NOT have numbers (times) in them and would like to be able to delete a specific item out of them too. Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] testing for 0
I have a form that has input for minutes. My problem is that I am trying to test to see if the field is blank or not and if they enter a 0 (zero), my test always show it as blank. I have tried !$timemb and !is_numeric($timemb). Thank You Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] testing for 0
There we go. Thank You so much. I also found that I had another error in my script and !is_numeric($timemb) did work after all. Steve At 10:41 AM 2/28/2003 -0800, you wrote: See isset() and empty() -Original Message- From: Steve Buehler [mailto:[EMAIL PROTECTED] Sent: Friday, February 28, 2003 10:29 AM To: PHP Subject: [PHP] testing for 0 I have a form that has input for minutes. My problem is that I am trying to test to see if the field is blank or not and if they enter a 0 (zero), my test always show it as blank. I have tried !$timemb and !is_numeric($timemb). Thank You Steve -- 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] sorting multi-dimensional array
This would work (and might still if I changed things), but the part that calls it is in another function also. Steve At 02:35 PM 2/20/2003 +, you wrote: -Original Message- From: Steve Buehler [mailto:[EMAIL PROTECTED]] Sent: 20 February 2003 05:25 Ahhhfinally did it with usort. Thanks to those who gave me that answer. Now here is a question for that. I would like to re-use my cmp function without having to rewrite it each time. Can it be written so that instead of divname being hard coded, that I can pass the sort field in the usort call. That way, I can either sort by divname and do another sort by divid for seperate results without having to have multiple cmp type functions. I hope that made since. Lack of sleep isn't good when programming. Below is my sorting code. function cmp ($a, $b) { return strcmp($a[divname], $b[divname]); } usort($array, cmp); Well, the only obvious way I can think of is to use a global variable to set the array index you want to sort by -- something like: function cmp ($a, $b) { global $field; return strcmp($a[$field], $b[$field]); } $field = divname; usort($array, cmp); $field = divid; usort($array, cmp); I haven't tested this, but I think it should work...! Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sorting multi-dimensional array part 2
The following Seems to work. But does anybody know how reliable this might be? Baically, I have a multi-dimensional array and want to sort by one column first, than another than another. Right now, I am using a temporary table in MySQL, but want to speed things up if possible. The command there would be to ORDER BY column1,column3,column2 in my select statement. If I kept it in a multi-dimensional array, would the following be reliable 1,b,a 2,a,c 1,e,b function dostuff(){ usort($array, column1); usort($array, column3); usort($array, column2); // I would be doing any of my outputting here after the sorting. } function column1 ($a, $b) { return strcmp($a[column1name], $b[column1name]); } function column2 ($a, $b) { return strcmp($a[column2name], $b[column2name]); } function column3 ($a, $b) { return strcmp($a[column3name], $b[column3name]); } output should be 1,b,a 1,e,b 2,a,c Yes, this is only 3 rows in this array, but the live one would have hundreds or thousands in it. I do hope that you experts understand what I am trying to do here. The above problem is why I was wondering also if I could have the function collect one more variable so that I could call it with the column name that I want to sort by. So that I don't have to have 3 different functions to do the job. Anybody know who I could go about doing that? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sorting multi-dimensional array
Ahhhfinally did it with usort. Thanks to those who gave me that answer. Now here is a question for that. I would like to re-use my cmp function without having to rewrite it each time. Can it be written so that instead of divname being hard coded, that I can pass the sort field in the usort call. That way, I can either sort by divname and do another sort by divid for seperate results without having to have multiple cmp type functions. I hope that made since. Lack of sleep isn't good when programming. Below is my sorting code. function cmp ($a, $b) { return strcmp($a[divname], $b[divname]); } usort($array, cmp); ThanksSteve At 01:08 PM 2/13/2003 -0600, you wrote: PHP version 4.2.2 I sure hope that I can get somebody to help me figure this one out. I have a multi-dimensional array that I need to sort. Here is the code that I have so far: function gettourndivs(){ GLOBAL $sea_id,$PHP_SELF; $result=get_mysql_query(SELECT * FROM `games` WHERE sea_id = '$sea_id' AND deleted != '1' GROUP BY div_id ORDER BY `type`); $i=0; while(($row=mysql_fetch_object($result))){ $divname=getdivisionname($row-div_id); $array[$i][divid]=$row-div_id; $array[$i][divname]=$divname; $array[$i++][type]=$row-type; } reset($array); // I need it to sort the array on the divname field here before going to the output. // and instead of it doing it by the $ii, it should ouput in the correct alphabetic order of the divname field. for($ii=0;$ii$i;$ii++){ echo $ii, . $array[$ii][divid].,; echo $array[$ii][divname].,; echo $array[$ii][type] . br\n; } } Here is the output: and I need to sort it on the third field so that it would be in alphabetic order, but keeping the other items on that line when it moves to the correct position. 0,91,Mens Open ,0 1,20,U11 Boys ,0 2,65,U17-19 Boys ,0 3,30,U12 Boys Premiership ,0 4,69,U16-17 Girls ,0 5,34,U12 Girls Premiership ,0 6,29,U12 Boys ,1 7,78,U19 Girls ,1 8,100,Mens O-30 ,1 9,11,U10 Boys ,1 10,47,U14 Boys ,1 11,56,U15 Boys ,1 12,24,U11 Girls ,1 13,42,U13 Girls ,1 14,60,U15 Girls ,1 15,35,U12 Girls UEFA Cup ,1 16,53,U14 Girls UEFA Cup ,1 17,52,U14 Girls Premiership ,1 18,38,U13 Boys ,2 19,110,U16 Boys ,2 Is this possible? I have looked at array_multisort and unless I am reading it wrong, it doesn't look like it would do what I needed. Thank You Steve -- 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] sorting multi-dimensional array
PHP version 4.2.2 I sure hope that I can get somebody to help me figure this one out. I have a multi-dimensional array that I need to sort. Here is the code that I have so far: function gettourndivs(){ GLOBAL $sea_id,$PHP_SELF; $result=get_mysql_query(SELECT * FROM `games` WHERE sea_id = '$sea_id' AND deleted != '1' GROUP BY div_id ORDER BY `type`); $i=0; while(($row=mysql_fetch_object($result))){ $divname=getdivisionname($row-div_id); $array[$i][divid]=$row-div_id; $array[$i][divname]=$divname; $array[$i++][type]=$row-type; } reset($array); // I need it to sort the array on the divname field here before going to the output. // and instead of it doing it by the $ii, it should ouput in the correct alphabetic order of the divname field. for($ii=0;$ii$i;$ii++){ echo $ii, . $array[$ii][divid].,; echo $array[$ii][divname].,; echo $array[$ii][type] . br\n; } } Here is the output: and I need to sort it on the third field so that it would be in alphabetic order, but keeping the other items on that line when it moves to the correct position. 0,91,Mens Open ,0 1,20,U11 Boys ,0 2,65,U17-19 Boys ,0 3,30,U12 Boys Premiership ,0 4,69,U16-17 Girls ,0 5,34,U12 Girls Premiership ,0 6,29,U12 Boys ,1 7,78,U19 Girls ,1 8,100,Mens O-30 ,1 9,11,U10 Boys ,1 10,47,U14 Boys ,1 11,56,U15 Boys ,1 12,24,U11 Girls ,1 13,42,U13 Girls ,1 14,60,U15 Girls ,1 15,35,U12 Girls UEFA Cup ,1 16,53,U14 Girls UEFA Cup ,1 17,52,U14 Girls Premiership ,1 18,38,U13 Boys ,2 19,110,U16 Boys ,2 Is this possible? I have looked at array_multisort and unless I am reading it wrong, it doesn't look like it would do what I needed. Thank You Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Dropping Tables
I have researched this and can't find an answer. Maybe I am just looking in the wrong places or not putting the correct keywords into the search engines. So any help would be greatly appreciated. I am using MySQL with PHP. I have some PHP scripts that create tables in a database that are meant to be temporary but can't actually create TEMPORARY tables to do the job. That isn't the problem in itself. The problem is that sometimes if the script is stopped prematurely, it doesn't get to the drop table function in it. All of the tables that are created for this start with an a and follow with a random number. What I need to do is to create a script that I can run that will delete all tables that start with an a in the database. Again, since the table name is randomly generated except for the starting a, I will need the script to find them and drop them. Has anybody done this before? I would sure appreciate some help here. Thanks Steve -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Dropping Tables
Thank You so much John and Michael. SHOW TABLES LIKE 'a%' worked like a charm and was exactly what I was looking for. I guess my searches were using the wrong keywords. Kind of figures. Some of my searches were turning up 1000's of results. How do you know whether it's an active a* table or not? Will you be dropping a table that someone is actually using? I will be shutting down the script at a certain time each day to run some things like this for maintenance. So none of these should be active and if they are, it won't hurt anything. The customer can just wait until the maintenance time is over. Approximately 10 mintues. At 10:21 PM 12/29/2002 -0500, you wrote: Basically just do a a php script the sends the sql show tables; Then do a strchr() to see if a is the first letter in the resuts and if so do a delete table. Just yo play safe do a dump of your db first. Or even better, use SHOW TABLES LIKE 'a%' to just get the a* tables and drop each one. How do you know whether it's an active a* table or not? Will you be dropping a table that someone is actually using? ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] copying tables
Using PHP and MySQL. I have looked and can't find the answer to this problem. What I am trying to do is to copy a mysql table to a new table name in a PHP script. The reason for this is to keep the original table the way it is and editing the copy. Now, I know that I can go through a loop reading the old table and putting it into the new table, but is there an easier way that would just duplicate or copy the mysql table to a new table name? The reason for all of this is my script will create the original table (a temporary table), populate it, delete what needs to be deleted out of it, then I need a copy of that table for a subroutine that will be running multiple times and need the same information to start off with. Thanks for any help Steve -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Expert Paid Help Needed
I have been working on a program and have come up to a block. A lot of people on the PHP list have been able to help me for free already. But what I have left to do would probably be to much to ask for someone to do for free. Are their any EXPERT PHP (with MySQL) programers out there that would be willing to help? If so, please send me privately the following: Name: Email: City: State: Country (USA preferred): Phone Number: Hourly Rate or (Work for Trade) Server space requirements: Somebody in the Kansas City Missouri/Kansas area would be preferred, just because I would be able to meet with you to discuss this. But it is NOT a requirement. This project will require me to at least talk with you on the phone because it would just take a lot less time than trying to email everything. We can also work out a trade for server space instead of payments for someone if that would help. We have some people that work for us JUST for web/server space. Steve Buehler IT Director Internet Business Applications, LLC 11638 W. 90th St. Overland Park, Kansas 66214 913-438-3074 x 7 steve @ vespro.com -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] query question
I have been trying to figure something out here and am having problems. What I have is a problem with outputting some info in a table. Here is what I have and the problem is in the getstart_end function. This should be a working copy if you want to run it and I have put in some sample times. // $dend is actually how many hours from the start time. It is not a clock time in itself. // So that would mean that a $dstart of 07:00:00 and a $dend of 6:00:00 would actually make // the $dend time 13:00:00 (1pm) createtemptable(); populatetemptable(); $dstart=07:00:00; $dend=6:00:00; deletetimes($dstart,$dend); $dstart=18:00:00; $dend=3:40:00; deletetimes($dstart,$dend); getstart_end(); droptemptable(); // This just creates the table and works function createtemptable(){ $result=mysql_query(CREATE TEMPORARY TABLE IF NOT EXISTS aplayabletimes (`min` time ) TYPE=MyISAM); } // This just populates the table in 5 minute increments and works function populatetemptable(){ for($i=0;$i1435;$i=$i+5){ $minutes=$minutes+5; if($minutes==60){ $minutes=00; $hours=$hours+1; } $time=$hours:$minutes:$seconds; $result=mysql_query(INSERT INTO aplayabletimes (min) values (\$time\)); } } / / This deletes times from the table and works function deletetimes($dstart,$dend){ list($hours,$minutes,$seconds)=split(:,$dstart); list($houre,$minutee,$seconde)=split(:,$dend); $minutee=$minutee+$minutes; $houre=$houre+$hours; if($minutee=60){$minutee=$minutee-60;$houre=$houre=1;} $dend=$houre:$minutee:00; $result=mysql_query(DELETE FROM aplayabletimes WHERE min '$dstart' AND min '$dend'); } // Here is where I am having problems. I need it to give me the start time // And the end time. There can be gaps in the table for times. // It starts at 00:00:00 and goes to 23:55:00 (in 5 minute increments). Once time frames are deleted, // it could have times from (example) 07:00:00 - 13:00:00 and another time frame from // 18:00:00 to 21:40:00. What I need it to do is to output like this: // First Start Time - First End Time newline // Next Start Time - Next End Time newline // etc... (because there can be multiple start and end times) // To determine if there is a new time block, there would be more than a 5 minute gap between // the end of one time block and the start of another time block. // The $i is just to grab the first block and I know there has to be a better way then this to do that too. function getstart_end(){ $result=mysql_query(SELECT * FROM aplayabletimes ORDER BY min); while(($row=mysql_fetch_object($result))){ if(!$i){ echo $row-min . - ; }else{ } $i++; } } // This just deletes the temporary table function droptemptable(){ $result=mysql_query(DROP TEMPORARY TABLE playabletimes); } Thank You in advance for any help that you can give me on the problem. Steve -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] query question
Thanks for the help, but that is not actually producing the desired results either. This returns the following results: 00:00:05 - 00:00:05 00:00:05 - 5 00:00:05 - 10 00:00:05 - 15 00:00:10 - 20 00:00:10 - 25 00:00:10 - 30 00:00:10 - 35 00:00:15 - 40 00:00:15 - 45 00:00:15 - 50 00:00:15 - 55 00:00:20 - 60 00:00:20 - 65 I am not going to post all of them. :) Here is the code that is now in the getstart_end() function. I had to change the line that you had because the 5 minutes would give an error. I just took out the minutes part. $tmp = $i+5 minutes; // add 5 minutes to $i, implement it yourself function getstart_end(){ $result=mysql_query(SELECT * FROM aplayabletimes ORDER BY min); while(($row=mysql_fetch_object($result))){ if(!$i){ echo $row-min . - ; $i=$row-min; }else{ $tmp = $i+5; // add 5 minutes to $i, implement it yourself if($tmp != $row-min) { // there is a gap echo $i .br\n; // print previous time as end echo $row-min . - ; // print this time as new start } $i = $tmp; // keep this new time for next loop } } echo $row-min .br\n; // print last row } At 07:09 PM 11/14/2002 +0100, you wrote: Untested, but should work Steve Buehler wrote: function getstart_end(){ $result=mysql_query(SELECT * FROM aplayabletimes ORDER BY min); while(($row=mysql_fetch_object($result))){ if(!$i){ echo $row-min . - ; $i=$row-min; }else{ $tmp = $i + 5 minutes // add 5 minutes to $i, implement it yourself if($tmp != $row-min) { // there is a gap echo $i .br\n; // print previous time as end echo $row-min . - ; // print this time as new start } $i = $tmp; // keep this new time for next loop } } echo $row-min .br\n; // print last row } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] query question
Ok. That output was my fault. I had an error in one of my other functions. I needed to set $hours to 00 to start with in my populatetemptable() function. Now my output is: 00:05:00 - 00:05:00 00:05:00 - 00:10:00 00:10:00 - 00:15:00 00:10:00 - 00:20:00 00:15:00 - 00:25:00 00:15:00 - 00:30:00 Problem is that it isn't giving me just the start and end times. I will keep working on it. Thanks Steve At 12:48 PM 11/14/2002 -0600, you wrote: Thanks for the help, but that is not actually producing the desired results either. This returns the following results: 00:00:05 - 00:00:05 00:00:05 - 5 00:00:05 - 10 00:00:05 - 15 00:00:10 - 20 00:00:10 - 25 00:00:10 - 30 00:00:10 - 35 00:00:15 - 40 00:00:15 - 45 00:00:15 - 50 00:00:15 - 55 00:00:20 - 60 00:00:20 - 65 I am not going to post all of them. :) Here is the code that is now in the getstart_end() function. I had to change the line that you had because the 5 minutes would give an error. I just took out the minutes part. $tmp = $i+5 minutes; // add 5 minutes to $i, implement it yourself function getstart_end(){ $result=mysql_query(SELECT * FROM aplayabletimes ORDER BY min); while(($row=mysql_fetch_object($result))){ if(!$i){ echo $row-min . - ; $i=$row-min; }else{ $tmp = $i+5; // add 5 minutes to $i, implement it yourself if($tmp != $row-min) { // there is a gap echo $i .br\n; // print previous time as end echo $row-min . - ; // print this time as new start } $i = $tmp; // keep this new time for next loop } } echo $row-min .br\n; // print last row } At 07:09 PM 11/14/2002 +0100, you wrote: Untested, but should work Steve Buehler wrote: function getstart_end(){ $result=mysql_query(SELECT * FROM aplayabletimes ORDER BY min); while(($row=mysql_fetch_object($result))){ if(!$i){ echo $row-min . - ; $i=$row-min; }else{ $tmp = $i + 5 minutes // add 5 minutes to $i, implement it yourself if($tmp != $row-min) { // there is a gap echo $i .br\n; // print previous time as end echo $row-min . - ; // print this time as new start } $i = $tmp; // keep this new time for next loop } } echo $row-min .br\n; // print last row } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] query question
Not sure if I wrote and thanked you or not, but this did the trick. THANK YOU THANK YOU THANK YOU!!! Steve At 08:41 PM 11/14/2002 +0100, Marek Kilimajer wrote: This is checked: function getstart_end(){ $result=mysql_query(SELECT * FROM aplayabletimes ORDER BY min); while(($row=mysql_fetch_object($result))){ if(!$i){ echo $row-min . - ; $i=$row-min; } else { list($houre,$minutee,$seconds)=explode(:,$i); $minutee=$minutee+5; if($minutee=60){$minutee=$minutee-60;$houre=$houre+1;} $tmp = implode(':',array(str_pad($houre,2,'0',STR_PAD_LEFT) ,str_pad($minutee,2,'0',STR_PAD_LEFT),'00')); if($tmp != $row-min) { // there is a gap //echo $row-min . != $tmpbr; echo $i .br\n; // print previous time as end echo $row-min . - ; // print this time as new start } $i = $row-min; // keep this new time for next loop } //echo $i. - $tmp --tmpbr\n; //echo $row-min.br\n; } echo $i .br\n; // print last row } Steve Buehler wrote: Ok. That output was my fault. I had an error in one of my other functions. I needed to set $hours to 00 to start with in my populatetemptable() function. Now my output is: 00:05:00 - 00:05:00 00:05:00 - 00:10:00 00:10:00 - 00:15:00 00:10:00 - 00:20:00 00:15:00 - 00:25:00 00:15:00 - 00:30:00 Problem is that it isn't giving me just the start and end times. I will keep working on it. Thanks Steve At 12:48 PM 11/14/2002 -0600, you wrote: Thanks for the help, but that is not actually producing the desired results either. This returns the following results: 00:00:05 - 00:00:05 00:00:05 - 5 00:00:05 - 10 00:00:05 - 15 00:00:10 - 20 00:00:10 - 25 00:00:10 - 30 00:00:10 - 35 00:00:15 - 40 00:00:15 - 45 00:00:15 - 50 00:00:15 - 55 00:00:20 - 60 00:00:20 - 65 I am not going to post all of them. :) Here is the code that is now in the getstart_end() function. I had to change the line that you had because the 5 minutes would give an error. I just took out the minutes part. $tmp = $i+5 minutes; // add 5 minutes to $i, implement it yourself function getstart_end(){ $result=mysql_query(SELECT * FROM aplayabletimes ORDER BY min); while(($row=mysql_fetch_object($result))){ if(!$i){ echo $row-min . - ; $i=$row-min; }else{ $tmp = $i+5; // add 5 minutes to $i, implement it yourself if($tmp != $row-min) { // there is a gap echo $i .br\n; // print previous time as end echo $row-min . - ; // print this time as new start } $i = $tmp; // keep this new time for next loop } } echo $row-min .br\n; // print last row } At 07:09 PM 11/14/2002 +0100, you wrote: Untested, but should work Steve Buehler wrote: function getstart_end(){ $result=mysql_query(SELECT * FROM aplayabletimes ORDER BY min); while(($row=mysql_fetch_object($result))){ if(!$i){ echo $row-min . - ; $i=$row-min; }else{ $tmp = $i + 5 minutes // add 5 minutes to $i, implement it yourself if($tmp != $row-min) { // there is a gap echo $i .br\n; // print previous time as end echo $row-min . - ; // print this time as new start } $i = $tmp; // keep this new time for next loop } } echo $row-min .br\n; // print last row } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] lynx and crontab
Info: Lynx has nothing to do with supporting or not supporting PHP. PHP is not a client side language, it is a server side language, so the browser that you use does not even know or need to know that it is running PHP. Solutions (hopefully): Take out the space between the - and the word dump. Your command should be: lynx -dump http://www.mysite.com/test.php Steve At 01:11 PM 10/15/2002 +0100, you wrote: my isp lets me control crontab so i've been trying to run a php script every 30 mins. the command is like this: lynx - dump http://www.mysite.com/test.php which gives the error lynx: Start file could not be found or is not text/html or text/plain what do i telll my isp to do to get lynx to supprt .php files? (i get a better response from them if i tell them exactly what to do ;-) ) -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: time stamp
Thank you David Lopez and David Robley. That was what I was looking for. Here is how I used it. $date=getlastupdatetime(array(team_id = $team_id, season = $season, div_id = $div_id)); echo $date; function getlastupdatetime($a){ extract($a); $result=mysql_query (SELECT MAX(UNIX_TIMESTAMP(updated)) as epoch_time FROM games WHERE (hteam='$team_id' OR vteam='$team_id') AND sea_id = '$season' AND div_id = '$div_id'); $date = mysql_result ($result, 0, 0); if(!$date){ return; }else{ return date(l dS of F Y h:i:s A O,$date); } } Which gives me the following line: Wednesday 28th of August 2002 06:00:06 PM -0500 I was doing the following which was a bit more code and I wanted to use a little less code. Plus it should make the search and processing quicker. $date=getlastupdatetime(array(team_id = $team_id, season = $season, div_id = $div_id)); echo $date; function getlastupdatetime($a){ extract($a); $result=mysql_query(SELECT updated FROM games WHERE (hteam='$team_id' OR vteam='$team_id') AND sea_id = '$season' AND div_id = '$div_id'); $b=0; while(($row=mysql_fetch_object($result))){ if($row-updated $b){ $b=$row-updated; } } $date=$b; $year=substr($date,0,4); $month=substr($date,4,2); $day=substr($date,6,2); $hour=substr($date,8,2); $min=substr($date,10,2); if($hour = 12){$ap = pm;}else{$ap = am;} if($hour 12){$hour = $hour-12;} if(!$month){ return nothing; }else{ return $month-$day-$year $hour:$min $apbr; } */ } Thank Again Steve At 08:28 AM 8/28/2002 -0700, you wrote: Steve Try: SELECT MAX(field_timestamp) from table1; David -Original Message- From: Steve Buehler [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 27, 2002 5:21 PM To: mysql; PHP Subject: time stamp I am using PHP with MySQL and have a timestamp field in my db table. What would be the easiest way to get the newest timestamp out of the db? Thanks in Advance Steve -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] time stamp
I am using PHP with MySQL and have a timestamp field in my db table. What would be the easiest way to get the newest timestamp out of the db? Thanks in Advance Steve -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: filling an array(2)
That did the trick. Thank you SO MUCH. Steve At 03:48 AM 7/29/2002 -0500, Richard Lynch wrote: h. Ok. Can somebody explain this one? Why won't it work correctly? for($m=1;$m=5;$m++){ $div_idd[$m]=${'row-sub' . $m . 'd'}; } Can it not be done with a 3 parter? The columns in the table that $row gets, are sub1d, sub2d, sub3d, sub4d and sub5d. Or is it the - that is messing it up? I have tried escaping them row\-\sub, but that didn't work. What would I search for on the PHP site or where are directions located that tells me how to use this type of putting a variable together. It makes it hard to search for it if I don't know what it is called. You want to search for variable variables At a guess, you need: $div_idd[$m] = $row-{'sub' . $m . 'd'}; For sure, you need to get the subXd part together before you get the - or the $row involved. -- Like Music? http://l-i-e.com/artists.htm I'm looking for a PRO QUALITY two-input sound card supported by Linux (any major distro). Need to record live events (mixed already) to stereo CD-quality. Soundcard Recommendations? Software to handle the recording? Don't need fancy mixer stuff. Zero (0) post-production time. Just raw PCM/WAV/AIFF 16+ bit, 44.1KHz, Stereo audio-to-disk. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Q:What is the easiest way to test my PHP+Html pages?
Install PHP on your desktop. You will need a web server too. I use PHP/MySQL/Apache on my Laptop, Desktop, Servers and workstations. Steve At 07:56 AM 7/27/2002 -0700, you wrote: I guess I should reiterate; What is the easiest way to test locally (on my desktop) without having to upload? Thanks,-Marcus Tim Luoma wrote: Marcus Unlimited wrote: So what is the absolute simplest and easiest path to open my .html pages with some php mysql in em. and see them as they will work on the web??? To quote a friend of mine: The only way to see how this will work is to see how this will work. Get some server space with the software installed, and play with it. There's free space available for this purpose at http://www.evolt.org and http://f2o.org/ and I'm sure others as well, but it's best if you can setup a little 'sandbox' to play in on the actual machine that you are using so that you are testing on the same versions, same config that you will be running on. TjL -- || Marcus Unlimited http://marcusunlimited.com Multimedia Internet Design and Education || --- Also visit: - http://www.chromaticus.com - http://ampcast.com/chromaticus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] filling an array(2)
h. Ok. Can somebody explain this one? Why won't it work correctly? for($m=1;$m=5;$m++){ $div_idd[$m]=${'row-sub' . $m . 'd'}; } Can it not be done with a 3 parter? The columns in the table that $row gets, are sub1d, sub2d, sub3d, sub4d and sub5d. Or is it the - that is messing it up? I have tried escaping them row\-\sub, but that didn't work. What would I search for on the PHP site or where are directions located that tells me how to use this type of putting a variable together. It makes it hard to search for it if I don't know what it is called. Thanks Steve -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] filling an array
Thank You Andrey, Matt and Martin for your answers. To summarize for everyone, here are the answers: From Andrey (tested, works): for($m=1;$m=5;$m++){ $div_id[$m]=${'divid'.$m}; } From Matt: for($m=1;$m=5;$m++){ $varName = 'divId' . $m; $div_id[$m]=${$varName} } From Martin: for($i =0; $i 5; $i++) { $offset = $m + 1; $divid[$m] = $div_id{$offset}; } At 10:55 PM 7/26/2002 +0300, you wrote: - Original Message - From: Steve Buehler [EMAIL PROTECTED] To: PHP [EMAIL PROTECTED] Sent: Friday, July 26, 2002 10:48 PM Subject: [PHP] filling an array Can anyone tell me what I am doing wrong? I am essentially trying to do this: $divid[1] = $div_id1; $divid[2] = $div_id2; $divid[3] = $div_id3; $divid[4] = $div_id4; $divid[5] = $div_id5; But I was looking for a tighter way, like the following (which does not work): for($m=1;$m=5;$m++){ $div_id[$m]=$divid$m; } Can anybody tell me how to do this in a for statement? Thanks In Advance Steve -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] filling an array(2)
Ok. That makes since. Thanks Steve At 04:20 PM 7/26/2002 -0500, you wrote: var names can only be letters, numbers, and underscores. Jim Grill Support Web-1 Hosting http://www.web-1hosting.net - Original Message - From: Steve Buehler [EMAIL PROTECTED] To: PHP [EMAIL PROTECTED] Sent: Friday, July 26, 2002 3:53 PM Subject: [PHP] filling an array(2) h. Ok. Can somebody explain this one? Why won't it work correctly? for($m=1;$m=5;$m++){ $div_idd[$m]=${'row-sub' . $m . 'd'}; } Can it not be done with a 3 parter? The columns in the table that $row gets, are sub1d, sub2d, sub3d, sub4d and sub5d. Or is it the - that is messing it up? I have tried escaping them row\-\sub, but that didn't work. What would I search for on the PHP site or where are directions located that tells me how to use this type of putting a variable together. It makes it hard to search for it if I don't know what it is called. Thanks Steve -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] filling an array
Can anyone tell me what I am doing wrong? I am essentially trying to do this: $divid[1] = $div_id1; $divid[2] = $div_id2; $divid[3] = $div_id3; $divid[4] = $div_id4; $divid[5] = $div_id5; But I was looking for a tighter way, like the following (which does not work): for($m=1;$m=5;$m++){ $div_id[$m]=$divid$m; } Can anybody tell me how to do this in a for statement? Thanks In Advance Steve -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ensim with PHP and MySQL
I have been running several servers using the ensim software and have had no problem with PHP and/or MySQL. Well, none that was the fault of PHP or MySQL. Neither one should give you a problem upgrading, except that you will have to edit the httpd_vwh.conf file by hand since both PHP and MySQL (if they upgrade the httpd.conf file) don't know it is now httpd_vwh.conf. Steve At 12:56 PM 6/24/2002 -0400, you wrote: Has anyone ever used Ensim on their server with PHP and MySQL. I am looking at purchase Ensim to management my web sites. It looks like a great product, but because it is embedded into RedHat, I am worried about its flexible. If I want to upgrade my PHP, MySQL or Apache on it. It doesn't look like it is that easy. In short I just want to know if anyone out there is using Ensim and if so, do you like it. Thanks, Mark. -- _ Mark McCulligh, Application Developer / Analyst Sykes Canada Corporation www.SykesCanada.com (888)225-6824 ex. 3262 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Extracting Variables
I hope that someone will be kind enough to help me on this. I have some variables on a page that are dynamic. I can run this to view the variables (from a POST) for testing: Foreach($HTTP_POST_VARS as $key=$value) echo($key = $valuebr); and the results are: -results- team_number_1 = 5 sub1_1 = 10 sub2_1 = B team_number_2 = 7 sub1_2 = 10 sub2_2 = B team_number_3 = 29 sub1_3 = 10 sub2_3 = B team_number_4 = 23 sub1_4 = 10 sub2_4 = B team_number_5 = 8 sub1_5 = 10 sub2_5 = B team_number_6 = 20 sub1_6 = 10 sub2_6 = B team_number_7 = 9 sub1_7 = 10 sub2_7 = B team_number_8 = 11 sub1_8 = 10 sub2_8 = B i = 8 action = Update -end results- I want to do something like the following, but it does not work: testinput(); function testinput(){ GLOBAL $HTTP_POST_VARS; extract($HTTP_POST_VARS); echo i = $ibr; for($c=1;$c=$i;$c++){ echo team_number $team_number_$cbr; echo sub1_$c = $sub1_$cbr; echo sub2_$c = $sub2_$cbr; echo sub3_$c = $sub3_$cbr; echo sub4_$c = $sub4_$cbr; echo sub5_$c = $sub5_$cbr; } } The above gives me these results: ---results-- i = 8 team_number 1 sub1_1 = 1 sub2_1 = 1 sub3_1 = 1 sub4_1 = 1 sub5_1 = 1 team_number 2 sub1_2 = 2 sub2_2 = 2 sub3_2 = 2 sub4_2 = 2 sub5_2 = 2 team_number 3 sub1_3 = 3 sub2_3 = 3 sub3_3 = 3 sub4_3 = 3 sub5_3 = 3 team_number 4 sub1_4 = 4 sub2_4 = 4 sub3_4 = 4 sub4_4 = 4 sub5_4 = 4 team_number 5 sub1_5 = 5 sub2_5 = 5 sub3_5 = 5 sub4_5 = 5 sub5_5 = 5 team_number 6 sub1_6 = 6 sub2_6 = 6 sub3_6 = 6 sub4_6 = 6 sub5_6 = 6 team_number 7 sub1_7 = 7 sub2_7 = 7 sub3_7 = 7 sub4_7 = 7 sub5_7 = 7 team_number 8 sub1_8 = 8 sub2_8 = 8 sub3_8 = 8 sub4_8 = 8 sub5_8 = 8 end results Thank You in Advance Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fw: Hosting_submission
Ok guys. Please take this OFF THIS LIST. Your fight, in itself, has nothing to do with PHP. If you want service, than be smart and don't go to a free service. If you do go to a free service, than don't expect great service. Actually, if you go to a free service, you don't have a right (IMHO) to complain if ANY OF IT is NOT what you want. You get what you pay for. I don't know what caused the argument and don't really care. The person/company that gave the free service was nice enough to do it. At the first sign that you didn't like it, you should have used your brain and backed out of it. It isn't like you lost any money with them. And if you did loose money because your business site was cut off, than you got what you deserved for trying to run a commercial site on a free service. A free service can go off line or kill your account anytime they want. You ever hear the saying We reserve the right to refuse service to Anyone. When you pay, you expect some support and to get something, when you don't pay for it Steve At 10:49 PM 6/12/2002 +1000, The_RadiX wrote: Abusing you??? I am quite sorry but I am lost as to when I abused you? I simply had a form of service on your system and after I tried to keep updated with what was going on I was kicked off.. If you couldn't handle the load.. Don't blame me.. I was patient.. All I wanted was a reply.. ::: : Julien Bonastre [The-Spectrum.org CEO] : A.K.A. The_RadiX : [EMAIL PROTECTED] : ABN: 64 235 749 494 : QUT Student #: 04475739 ::: - Original Message - From: Liam MacKenzie [EMAIL PROTECTED] To: The_RadiX [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, June 12, 2002 9:49 PM Subject: Re: [PHP] Fw: Hosting_submission I am providing a free hosting service for PHP Developers. This is something that costs me a considerable amount of money and time to maintain, and I am giving it away for free. After being abused by you time and time again, I removed your account from my servers and declined your request to re-join. I think that was a fair move. Now, if you will, please leave me alone. Liam - Original Message - From: The_RadiX [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, June 12, 2002 9:34 PM Subject: [PHP] Fw: Hosting_submission Well anybody who wants to join Liam Mackenzie's hosting... Here's the touching response I got... .. Shows a great deal of maturity... Thankfully he doesn't start some sort of hosting company... After all customers would be very very upset if there was some kind of publicity stunt against his company. wouldn't they? * snigger snigger * :)... me threatening?? pfft. no.. how could you think that... Anyway read the email I got back below.. Notice the lovely name he cooked up for the From address... very cute.. - Original Message - From: Fuck You To: The_RadiX Sent: Tuesday, June 11, 2002 6:50 AM Subject: Re: Hosting_submission No! - Original Message - From: website To: Liam Mackenzie ([EMAIL PROTECTED]) Sent: Monday, June 10, 2002 11:26 PM Subject: Hosting_submission User registered with these details... Real Name The_RadiX Username spectrum Domain operationenigma.org Password 1ReRqipo78 Email [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Array Sorting
I have looked through php.net and the books that I have and I am confused, so I hope that someone can help me out here. I am trying to sort an array that I have. I use a while statement to fill the array: $teams[++$i][team_id]=$row-team_id; $teams[$i][name]=$row1-name; $teams[$i][team_sea_id]=$row-team_sea_id; Everything goes in the array as it should, so no problem there. I just want to know how do I sort the array by the name column? Thanks In Advance Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Removing ^M
I get this when running that command: tr: only one string may be given when deleting without squeezing repeats I looked at the tr man pages and it didn't help much. I also tried using '\r' and `\r` and just \r , but always get the same result. Steve At 11:07 PM 6/8/2002 +0200, you wrote: why not just run tr -d \r htmlfile.htm - Original Message - From: Michael Hall [EMAIL PROTECTED] To: PHP List [EMAIL PROTECTED] Sent: Sunday, June 09, 2002 2:40 AM Subject: [PHP] Removing ^M I am trying remove ^M characters (some kind of newline character) from an HTML file. I've tried all sorts of ereg_replace and sed possibilities but the things just won't go away. Does anyone have a way of removing such characters? TIA Mick -- 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 -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Apache Module AND command Line
Is there doc somewhere to would tell how to install PHP as a command line interpreter (like perl) without messing up the installation of PHP that is installed as a module in/for Apache? Basically, I want to have both on the same server. Or can this even be done? Thank You Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] htaccess
I have a php script in an .htaccess protected directory. Is there a way that PHP could find out what login was used? Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Cyber Cafe software
Bret Thanks for the reply. I put that message up on three list (PHP, MySQL, RedHat) and this has been the only reply. There are a lot of software packages that I found searching google.com, but they are all for cyber cafe's that have the computers all ready set up for people to log into. I have found none that would allow someone to bring in their own laptop and be able to just hook it up and also keep track of the time. I was hoping to find one that would run the server on RedHat/PHP/MySQL and do what is needed. The customer is not actually going to be running a regular cyber cafe. But for the things that they want to do, it is pretty much the same thing. I guess they have some clients that travel a lot and want to come in and use their network when they are in town. From what I understand, it is getting pretty annoying but they don't want to tell the people NO. I don't know all of the details about that, I just know that they want it, so I am going to try and get it for them. I have not tried to connect my laptop in an airport yet, but from the way it sounds, that is part of the type of setup that we want. If I can ever figure out how to do this, I will try to post the results to the lists so other people can use it and improve it as they see fit. Thanks Steve At 09:08 PM 6/3/2002 -0500, Bret Hughes wrote: On Mon, 3 Jun 2002, Steve Buehler wrote: Does anybody know of any software all ready written or what would have to be done, to allow us to run a cyber cafe style setup. What we need the software to do is to allow someone to come in and plug in their computer to our network (actually a customers network). They want the following: 1. A customer comes in and signs up starting a clock so they could charge the customer for the time. 2. They want it to work for wired or wireless networks. So when they sign in, it would either have to set their IP address on their machine automatically, or we would have to give them an IP address to put in to their system. 3. It would have to send a report once a day to an email address (or multiple email addresses) with the days summary of time used and amount of money made. 4. A regular customer could come in and use the same login each time so that they could track everything over long periods of time, on a per customer basis. They might want to give discounts to these people and/or give away free stuff. Kind of likefor every minute someone has been on, they get one credit point. Those credit points can be used for purchasing extra time, or other products in the business. Now, if it is kept in a mysql database, than that would not be hard to pull. I know that there are cyber cafe's out there now, so I am assuming that I should not have to reinvent the wheel for this software. If not, how would somebody go about setting this up. Basically, if I could get it set up so that ALL IP addresses on the local network are not allowed in unless they sign in first, than what file would it have to put that IP address in and what would have to be restarted to allow that customer access? Preferably, I would like the program to work with RedHat Linux, PHP and MySQL. Thanks In Advance Steve Buehler Steve I am sitting in a cyber cafe right now in Las Vegas, and no inspite of what the reservations people tell you there is no highspeed internet connectivity in the Flamingo Hilton. Pisses me off but I will leave that for tomorrow. Any way I have used these types of thing occationally while traveling probably 3 or four times but have yet to see anyone do this cleverly. It is usually writting your name on a peice of paper with the time and then paying as you leave. However If I was going to try to do this I would probably start with a simple php generated html form that everyone should be able to use and have them obtain an address via dhcp but have the firewall setup to block all outgoing except for those that have logged in vi the php page. THe phph script would of course have the ipaddress since that is part of the http packet and could then build a FW rule that would allow the machine to hit the net. Then logging off via the same page would then kill the rule and tell them how much they owe. I don't know what happens when the shut down the machine without logging off but I am sure some business pratice could be put in place mabye a $2 stupid charge. If you wanted to get real fancy , I guess the php page could take a credit card and bill them automatically after verifying of course. Now, having said all that I have not seen this anywhere but would start as you have asking qestions and probably googling and freshmeat. Bret ___ Redhat-list mailing list [EMAIL PROTECTED] https://listman.redhat.com/mailman/listinfo/redhat-list -- This message has been scanned for viruses and dangerous content
[PHP] Cyber Cafe software
Does anybody know of any software all ready written or what would have to be done, to allow us to run a cyber cafe style setup. What we need the software to do is to allow someone to come in and plug in their computer to our network (actually a customers network). They want the following: 1. A customer comes in and signs up starting a clock so they could charge the customer for the time. 2. They want it to work for wired or wireless networks. So when they sign in, it would either have to set their IP address on their machine automatically, or we would have to give them an IP address to put in to their system. 3. It would have to send a report once a day to an email address (or multiple email addresses) with the days summary of time used and amount of money made. 4. A regular customer could come in and use the same login each time so that they could track everything over long periods of time, on a per customer basis. They might want to give discounts to these people and/or give away free stuff. Kind of likefor every minute someone has been on, they get one credit point. Those credit points can be used for purchasing extra time, or other products in the business. Now, if it is kept in a mysql database, than that would not be hard to pull. I know that there are cyber cafe's out there now, so I am assuming that I should not have to reinvent the wheel for this software. If not, how would somebody go about setting this up. Basically, if I could get it set up so that ALL IP addresses on the local network are not allowed in unless they sign in first, than what file would it have to put that IP address in and what would have to be restarted to allow that customer access? Preferably, I would like the program to work with RedHat Linux, PHP and MySQL. Thanks In Advance Steve Buehler -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] for loops
it works for me just the way you have itexcept of course that you are telling it to only print to y because you are saying z Steve At 12:50 PM 5/30/2002 +0800, Jason Wong wrote: On Thursday 30 May 2002 11:46, Peter wrote: Just a query ... has any one else noticed this for($i = a; $i z; $i++) { print $i; echo BR;} will print out a right down to yz It should only print to 'y' ... but replace the letters with numbers eg for($i = 1; $i 10; $i++) { print $i; echo BR;} and it prints 1 thru to 10 ... and should only print to '9' ... and any one know a reason for this? ... so if it does otherwise for you then you've got a bug in your version of php! -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Many people are desperately looking for some wise advice which will recommend that they do what they want to do. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unsetting function
You might want to give an example of what you are trying to do or at least, why. I am not an expert (not by a long ways), but to me, the way your question is worded, I would have to sayOpen up the page in whatever editing program you want to use delete the function and put in a new function that you want in its place. It would make it easier if you used the same function name, or you will have to change all calls to it. Steve At 11:33 AM 5/29/2002 +0200, Laurent Drouet wrote: Hi the ML I would like to know if there is a way to unset a function or to replace function contents by an other ? Regards Laurent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Avoid escaping
http://www.php.net/manual/fi/function.stripslashes.php Steve At 11:36 AM 5/29/2002 +0200, you wrote: i have some html that i submit using html example textarea name=test font face=ArialPerro/font /textarea When i submit this and retrieve it on the target page the value looks like this: font face=\Arial\Perro/font Can I somehow avoid that somehow? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unexpected T_IF
put a ; at the end of line 31 and see if it still gives you the error. Steve At 10:33 AM 5/25/2002 +0100, you wrote: Hmm, can anyone explain why I'm getting this error? Parse error: parse error, unexpected T_IF in /usr/local/htdocs/san.loc/upload-img.php on line 34 Code reads: 11:#--if form submitted then process file upload 12:if($HTTP_POST_VARS['ttl']) { 13: 14: #--check if there is already a picture called this 15: include $DOCUMENT_ROOT . 'incs/db.php'; 16: mysql_select_db(infoNav) or die(unable to connect to table); 17: $qry = SELECT ttl FROM imgLst WHERE site = $HTTP_SESSION_VARS[site_no] AND ttl = '$HTTP_POST_VARS[ttl]';; 18: $imgTst = MYSQL_QUERY($qry); 19: 20: if(mysql_numrows($imgTst) 1) { 21: 22: #-- check file type 23: $ulf = $HTTP_POST_FILES['uplfile']['type']; 24: if($ulf == 'image/pjpeg' || $ulf == 'image/gif') { 25: 26: #-- get ext 27: ($ulf == 'image/pjpeg') ? $ext = '.jpg' : $ext = '.gif'; 28: 29: #-- create unique filename 30: $flNme = '\/imgs\/user-imgs\/' . time() . $REMOTE_HOST . $ext; 31: $FulflNme = $DOCUMENT_ROOT . $flNme 32: 33: #-- check file is realy uploaded for security then copy to store folder 34: if (is_uploaded_file($HTTP_POST_FILES['uplfile'])) { Thanks Zac -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with if statement and while loops
I am having trouble with the following function. What it should do is to check one table for team_id's. Than it goes to another table and gets all rows with that team_id. If the team_id is in the new table, it should do one thing, else it should do something else. Can somebody look at this code and see if they can find out where my problem is besides in my inexperience? It always goes to the else statement inside the if statement. function searchbyteamname($team_name){ GLOBAL $PHP_SELF; $result=mysql_query(SELECT team_id,name FROM team WHERE name like '%$team_name%' AND deleted NOT LIKE '1' ORDER BY 'name'); $i=1; while (($row=mysql_fetch_object($result))){ if(!($result1=mysql_query(SELECT * FROM team_season WHERE team_id = '$row-team_id' AND deleted NOT LIKE '1'))){ echo $i. $row-name; $i++; }else{ while(($row1=mysql_fetch_object($result1))){ echo $i. a href=\$PHP_SELF?action=editteam_id=$row-team_id\$row-name/a/td; echo getdivisionnameshort($row1-div_id); echo getseasonnameshort($row1-sea_id)\n; $i++; } } } } Thank You In Advance Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php