Jump to content

file and echo help


adamriley

Recommended Posts

taken.php

<?php
session_start();
$adam = $_SESSION['dir'];
$pfile = fopen("Places/$adam.txt","r");
    rewind($pfile);
        
        while (feof($pfile)) {
        $line = fgets($pfile);
        $tmp = explode(':', $line);
        $name = $tmp[0];
        fclose($pfile);
}
?>

 

$_SESSION['dir'] = England

 

England.txt

 

Adam Riley:adam162@******.com:9846

 

I would hope that is echo's the "Adam Riley" bit of the file but it does not

 

 

Link to comment
https://forums.phpfreaks.com/topic/201271-file-and-echo-help/
Share on other sites

<?php
session_start();
$adam = $_SESSION['dir'];
$pfile = fopen("Places/$adam.txt","r");
    rewind($pfile);
        
        while (feof($pfile)) {
        $line = fgets($pfile);
        $tmp = explode(':', $line);
        $name = $tmp[0];
        fclose($pfile);
}
error_reporting(E_ALL);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Foot Ball game card || Place Taken</title>
</head>
<body bgcolor="#FF0000" text="#000000">
<div id="Text2" style="position:absolute;left:31px;top:158px;width:698px;height:64px;z-index:0;" align="left">
<font style="font-size:27px" color="#FFFF00" face="Arial">This slot has already been taken by </font><font style="font-size:27px" color="#0000FF" face="Arial"><?php echo $name ?></font></div>
<div id="Text1" style="position:absolute;left:34px;top:95px;width:660px;height:32px;z-index:1;" align="left">
<font style="font-size:27px" color="#FFFF00" face="Arial">You have selected </font><font style="font-size:27px" color="#0000FF" face="Arial"><?php echo $_SESSION['dir'] ?></font></div>
<div id="Text3" style="position:absolute;left:280px;top:17px;width:305px;height:36px;z-index:2;" align="left">
<font style="font-size:32px" color="#FFFF00" face="Arial"><u>Football Game Card</u></font></div>
<input type="submit" id="Button1" onclick="window.close();return false;" name="Button1" value="Close" style="position:absolute;left:211px;top:271px;width:339px;height:72px;font-family:Arial;font-size:19px;z-index:3">
</body>
</html>

 

Theres the full file

Link to comment
https://forums.phpfreaks.com/topic/201271-file-and-echo-help/#findComment-1055966
Share on other sites

Changed it and now i get

 

Notice: A session had already been started - ignoring session_start() in C:\xampp\htdocs\Game\Check\Taken.php on line 3

Warning: feof(): 7 is not a valid stream resource in C:\xampp\htdocs\Game\Check\Taken.php on line 8

Warning: fgets(): 7 is not a valid stream resource in C:\xampp\htdocs\Game\Check\Taken.php on line 9

Warning: fclose(): 7 is not a valid stream resource in C:\xampp\htdocs\Game\Check\Taken.php on line 12

 

 

Link to comment
https://forums.phpfreaks.com/topic/201271-file-and-echo-help/#findComment-1055996
Share on other sites

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.