Zelaron Gaming Forum  
Stats Arcade Portal Forum FAQ Community Calendar Today's Posts Search
Go Back   Zelaron Gaming Forum > The Zelaron Nexus > Science and Art > Tech Help

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next

 
More PHP help needed!
Reply
Posted 2008-06-25, 08:11 AM
Alright! I've practiced a ton of php and am learning more and more. Now, I've figured out how to make an admin area (secure login/logout) with a page creator, page editor, and IP logger. The page editor is actually what I need help with as of right now.

I'm using a rather strange method to edit things. Really what I want is to edit the raw data. As of right now, I'm editing the data output. I've yet to figure out how to edit any other way. So, please take a look and tell me a better way with this.


index.php
Code:
<?php 

// Page asks for user cookie of proof of signed in.  If not, then use is given the login page.

if ($_GET['function']=="newpage" && isset($_COOKIE['HIDDEN'])) {
	include('inc/main.php');
	}
elseif ($_GET['function']=="editpage" && isset($_COOKIE['HIDDEN'])) {
	include('inc/editpage.php');
	}
elseif ($_GET['function']=="editpage" && $_GET['data']=="process" && isset($_COOKIE['HIDDEN'])) {
	include('inc/editpage.php');
	}
elseif ($_GET['function']=="logged" && isset($_COOKIE['HIDDEN'])) {
	include('inc/logging.php');
	}
elseif (isset($_COOKIE['HIDDEN'])) {
	include('inc/main2.php');
	}
else {
	include('login.php');
	}
?>


index.php?function=editpage
Code:
		  <form id="form1" name="form1" method="post" action="index.php?function=editpage&data=process">
            <label>File Name (e.g. file.php - Look below for folder contents)<br />
            <input name="pageopen" type="text" value="" />                   
            <br /></label>
			<label>[To edit pages from the admin folder type "./" without the quotes.]<br />Folder Location (e.g. ../ or /site/)<br />
			<input name="pageloc" type="text" value="" />
            </label>
            <input name="Submit" type="submit" value="Submit" />
		  </form>
	  <br />
        <form action="fedit.php" method="post">
        <label>Edit File (Once File is Opened)<br />
        <textarea name="edit" cols="60" rows="25">
<?php 
if (isset($_REQUEST['pageopen']) && isset($_POST['pageloc'])) {
$thepage = $_POST['pageopen'];
$thedir = $_POST['pageloc'];
chdir("$thedir");
include("$thepage");
}
else {
echo "";
}
?>
</textarea>
        </label>
        <input name="pagename" type="text" value="<?php 
		if (isset($_POST['pageloc'])) {
			$thepage = $_POST['pageopen'];
			echo "$thepage";
			}
		else
			echo "";
		?>" />
        <input name="pagedir" type="text" value="<?php 
		if (isset($_POST['pageloc'])) {
			$thedir = $_POST['pageloc'];
			echo "$thedir";
			}
		else
			echo "";
		?>" />
        <input name="submitter" type="submit" value="Save" />
        </form>

fedit.php
Code:
<?php 
if (isset($_COOKIE['HIDDEN'])) {
	header("Location: index.php?function=editpage");
	$thepage = stripslashes($_POST['pagename']);
	$thedir = $_POST['pagedir'];
	$edit = stripslashes($_POST['edit']);
	chdir("$thedir");
	unlink("$thepage");
	$fp = fopen("$thepage", "a");
	fwrite($fp, "$edit");
	fclose($fp);
	exit;
	}
else {
	header("Location: index.php?function=editpage");
	} 
?>
So, I don't believe there are any more pages that need to be defined to understand this.
 
Work List
疲れていますから 寝むってありますね。 むずかしいです。 また、ケーキ屋で ケーキを食べていました。

I've considered being a translator, but I dunno. It feels like a lot of work. If someone gets angry then I have to deal with it, you know? I'd rather just relax.

 
Speed Test
 
Favorite Anime/Manga
#01 Clannad ~After Story~
#02 Trigun {Maximum}
#03 Koi Kaze
#04 Berserk
#05 Outlaw Star
#06 Slayers
#07 Desert Punk
#08 Spirited Away
#09 Fullmetal Alchemist
#10 Shakugan no Shana
#11 Death Note
#12 FLCL
#13 Tokyo Magnitude 8.0
#14 Toradora
#15 Gunslinger Girl

 
Anime List

Last edited by Goodlookinguy; 2008-06-25 at 08:13 AM.
Old
Profile PM WWW Search
Goodlookinguy seldom sees opportunities until they cease to beGoodlookinguy seldom sees opportunities until they cease to beGoodlookinguy seldom sees opportunities until they cease to beGoodlookinguy seldom sees opportunities until they cease to be
 
 
Goodlookinguy
 



 

Bookmarks

« Previous Thread | Next Thread »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules [Forum Rules]
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[RM2K3] Charset needed real fast. Skurai RPGMaker 9 2008-06-25 08:25 AM
proxys needed Sum Yung Guy Tech Help 3 2007-11-29 05:59 AM
Help Needed for HTML Goodlookinguy Tech Help 13 2007-04-09 05:42 PM
PhP nuke quikspy67 Tech Help 3 2003-05-07 06:49 PM


All times are GMT -6. The time now is 06:17 AM.
'Synthesis 2' vBulletin 3.x styles and 'x79' derivative
by WetWired the Unbound and Chruser
Copyright ©2002-2008 zelaron.com
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
This site is best seen with your eyes open.