vrtx Posted January 4, 2007 Share Posted January 4, 2007 I would like to load variables that are stored in a txt file into my PHP programming... I looked at the {config_load file="test.conf"} option, but I cant get it to put variables in the PHP programming (only in the HTML-part). So, I wonder if there is a way to get this done!?Yours Mr. VRTX ::) Quote Link to comment Share on other sites More sharing options...
SharkBait Posted January 4, 2007 Share Posted January 4, 2007 How is your config file written? I mean what does it look like? We could then see how you can read it in and parse it for the variables? Quote Link to comment Share on other sites More sharing options...
vrtx Posted January 4, 2007 Author Share Posted January 4, 2007 The config file just contains:[code]slot = 6003[/code]The script I made:[code]{config_load file="slot.conf"}<body bgcolor="#000000"><?php@extract($_POST); $name = stripslashes($name); $phone = stripslashes($phone); $email = stripslashes($email); $message = stripslashes($message); $sleutel = stripslashes($sleutel); //just some vriables import from Flash$test = 20;if (#slot# > $test) { echo 'welldone'; } else { echo 'not correct'; }mail('Info@vrtx.nl','VRTX sitereactie',"Contactpersoon: $nameTelefoon: $phonee-mail: $emailBericht: $message","From: $email"); //lets mail the vars to my address[/code] Quote Link to comment Share on other sites More sharing options...
vrtx Posted January 5, 2007 Author Share Posted January 5, 2007 I found another way:http://www.php-editors.com/articles/php_textfile.phpthis makes use of a data array...[code]$data = array();# define your data file and its path, ensure you have write permission to folder$myTextFile = 'slot.txt';if (file_exists($myTextFile)) $data = parse_ini_file($myTextFile, true);$slot = $data[sectienaam]['waarde'];[/code]and in the txt file you should put somthing like...[code][sectienaam]waarde=51[/code]Now $slot equals 51 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.