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  ::)
Link to comment
Share on other sites

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: $name
Telefoon: $phone
e-mail: $email
Bericht: $message
","From: $email");
  //lets mail the vars to my address[/code]
Link to comment
Share on other sites

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.