[PHP] $_POST variable
Hi guys, I have a form that has a long list of radio-bottons inside of it. The radio-buttons are dynamically created via php and MySQL. Here is an example of one of the radio buttons: input type=radio name=?php print (radio_.$result_from_mysql) ; ? value=0 input type=radio name=?php print (radio_.$result_from_mysql) ; ? value=1 Now, when I submit this form to another page for processing, how would I catch the above radio-button's $_POST name since I do not know the name, only that it starts with radio_ ? Thank You Danny -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Quick session question
Hi guys, I always start new projects with the following session code-snippet: (In other words this is how I initialize my sessions in the index.php file.) ### START CODE SNIPPET ?php session_start(); setcookie(session_name(),,0,/); unset($_COOKIE[session_name()]); $_SESSION = array(); session_unset(); session_destroy(); session_start(); /// Define some $_SESSION variables $_SESSION['sessionid'] = session_id() ; $_SESSION['server'] = http://localhost/~user/new_project; ; $_SESSION['sql_dflts'] = $_SESSION['server']./sql/sql_dflts.inc ; $_SESSION['remoteaddr'] = $_SERVER['REMOTE_ADDR'] ; $_SESSION['remotehost'] = gethostbyaddr ( $_SERVER['REMOTE_ADDR'] ) ; /// Include Files include ( $_SESSION['sql_dflts'] ) ; include ( $_SESSION['server']./fnc/fnc_include_dir.inc ) ; $var_include_dir = include_dir ( fnc ) ; ? ### END CODE SNIPPET # All of the projects I have done so far were for business intranet purposes and it worked fine. But last week I uploaded another project to the internet and my sessions did not work. I have been using it this way since v4.0 (I think, anyway since a LONG time ago), but now I think it is a bit outdated and needs some kind of revision. Is this still sufficient or can you guys give some tips on a more updated way of starting my sessions? My php.ini file is stock-standard. I am running version 5.2.6-1 with apache 2.2.9 on a Debian 5.04 machine. Thank You Danny -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quick session question
Thanks Ashley and Jim, When you say 'sessions did not work' what do you mean? Sessions aren't being created? You can't access session variables? You need to be a bit more specific about the issue. Sorry, here is an explanation: The project I uploaded for a customer is a stock ordering web-app that they used on their local intranet for a year or so, but now they want this same web-app to be available globally. I thought that it would work out-the-box on the internet but it doesn't. On their local-lan I am able to do some (advanced) login checks with sessions with no problem, like I said, it has been workng for a year or so now. Also, the same login sequence I use here I also use in my other intranet web-apps. However, when I uploaded this project and I log on, I just get a blank screen after the login checks are done and it is supposed to take me to the logged-in start page. That is why I say that somehow my sessions are not carried over or caught by php. Thanks for the comments on my session initialization, if there is not really anything that should be changed, then I will leave it like it is. Just one more thing, should I always expand the URL's to an absolute path instead of using a session variable like I do? Thnks again guys Danny -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quick session question
Hi Gaurav, Creating a local folder solved the problem. I can now catch the session varaibles. I think that I am too familiar with setting up everything on a local server and forgot that there are other things to consider when you work on the internet. Thank You Danny On Jun 25 10, Gaurav Kumar : 2. Check on the server that are the sessions really getting saved on the server? 3. Now in case you do not have access to a sessions folder on the server then set the session folder name/path to the folder (a new one) you can have access to (may be root of your ftp) using session_save_path('/httpdocs/ 'your-domain-folder/new-session-folder) (provide read/write permission) before session_start() in index.php or common header include file. This session_save_path() should be declared on every file on the top. Try the above and let me know if it works. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quick session question
Hi Jim, I followed Gaurav's tips on creating a folder to store the session info in and it got solved. I can now catch the session variables but I got A LOT of include() file errors which was solved by following your suggestion on expanding my URL's. Thank You Danny On Jun 24 10, Jim Lucas : Nothing looks to be wrong with the session initiation code. The problem is more the likely the calls to include a remote file. Basically, to expand your variables out, you would be doing this: include ( 'http://localhost/~user/new_project/sql/sql_dflts.inc' ) ; include ( 'http://localhost/~user/new_project/fnc/fnc_include_dir.inc' ) ; If your php.ini settings are stock, then the problem is with the allow_url_include directive. It is set to 0 by default. See here: http://us3.php.net/manual/en/filesystem.configuration.php Change that setting to '1' and restart your web server, then you should be good to go. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quick session question [SOLVED]
Hi Guys, Thanks to all of you who helped me with my problem. I can now continue with my life :) . I'm happy and the customer is happy ... Thank you once again. Danny -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quick session question
Hi Mari, I used localhost as a substitute for the real url. My mistake I should've told you guys. Thanks anyway for your input. Danny On Jun 24 10, Mari Masuda : Maybe you need to change $_SESSION['server'] = http://localhost/~user/new_project; ; to be not localhost. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] CSV speed
I have about 10 csv files I need to open to access data. It takes a lot of time to search each file for the values I need. Would it be best to just dump all the cvs files to an SQL db and then just grab what I need from there? I'm starting to think it would make a lot of sense. What do you guys think? Thanks, Dan -- 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] CSV speed
On Mon, 2008-03-10 at 22:36 -0400, Wolf wrote: Danny Brow wrote: I have about 10 csv files I need to open to access data. It takes a lot of time to search each file for the values I need. Would it be best to just dump all the cvs files to an SQL db and then just grab what I need from there? I'm starting to think it would make a lot of sense. What do you guys think? Thanks, Dan Dan, I can tell you that depending on the size of your files is going to dictate the route you want to go. I have a CSV with 568,000+ lines with 19 different pieces to each line. The files are around 180M apiece and it takes my server about 2 seconds to run a system grep against the files. I can run a recursive call 7 times against a MySQL database with the same information and it takes it about 4 seconds. IF you have system call ability, a grep wouldn't be bad, otherwise I'd suggest loading the csv files into MySQL tables and checking them for the information, then dropping the tables when you get the next files. You can backup the databases such as a cron job overnight even. HTH, Wolf Thanks that sounds like a good idea. I'm still plugging away with how I started. I want to know how much faster it will be going with a db. I was actually thinking of using diff for each updated file to and upload that to the DB. Dan -- 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] GPS Locator
Wintec makes a nice unit. http://www.wintec.com.tw/en/home.php But you are screwed if the system is in doors. I doubt you would get a GPS signal inside a building. Dan On Tue, 2008-03-04 at 10:18 -0600, Jay Blanchard wrote: Howdy group! I know that this is not a PHP question (but it will work with a PHP app) but I thought I would ask the smartest group of people I know if they have any clue or would be familiar with a device I can use. I need to purchase a small GPS receiver/antenna that will plug into a USB port. Then I need to access the port (Ajax? Java?) while in my web application to deliver the coordinates to my PHP application. That will give me the physical location of the machine accessing the application. Any insight will be valuable. -- 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
[PHP] DESC order results
Just wondering if anyone could tell me how reliable the DESC order option is going to be when I am parsing thousands of records where they are multiple ChartNo's for the same clientNo. Or is there a better way to grab the most recent ChartNo. $link = mysql_connect('localhost', 'myuser', 'mypassword') or die('Could not connect: ' . mysql()); mysql_select_db('mydatabase') or die('Could not select database'); $query = 'SELECT * FROM eChart WHERE clientNo = 2 ORDER BY ChartNo DESC'; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); $line = mysql_fetch_array($result, MYSQL_ASSOC); // Just for testing print mysql_num_rows($result); Thanks, Dan -- 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] DESC order results
Thanks for the answer, didn't think of asking this in a MySQL forum, sorry. Dan On Sun, 2008-01-13 at 20:28 +0100, Jochem Maas wrote: Danny Brow schreef: Just wondering if anyone could tell me how reliable the DESC order option is going to be when I am parsing thousands of records where they are multiple ChartNo's for the same clientNo. Or is there a better way to grab the most recent ChartNo. this is a mysql question not a php question, please try to ask questions in the appropriate forum. the reliability of 'ORDER BY' is not tied to the ammount of records returned. given that you only want the 'most recent' (by which I assume you mean the 'highest value') ChartNo for a given clientNo you should be performing a query that returns a single row of data. also you shouldn't be quoting values pertaining to numeric fields (I assume clientNo is an integer) 1. assuming ChartNo is numeric: SELECT MAX(ChartNo) as chartno FROM eChart WHERE clientNo=2 2. assuming ChartNo is a varchar (or similar): SELECT ChartNo FROM eChart WHERE clientNo=2 ORDER BY ChartNo DESC LIMIT 0,1 $link = mysql_connect('localhost', 'myuser', 'mypassword') or die('Could not connect: ' . mysql()); mysql_select_db('mydatabase') or die('Could not select database'); $query = 'SELECT * FROM eChart WHERE clientNo = 2 ORDER BY ChartNo DESC'; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); $line = mysql_fetch_array($result, MYSQL_ASSOC); // Just for testing print mysql_num_rows($result); Thanks, Dan -- 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
[PHP] fgetcsv
Hi Everyone, I'm trying to compare a value to the first field in a csv fILE (example of the data below). Using while takes too long and I can't figure out how to compare just one row at a time. I've tried some variations of the following. //Common for all trials $demoID = fopen(newDemoID.csv, r);; $ID = 43; $data = fgetcsv($demoID); First try with while: /* while ($data) { if ($data[0] == $wolfID) { print $data[1] . , . $data[2] . , . $data[3] . .\n; } } */ Takes for every. I can't use just the below because it only compares the first row. /* if ($data[0] == $wolfID) { print $data[1] . , . $data[2] . , . $data[3] . .\n; } */ I know this is simple, but I've hit codes block due to lack of sleep. Thanks, Dan Sample Data: 5,1,Smith,Myrtle 6,2,Smith,Carita 7,3,Smith,Paul 8,4,Smith,Donald -- 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] fgetcsv
I need to compare the first field of each row. But this idea is shot to hell, i've been running one of the examples on the file and it's been about an hour+ already... 6500 records have to be checked... I think MySQL is calling my name right now. Thanks, Dan On Thu, 2008-01-10 at 09:59 +1100, Chris wrote: Danny Brow wrote: Hi Everyone, I'm trying to compare a value to the first field in a csv fILE (example of the data below). Using while takes too long and I can't figure out how to compare just one row at a time. I've tried some variations of the following. So are you trying to compare the first column or the first row? You've said you want to compare both. To compare the first row: ?php $handle = fopen('file.csv', 'r') or die(unable to open file); $my_row = array('1','2','John Smith'); $data = fgetcsv($handle, 1000, ,); if ($data === false) { echo Unable to get anything from the file.; } if (is_array($data)) { if ($data == $my_row) { echo The first row matched\n; } else { echo The first row didnt match\n; } } fclose($handle); If you really do want to compare the first column, then the time to do it will be based on how big the csv file is. If you have a big file, it's going to take a long time to go through each row and then look at the first field. ?php $handle = fopen('file.csv', 'r') or die(unable to open file); $my_value = '1'; $row_count = 0; while (($data = fgetcsv($handle, 1000, ,)) !== FALSE) { $row_count++; if ($data[0] == $my_value) { echo Found my_value on row , $row_count, \n; } else { echo Did not find my_value on row , $row_count, \n; } } fclose($handle); -- Postgresql php tutorials http://www.designmagick.com/ -- 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] fgetcsv
Um, I've read the manual. On Wed, 2008-01-09 at 20:11 -0500, Bastien Koert wrote: http://ca.php.net/manual/en/function.fgetcsv.php _ Discover new ways to stay in touch with Windows Live! Visit the City @ Live today! http://getyourliveid.ca/?icid=LIVEIDENCA006 -- 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] fgetcsv
You are so right, takes all of 0.122 s to process the whole file with the fgetcsv inside the while loop Guess I need to look up why this was the problem. Thanks everyone! On Wed, 2008-01-09 at 20:59 -0600, Richard Lynch wrote: 6500 rows is chump-change. You probably don't have the fgetcsv inside the while loop to get past the first row... :-) On Wed, January 9, 2008 6:09 pm, Danny Brow wrote: I need to compare the first field of each row. But this idea is shot to hell, i've been running one of the examples on the file and it's been about an hour+ already... 6500 records have to be checked... I think MySQL is calling my name right now. Thanks, Dan On Thu, 2008-01-10 at 09:59 +1100, Chris wrote: Danny Brow wrote: Hi Everyone, I'm trying to compare a value to the first field in a csv fILE (example of the data below). Using while takes too long and I can't figure out how to compare just one row at a time. I've tried some variations of the following. So are you trying to compare the first column or the first row? You've said you want to compare both. To compare the first row: ?php $handle = fopen('file.csv', 'r') or die(unable to open file); $my_row = array('1','2','John Smith'); $data = fgetcsv($handle, 1000, ,); if ($data === false) { echo Unable to get anything from the file.; } if (is_array($data)) { if ($data == $my_row) { echo The first row matched\n; } else { echo The first row didnt match\n; } } fclose($handle); If you really do want to compare the first column, then the time to do it will be based on how big the csv file is. If you have a big file, it's going to take a long time to go through each row and then look at the first field. ?php $handle = fopen('file.csv', 'r') or die(unable to open file); $my_value = '1'; $row_count = 0; while (($data = fgetcsv($handle, 1000, ,)) !== FALSE) { $row_count++; if ($data[0] == $my_value) { echo Found my_value on row , $row_count, \n; } else { echo Did not find my_value on row , $row_count, \n; } } fclose($handle); -- Postgresql php tutorials http://www.designmagick.com/ -- 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 -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- 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] CSV date issue
Hi, It's been a while since I've used php and I'm trying to organize some data by date. The problem I'm having is that when the data changes from say 2006 to 2005 the first few rows of 2005 data goes into my 2006 data and the date for 2006 is lost. My code for separating dates is below with some sample data. I'm sure I'm missing something simple here. The date within the 3rd column can be ignored. TIA $num = count($data); for ($c=0; $c $num; $c++) { if ($c == 5) { $data[5] = strftime(%m/%d/%G,strtotime('-1 Day', strtotime($data[5]))); //Fix date, data is off by 1 day. } $date = strftime(%G,strtotime($data[5])); if ($date == ) { //Skip row if date field is empty. // Skip } else { if ($date == 2006) { $data2006 .= \ . $data[$c] .\,; } elseif ($date == 2005) { $data2005 .= \ . $data[$c] .\,; } elseif ($date == 2004) { $data2004 .= \ . $data[$c] .\,; } elseif ($date == 2003) { $data2003 .= \ . $data[$c] .\,; } elseif ($date == 2002) { $data2002 .= \ . $data[$c] .\,; } elseif ($date == 2001) { $data2001 .= \ . $data[$c] .\,; } elseif ($date 2000) { $data1999pre .= \ . $data[$c] .\,; } } } Sample data 60609C49.PCX,PG 1,BLUEWATER HEALTH, LAB, 04/06/06,10003533S,BUNNY BUGS,06/10/2006 60609C50.PCX,PG 1,Cake walk, other, 04/06/06,10003533T,Tweedy Bird,06/11/2006 50609C49.PCX,PG 1,HEALTH, LAB, 04/06/06,10003533g,Smurf Grumpy,06/10/2005 50699C55.PCX,PG 1,Lab 101, 04/06/06,10003533p,Smurf Pappy,04/10/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CSV date issue - Solved
Seems my problem was a data issue and I needed to compensate for missing dates. thanks, Dan On Thu, January 11, 2007 2:31 pm, Danny Brow wrote: Hi, It's been a while since I've used php and I'm trying to organize some data by date. The problem I'm having is that when the data changes from say 2006 to 2005 the first few rows of 2005 data goes into my 2006 data and the date for 2006 is lost. My code for separating dates is below with some sample data. I'm sure I'm missing something simple here. The date within the 3rd column can be ignored. TIA $num = count($data); for ($c=0; $c $num; $c++) { if ($c == 5) { $data[5] = strftime(%m/%d/%G,strtotime('-1 Day', strtotime($data[5]))); //Fix date, data is off by 1 day. } $date = strftime(%G,strtotime($data[5])); if ($date == ) { //Skip row if date field is empty. // Skip } else { if ($date == 2006) { $data2006 .= \ . $data[$c] .\,; } elseif ($date == 2005) { $data2005 .= \ . $data[$c] .\,; } elseif ($date == 2004) { $data2004 .= \ . $data[$c] .\,; } elseif ($date == 2003) { $data2003 .= \ . $data[$c] .\,; } elseif ($date == 2002) { $data2002 .= \ . $data[$c] .\,; } elseif ($date == 2001) { $data2001 .= \ . $data[$c] .\,; } elseif ($date 2000) { $data1999pre .= \ . $data[$c] .\,; } } } Sample data 60609C49.PCX,PG 1,BLUEWATER HEALTH, LAB, 04/06/06,10003533S,BUNNY BUGS,06/10/2006 60609C50.PCX,PG 1,Cake walk, other, 04/06/06,10003533T,Tweedy Bird,06/11/2006 50609C49.PCX,PG 1,HEALTH, LAB, 04/06/06,10003533g,Smurf Grumpy,06/10/2005 50699C55.PCX,PG 1,Lab 101, 04/06/06,10003533p,Smurf Pappy,04/10/2005 -- 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] Infinite subcategories
Hi All, Time ago, somebody sent a sample to the list about how to do an infinite subcategories, based on parent field. I´ve been googling, and searching my mail history, but cannot find it. The objective is to create a tree with categories and subcategories of documents, but with no limit into the subcategory depth. Anybody remember that thread, or can point me to a solution? Thank you Regards -- dpc
[PHP] PHP, MySQL and XML for IPodCasting
Hi, I´ve got a web project that daily offers 4 o 5 mp3 files recorded by me. From an web based interface I populate a database with titles, descripcion, images and the path for the mp3 file in the server The cuestion is I would like to offer the content for Ipod, using ipodcasting. Then I have to produce a daily XML file in order the Ipods feed from that file How to proceed Should I create a script to make the well-formed XML file? (echoing to a file based into a template that I´ve got) or is there parser of something like that? which can help me to produce that file The scenario would be PHP 5, MySQL 5.x and Apache 2.0 Thank you in advance Rgards
Re: [PHP] PHP, MySQL and XML for IPodCasting
Simply Fantastic!. Thanks a lot! So for me the best solution I think, would be to read the MySQL Table, and produce the XML with a given template from a PHP Script. I will use Scheduled Task instead of CRON... (Sorry, working on windows ;-) ) [Off topic] Could it be tested without an IPod device? I´ve been googling around, but I don´t know much about those devices, and IPodCasters simulators for PC Thanks again, Best Regards. On 12/9/05, Michael Hulse [EMAIL PROTECTED] wrote: On Dec 9, 2005, at 3:45 AM, Danny wrote: How to proceed I recently set-up my first Podcast... Every week I have a script that grabs three MP3 files from a remote server and puts them on my own server... Then I have another script that generates the Podcast XML. I am using CRON jobs to do all the work for me... all I have to do is open iTunes and everything starts downloading automatically is nice. The way I generate my XML is via output buffering and a simple text-file template. Here is my template (template.txt): ?xml version= 1.0? rss version=2.0 channel titlePut your title here [{_dateCheck_}]/title linkLink to your site/the page that explains what this podcast is all about./link descriptionThis is the description... it will show-up in iTunes... yadda yadda.../description languageen-us/language copyrightCopyright Info/copyright lastBuildDate{_dateLong_}/lastBuildDate webMasterYour name here/webMaster ttl1/ttl item titleName of MP3 podcast - Hour 01, {_dateCheck_}, {_dateSlashes_}/title descriptionHour 01 ({_dateSlashes_}) of this particular podcast./description pubDate{_dateLong_}/pubDate enclosure url=http://www.yoursite.com/location_of_podcast_mp3/mp3_name- {_dateShort_}.mp3 length=10800040 type=audio/mpeg/ guid isPermaLink=false{_randNumOne_}/guid /item item titleName of MP3 podcast - Hour 02, {_dateCheck_}, {_dateSlashes_}/title descriptionHour 02 ({_dateSlashes_}) of this particular podcast./description pubDate{_dateLong_}/pubDate enclosure url= http://www.yoursite.com/location_of_podcast_mp3/mp3_name- {_dateShort_}.mp3 length=10800040 type=audio/mpeg/ guid isPermaLink=false{_randNumTwo_}/guid /item item titleName of MP3 podcast - Hour 03, {_dateCheck_}, {_dateSlashes_}/title descriptionHour 03 ({_dateSlashes_}) of this particular podcast./description pubDate{_dateLong_}/pubDate enclosure url= http://www.yoursite.com/location_of_podcast_mp3/mp3_name- {_dateShort_}.mp3 length=10800040 type=audio/mpeg/ guid isPermaLink=false{_randNumThree_}/guid /item /channel /rss Here is my PHP (pod.php): ?php # Error checking: if((isset($_REQUEST['pass'])) ($_REQUEST['pass'] === 'let_me_in') (!empty($_REQUEST['pass']))) { # Begin date: $date_long = date('r'); // Example output: Mon, 21 Nov 2005 05:20:18 -0500 $date_short = date('mdy'); // Example output: 051121 $date_slashes = date('m/d/y'); // Example output: 11/21/05 $date_check = date('l'); #End date. function randNumb() { # Begin random # generation: srand ((double) microtime( )*100); $random_number = rand( ); return $random_number; # End random # generation. } $rand_num_one = randNumb(); $rand_num_two = randNumb(); $rand_num_three = randNumb(); // HTML to be written: ob_start(); readfile($_SERVER['DOCUMENT_ROOT'].'/template.txt'); $contents = ob_get_clean(); @ob_end_clean(); $contents = str_replace('{_dateLong_}',$date_long, $contents); $contents = str_replace('{_dateSlashes_}',$date_slashes, $contents); $contents = str_replace('{_dateShort_}',$date_short, $contents); $contents = str_replace('{_randNumOne_}',$rand_num_one, $contents); $contents = str_replace('{_randNumTwo_}',$rand_num_two, $contents); $contents = str_replace('{_randNumThree_}',$rand_num_three, $contents); $contents = str_replace('{_dateCheck_}',$date_check, $contents); # Now open the file and write contents of template: $fp = fopen($_SERVER['DOCUMENT_ROOT'].'/ path_to_place_where_you_store_the_xml_file/ xml_file_name'.$date_check.'.xml','wb'); // Open for writing only; If the file does not exist, attempt to create it. fwrite($fp, $contents); fclose($fp); } else { echo h1Please Leave Now!/h1; } ? I then use a cron to run the above script every week, like so: GET http://www.your_site.com/pod.php?pass=let_me_in /dev/null Or, instead of using the CRON, you can just got to the script via your browser like so: http://www.your_site.com/pod.php?pass=let_me_in And the XML file will generate itself. Please keep in mind, I quickly slapped this script together... It gets the job done for me... I am sure there are way
[PHP] Code generators
Hi there, There´s a lot of manufacturers, about PHP code generators. What do you think about that? I mean, it seems like PHP Nuke fashion or other portal systems. Everybody has its portal, but all web pages seems to be the same, because all are under the same design. I would like to gather opinions about it. Example: http://www.yessoftware.com/index2.php Thank you P.S. Please sorry my poor english, I´m trying to improve my skills -- dpc
[PHP] Newbie to PHP5
Hi there, I´m familiar with PHP syntax, but I´ve been reading some sample scripts, in PHP5 and i´ve seen some strange things, like diferent ways to read a collection of rows, magic functions, wrapers, and operators like :: and -. I know that all is the manual, but before that anyone nows, a website or a simple tutorial or explained samples, in order that the transition from PHP4 and PHP5 were easiest as possible. Thanks -- dpc
Re: [PHP] Newbie to PHP5
Thanks. Any other source (some resume pdf or something like What´s new) On 11/15/05, Raz [EMAIL PROTECTED] wrote: -. I know that all is the manual, but before that anyone nows, a website or a simple tutorial or explained samples, in order that the transition from PHP4 and PHP5 were easiest as possible. http://www.php.net/ -- dpc
[PHP] php5 / php4 - MySQL/SQLite
Hi, Let me open a discussion about php5 / php4 Why upgrade? It worth? Benefits? Code programming changes? Is there and end-of-life for php4, in the near/medium future? What about MySQL and SQLite. What is the future of both? I would like to open a discussion about the future of both related to php no matter the version of it... Let´s start -- dpc
Re: [PHP] is there a number translation function?
http://www.phpguru.org/TextualNumberExample.php?number=3450 Regards. Salu2 On 10/29/05, Linda H [EMAIL PROTECTED] wrote: Hi, Does anyone know of a function for translating a decimal number into an English number. In other words, if you pass it 1 it will return 'one', if you pass it 127 it will return 'one hundred twenty seven', and etc. Thanks, Linda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- dpc
[PHP] Substr by words
Hi, I need to extract 50 words more or less from a description field. How can i do that?. Substr, cuts the words. Is there any other way to that, without using and array? I mean and implemented function in PHP 4.x I´ve been googling around, but wordwrap, and substr is driving me mad... Thanks in advance Best Regards -- dpc
[PHP] [DONE] Substr by words
Finally i found it (Google is god, you only have to ask the right question) function trim_text($text, $count){ $text = str_replace( , , $text); $string = explode( , $text); for ( $wordCounter = 0; $wordCounter = $count;wordCounter++ ){ $trimed .= $string[$wordCounter]; if ( $wordCounter $count ){ $trimed .= ; } else { $trimed .= ...; } } $trimed = trim($trimed); return $trimed; } Usage $string = one two three four; echo trim_text($string, 3); -- Forwarded message -- From: Danny [EMAIL PROTECTED] Date: Oct 29, 2005 1:36 PM Subject: Substr by words To: php-general@lists.php.net Hi, I need to extract 50 words more or less from a description field. How can i do that?. Substr, cuts the words. Is there any other way to that, without using and array? I mean and implemented function in PHP 4.x I´ve been googling around, but wordwrap, and substr is driving me mad... Thanks in advance Best Regards -- dpc -- dpc
[PHP] Retrieve Data Formated from Text field
Hi Gurus, I´ve got a problem with the result displaying a TEXT type field The data is inserted into db in this way: Hello, This is a sample of first line. This is another paragraph, blah blah blah Bye But the result is in one paragraph: Hello, This is a sample of first line. This is another paragraph, blah blah blah Bye If I use HTML PRE label, I´ve got the result correct, but cannot use styles Any Suggestion? thx . -- dpc
[PHP] Detailed Report
Hi All, I´ve got a connection, to a MySQL db, and get the following ResultSet(Category | Name | Code | City) Customers | John | A36 | New York Customers | Jason | B45 | Los Angeles Customers | Max | A36 | Paris Providers | John | A36 | London Providers | Mark | B67 | Madrid And I need the report in the following format: Customers John - A36 - New York Jason - B45 - Los Angeles Max - A36 - Paris Providers John - A36 - London Mark - B67 - Madrid Any one can help? I´m a bit stalled thx regards. --
Re: [PHP] Detailed Report
Thanks for your help Adrian, but the problem is that I need to show row[0] once (Customers text are repeated), and below the details of the records Your solution shows: Customers | John | A36 | New York Customers | Jason | B45 | Los Angeles (...) And I need CustomersBR John | A36 | New York Jason | B45 | Los Angeles (...) (...) On 10/27/05, Adrian Bruce [EMAIL PROTECTED] wrote: load each row of the resultset into an array $row using mysql_fetch_array(), each field in the result set row will be held in the corresponding array element. while ($row = mysql_fetch_array($resultset, MYSQL_NUM)){ echo$row[0] | $row[1] | $row[2]; } Hope this helps, Ade Danny wrote: Hi All, I´ve got a connection, to a MySQL db, and get the following ResultSet(Category | Name | Code | City) Customers | John | A36 | New York Customers | Jason | B45 | Los Angeles Customers | Max | A36 | Paris Providers | John | A36 | London Providers | Mark | B67 | Madrid And I need the report in the following format: Customers John - A36 - New York Jason - B45 - Los Angeles Max - A36 - Paris Providers John - A36 - London Mark - B67 - Madrid Any one can help? I´m a bit stalled thx regards. -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- dpc
Re: [PHP] Detailed Report
Thank you very much I think it will work, because my problem seems to be with if operators and order... Thanks again On 10/27/05, Adrian Bruce [EMAIL PROTECTED] wrote: ok, so i assume that customers is a grouping of some sort and that in some cases you may come accross a row like Staff | John | A36 |LA . It may not be a perfect way of doinig it but this is what i would generally try: while ($row = mysql_fetch_array($resultset, MYSQL_NUM)){ if($row[0] == $group){ echo $row[1] | $row[2]; } else{ echo$row[0]br/br/$row[1] | $row[2] | $row[3]; } $group = $row[0]; } Ade Danny wrote: Thanks for your help Adrian, but the problem is that I need to show row[0] once (Customers text are repeated), and below the details of the records Your solution shows: Customers | John | A36 | New York Customers | Jason | B45 | Los Angeles (...) And I need CustomersBR John | A36 | New York Jason | B45 | Los Angeles (...) (...) On 10/27/05, *Adrian Bruce* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: load each row of the resultset into an array $row using mysql_fetch_array(), each field in the result set row will be held in the corresponding array element. while ($row = mysql_fetch_array($resultset, MYSQL_NUM)){ echo$row[0] | $row[1] | $row[2]; } Hope this helps, Ade Danny wrote: Hi All, I´ve got a connection, to a MySQL db, and get the following ResultSet(Category | Name | Code | City) Customers | John | A36 | New York Customers | Jason | B45 | Los Angeles Customers | Max | A36 | Paris Providers | John | A36 | London Providers | Mark | B67 | Madrid And I need the report in the following format: Customers John - A36 - New York Jason - B45 - Los Angeles Max - A36 - Paris Providers John - A36 - London Mark - B67 - Madrid Any one can help? I´m a bit stalled thx regards. -- -- PHP General Mailing List ( http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- dpc -- dpc
Re: [PHP] test
On Tue, 2005-06-07 at 14:46 +0200, Hans J.J. Prins wrote: test Failed. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] linux php editor
On Mon, 2005-06-06 at 18:09 -0800, Clive Zagno wrote: the truth is Ive been developing on windows, because of some .net developments. Ive been starting most new projects as web applications and using php/mysql. On windows I used ultredit, then I found a product called phpedit, which I liked, now Im trying to move to linux. what I really want is a app that can do that predictive text thing, you know when it start showing me the possible php syntax as Im typing it in. Two reasons for this is it help with debugging as I get the syntax correct the first time and secondly I think its cool. Komodo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] dynamic drop down
On Wed, 2005-06-01 at 11:49 +0100, Mark Rees wrote: The dropdown list is on the client (browser). Javascript runs on the client. PHP runs on the server. You have 2 options - one is to do as Richard says and use javascript to change the contents of one select box when an option is selected in another. - the other is to refresh the page when the option is selected and write different data into the second select box based on the option selected. This is a question of using echo and iterating through the data you wish to output. So how do you refresh the page when the drop down is selected? Thanks, Dan. -Original Message- From: Danny Brow [mailto:[EMAIL PROTECTED] Sent: 01 June 2005 07:08 To: PHP-Users Subject: Re: [PHP] dynamic drop down On Tue, 2005-05-31 at 22:08 -0700, Richard Lynch wrote: On Tue, May 31, 2005 8:48 pm, Danny Brow said: Could someone point me to an example with code for dynamic drop downs in PHP? I would like to be able to have drop downs like Select Country and another drop down show the states/provinces based on the selected country. Well, the dynamic part of it isn't gonna be in PHP at all ; It's gonna be JavaScript. I thought I'd have to use JS, but was hoping someone knew a way to do it with PHP. You can Google for JavaScript dynamic menus to find what you want. Then you just need to use PHP to spew out the JavaScript you want to spew out, but that's no different than spewing out the HTML you want to spew out, really. Tons on google, thanks, Dan. Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, Cisco, Sun Microsystems, 3Com GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND REGISTERED FOR ISO 9001:2000 CERTIFICATION ** CONFIDENTIALITY NOTICE: This Email is confidential and may also be privileged. If you are not the intended recipient, please notify the sender IMMEDIATELY; you should not copy the email or use it for any purpose or disclose its contents to any other person. GENERAL STATEMENT: Any statements made, or intentions expressed in this communication may not necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no content herein may be held binding upon Gamma Global (UK) Ltd or any associated company unless confirmed by the issuance of a formal contractual document or Purchase Order, subject to our Terms and Conditions available from http://www.gammaglobal.com EOE ** ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Delay?
On Thu, 2005-06-02 at 15:32 -0400, GamblerZG wrote: Sebastian wrote: yea.. takes hours... sometimes 6+ or more. i dont post that much to the list for this reason.. if it stays like this i'll just unsubscribe.. its pointless... this is suppose to be E-mail, not post office mail. I don't understand why everyone like these mailing lists so much. Web-forums more convenient. Convenient for your maybe, I personally hate web forums. signature.asc Description: This is a digitally signed message part
Re: [PHP] Mailing list delays
On Thu, 2005-06-02 at 17:15 -0700, Rasmus Lerdorf wrote: We found a problem caused by a recent disk failure that wiped out a named pipe qmail needed. I am hoping the mailing list delays should be fixed now. -Rasmus test signature.asc Description: This is a digitally signed message part
Re: [PHP] dynamic drop down
On Tue, 2005-05-31 at 22:08 -0700, Richard Lynch wrote: On Tue, May 31, 2005 8:48 pm, Danny Brow said: Could someone point me to an example with code for dynamic drop downs in PHP? I would like to be able to have drop downs like Select Country and another drop down show the states/provinces based on the selected country. Well, the dynamic part of it isn't gonna be in PHP at all ; It's gonna be JavaScript. I thought I'd have to use JS, but was hoping someone knew a way to do it with PHP. You can Google for JavaScript dynamic menus to find what you want. Then you just need to use PHP to spew out the JavaScript you want to spew out, but that's no different than spewing out the HTML you want to spew out, really. Tons on google, thanks, Dan. signature.asc Description: This is a digitally signed message part
[PHP] test
signature.asc Description: This is a digitally signed message part
[PHP] test
If this gets to the list it's just a test. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] dynamic drop down
Could someone point me to an example with code for dynamic drop downs in PHP? I would like to be able to have drop downs like Select Country and another drop down show the states/provinces based on the selected country. Thanks, Dan. signature.asc Description: This is a digitally signed message part
Re: [PHP] PHP Applications?
On Tue, 2005-05-17 at 15:34 -0400, Brent Baisley wrote: Zend sells a compiler to speed up your PHP code. Since it's compiled, it also does not contain the source code in readable form. You should visit the Zend website. Any free ones? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Starting a big project
I'm about to start writing a big web app (mostly in PHP). But I'm not sure if I should layout the DB first then write the app, or should I just start writing the app and add stuff to the DB as I need it. How do you guys go about it? Thanks, Dan. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Starting a big project
On Sun, 2005-05-01 at 18:53 +0200, Gabriel Birke wrote: You could avoid the decision if you use the O/R mapper propel: http://propel.phpdb.org/wiki/ I'm using Pear DB (via PG). And then I'm going to port to postgresql. I've got most of the tools I'm going to use for the project worked out. Just figuring out what is better, DB layout - Write App, or Write app DB at the same time. Mike sent a real good answer, exactly what I was looking for. Thanks for you reply, I'm going to read up on propel even though I will probably not use it for this project. Thanks, Dan On 5/1/05, Danny Brow [EMAIL PROTECTED] wrote: I'm about to start writing a big web app (mostly in PHP). But I'm not sure if I should layout the DB first then write the app, or should I just start writing the app and add stuff to the DB as I need it. How do you guys go about it? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best Server OS
On Mon, 2005-03-28 at 15:19 -0500, Phil Neeb wrote: I'm lookin for some opinions on this one ... What do you think the best OS is for running a server with PHP and MySQL? If you're going to say Linux, please, which Linux OS, there are so many. Slackware. Dan. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Best Server OS
On Mon, 2005-03-28 at 15:58 -0500, Mike wrote: I personally like OpenBSD - though many of the BSDs are similar at many tasks and only have notable differences in a few areas (and it's those areas you should look to find which works best for you). I wonder who will get bored and stir up the ants nest and say Windows? ;) Screw Windows, how about OS/2 :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best Server OS
On Mon, 2005-03-28 at 23:28 +0200, M. Sokolewicz wrote: Danny Brow wrote: On Mon, 2005-03-28 at 15:58 -0500, Mike wrote: I personally like OpenBSD - though many of the BSDs are similar at many tasks and only have notable differences in a few areas (and it's those areas you should look to find which works best for you). I wonder who will get bored and stir up the ants nest and say Windows? ;) Screw Windows, how about OS/2 :) screw that too. Unix-based systems are the way to go here. From what I've seen, those are the systems that are: a) most used b) run smoothest c) are simplest to install / manage from a distance d) are most up-to-date at all times Personally I'd suggest using either Fedora (RH), or Debian. But that's just my personal opinion ;) I was kidding about OS/2, it's a dead OS. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Postgresql PHP
Any recommendations on books for postgresql PHP usage. Thanks, Dan. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Update db with $_POST
On Wed, 2005-03-16 at 16:50 +1000, Ligaya Turmelle wrote: assuming you are using PEAR DB - $result = $db-query(UPDATE items SET (item_name, item_desc, item_price, extraprice) VALUES (?,?,?,?) WHERE item_id = 3, array($_POST['title'], $_POST['description'], $_POST['price'], $_POST['extraprice'])); if (PEAR::isError($result)) { echo Error: There was an error with the query. Message returned: ; die($result-getMessage().' '.$db-getUserInfo().' ')); } Thanks I got it worked out though, I'm going to try this also to see what happens, I'm trying to learn the best I can and when things break and you fix em you learn a lot more. Thanks again. PS this is what I did: $db-query('UPDATE items SET item_name=?, item_desc=?, item_price=?, extraprice=? WHERE item_id = 3', array($_POST['title'], $_POST['description'], $_POST['price'], $_POST['extraprice'])); I've already posted this to the list, but it may not be there yet. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] recommending a PHP book?
Can any one recommend a good book that discusses MVC design patterns with PHP (and mySQL)? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: Update db with $_POST
Thanks for looking, I figured it out, after RTFM for db, I found that I needed to do field=? instead of using VALUES (). Example: $db-query('UPDATE items SET item_name=?, item_desc=?, item_price=?, extraprice=? WHERE item_id = 3', array($_POST['title'], $_POST['description'], $_POST['price'], $_POST['extraprice'])); I'm trying to update some form data with this db update query and it's not working, I'm not getting an error either. $db-query(UPDATE items SET item_name = $_POST[title], item_desc = $_POST[description], item_price = $_POST[price], extraprice = $_POST[extraprice] WHERE item_id = 3); I've tried this: $db-query(UPDATE items SET (item_name, item_desc, item_price, extraprice) VALUES (?,?,?,?) WHERE item_id = 3, array($_POST['title'], $_POST['description'], $_POST['price'], $_POST['extraprice'])); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Update db with $_POST
I'm trying to update some form data with this db update query and it's not working, I'm not getting an error either. $db-query(UPDATE items SET item_name = $_POST[title], item_desc = $_POST[description], item_price = $_POST[price], extraprice = $_POST[extraprice] WHERE item_id = 3); I've tried this: $db-query(UPDATE items SET (item_name, item_desc, item_price, extraprice) VALUES (?,?,?,?) WHERE item_id = 3, array($_POST['title'], $_POST['description'], $_POST['price'], $_POST['extraprice'])); Thanks, Dan. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Update db with $_POST
On Tue, 2005-03-15 at 18:45 -0500, Jason Barnett wrote: Danny Brow wrote: Thanks for looking, I figured it out, after RTFM for db, I found that I needed to do field=? instead of using VALUES (). Example: $db-query('UPDATE items SET item_name=?, item_desc=?, item_price=?, extraprice=? WHERE item_id = 3', array($_POST['title'], $_POST['description'], $_POST['price'], $_POST['extraprice'])); FYI - You should at least escape the $_POST data (more filtering may be necessary) before you go inserting it into your database. When using raw $_POST data it may be possible for someone to DROP DATABASE. I was planning on this, but I like to get things working first then move on to cleaning the input up. I'm still learning the db stuff, so the less that can cause an issue the better. Thanks, Dan. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] List gone quiet?
On Fri, 2005-02-25 at 11:13 +, Lester Caine wrote: Nothing on list over night? It's a PHP fast :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] For HomeSite users...
.org don't work but www.phpeclipse.de does. Dan. On Fri, 2005-01-21 at 12:06 +1100, [EMAIL PROTECTED] wrote: I havent used Homesite in years, I am now an Eclipse advocate :) www.phpeclipse.org :) OMG! This is quite possibly the coolest thing I've found in a while, and it breathes new life into my aging HomeSite+ v5.2 (now that Macromedia isn't really updating it and is focusing more on their DreamWeaver line). http://www.wilk4.com/asp4hs/installation.htm#parser http://www.wilk4.com/asp4hs/dnld/php5_parser_js.zip http://www.wilk4.com/asp4hs/list2.htm Just look around all those links and you will find an abundance of useful toolbars, PHP5 color coders, snippets, context manuals, etc. I nearly spooged on myself when I came across this today. (no pun intended) Jeremy Swinborne [EMAIL PROTECTED] created a PHP5 color coding .scc file that is just a life saver. It fixes many of the short comings of the default PHP4 color coder. It handles stuff like: echo \this is embeded $variable in my output\; and it knows about classes! daevid.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] php editor
On Thu, 2005-01-13 at 18:02 +0200, William Stokes wrote: Hello, I'm quite new with writing php code. I was considering of using some kind of php editor program to help with the syntax. Know any goog ones? Thanks -Will I like Komodo. Dan. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] can I compile php source OT
Wow I just wasted 10 minutes of my day reading half these post. This is one long thread. And man is it hard to follow. Dan. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ISP snippet
On Thu, 2004-12-09 at 18:17 -0600, Brad Ciszewski wrote: i need help to figure out the isp of a user. can anyone help me with this? http://www.arin.net/whois/ It will give you the owner of the IP address, i.e. Bell, AOL, etc. Whats the reason you need the uses ISP? -Brad www.BradTechnologies.com 99.9% Uptime 24/7 Support Packages as low as 3.50 p/month! www.BradTechnologies.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Confused - $GLOBALS
Below is a snip of a program I am writing, I am a little new to php. Any how, I can't for the life me figure out why one of my functions cannot grab the item_pics1 variable. I have tried passing the variable to the function, tried using $GLOBALS['item_pic1']. So I guess my question is, does PHP in some cases need to have a variable in a if statement sent back to the global scope? everything works but the str_replace item_pics1. Hope this is enough code. if (array_key_exists('pictures', $_POST)) { $how_many_pics = $_POST['pictures']; picture_input($how_many_pics); //process_errors(); $k = '1'; while ($k = $how_many_pics) { $item_pics1 .= td align=\center\A HREF=\pics/full_$k.jpg \ onMouseOver=\hiLite3('img03','clickme5')\; $item_pics1 .= img src=\pics/thumb_$k.jpg\ border=\0 \/td; $k++; } html_form($title, $price, $descrip, $current_items, $title_file_name, $errors); } else { print 'form method=post action=add-item.php'; print 'trtdHow Many pictures do you have?: /tdtdinput type=text name=pictures size=2/td/tr'; print '/form'; } function html_template() { if (file_exists('item.html')) { $html_template = $GLOBALS['html_template']; $html_template = str_replace('{pictures2}', $GLOBALS['item_pics1'], $html_template); $html_template = str_replace('{title}', $GLOBALS['title'], $html_template); $html_template = str_replace('{description}', $GLOBALS['descrip'], $html_template); $html_template = str_replace('{price}', $GLOBALS['price'], $html_template); $item_file_name = $GLOBALS['root_dir'] . / . $GLOBALS['dir'] . /item.html; $item_fh = fopen($item_file_name, 'x+'); fwrite($item_fh, $html_template); } else { $GLOBALS['errors'] .= item.html template does not exsit; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unsubscribing Junk Emails From the List: requests@firstustrading.com
I'm getting it too. On Thu, 2004-12-09 at 09:49 -0800, Justin Palmer wrote: Hi, Every time I send a response to the list I get a auto-reply from: [EMAIL PROTECTED] Is there someone that I could email that can delete this user from the list? Thanks for any information. Regards, Justin Palmer __ KISS (Keep It Simple, SEARCH)! Google::getUri( http://www.google.com ); Archives::getUri( http://marc.theaimsgroup.com/?l=php-general ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Confused - $GLOBALS
On Thu, 2004-12-09 at 13:41 -0500, John Nichel wrote: Danny Brow wrote: Below is a snip of a program I am writing, I am a little new to php. Any how, I can't for the life me figure out why one of my functions cannot grab the item_pics1 variable. I have tried passing the variable to the function, tried using $GLOBALS['item_pic1']. So I guess my question is, does PHP in some cases need to have a variable in a if statement sent back to the global scope? everything works but the str_replace item_pics1. Hope this is enough code. snip If you want to use a variable from outside the function, you either have to pass it to the function; if you want to change it, you have to pass it by reference, or make it global inside the function function foo ( $bar ) { /--code--/ } function foo ( $bar ) { /--code--/ } function foo() { global $var; /--more code--/ } See this is where the confusion is, I've tried all these and it still does not work. I'm going to read the whole page on variable scope a few times, see if I missed something. Maybe it's something else in my code screwing my up. Thanks. Dan. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Confused - $GLOBALS
On Thu, 2004-12-09 at 12:40 -0800, Richard Lynch wrote: My best guess from skimming your code is that you need: global $_POST; should I put this at the top of my code with the rest of my variables? in the function that uses $_POST. Or is $_POST always global anyway? No. I always forget, because they changed it around on POST/GLOBALS/etc at some point, but only on some of them. Grrr. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Confused - $GLOBALS
On Thu, 2004-12-09 at 15:39 -0500, Roger Spears wrote: Danny Brow wrote: On Thu, 2004-12-09 at 13:41 -0500, John Nichel wrote: Danny Brow wrote: Below is a snip of a program I am writing, I am a little new to php. Any how, I can't for the life me figure out why one of my functions cannot grab the item_pics1 variable. I have tried passing the variable to the function, tried using $GLOBALS['item_pic1']. So I guess my question is, does PHP in some cases need to have a variable in a if statement sent back to the global scope? everything works but the str_replace item_pics1. Hope this is enough code. This may seem a little simple, but it's happened to me. Are you sure the variable has a value? Yes, I can do a print $item_pics before and after the function. dan. PS. Roger, sorry for sending this to you twice, you sent your reply to directly and not to the list. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Confused - $GLOBALS
On Thu, 2004-12-09 at 12:40 -0800, Richard Lynch wrote: My best guess from skimming your code is that you need: global $_POST; in the function that uses $_POST. Or is $_POST always global anyway? I always forget, because they changed it around on POST/GLOBALS/etc at some point, but only on some of them. Grrr. After reading this again, the function does not use $_POST at all. here it is again. function html_template() { global $item_pics1; if (file_exists('item.html')) { print This is item_pics1 . $item_pics1; $html_template = $GLOBALS['html_template']; $html_template = str_replace('{item_pictures}', $item_pics1, $html_template); $html_template = str_replace('{title}', $GLOBALS['title'], $html_template); $html_template = str_replace('{description}', $GLOBALS['descrip'], $html_template); $html_template = str_replace('{price}', $GLOBALS['price'], $html_template); $item_file_name = $GLOBALS['root_dir'] . / . $GLOBALS['dir'] . /item.html; $item_fh = fopen($item_file_name, 'x+'); fwrite($item_fh, $html_template); } else { $GLOBALS['errors'] .= item.html template does not exsit; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Confused - $GLOBALS
On Fri, 2004-12-10 at 05:52 +0800, Jason Wong wrote: On Friday 10 December 2004 04:52, Danny Brow wrote: OK, you never said what your problem was except to say everything works but the str_replace item_pics1. Did you check $GLOBALS['errors'] after calling this function? No but I'm doing that now. I'm also reading the manual on $GLOBALS right again, this must have been something I missed the first time reading it. function html_template() { global $item_pics1; if (file_exists('item.html')) { Is this file supposed to be same as the one below? $item_file_name = $GLOBALS['root_dir'] . / . $GLOBALS['dir'] . /item.html; no, this is what the original item.html becomes. In my program $GLOBALS['root_dir'] is the root directory of the program, $GLOBALS['dir'] is created based on the current item number, like /var/www/htdocs/items_for_sale/item1 Thanks, dan. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* We are all dying -- and we're gonna be dead for a long time. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Creating a directory
What's the best way to create a directory with PHP, I tried using: if (array_exists('dir',$_POST)) { $dir_name = test123; shell_exec('mkdir $dir_name'); I don't want to have to declare a variable, I would like to do this all on one line. Like: shell_exec('mkdir $_POST['dir']'); // but it don't work } else { print Get get some coffee!; } I'll be putting some error checking in later :) Thanks, Dan. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating a directory
Thanks, I should have looked that up. 4am, time for bed. Thanks again, Dan. On Fri, 2004-11-12 at 18:01 +0900, Pluance wrote: Use mkdir in PHP Functions. See Also: http://www.php.net/manual/en/function.mkdir.php On Fri, 12 Nov 2004 03:54:52 -0500, Danny Brow [EMAIL PROTECTED] wrote: What's the best way to create a directory with PHP, I tried using: if (array_exists('dir',$_POST)) { $dir_name = test123; shell_exec('mkdir $dir_name'); I don't want to have to declare a variable, I would like to do this all on one line. Like: shell_exec('mkdir $_POST['dir']'); // but it don't work } else { print Get get some coffee!; } I'll be putting some error checking in later :) Thanks, Dan. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating a directory
On Fri, 2004-11-12 at 17:12 +, Jason Wong wrote: On Friday 12 November 2004 08:54, Danny Brow wrote: What's the best way to create a directory with PHP, I tried using: if (array_exists('dir',$_POST)) { $dir_name = test123; I'm 99% sure you mean 'test123'. I meant $dir_name = $_POST['dir']; This works with out the single quote. but all my variables have single or double quotes around them. shell_exec('mkdir $dir_name'); I'm 100% sure you meant to use instead of '. this is how I normally do this when declaring variables, but that maybe the difference here. } else { print Get get some coffee!; I'm 50% sure that should be print RTFM. RTFM /dev/null :) I'm 25-50% sure that this was a complete waste of a reply to a question. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* I like your SNOOPY POSTER!! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] probably stupid, but...
On Fri, 2004-11-12 at 15:08 -0500, Robert Sossomon wrote: I have a form that sends 20 rows of data into a script, instead of having to write 20 separate add functions, I wrote this piece of code... $i=1; while ($i20) { if ($_POST[book_title_$i]' != ) // One problem maybe the quote you have at the end of your $_POST request. { INSERT INTO `curriculum` VALUES // You could probably simplify this with a while or for loop. But I'm no PHP expert. Perhaps you could use an array to clean this up. ('','$_POST[book_title_$i]','$_POST[book_level_$i]','$_POST[level_grades_$i]','$_POST[book_section_$i]','$_POST[chapter_$i]','$_POST[chapter_title_$i]','$_POST[lesson_title_$i]','$_POST[skill_$i]','$_POST[life_skill_$i]','$_POST[success_indicator_$i]','$_POST[ncscos_$i]','$_POST[subject_$i]','$_POST[pages_$i]','$_POST[c_kit_$i]'); $message .= The entry $i was entered ; $i++; } else { $i++; } } Sorry if I missed anything else :- Dan. But I get THIS error in the log: [12-Nov-2004 14:59:19] PHP Parse error: parse error, unexpected T_VARIABLE, expecting ']' in /home/public/html/depts/fourh/curriculum_form_post.php on line 19 - How can I go about iterating through the script? or do I just need to write 20 if/else statements and separate inserts? Thanks, Robert -- Robert Sossomon, Business and Technology Application Technician 4-H Youth Development Department 200 Ricks Hall, Campus Box 7606 N.C. State University Raleigh NC 27695-7606 Phone: 919/515-8474 Fax: 919/515-7812 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] probably stupid, but...
On Fri, 2004-11-12 at 14:35 -0600, Jay Blanchard wrote: [snip] Did that and it fixed only that piece (saw it right after I sent the email out to the group). I am thinking that it is still somewhat of the iterations that are causing problems. I am waiting on the server guy to get back with me as to what the new error message looks like. [/snip] Have you echo'd the query out to see what it looks like? It's probably a good idea to get the part of a reply that tells everyone who your replying too. Not sure if it was me or Chris P. Chris has a way better answer then I. So I assume your replying to mine. Dan. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Accelerator
On Sun, 2004-11-07 at 07:55 +0200, Jyry Kuukkanen wrote: On Sun, 7 Nov 2004, raditha dissanayake wrote: David wrote: I need a PHP accelerator but am not sure which one to use. I would highly prefer to not use a commercial accelerator and need one that works with PHP 5. Does anyone recommend one out of the ones that exist? this one: - Turck MMCache for PHP I second that, unless you need it with latest PHP4.3.x, that Turck MMCache does not support currently. Then the free option known to work is PHP-Accelerator. According to the website: This version of the Turck MMCache has been successfully tested on PHP 4.1.0-4.3.3 under RedHat Linux 7.0, 7.3, 8.0 and Windows with Apache 1.3 and 2.0. But David asked for something that works with PHP 5. It seems that most work with the 4.x releases of PHP. Dan. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] VOTE TODAY
On Tue, 2004-11-02 at 10:50 -0700, Grant wrote: I can't wait for the replies... Here's a reply: Don't vote for Bush. - Grant I'm Canadian, please stop wasting my bandwidth. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Learning PHP5
On Thu, 2004-10-28 at 15:03 -0700, Matthew Sims wrote: About a week ago someone was asking where are beginner can go to learn PHP5? This book was just advertised on Slashdot. Learning PHP 5 Only $20 on Amazon.com http://www.amazon.com/exec/obidos/tg/detail/-/0596005601/qid=1099000383/sr=8-1/ref=pd_csp_1/104-8763861-9120755?v=glances=booksn=507846 I'm using it now and it's pretty good. I am almost 3/4 done the book after a week and half (including exercises). Dan. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Learning PHP5
On Thu, 2004-10-28 at 20:20 -0500, Greg Donald wrote: On Thu, 28 Oct 2004 19:12:12 -0400, Michael Lauzon [EMAIL PROTECTED] wrote: Unfortunately the PHP.net are not really for beginners, you have to have some programming knowledge to get started using their tutorials...this is just my opinion. Well you're certainly entitled to your opinion.. I program in multiple languages as do many people on this list. And I for one have to say that it doesn't get any more simple than PHP and the ease of learning you get from it's excellent online manual. No other programming manual even comes close. You get well documented usage examples plus hundreds if not thousands of user comments that often contain even more coding examples. Being able to teach yourself kinda goes along with being a programmer.. and PHP.net totally accelerates that function. Go out and try to learn Perl, Python, Java, or C (with no prior programming knowledge) and get back to me. It's certainly possible, but I wouldn't want to learn Perl again from scratch. I have to agree with this, Learning PHP 5 and the online manual are making this very easy for me, I can almost say it's as easy as HTML. But this maybe because I know perl. Dan. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] hello
Try this, or nothing! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] using xp home
is it better to use apache 1.3.29 or apache 2.0.48? i am having the worst trouble ever trying to get this thing to work -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help needed to install php on my xp home edition pc
i have installed apache 2 and mysql 3 on my pc (running xp home) i have installed php 4.3.4 but have hit a snag. the php doesnt seem to gel with apache at all. any help please? how do i configure apache and php to mix? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie: hmtl form to select items from mysql db
Hola, PHP folk! I am slowly getting a handle on what php/mysql can do. I have a mysql database that I can display in a web browswer with php. That part is working just fine, but it was the easiest part, of course. My goal is to create an order form sort of thing were a certain quantity of each item is specified, and the final step is creating the invoice with the grand total is tabulated, etc, etc. I know this is standard stuff, my immediate question is more specific. I need some direction in creating the html form where the items are selected. As it stands now, I have six digit ID numbers that identify each item. The first digit represents the general class of items and the second digit represents a sub-class. The remaining four are arbitrary. What I would like is for the user to 1)pick the class, see the available sub-classes 2)pick the subclass, see the items available 3)pick the item 4)pick quantity If anybody can point me to a tutorial or examples, I would be most appreciative. Danny -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 4.2.2 doesn't have mysql_real_esacpe_string()
Hola, PHP folk! I am learning about PHP from a book (MySQL/PHP Database Applications). I have been following the examples in the book, modifying them to suit my purpose and experiment, etc. I am using an old work machine my webserver. I did a Redhat 9 install, adding MySQL version 4. The 'stock' Redhat installation of PHP was version 4.2.2. Having this older version had presented no problems until now. The example I am currently working on uses a function mysql_real_escape_string(), which is only in php 4.3.0 and higher. An example of the how the function is used: [code] $query = sprintf($query , mysql_real_escape_string($name) , mysql_real_escape_string($location) , mysql_real_escape_string($email) , mysql_real_escape_string($url) , mysql_real_escape_string($comments) , mysql_real_escape_string($_SERVER['REMOTE_ADDR']) ); safe_mysql_query($query); [/code] I am looking for recommendations on what I should do. I can upgrade to the latest version of PHP if need be, though I am not particulary eager to do so, since everything else has been playing nice with each other. The lazy person inside of me is looking for a painless answer, something along the lines of just use mysql_foo() instead, it does the same thing as that function that isn't in 4.2.2 Thanks, Danny -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] best way to specify path to a file in a $variable?
Hola, PHP folk- I am using $page_title=some page title here; require('header.inc'); to include a common header for all my pages. I am using $page_title so I can have unique names for the different pages. //---header.inc !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN html head title?php echo $page_title; ?/title link rel=stylesheet href=./some.css type=text/css /head body ... I want to be able to also define the path to the CSS file. For instance, some pages will have the CSS in the same directory, so that part would read ./my.css If the page is located in a subdirectory, the path would then be ../my.css I would like to use a php variable where I can define the path the same way as the $page_title works. I have tried some experiments with a $path_to_css variable, but I have not had much success. I think part of the problem is that I might be stumbling over escaping everything properly. Is there a better way to do what I am trying to do? Thanks, Danny -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Apache 2.0.48 won't play nice with php 4.3.4 ?
Hola, PHP folk! I hope this is an appropriate forum for this: I am setting up a Redhat 9 webserver to serve as my testbed for a little php/mysql app I want to develop. I installed RH9 without the webserver/php/mysql so I could manually install the most current versions. MySQL 4.0.16 installed fine, Apache (httpd-2.0.48) installed fine. PHP 4.3.4 seemed to install fine. Unfortunately, when I try to start the webserver with php, I get the following error: '...httpd: module /usr/local/php-4.3.4/sapi/apache2handlers/sapi_apache2.c is not compatible with this version of Apache. Help! Is there a work around for this? Apache will start fine if I don't try to enable php via LoadModule in the Apache configuration file. Any comments and suggestions appreciated. Thanks, Danny -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] printing support
Hello, I was wondering where the printing support has gone in php5? Is it still possible? Is is better to use mysql or sqlite with the new (and improved) php5? Thanks in advance, Best regards, Danny Schalken. Atrion Information Technology. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem connecting to POP3 accounts
Try: $strMailServer = {domain.co.uk:110/pop3}INBOX; As per the manual. HTH Danny. -Original Message- From: Alec Wallis [mailto:[EMAIL PROTECTED] Sent: 03 April 2003 18:35 To: [EMAIL PROTECTED] Hi I am currently experiencing some problems connecting to POP3 accounts using imap_open. I am using the following code: $ArrayImap = imap_open ($strMailServer, $strUsername, $strPassword); with the mail server being set to: $strMailServer = {domain.co.uk/pop3:110}INBOX; It seems to connect ok, as if an incorrect username or password is entered incorrectly something different happens. The error message I seem to get is: Notice: (null)(): Mailbox is empty (errflg=1) in Unknown on line 0 PHP Notice: (null)(): Mailbox is empty (errflg=1) in Unknown on line 0 When I view the mailbox in Outlook it has messages in it and so isn't empty. Can anyone help me please? Alec -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Constants and Here Document Interpolation
Hello, It doesn't look like it - a note in the constants manual entry reads: PHP has no way of recognizing the constant from any other string of characters within the heredoc block Danny. -Original Message- From: Daniel R. Hansen [mailto:[EMAIL PROTECTED] Sent: 01 March 2003 15:57 To: [EMAIL PROTECTED] Can anyone tell me if it is possible (and how) to use defined constants within here document content? I've not been successful finding anything on this in the online docs. Thanks! Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Capitalising Personal Names
Hi, Well it's hardly rocket science - a flick through the manual and I came up with : $name=ucwords(strtolower($name)); HTH Danny. - Original Message - From: Geoff Caplan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 28, 2003 10:31 AM Subject: [PHP] Capitalising Personal Names Hi folks, I need to clean up the capitalisation of user-entered personal names. Once you start thinking about it, you realise it is a non-trivial issue, but previous discussions on the list presented only very partial solutions. In Perl, there are Cpan modules such as namecase and nameparse which handle this quite well. Does anyone have anything similar in PHP? Thanks -- Geoff Caplan Advantae Ltd -- 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] Finally!!! A workaround to mail() in PHP...
I'd say an even simpler workaround would be to add '[EMAIL PROTECTED]' as the fifth parameter to the mail function - just as in example 3 of the docs. Danny. - Original Message - From: Scott Fletcher [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 19, 2003 3:43 PM Subject: [PHP] Finally!!! A workaround to mail() in PHP... Finally a workaround to the problem in mail() in PHP I did the posting somewhere, so I'll cut to the chase by posting it here My recent posting does not work too well --clip-- This is for any Unix or Linux machine using the Sendmail. However, no guarentee that it would work in Windows. Some SMTP won't accept e-mail with the From: host@domain without the suffix com, like domain.com, so using the From: [EMAIL PROTECTED] option in the $header in the mail() does not solve the problem for me. Someone suggest using the php.ini with the configuration by adding the -f [EMAIL PROTECTED] to the sendmail path. Example look like this --clip-- sendmail_path = /usr/sbin/sendmail -t -i -f [EMAIL PROTECTED] --clip-- This is not an option for me because it is limit to one user, not more than one and it override the From: [EMAIL PROTECTED] option in the $header in mail().. So, Finally there is a workaround to the problem and it is very simple Just add this entrie to the /etc/hosts file in Unix or Linux. Just substitute the word in bracket for a value --clip-- ip addressmachine's_host.domain.com --clip-- Example ... --clip-- 123.456.789.012 xyz.abc.com --clip-- Make sure your machine do the search order with the host first before the DNS or Nameserver. In my case in AIX, is /etc/netsvc.conf. Hope Make sure your machine is set to read the host file first before the DNS or the nameserver, if not then make some changes to it. In my case for AIX, it is /etc/netsvc.conf... Hope this help --clip-- -- 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] What's the scoop on PHP 5?
The latest cvs snapshots for PHP4.3.x and PHP5.0.x can be found at http://snaps.php.net Danny. - Original Message - From: Leif K-Brooks [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 13, 2003 8:50 PM Subject: [PHP] What's the scoop on PHP 5? Anyone know what the status of PHP 5 is? I can't find reference of it on php.net, and the only place I can find an alpha of it is at the PHP Museum. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- 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] Attaining NTLM information from IE browsers.
There is actually an NTLM Auth module available for Apache. (http://modntlm.sourceforge.net/). If you really need to do it though PHP I'd suggest running a packet sniffer to see what headers IIS sends and what to expect back from IE. HTH Danny Shepherd. - Original Message - From: Marriner, Bruce W. [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, February 08, 2003 6:39 PM Subject: [PHP] Attaining NTLM information from IE browsers. I know this is in the archives, but I couldnt seem to find the answer I needed. I am running redhat8, apache 2.0.44, and php 4.2.2. I am trying to write a script that will emulate the IIS server and request NTLM auth. from the browser. And then decode the base64? information and compate the user information against a ldap function that connects to a active directory server. I know that you must modify the header with the header() command. I have done that, and the most I get in one line of information back from the browser. There is suppose to be three lines of encoded information sent back. If anyone has any code or knows the complete hand shake or anything really, I would really like the help. This is a really big project at my company, and they are considering moving to a linux platform and even PHP. But if I can't make the same stuff work that their w2k cold fusion platform does. It's not going to work so well. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Framework
Well, Yahoo! have moved/are moving to Smarty and they get a few million views a day. The killer part with smarty is that it converts the Smarty tags, in your template, to real PHP code - that's what makes it so fast. It's also very easy to extend. Danny. - Original Message - From: John Wards [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, February 03, 2003 2:41 PM Subject: Re: [PHP] PHP Framework On Monday 03 Feb 2003 2:01 pm, karthikeyan.balasubramanian wrote: Hi All, I finally decided to upgrade my PHP. Just want to know your thoughts on which Framework is the best with a clear seperation of content from presentation. Please let me know which do you think is the best and why? I use SMARTY (smarty.php.net) and think its the dogs bolxs. Its fast, its easy to use. The template pasing language is simple. My site gets somewhere in the region on 100,000 p.v.s a day and it copes easily. But, there is a pertender lurking in the shadows. phorum.org, yes its a message board. But phorum 5 which is not pre alpha yet has its own built in templating system which I thnk with a bit of tweaking could be used as a full blown templating system. John -- 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] Re: [SOAP] Re: soap post and http 1.1 100 continue
- Original Message - From: Dominik Wittenbeck [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, January 25, 2003 3:28 PM Subject: [SOAP] Re: soap post and http 1.1 100 continue Yep, know that one, Why it does happen: although the HTTP 1.1 spec states that a HTTP 100 SHOULD NOT (or was it MUST NOT ;-) to the client, unless it requires it by a specific header, IIS does it with webservices and thereby about any that are published and maintained with .NET ;-) Not quite right : An origin server SHOULD NOT send a 100 (Continue) response if the request message does not include an Expect request-header field with the 100-continue expectation, and MUST NOT send a 100 (Continue) response if such a request comes from an HTTP/1.0 (or earlier) client. There is an exception to this rule: for compatibility with RFC 2068, a server MAY send a 100 (Continue) status in response to an HTTP/1.1 PUT or POST request that does not include an Expect request-header field with the 100-continue expectation. This exception, the purpose of which is to minimize any client processing delays associated with an undeclared wait for 100 (Continue) status, applies only to HTTP/1.1 requests, and not to requests with any other HTTP-version value. Solution: A HTTP 100 basically states: ok I am ready for your content now. You have probably submitted your content already... resend it, but the content only, without the \r\n\r\n mark that separates headers from payload with HTTP. To serve a clean solution you should however go ahead and implement a listener that tries to hear a HTTP 100. With PHP this is kind of tiresome. In my implementation I also just resend the payload ;-) A HTTP 100 basically states ok based on your headers I won't reject your body data, so send it now - handy for services which need to check specific headers. Imagine if the client sent 5MBs of data only to have it knocked back because an authorization header wasn't present. :-) I suppose a better solution would be to use the 100-Continue properly (i.e. send headers + with an expect header and no body) or send HTTP/1.0 requests. HTH Danny. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Script under Windows OK, under Linux, not...
Why are you opening the file in append mode? As the manual says: a+' - Open for reading and writing; place the file pointer at the end of the file. Try using 'r+' instead or rewind the file pointer before reading. Danny. - Original Message - From: Daniel Page [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, January 25, 2003 11:39 AM Subject: [PHP] Script under Windows OK, under Linux, not... Hi, I have the following code : $_fp = fopen(/home/dh2240/mgt/index.php, a+) or die(); $_contents = fread($_fp,filesize(/home/dh2240/mgt/index.php)); fclose ($_fp); //Menu elements $_sme = strpos($_contents,sub_menu_elements); echo sme = $_smep; ... It should display somthing like sme = 850, after finding the string in the specified file. Under windows, this script works fine (except replacing the /home/dh2240/mgt/index.php by c:/apache/htdocs/mgt/index.php)... it seems that the file index.php cannot be opened under linux... The file is chmod 777, along with the directory /mgt, and the files identical, but still no luck... The fopen does not die(), but it does not seem to read any data from the file... I'm confused, and not sure how to check what is happening... Anyone got any ideas ? Cheers, Daniel -- 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] Random Row...
Don't make life difficult for yourself :) SELECT * FROM myTable ORDER BY RAND() LIMIT 0,1 HTH Danny. - Original Message - From: Brian McGarvie [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, January 16, 2003 9:37 AM Subject: [PHP] Random Row... $sql = select count(*) as theCount from myTable ; ... $row_id = rand(1, $myrow[theCount]); ... $sql_randow_row select * from myTable where id = $row_id ; I assume I'm right with the method above to select a random row? or any other way? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting a dynamic IP address
$_SERVER['SERVER_ADDR'] gives the address of the server running the php script $_SERVER['REMOTE_ADDR'] gives the client address or the proxy address. (be careful here, storing a proxy's IP is next to useless) $_SERVER[' HTTP_X_FORWARDED_FOR'] gives the client address if they're behind a proxy (if this isn't set then they probably aren't behind a proxy so you can use the remote_addr instead) HTH Danny. - Original Message - From: Kyle Lampkin [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 15, 2003 11:41 PM Subject: [PHP] Getting a dynamic IP address Hello all, Newbie here I need to know if there is a way I can get my dynamic IP address for use in a php script? -- Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.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] Question about $_GET
Try $query = SELECT Newsheadline, News, Contact FROM news WHERE Newsid = {$_GET['id']}; HTH Danny. - Original Message - From: Frank Keessen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 15, 2003 10:50 AM Subject: [PHP] Question about $_GET Hi All, Can you please help me with the following problem? I've had code wich was running fine with php till i've upgraded to PHP version 4.2.3. The original code line was: $query = SELECT Newsheadline, News, Contact FROM news WHERE Newsid = '$id'; but it's not working when you have register_globals=Off So i've read everywhere to use the $_Get: So the code looks like this: $query = SELECT Newsheadline, News, Contact FROM news WHERE Newsid = $_GET['id']; But all i'm getting in my browser is: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' Can someone please help? Thanks and regards, Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP_ACCEPT - Reliabilty?
Hi, No, I wouldn't rely on it at all, I couldn't find a browser that *does* have that mime-type in it's header! - Here's what IE6 sends : Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/msword, */* Accept-Language: en-gb Accept-Encoding: gzip, deflate Flash, along with a multitude of other plugins, is installed and working fine. FWIW, Mozilla 1.3a sends: Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q= 0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate,compress;q=0.9 Opera 7 sends: Accept: text/html, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1 Accept-Language: en Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0 - Original Message - From: SED [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 14, 2003 10:22 AM Subject: [PHP] HTTP_ACCEPT - Reliabilty? I'm using Flash very often within websites. Like you know, sometimes the user doesn't have the Flash-plug-in so I was wandering if I could depend on this $_SERVER['HTTP_ACCEPT'] variable to look for shockwave-flash. If found, the visitor has Flash-plugging, if not, he doesn't. So my question really is, can I base my Flash-detection on this global variable or is too uncertain? (e.g. when the user is using Netscape, Opera etc., Linux, Mac etc.) Regards, Sumarlidi E. Dadason SED - Graphic Design _ E-mail: [EMAIL PROTECTED] website: www.sed.is -- 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] php5 cvs
It includes the latest CVS build of ZendEngine 2.0 - AFAIK it hasn't even reached beta status yet, so don't even think about using it for production work. That said, I didn't have any problems building it and it seems pretty stable. A list of changes and features can be found at http://www.php.net/ZEND_CHANGES.txt. HTH Danny. - Original Message - From: electroteque [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, January 11, 2003 6:50 PM Subject: [PHP] php5 cvs hi guys just noticed php5 cvs in the snaps page , does this have the zend 2.0 engine ? more specific question has it got the proper OO built in yet ? -- 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] Is this possible with php?
Hi, Where did he say he wanted to use Word to edit PHP files? AFAICT the idea was to automatically upload Word files, presumably to make them available on an Intranet for download etc. As for uploading a file automatically - PHP isn't going to do it. An app which can map a virtual drive in Windows would probably be the best bet - I think Windows has built in support for mapping WebDAV and FTP servers as shares so this may be a good starting point. HTH Danny. - Original Message - From: Maxim Maletsky [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, January 10, 2003 11:38 AM Subject: Re: [PHP] Is this possible with php? [EMAIL PROTECTED] wrote... : I would like to know if the follwing function can be implemneted in php with help of other tools: in PHP distribution? PHP is the programming language, not a client/server tool. This is definitely something to be an integrated part of something else. using MS Word in windows, MS Word for editing PHP files? That is very, very bad ... You will never find a job if ever mention it to an employer. Search the archives of this list for PHP Editors. I recommend Edit Plus for plain-text programming. If you want a whole IDE then Zend Studio is probably the best for you. when a file is saved, can it be AUTOMATICALLY uploaded (via http POST or other mechanism) to a server? Currently I need to first save it on my desktop, then upload that copy to a php-supported server. Oh well, there are four ways to accomplish this. 1. Professional way: Using CVS. CVS (cvshome.org) is a system that allows you to version your files. This, in two words, works this way: in CVS, you `checkout' (update) a file, edit it, and save it (if somebody else edited that file while you edited yours both changes will merge). CVS is the most professional solution for this thing. 2. Simplest way: Use a mapped networking like Samba. This will mean that you will see your server just as it was a hard disk on your windows. You dragdrop files there and the same will occur remotely. Not a very secure way, though. 3. FTP integrated tool: Get a good editor that has some FTP integration. It will means that when you `save' a file in your editor, it will automatically FTP that file on the server. A very tool-dependent way but can work. Very cruel when something goes wrong, though. Again, Zend IDE and Edit Plus can do that. 4. The Geeky way: Edit all your files in a simple VIM or other fancy directly on the server by logging there with telnet or SSH. Have fun. -- Maxim Maletsky [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] money
http://www.php.net/manual/en/function.number-format.php - Original Message - From: Wilbert Enserink [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, January 09, 2003 10:44 AM Subject: [PHP] money Hi all, I'm busy making a swebstore. I have troubles with the format of money. I wanrt to display amounts like 2 products a ? 6,25 = ? 12,50 Whatever I try I can't get the comma there (it's showing a point . and it doesn't display the second number behind the comma i.e. 12.5 Anybody knows how to make me my money? :-) regards Wilbert - Pas de Deux Van Mierisstraat 25 2526 NM Den Haag tel 070 4450855 fax 070 4450852 http://www.pdd.nl [EMAIL PROTECTED] - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache 2 and PHP 4.2.3.
In short - looks as if your version of Apache 2 is out of date. You're using a version from 28th June, the PHP dll was built against a version from 3rd September. Danny. - Original Message - From: Horst Gassner [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, November 16, 2002 12:06 PM Subject: [PHP] Apache 2 and PHP 4.2.3. Hi! When I am laoding php as module: LoadModule php4_module c:/php/sapi/php4apache2.dll I get the following error: Apache.exe: module c:\php4build\snap\sapi\apache2filter\sapi_apache2.c is not compatible with this version of Apache (found 20020628, need 20020903). Please contact the vendor for the correct version. What I am doing wrong? Thanx in advance Horst -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: GD 1.5
Actually, GD2 can be compiled (after a patch) to read/write GIFs with LZW compression (the LZW algorithm is the root of the legal iffyness), but (AFAIK) you're only legally allowed to enable it if you live outside the US Canada. AFAIK only FreeBSD's ports system does this atm. - Original Message - From: Mako Shark [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, November 15, 2002 7:18 PM Subject: [PHP] Re: GD 1.5 If the OP was concerned about such issues then he/she should not be using GIF at all! This is leading me to believe that I can't use GIFs because of these issues. Is this true? I know now that Unisys (Unisys?) made a fuss about some compression or whatever, but someone told me it was still okay to use old GDs (am I naive? maybe). Is it now considered piracy to use GIFs at all? Does this mean I have to switch over to JPGs, even those images that compress better with GIFs? I just assumed we were still permitted, what with Jasc and everybody still allowing it in their products. Is JPEG (or PNG) the way to go? I hesitate using PNGs since they seem to be the least-supported out of the 'big three'. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php