View Full Version : Php help
midwesthosting
April 12th, 2007, 02:05
Im Trying to read a .Conf File And Get The data In The my text field,But Aint Working.
<?php
$file = fopen('sc_trans.conf', 'r');
$read = fread($file);
?>
<input name="stream_title" type="text" style="border-style: solid; border-width: 1" value='$read' size="45" />
Ive Used Too Write This Config File,And It Work's Now I Wanna Get The Info In The Text Field.
fwrite($fd, "StreamTitle=".$stream_title."\n");
krakjoe
April 12th, 2007, 03:18
<?
$conf = file_get_contents('sc_trans.conf');
echo "<input type=\"text\" name=\"stream_title\" value=\"$conf\" />";
?>
midwesthosting
April 12th, 2007, 03:26
That Work's,But puts the Whole config File In There,Im Calling for<?
stream_title stream_genre ect,It's A Whole List of Detail's
krakjoe
April 12th, 2007, 07:40
post a line format and the array format you want from it....
midwesthosting
April 12th, 2007, 15:17
This is my Input
<input name="stream_title" type="text" style="border-style: solid; border-width: 1" size="45" />
This is how i write it
<?php
$sc_adresse = $_POST["sc_adresse"];
$sc_port = $_POST["sc_port"];
$sc_password = $_POST["sc_password"];
$stream_title = $_POST["stream_title"];
$stream_url = $_POST["stream_url"];
$stream_genre = $_POST["stream_genre"];
$shuffle = $_POST["shuffle"];
$stream_birate_khz_channels = $_POST["stream_birate_khz_channels"];
$crossfademode = $_POST["crossfademode"];
$crossfademodeTime = $_POST["crossfademodeTime"];
$id3tag = $_POST["id3tag"];
$public = $_POST["public"];
$aim = $_POST["aim"];
$icq = $_POST["icq"];
$irc = $_POST["irc"];
$fd = fopen("sc_trans.conf","w");
fwrite($fd, "PlaylistFile=playlist.lst\n");
fwrite($fd, "ServerIp=".$sc_adresse."\n");
fwrite($fd, "ServerPort=".$sc_port."\n");
fwrite($fd, "Password=".$sc_password."\n");
fwrite($fd, "StreamTitle=".$stream_title."\n");
fwrite($fd, "StreamURL=".$stream_url."\n");
fwrite($fd, "Genre=".$stream_genre."\n");
fwrite($fd, "$logfile\n");
fwrite($fd, "Shuffle=".$shuffle."\n");
fwrite($fd, "".$stream_birate_khz_channels."\n");
fwrite($fd, "Quality=10\n");
fwrite($fd, "CrossfadeMode=".$crossfademode."\n");
fwrite($fd, "CrossfadeLength=".$crossfademodeTime."\n");
fwrite($fd, "UseID3=".$id3tag."\n");
fwrite($fd, "Public=".$public."\n");
fwrite($fd, "AIM=".$aim."\n");
fwrite($fd, "ICQ=".$icq."\n");
fclose($fd);
?>
This is how it look's When It's Wrote
PlaylistFile=playlist.lst
ServerIp=midweststreaming.com
ServerPort=8000
Password=adasdasd
StreamTitle=Midweststreaming.Com Demo Server
StreamURL=
Genre=All
Shuffle=1
Bitrate=16000 SampleRate=11025 Channels=1
Quality=10
CrossfadeMode=0
CrossfadeLength=
UseID3=0
Public=1
AIM=
ICQ=
IRC=#
Now i just wanna pull the Vaule's Like ServerIp=midweststreaming.com But Just the Value For My Input,So If The field is there It Show's The Config's For It
midweststreaming.com
krakjoe
April 13th, 2007, 03:16
well, use parse_ini_file to get the text into an array:
$assoc = parse_ini_file( "sc_trans.conf" );
and then the form part for the server ip would look like :
<input type="text" name="ServerIp" value="<?=$assoc['ServerIp'] ?>" />
midwesthosting
April 14th, 2007, 02:40
That work's,now i got another error
Warning: Error parsing sc_trans.conf on line 10 in /home/mwhost/public_html/demo/inc/inc_box_sc_trans.php on line 4
That is from the other Configs,option values parse out a bit dif
Bitrate=16000 SampleRate=11025 Channels=1 < That's where the error is,But the other's Work fine
midwesthosting
April 14th, 2007, 05:08
Got it,It was my code :D Thank's Alot Man :)
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.