Jump to content

[SOLVED] How to load a variable from file into PHP


vrtx

Recommended Posts

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  ::)
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('[email protected]','VRTX sitereactie',"
Contactpersoon: $name
Telefoon: $phone
e-mail: $email
Bericht: $message
","From: $email");
  //lets mail the vars to my address[/code]
I found another way:
http://www.php-editors.com/articles/php_textfile.php
this 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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.