Zelaron Gaming Forum  
Stats Arcade Portal Forum FAQ Members List Social Groups Calendar Search Today's Posts Mark Forums Read
Go Back   Zelaron Gaming Forum > The Zelaron Nexus > Science and Art > Tech Help

 
 
Thread Tools Display Modes

 
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
 



 
Reply
Posted 2008-06-25, 11:42 AM in reply to Goodlookinguy's post "More PHP help needed!"
I have no idea what you're showing me.
Old
Profile PM WWW Search
WetWired read his obituary with confusionWetWired read his obituary with confusionWetWired read his obituary with confusionWetWired read his obituary with confusion
 
 
WetWired
 



 
Reply
Posted 2008-06-25, 01:07 PM in reply to WetWired's post starting "I have no idea what you're showing me."
WetWired said: [Goto]
I have no idea what you're showing me.

If you make the pages you will see and understand what I did.

This is a page editor. I am using the second code that I made to call other pages via include within the text box.

I am using the 3rd code to delete then make the pages ("update").

I need to know how I would pull raw data into the box instead of pulling output data.
 
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
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
 



 
Reply
Posted 2008-06-25, 02:50 PM in reply to Goodlookinguy's post starting "If you make the pages you will see and..."
htmlspecialchars?
I don't see why you would want to do what you're doing, though.
Old
Profile PM WWW Search
WetWired read his obituary with confusionWetWired read his obituary with confusionWetWired read his obituary with confusionWetWired read his obituary with confusion
 
 
WetWired
 



 
Reply
Posted 2008-06-25, 05:05 PM in reply to WetWired's post starting "htmlspecialchars? I don't see why you..."
WetWired said: [Goto]
htmlspecialchars?
I don't see why you would want to do what you're doing, though.

I'm creating a website for my neighbors company. Basically he needs me to create a insite page creator and editor. The page creator wasn't an issue, but the page editor was another story. I had to think outside the box when creating it. But I can't pull raw data from the server, only output data.

It is important that I finish it by next week Friday. $50 for me!
 
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
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
 



 
Reply
Posted 2008-06-25, 06:18 PM in reply to Goodlookinguy's post starting "I'm creating a website for my neighbors..."
file_get_contents

Still sounds like a bad idea.
Old
Profile PM WWW Search
WetWired read his obituary with confusionWetWired read his obituary with confusionWetWired read his obituary with confusionWetWired read his obituary with confusion
 
 
WetWired
 



 
Reply
Posted 2008-06-26, 10:07 AM in reply to WetWired's post starting "file_get_contents Still sounds like..."
WetWired said: [Goto]
file_get_contents

Still sounds like a bad idea.

Thank you WW. I had to look up the function since I'd not not heard of it. I figured out that I had to use echo file_get_contents($file);

I know it sounds like a bad idea but I am serving the customer. I have to do what the customer wants. That's just the way things work, for now anyways.
 
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
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
 



 
Reply
Posted 2008-06-26, 11:32 AM in reply to Goodlookinguy's post starting "Thank you WW. I had to look up the..."
Don't forget to htmlspecialchars. Otherwise, you won't be able to have a textarea in the file being edited.

I sent you an example of a better way to run a site on ICQ.
Old
Profile PM WWW Search
WetWired read his obituary with confusionWetWired read his obituary with confusionWetWired read his obituary with confusionWetWired read his obituary with confusion
 
 
WetWired
 
 

Bookmarks

« Previous Thread | Next Thread »

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

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 10:06 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.