php and fopen problem.

Troubleshooting with your custom scripts/programs installed on Polarhome.

Moderator: Moderators

php and fopen problem.

Postby uroskn_redhat » Wed Apr 05, 2006 7:59 am

Erm... I've got one problem...
The php script is working fine, unitll it reach fopen(); After that all execution of the script stoped.

Code: Select all
<?
error_reporting(0);
$user = $_GET["user"]; $id = $_GET["pass"]; $err = 0;
if (empty($user) == True) { $user = $_POST["user"]; if (empty($user) == True) { $err = 1; } }
if (empty($id) == True) { $id = $_POST["id"]; if (empty($id) == True) { $err = 1 ; } }
if ($err == 0) {
  include("info/".$user.".php");
  if (empty($member_ok) == True) { $err = 1; }
}
?>
<html>
<head>
<link title="Test" href="style.css" type="text/css" rel="stylesheet">
</head>
<body>
<h2><b>FreeNet web admin</b></h2>
<hr color="#0099FF">
<?
if ($err == 1) {
  print('Nimate dovoljenja za dostop... Treba bo se <a href="/freenetwadmin/index.php">loginat.</a><script>');
  print("self.parent.location='/freenetwadmin/index.php';</script>");
}
else {
  print("<h3>Dobrodosel ".$user."</h3>");
  print('<table width="100%"><tr><td width=200 valign="top">');
  $i = 0; include("info/settings/menu.php");
  while ($i <= $max) {
    $i++;
    if (empty($page[$i]) != True) {
      if ($prio[$i] <= $priority_d) { print('<big><b><a href="'.$page[$i].'?user='.$user.'&pass='.$id.'">'.$site[$i].'</a><br></b></big>'); print("\n"); }
    }
  }
  print('</td><td width=15>&nbsp;</td><td valign="top">');
  include("info/settings/config.php");
  $posted = $_POST["post_ed"]; $err = 0; $fp = "w"; $txt = $_POST["conf_t"];
  if (empty($posted) == True) { $err = 1; $fp = "r"; }
  $handle = fopen($conffile, $fp);
  $text = fread($handle, filesize($conffile));
  if (empty($posted) == False) {
    fwrite($handle, $txt);
    $text = $txt;
  }
  fclose($handle);
  if (empty($posted) == False) { print("<b>Datoteka updetana!</b><br><br>"); }
  print("Konfiguracija <b>".$conffile."</b><br><br>");
  print('<form method="post" action="ircd_confc.php?user='.$user.'&pass='.$id.'"><input type="hidden" name="post_ed" value="1">');
  print('<textarea name="conf_t" class="button" rows=25 cols=100>');
  print($text);
  print('</textarea><br><br><input type="submit" value="    Update datoteko    " class="button"></form>');
  print("</td></tr></table>");
}
?>
</body>
</html>


I'm still newbie to php... :roll:
You cant fail unless you quit.
User avatar
uroskn_redhat
Junior Member
 
Posts: 24
Joined: Wed Oct 19, 2005 1:50 am
Location: Slovenija, Slovenske Konjice, Kajuhova X ;-)

Postby uroskn_redhat » Wed Apr 05, 2006 1:26 pm

never mind... I discovered where the error was. :oops:
You cant fail unless you quit.
User avatar
uroskn_redhat
Junior Member
 
Posts: 24
Joined: Wed Oct 19, 2005 1:50 am
Location: Slovenija, Slovenske Konjice, Kajuhova X ;-)


Return to Troubleshooting

Who is online

Users browsing this forum: No registered users and 16 guests

cron