Jump to content

simple php help.


sethyz

Recommended Posts

I'm having problems with this file not posting to the file on the website to update my webpage.  let me know if you can help

 

<?php
// If no cookie is present, redirect the user.
// if (!isset($_COOKIE['password'])) {

require_once ('central.php'); // Connect to the stored password page.

if ($stored_password != $_COOKIE['password'])  {


header ("Location:  http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "login.php");
exit(); // Quit the script.
        }


?>

<html>

<head>

<title>Sc0tsman.com information Updater</title>

<LINK REL="stylesheet" HREF="stylesheet.css" TYPE="text/css">

</head>

<body>

<table align="center" border="0"><tr><td>

<?php


$newsboxid = "$_REQUEST[newsid]";


if (empty($submit_news_update))
        $submit_news_update = "";

if (empty($newsboxid))
        $newsboxid = "";

$boxon = "on";


$news = "newsfile" . "$newsboxid" ;
//---------------------------------------------------------

if ($submit_news_update == "Submit Update"){

trim($news_box);

$news_box_text = "newsphp/$news.txt";

$FilePointer = fopen ($news_box_text, "w");

fwrite ($FilePointer, $news_box);

fclose ($FilePointer);

$boxon = "no";


print "<br> <br><b>The information has been updated!<br> <br>

<br> <br><a href=\"$homepage\">Back to the Home page</a>";

}

## If we are not submitting an update we just need to open the text file ansd read it but first
## we need to check if the file is there first


if ($submit_news_update == "" && file_exists("newsphp/$news.txt")) {

$boxon = "no";

$news_box_text = "newsphp/$news.txt";

$Open = fopen ($news_box_text, "r");

$existing_news_array = file ($news_box_text);

$existing_news = implode("", $existing_news_array);

fclose ($Open);

trim($existing_news);

$new_line = "";

//$existing_news = ereg_replace("[\n\r]", "$new_line", "$existing_news");

$existing_news = ereg_replace("[\n]", "$new_line", "$existing_news");

$existing_news = stripslashes($existing_news);


print '

<br> <br><a href="listing_manager.php">Back to the manager select page</a><br> <br>

<p><h2>Information box updater';

print " $newsboxid";

print '

</h2></p>

<FORM ACTION="update_news.php" METHOD=POST>

<textarea rows=15 cols=50 name="news_box" class="input_text_area">';

print "$existing_news";

print '</textarea><br>

<input type="hidden" name="newsid" value="';

print $newsboxid ;

print '"><input type="submit" name="submit_news_update" value="Submit Update"> ';

}

if ($boxon == "no") {

## Do nothing

}

else {

print '

<br> <br><a href="listing_manager.php">Back to the manager select page</a><br> <br>

<p><h2>Create content for information box';

print " $newsboxid";

print '

</h2></p>



<FORM ACTION="update_news.php" METHOD=POST>

<textarea rows=15 cols=50 name="news_box" class="input_text_area">';

print '</textarea><br>

<input type="hidden" name="newsid" value="';

print $newsboxid ;

print '"><input type="submit" name="submit_news_update" value="Submit Update"> ';



}


?>

</body>

</html>

 

(edited by kenrbnsn to add


tags)

 

Link to comment
https://forums.phpfreaks.com/topic/130791-simple-php-help/
Share on other sites

I thought that was for the page request like update_news.php?newsid=2 etc.

anyways I gave it a try and no go it stoped reading the files I already have added  goto http://sc0tsman.x10hosting.com/login.php  the password is  password32  tell me what you think, cause I can't get it to work.

Link to comment
https://forums.phpfreaks.com/topic/130791-simple-php-help/#findComment-678835
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.