Re: [PHP-DB] Text file (rw) question...
Nevermind. I figured it out. - Original Message - From: Rob W. [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Tuesday, March 14, 2006 1:45 AM Subject: [PHP-DB] Text file (rw) question... I'm trying to figure out how to read specific data from a text file that is already written. Example MaxUser=3D32 PortBase=3D8000 I want to be able to have php read them specific pieces of info so I can put them in to forms and update them via php. Any help would be appreciated. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Mysql/PHP5 connection error
Hello, I hope somebody can assist. I am using dreamweaver 8, Mysql, PHP5 for a simple we application. After using the dreamweaver wizard to make a connection, then created a recordset. Trouble starts when I use require_once(connections/ConnSAFDEM) to link to the database connection file. I get the error below. If I hand code the connection and recordsets things work fine as long as I am not using the require, require_once, include functions. I installed PHP recently on IIS (manual installation). I am wondering if I am mssing something which is stopping those functions to work? Warning: require_once(Connections/connSAFDEM.php) [ http://localhost/safdem_web/Admin/function.require-once function.require-once]: failed to open stream: No such file or directory in c:\Inetpub\wwwroot\safdem_web\Admin\add_vacancy.php on line 1 Fatal error: require_once() [ http://localhost/safdem_web/Admin/function.require function.require]: Failed opening required 'Connections/connSAFDEM.php' (include_path='.;C:\php5\pear') in c:\Inetpub\wwwroot\safdem_web\Admin\add_vacancy.php on line 1
Re: [PHP-DB] Mysql/PHP5 connection error
On 3/14/06, Eustace [EMAIL PROTECTED] wrote: Hello, I hope somebody can assist. I am using dreamweaver 8, Mysql, PHP5 for a simple we application. After using the dreamweaver wizard to make a connection, then created a recordset. Trouble starts when I use require_once(connections/ConnSAFDEM) to link to the database connection file. I get the error below. If I hand code the connection and recordsets things work fine as long as I am not using the require, require_once, include functions. I installed PHP recently on IIS (manual installation). I am wondering if I am mssing something which is stopping those functions to work? Warning: require_once(Connections/connSAFDEM.php) [ http://localhost/safdem_web/Admin/function.require-once function.require-once]: failed to open stream: No such file or directory in c:\Inetpub\wwwroot\safdem_web\Admin\add_vacancy.php on line 1 Did you read the error message? No such file or directory That means the file Connections/connSAFDEM.php doesn't exist. It could be: - wrong path - wrong case - file really doesn't exist. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Mysql/PHP5 connection error
Thanks. That's the mind boggling part, the file does exist, correct case, correct path! Dreamweaver does ship the files automatically to the testing server..and I checked to make sure! -Original Message- From: chris smith [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 14, 2006 12:04 PM To: [EMAIL PROTECTED] Cc: php-db@lists.php.net Subject: Re: [PHP-DB] Mysql/PHP5 connection error On 3/14/06, Eustace [EMAIL PROTECTED] wrote: Hello, I hope somebody can assist. I am using dreamweaver 8, Mysql, PHP5 for a simple we application. After using the dreamweaver wizard to make a connection, then created a recordset. Trouble starts when I use require_once(connections/ConnSAFDEM) to link to the database connection file. I get the error below. If I hand code the connection and recordsets things work fine as long as I am not using the require, require_once, include functions. I installed PHP recently on IIS (manual installation). I am wondering if I am mssing something which is stopping those functions to work? Warning: require_once(Connections/connSAFDEM.php) [ http://localhost/safdem_web/Admin/function.require-once function.require-once]: failed to open stream: No such file or directory in c:\Inetpub\wwwroot\safdem_web\Admin\add_vacancy.php on line 1 Did you read the error message? No such file or directory That means the file Connections/connSAFDEM.php doesn't exist. It could be: - wrong path - wrong case - file really doesn't exist. -- Postgresql php tutorials http://www.designmagick.com/ -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 268.2.1/279 - Release Date: 3/10/2006 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Mysql/PHP5 connection error
On 3/14/06, Eustace [EMAIL PROTECTED] wrote: Thanks. That's the mind boggling part, the file does exist, correct case, correct path! Dreamweaver does ship the files automatically to the testing server..and I checked to make sure! Is this the full path to the file? c:\Inetpub\wwwroot\safdem_web\Admin\Connections\connSAFDEM.php because that's what the server is looking for. -Original Message- From: chris smith [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 14, 2006 12:04 PM To: [EMAIL PROTECTED] Cc: php-db@lists.php.net Subject: Re: [PHP-DB] Mysql/PHP5 connection error On 3/14/06, Eustace [EMAIL PROTECTED] wrote: Hello, I hope somebody can assist. I am using dreamweaver 8, Mysql, PHP5 for a simple we application. After using the dreamweaver wizard to make a connection, then created a recordset. Trouble starts when I use require_once(connections/ConnSAFDEM) to link to the database connection file. I get the error below. If I hand code the connection and recordsets things work fine as long as I am not using the require, require_once, include functions. I installed PHP recently on IIS (manual installation). I am wondering if I am mssing something which is stopping those functions to work? Warning: require_once(Connections/connSAFDEM.php) [ http://localhost/safdem_web/Admin/function.require-once function.require-once]: failed to open stream: No such file or directory in c:\Inetpub\wwwroot\safdem_web\Admin\add_vacancy.php on line 1 Did you read the error message? No such file or directory That means the file Connections/connSAFDEM.php doesn't exist. It could be: - wrong path - wrong case - file really doesn't exist. -- Postgresql php tutorials http://www.designmagick.com/ -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 268.2.1/279 - Release Date: 3/10/2006 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Mysql/PHP5 connection error
Never trust DW to do the testing for you. I never user DWs built in server stuff to test...create it and then test it thru the browser like it would actually operate. Bastien From: Eustace [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: php-db@lists.php.net Subject: RE: [PHP-DB] Mysql/PHP5 connection error Date: Tue, 14 Mar 2006 12:13:22 +0200 Thanks. That's the mind boggling part, the file does exist, correct case, correct path! Dreamweaver does ship the files automatically to the testing server..and I checked to make sure! -Original Message- From: chris smith [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 14, 2006 12:04 PM To: [EMAIL PROTECTED] Cc: php-db@lists.php.net Subject: Re: [PHP-DB] Mysql/PHP5 connection error On 3/14/06, Eustace [EMAIL PROTECTED] wrote: Hello, I hope somebody can assist. I am using dreamweaver 8, Mysql, PHP5 for a simple we application. After using the dreamweaver wizard to make a connection, then created a recordset. Trouble starts when I use require_once(connections/ConnSAFDEM) to link to the database connection file. I get the error below. If I hand code the connection and recordsets things work fine as long as I am not using the require, require_once, include functions. I installed PHP recently on IIS (manual installation). I am wondering if I am mssing something which is stopping those functions to work? Warning: require_once(Connections/connSAFDEM.php) [ http://localhost/safdem_web/Admin/function.require-once function.require-once]: failed to open stream: No such file or directory in c:\Inetpub\wwwroot\safdem_web\Admin\add_vacancy.php on line 1 Did you read the error message? No such file or directory That means the file Connections/connSAFDEM.php doesn't exist. It could be: - wrong path - wrong case - file really doesn't exist. -- Postgresql php tutorials http://www.designmagick.com/ -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 268.2.1/279 - Release Date: 3/10/2006 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Text file (rw) question...
How about posting your solution as well? Maybe someone will find it useful. -Original Message- From: Rob W. [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 14, 2006 2:07 AM To: php-db@lists.php.net Subject: Re: [PHP-DB] Text file (rw) question... Nevermind. I figured it out. - Original Message - From: Rob W. [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Tuesday, March 14, 2006 1:45 AM Subject: [PHP-DB] Text file (rw) question... I'm trying to figure out how to read specific data from a text file that is already written. Example MaxUser=3D32 PortBase=3D8000 I want to be able to have php read them specific pieces of info so I can put them in to forms and update them via php. Any help would be appreciated. -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] RE: Ye old $_SESSION variables :)
Try to make a small new script that only contains a form and a session. Then try a from with the same field names as the variable names. name='test' = $_SESSION['test']. When the session data is overwritten by the second try, registerglobals is switchd on. The thing you can do then is to rename your form fields. I use: name='in[YourFieldName]' This outputs an array: $_POST = in = YourFieldName = 'bar' Adriaan Ayy. If registerglobals should be on, try to turn it off. It just supports laziness and promotes confusion. But that's just my very subjective opinion. Checking for registerglobals is a good idea, though, and grouping form fields into an array is one as well, as long as you stay in php with your backend. Also, try fiddling with your cookie settings, if a lower setting solves the problem, you have to add the session-id to the action in the form tag, i.e. form method=post action=somewhere.php? =?=session_name().'='.session_id();? Ah, and, don't know if you knew or not: You can see what's left of your session, your post and generally any array with print_r or vardump, i.e. print_r($_SESSION); print_r($_POST). As other people said, you probably either forgot to session_start() somewhere, or the post screws up the transparent session id thingy, or registerglobals is on. Matthias -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Text file (rw) question...
Ok, The fix is just doing something like this... list($variable, $data) = explode(=, $x); But now my problem is trying to figure out how to update that data with form post ect... So the main page would get MaxUser=32 It would read that info and put it in to a form field, which I have. Now I gotta get it to take and make it so that a new value can be put in that field and updated back in to the text file. I have searched all over google for about 4 hrs looking for something like this but no go, any help would be appricated. - Original Message - From: Dwight Altman [EMAIL PROTECTED] To: 'Rob W.' [EMAIL PROTECTED]; php-db@lists.php.net Sent: Tuesday, March 14, 2006 9:13 AM Subject: RE: [PHP-DB] Text file (rw) question... How about posting your solution as well? Maybe someone will find it useful. -Original Message- From: Rob W. [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 14, 2006 2:07 AM To: php-db@lists.php.net Subject: Re: [PHP-DB] Text file (rw) question... Nevermind. I figured it out. - Original Message - From: Rob W. [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Tuesday, March 14, 2006 1:45 AM Subject: [PHP-DB] Text file (rw) question... I'm trying to figure out how to read specific data from a text file that is already written. Example MaxUser=3D32 PortBase=3D8000 I want to be able to have php read them specific pieces of info so I can put them in to forms and update them via php. Any help would be appreciated. -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Text file (rw) question...
Rob W. wrote: Ok, The fix is just doing something like this... list($variable, $data) = explode(=, $x); But now my problem is trying to figure out how to update that data with form post ect... So the main page would get MaxUser=32 It would read that info and put it in to a form field, which I have. Now I gotta get it to take and make it so that a new value can be put in that field and updated back in to the text file. I have searched all over google for about 4 hrs looking for something like this but no go, any help would be appricated. This is a simple example but it should work for you: $new_textcontent = ; foreach($_POST as $area = $value) { $new_textcontent .= $area . = . $value . \n; } $fp = fopen($filename, 'w'); fputs($fp, $new_textcontent); fclose($fp); - Original Message - From: Dwight Altman [EMAIL PROTECTED] To: 'Rob W.' [EMAIL PROTECTED]; php-db@lists.php.net Sent: Tuesday, March 14, 2006 9:13 AM Subject: RE: [PHP-DB] Text file (rw) question... How about posting your solution as well? Maybe someone will find it useful. -Original Message- From: Rob W. [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 14, 2006 2:07 AM To: php-db@lists.php.net Subject: Re: [PHP-DB] Text file (rw) question... Nevermind. I figured it out. - Original Message - From: Rob W. [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Tuesday, March 14, 2006 1:45 AM Subject: [PHP-DB] Text file (rw) question... I'm trying to figure out how to read specific data from a text file that is already written. Example MaxUser=3D32 PortBase=3D8000 I want to be able to have php read them specific pieces of info so I can put them in to forms and update them via php. Any help would be appreciated. -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Text file (rw) question...
That works, but it just throws it in to a big loop and fills up the file, any suggestions? - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 5:54 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: Ok, The fix is just doing something like this... list($variable, $data) = explode(=, $x); But now my problem is trying to figure out how to update that data with form post ect... So the main page would get MaxUser=32 It would read that info and put it in to a form field, which I have. Now I gotta get it to take and make it so that a new value can be put in that field and updated back in to the text file. I have searched all over google for about 4 hrs looking for something like this but no go, any help would be appricated. This is a simple example but it should work for you: $new_textcontent = ; foreach($_POST as $area = $value) { $new_textcontent .= $area . = . $value . \n; } $fp = fopen($filename, 'w'); fputs($fp, $new_textcontent); fclose($fp); - Original Message - From: Dwight Altman [EMAIL PROTECTED] To: 'Rob W.' [EMAIL PROTECTED]; php-db@lists.php.net Sent: Tuesday, March 14, 2006 9:13 AM Subject: RE: [PHP-DB] Text file (rw) question... How about posting your solution as well? Maybe someone will find it useful. -Original Message- From: Rob W. [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 14, 2006 2:07 AM To: php-db@lists.php.net Subject: Re: [PHP-DB] Text file (rw) question... Nevermind. I figured it out. - Original Message - From: Rob W. [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Tuesday, March 14, 2006 1:45 AM Subject: [PHP-DB] Text file (rw) question... I'm trying to figure out how to read specific data from a text file that is already written. Example MaxUser=3D32 PortBase=3D8000 I want to be able to have php read them specific pieces of info so I can put them in to forms and update them via php. Any help would be appreciated. -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Text file (rw) question...
pear install Config Now you can load a config file like that with a single command, load it into an array, modify values, then write it back. http://pear.php.net/package/Config It is fantastic. Beckman On Tue, 14 Mar 2006, Rob W. wrote: That works, but it just throws it in to a big loop and fills up the file, any suggestions? - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 5:54 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: Ok, The fix is just doing something like this... list($variable, $data) = explode(=, $x); But now my problem is trying to figure out how to update that data with form post ect... So the main page would get MaxUser=32 It would read that info and put it in to a form field, which I have. Now I gotta get it to take and make it so that a new value can be put in that field and updated back in to the text file. I have searched all over google for about 4 hrs looking for something like this but no go, any help would be appricated. This is a simple example but it should work for you: $new_textcontent = ; foreach($_POST as $area = $value) { $new_textcontent .= $area . = . $value . \n; } $fp = fopen($filename, 'w'); fputs($fp, $new_textcontent); fclose($fp); - Original Message - From: Dwight Altman [EMAIL PROTECTED] To: 'Rob W.' [EMAIL PROTECTED]; php-db@lists.php.net Sent: Tuesday, March 14, 2006 9:13 AM Subject: RE: [PHP-DB] Text file (rw) question... How about posting your solution as well? Maybe someone will find it useful. -Original Message- From: Rob W. [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 14, 2006 2:07 AM To: php-db@lists.php.net Subject: Re: [PHP-DB] Text file (rw) question... Nevermind. I figured it out. - Original Message - From: Rob W. [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Tuesday, March 14, 2006 1:45 AM Subject: [PHP-DB] Text file (rw) question... I'm trying to figure out how to read specific data from a text file that is already written. Example MaxUser=3D32 PortBase=3D8000 I want to be able to have php read them specific pieces of info so I can put them in to forms and update them via php. Any help would be appreciated. -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Peter Beckman Internet Guy [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Text file (rw) question...
Rob W. wrote: That works, but it just throws it in to a big loop and fills up the file, any suggestions? What do you want it to do? We have absolutely no idea exactly what you're trying to achieve - that was just a guess because you're posting a form and want the new values written to a file. - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 5:54 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: Ok, The fix is just doing something like this... list($variable, $data) = explode(=, $x); But now my problem is trying to figure out how to update that data with form post ect... So the main page would get MaxUser=32 It would read that info and put it in to a form field, which I have. Now I gotta get it to take and make it so that a new value can be put in that field and updated back in to the text file. I have searched all over google for about 4 hrs looking for something like this but no go, any help would be appricated. This is a simple example but it should work for you: $new_textcontent = ; foreach($_POST as $area = $value) { $new_textcontent .= $area . = . $value . \n; } $fp = fopen($filename, 'w'); fputs($fp, $new_textcontent); fclose($fp); - Original Message - From: Dwight Altman [EMAIL PROTECTED] To: 'Rob W.' [EMAIL PROTECTED]; php-db@lists.php.net Sent: Tuesday, March 14, 2006 9:13 AM Subject: RE: [PHP-DB] Text file (rw) question... How about posting your solution as well? Maybe someone will find it useful. -Original Message- From: Rob W. [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 14, 2006 2:07 AM To: php-db@lists.php.net Subject: Re: [PHP-DB] Text file (rw) question... Nevermind. I figured it out. - Original Message - From: Rob W. [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Tuesday, March 14, 2006 1:45 AM Subject: [PHP-DB] Text file (rw) question... I'm trying to figure out how to read specific data from a text file that is already written. Example MaxUser=3D32 PortBase=3D8000 I want to be able to have php read them specific pieces of info so I can put them in to forms and update them via php. Any help would be appreciated. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Text file (rw) question...
Yeah, It's exactally what I needed, but I just want it to replace that one value that is sent via $_POST. What i'm trying to do is just make a web intigration to edit shoutcast .conf files. I have everything else execpt for now like I was saying, that code worked, I just want it to halt after it updates that line of code. - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 6:23 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: That works, but it just throws it in to a big loop and fills up the file, any suggestions? What do you want it to do? We have absolutely no idea exactly what you're trying to achieve - that was just a guess because you're posting a form and want the new values written to a file. - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 5:54 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: Ok, The fix is just doing something like this... list($variable, $data) = explode(=, $x); But now my problem is trying to figure out how to update that data with form post ect... So the main page would get MaxUser=32 It would read that info and put it in to a form field, which I have. Now I gotta get it to take and make it so that a new value can be put in that field and updated back in to the text file. I have searched all over google for about 4 hrs looking for something like this but no go, any help would be appricated. This is a simple example but it should work for you: $new_textcontent = ; foreach($_POST as $area = $value) { $new_textcontent .= $area . = . $value . \n; } $fp = fopen($filename, 'w'); fputs($fp, $new_textcontent); fclose($fp); - Original Message - From: Dwight Altman [EMAIL PROTECTED] To: 'Rob W.' [EMAIL PROTECTED]; php-db@lists.php.net Sent: Tuesday, March 14, 2006 9:13 AM Subject: RE: [PHP-DB] Text file (rw) question... How about posting your solution as well? Maybe someone will find it useful. -Original Message- From: Rob W. [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 14, 2006 2:07 AM To: php-db@lists.php.net Subject: Re: [PHP-DB] Text file (rw) question... Nevermind. I figured it out. - Original Message - From: Rob W. [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Tuesday, March 14, 2006 1:45 AM Subject: [PHP-DB] Text file (rw) question... I'm trying to figure out how to read specific data from a text file that is already written. Example MaxUser=3D32 PortBase=3D8000 I want to be able to have php read them specific pieces of info so I can put them in to forms and update them via php. Any help would be appreciated. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Text file (rw) question...
Rob W. wrote: Yeah, It's exactally what I needed, but I just want it to replace that one value that is sent via $_POST. What i'm trying to do is just make a web intigration to edit shoutcast .conf files. I have everything else execpt for now like I was saying, that code worked, I just want it to halt after it updates that line of code. In the simplest form: $new_textcontent = 'post_field=' . $_POST['post_field'] . \n; $fp = fopen($filename, 'w'); fputs($fp, $new_textcontent); fclose($fp); I'd suggest cleaning up $_POST['post_field'] before just writing it (eg making sure it is only numbers, whatever data you actually want to keep in it). - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 6:23 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: That works, but it just throws it in to a big loop and fills up the file, any suggestions? What do you want it to do? We have absolutely no idea exactly what you're trying to achieve - that was just a guess because you're posting a form and want the new values written to a file. - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 5:54 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: Ok, The fix is just doing something like this... list($variable, $data) = explode(=, $x); But now my problem is trying to figure out how to update that data with form post ect... So the main page would get MaxUser=32 It would read that info and put it in to a form field, which I have. Now I gotta get it to take and make it so that a new value can be put in that field and updated back in to the text file. I have searched all over google for about 4 hrs looking for something like this but no go, any help would be appricated. This is a simple example but it should work for you: $new_textcontent = ; foreach($_POST as $area = $value) { $new_textcontent .= $area . = . $value . \n; } $fp = fopen($filename, 'w'); fputs($fp, $new_textcontent); fclose($fp); - Original Message - From: Dwight Altman [EMAIL PROTECTED] To: 'Rob W.' [EMAIL PROTECTED]; php-db@lists.php.net Sent: Tuesday, March 14, 2006 9:13 AM Subject: RE: [PHP-DB] Text file (rw) question... How about posting your solution as well? Maybe someone will find it useful. -Original Message- From: Rob W. [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 14, 2006 2:07 AM To: php-db@lists.php.net Subject: Re: [PHP-DB] Text file (rw) question... Nevermind. I figured it out. - Original Message - From: Rob W. [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Tuesday, March 14, 2006 1:45 AM Subject: [PHP-DB] Text file (rw) question... I'm trying to figure out how to read specific data from a text file that is already written. Example MaxUser=3D32 PortBase=3D8000 I want to be able to have php read them specific pieces of info so I can put them in to forms and update them via php. Any help would be appreciated. -- Postgresql php tutorials http://www.designmagick.com/ -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Text file (rw) question...
Yeah, but will that just replace the data that is present already there? I dont wanna have duplicate entries in there or i'm affraid it wont read it. The origional code you gave worked but it just ran in a big loop. - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 6:42 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: Yeah, It's exactally what I needed, but I just want it to replace that one value that is sent via $_POST. What i'm trying to do is just make a web intigration to edit shoutcast .conf files. I have everything else execpt for now like I was saying, that code worked, I just want it to halt after it updates that line of code. In the simplest form: $new_textcontent = 'post_field=' . $_POST['post_field'] . \n; $fp = fopen($filename, 'w'); fputs($fp, $new_textcontent); fclose($fp); I'd suggest cleaning up $_POST['post_field'] before just writing it (eg making sure it is only numbers, whatever data you actually want to keep in it). - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 6:23 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: That works, but it just throws it in to a big loop and fills up the file, any suggestions? What do you want it to do? We have absolutely no idea exactly what you're trying to achieve - that was just a guess because you're posting a form and want the new values written to a file. - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 5:54 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: Ok, The fix is just doing something like this... list($variable, $data) = explode(=, $x); But now my problem is trying to figure out how to update that data with form post ect... So the main page would get MaxUser=32 It would read that info and put it in to a form field, which I have. Now I gotta get it to take and make it so that a new value can be put in that field and updated back in to the text file. I have searched all over google for about 4 hrs looking for something like this but no go, any help would be appricated. This is a simple example but it should work for you: $new_textcontent = ; foreach($_POST as $area = $value) { $new_textcontent .= $area . = . $value . \n; } $fp = fopen($filename, 'w'); fputs($fp, $new_textcontent); fclose($fp); - Original Message - From: Dwight Altman [EMAIL PROTECTED] To: 'Rob W.' [EMAIL PROTECTED]; php-db@lists.php.net Sent: Tuesday, March 14, 2006 9:13 AM Subject: RE: [PHP-DB] Text file (rw) question... How about posting your solution as well? Maybe someone will find it useful. -Original Message- From: Rob W. [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 14, 2006 2:07 AM To: php-db@lists.php.net Subject: Re: [PHP-DB] Text file (rw) question... Nevermind. I figured it out. - Original Message - From: Rob W. [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Tuesday, March 14, 2006 1:45 AM Subject: [PHP-DB] Text file (rw) question... I'm trying to figure out how to read specific data from a text file that is already written. Example MaxUser=3D32 PortBase=3D8000 I want to be able to have php read them specific pieces of info so I can put them in to forms and update them via php. Any help would be appreciated. -- Postgresql php tutorials http://www.designmagick.com/ -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Text file (rw) question...
Rob W. wrote: Yeah, but will that just replace the data that is present already there? I dont wanna have duplicate entries in there or i'm affraid it wont read it. The origional code you gave worked but it just ran in a big loop. That particular example will replace the whole file. If you only want to replace a particular option then that's different - but we don't know what you are trying to do. - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 6:42 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: Yeah, It's exactally what I needed, but I just want it to replace that one value that is sent via $_POST. What i'm trying to do is just make a web intigration to edit shoutcast .conf files. I have everything else execpt for now like I was saying, that code worked, I just want it to halt after it updates that line of code. In the simplest form: $new_textcontent = 'post_field=' . $_POST['post_field'] . \n; $fp = fopen($filename, 'w'); fputs($fp, $new_textcontent); fclose($fp); I'd suggest cleaning up $_POST['post_field'] before just writing it (eg making sure it is only numbers, whatever data you actually want to keep in it). - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 6:23 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: That works, but it just throws it in to a big loop and fills up the file, any suggestions? What do you want it to do? We have absolutely no idea exactly what you're trying to achieve - that was just a guess because you're posting a form and want the new values written to a file. - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 5:54 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: Ok, The fix is just doing something like this... list($variable, $data) = explode(=, $x); But now my problem is trying to figure out how to update that data with form post ect... So the main page would get MaxUser=32 It would read that info and put it in to a form field, which I have. Now I gotta get it to take and make it so that a new value can be put in that field and updated back in to the text file. I have searched all over google for about 4 hrs looking for something like this but no go, any help would be appricated. This is a simple example but it should work for you: $new_textcontent = ; foreach($_POST as $area = $value) { $new_textcontent .= $area . = . $value . \n; } $fp = fopen($filename, 'w'); fputs($fp, $new_textcontent); fclose($fp); - Original Message - From: Dwight Altman [EMAIL PROTECTED] To: 'Rob W.' [EMAIL PROTECTED]; php-db@lists.php.net Sent: Tuesday, March 14, 2006 9:13 AM Subject: RE: [PHP-DB] Text file (rw) question... How about posting your solution as well? Maybe someone will find it useful. -Original Message- From: Rob W. [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 14, 2006 2:07 AM To: php-db@lists.php.net Subject: Re: [PHP-DB] Text file (rw) question... Nevermind. I figured it out. - Original Message - From: Rob W. [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Tuesday, March 14, 2006 1:45 AM Subject: [PHP-DB] Text file (rw) question... I'm trying to figure out how to read specific data from a text file that is already written. Example MaxUser=3D32 PortBase=3D8000 I want to be able to have php read them specific pieces of info so I can put them in to forms and update them via php. Any help would be appreciated. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Text file (rw) question...
So how do I make it so it just set's the variable's that are sent in the $_POST because i wanna write it so that if the value isnt changed, it wont send the $_POST and wont update the config file.. - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 7:02 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: Yeah, but will that just replace the data that is present already there? I dont wanna have duplicate entries in there or i'm affraid it wont read it. The origional code you gave worked but it just ran in a big loop. That particular example will replace the whole file. If you only want to replace a particular option then that's different - but we don't know what you are trying to do. - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 6:42 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: Yeah, It's exactally what I needed, but I just want it to replace that one value that is sent via $_POST. What i'm trying to do is just make a web intigration to edit shoutcast .conf files. I have everything else execpt for now like I was saying, that code worked, I just want it to halt after it updates that line of code. In the simplest form: $new_textcontent = 'post_field=' . $_POST['post_field'] . \n; $fp = fopen($filename, 'w'); fputs($fp, $new_textcontent); fclose($fp); I'd suggest cleaning up $_POST['post_field'] before just writing it (eg making sure it is only numbers, whatever data you actually want to keep in it). - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 6:23 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: That works, but it just throws it in to a big loop and fills up the file, any suggestions? What do you want it to do? We have absolutely no idea exactly what you're trying to achieve - that was just a guess because you're posting a form and want the new values written to a file. - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 5:54 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: Ok, The fix is just doing something like this... list($variable, $data) = explode(=, $x); But now my problem is trying to figure out how to update that data with form post ect... So the main page would get MaxUser=32 It would read that info and put it in to a form field, which I have. Now I gotta get it to take and make it so that a new value can be put in that field and updated back in to the text file. I have searched all over google for about 4 hrs looking for something like this but no go, any help would be appricated. This is a simple example but it should work for you: $new_textcontent = ; foreach($_POST as $area = $value) { $new_textcontent .= $area . = . $value . \n; } $fp = fopen($filename, 'w'); fputs($fp, $new_textcontent); fclose($fp); - Original Message - From: Dwight Altman [EMAIL PROTECTED] To: 'Rob W.' [EMAIL PROTECTED]; php-db@lists.php.net Sent: Tuesday, March 14, 2006 9:13 AM Subject: RE: [PHP-DB] Text file (rw) question... How about posting your solution as well? Maybe someone will find it useful. -Original Message- From: Rob W. [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 14, 2006 2:07 AM To: php-db@lists.php.net Subject: Re: [PHP-DB] Text file (rw) question... Nevermind. I figured it out. - Original Message - From: Rob W. [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Tuesday, March 14, 2006 1:45 AM Subject: [PHP-DB] Text file (rw) question... I'm trying to figure out how to read specific data from a text file that is already written. Example MaxUser=3D32 PortBase=3D8000 I want to be able to have php read them specific pieces of info so I can put them in to forms and update them via php. Any help would be appreciated. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Text file (rw) question...
Rob W. wrote: So how do I make it so it just set's the variable's that are sent in the $_POST because i wanna write it so that if the value isnt changed, it wont send the $_POST and wont update the config file.. You can't stop the post because your browser does that not php (well you could stop it with javascript). You could store the original values in a session and then compare when you post the new values. Take the appropriate action if they are the same/different. What difference does it make if you rewrite the file with the same values? and why are you afraid of loops? That will be the easiest way to get everything from the form. If you only want particular values: $newconfig = ; $config_values = array('field1', 'field2'); foreach($config_values as $p = $fieldname) { $newconfig .= $fieldname . '=' . $_POST[$fieldname] . \n; } -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Text file (rw) question...
It's all fixed and works. If anybody is wondering how this turned out, here's the begining of the results. index.php ?php if (!($f=fopen(sc_serv.conf,r))) exit(Unable to open file.); while (!feof($f)) { $x=fgets($f, 100); list($variable, $data) = explode(=, $x); echo form method=\POST\ action=\update.php\; if ($variable == MaxUser) { echo Max Users: input type=\text\ value=\$data\ name=\MaxUser\ size=\3\br /; } if ($variable == Password) { echo Password: input type=\text\ value=\$data\ name=\Password\ size=\15\br /; } // echo $variable $databr /; } fclose($f); echo p /input type=\SUBMIT\ value=\Submit\ //form; ? update.php ? $newconfig = ; $maxuser=$_POST['maxuser']; $password=$_POST['password']; foreach($_POST as $area = $value) { $newconfig .= $area . = . $value . \n; } $fp = fopen('sc_serv.conf', 'w'); fputs($fp, $newconfig); fclose($fp); exit(); ? Thankyou to everyone who helped. Special thanks to Chris.
Re: [PHP-DB] Text file (rw) question...
Rob W. wrote: It's all fixed and works. If anybody is wondering how this turned out, here's the begining of the results. index.php ?php if (!($f=fopen(sc_serv.conf,r))) exit(Unable to open file.); while (!feof($f)) { $x=fgets($f, 100); list($variable, $data) = explode(=, $x); echo form method=\POST\ action=\update.php\; if ($variable == MaxUser) { echo Max Users: input type=\text\ value=\$data\ name=\MaxUser\ size=\3\br /; } if ($variable == Password) { echo Password: input type=\text\ value=\$data\ name=\Password\ size=\15\br /; } // echo $variable $databr /; } fclose($f); echo p /input type=\SUBMIT\ value=\Submit\ //form; ? update.php ? $newconfig = ; $maxuser=$_POST['maxuser']; $password=$_POST['password']; You're not using these variables anywhere so it'd be best to remove them (might be confusing later on if you need to come back to it). or you can leave them there and do: $newconfig = ''; $newconfig .= MaxUser= . $maxuser . \n; $newconfig .= Password= . $password . \n; instead of the foreach($_POST... loop. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Text file (rw) question...
Ah yes, that's true. I didnt realize that. Thanks for pointing that out. - Original Message - From: Chris [EMAIL PROTECTED] To: Rob W. [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Tuesday, March 14, 2006 9:02 PM Subject: Re: [PHP-DB] Text file (rw) question... Rob W. wrote: It's all fixed and works. If anybody is wondering how this turned out, here's the begining of the results. index.php ?php if (!($f=fopen(sc_serv.conf,r))) exit(Unable to open file.); while (!feof($f)) { $x=fgets($f, 100); list($variable, $data) = explode(=, $x); echo form method=\POST\ action=\update.php\; if ($variable == MaxUser) { echo Max Users: input type=\text\ value=\$data\ name=\MaxUser\ size=\3\br /; } if ($variable == Password) { echo Password: input type=\text\ value=\$data\ name=\Password\ size=\15\br /; } // echo $variable $databr /; } fclose($f); echo p /input type=\SUBMIT\ value=\Submit\ //form; ? update.php ? $newconfig = ; $maxuser=$_POST['maxuser']; $password=$_POST['password']; You're not using these variables anywhere so it'd be best to remove them (might be confusing later on if you need to come back to it). or you can leave them there and do: $newconfig = ''; $newconfig .= MaxUser= . $maxuser . \n; $newconfig .= Password= . $password . \n; instead of the foreach($_POST... loop. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Max Size File that can be uploaded
Dear All, I want to give max size file = 4000KB when I am uploading to mySQL. I used this : INPUT type=hidden name=MAX_FILE_SIZE value=4000 But it didn't work. The file that could upload only under 2048KB. Is there anyone could help me? Thanks so much. Regards, Anita
Re: [PHP-DB] Max Size File that can be uploaded
[EMAIL PROTECTED] wrote: Dear All, I want to give max size file = 4000KB when I am uploading to mySQL. I used this : INPUT type=hidden name=MAX_FILE_SIZE value=4000 But it didn't work. The file that could upload only under 2048KB. Check a phpinfo page and look for upload_max_filesize PHP is probably limiting it to 2M. Not sure if you can change this with a htaccess file (check http://www.php.net) or if it's a php.ini change only. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Max Size File that can be uploaded
Chris, Its solved my problem. Thank you so much. -Original Message- From: Chris [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 15, 2006 12:12 PM To: Adman, Nur anita Cc: php-db@lists.php.net Subject: Re: [PHP-DB] Max Size File that can be uploaded [EMAIL PROTECTED] wrote: Dear All, I want to give max size file = 4000KB when I am uploading to mySQL. I used this : INPUT type=hidden name=MAX_FILE_SIZE value=4000 But it didn't work. The file that could upload only under 2048KB. Check a phpinfo page and look for upload_max_filesize PHP is probably limiting it to 2M. Not sure if you can change this with a htaccess file (check http://www.php.net) or if it's a php.ini change only. -- Postgresql php tutorials http://www.designmagick.com/