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