Affiliate Marketing
Forum Search


Reply
 
LinkBack Thread Tools Display Modes

  #1 (permalink)  
Old 15-01-07
SIMONR85's Avatar
Registered User
 
Join Date: Mar 2006
Location: Preston
Posts: 219
Thanks: 0
Thanked 0 Times in 0 Posts
SIMONR85 is an unknown quantity at this point
  looking 4 a php script that edits selected pages of my site

Hi the title dont explain it 2 well so here goes:

i am currently converting my site to php so i can use phpincludes, and have done that ok, the next stage was to make a admin login script which i have done and that works perfect and so leaving me with wanting:

a script that when i login to my adminarea, a list of all the php include files are shown (or maybe all my php files that make up my site) and i can select a file and then edit it on the fly without having to upload my changes everytime.

thanks in advance
__________________
Sim cards - all UK networks./Fishing Tackle Shop UK /Cheap Broadband providers/ Outdoor patio heaters
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 15-01-07
1BIZLIST's Avatar
In need of a mentor!
 
Join Date: Mar 2006
Posts: 297
Thanks: 0
Thanked 0 Times in 0 Posts
1BIZLIST is an unknown quantity at this point
  Re: looking 4 a php script that edits selected pages of my site

It's not impossible to do, but a fair amount of unnecessary work I would have thought:

Anyway you could create a script to read the directory and search for .php files - listing them should be easy enough, then change the attributes of any file you select with the chmod() command this would allow you to read and write to the file, read the contents into a Textarea (fgets() )and then write them back to the file upon editing.

As I said above a fair amount of work for what I would have thought is little gain, but heyho

Mark.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 15-01-07
SIMONR85's Avatar
Registered User
 
Join Date: Mar 2006
Location: Preston
Posts: 219
Thanks: 0
Thanked 0 Times in 0 Posts
SIMONR85 is an unknown quantity at this point
  Re: looking 4 a php script that edits selected pages of my site

cheers mate il give it a whirl, but if anybody can write me s acript to do this then name me a price!!!
__________________
Sim cards - all UK networks./Fishing Tackle Shop UK /Cheap Broadband providers/ Outdoor patio heaters
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 16-01-07
Registered User
 
Join Date: Feb 2006
Location: Gillingham
Posts: 503
Thanks: 0
Thanked 0 Times in 0 Posts
Donk is an unknown quantity at this point
  Re: looking 4 a php script that edits selected pages of my site

Just change the $path to your files directory
PHP Code:
<?php 
$path
="your/path/to/files/";
$dp=opendir($path);
while(
$file=readdir($dp)){
if (
stristr($file,".php")){
$filearray[]=$file;
}
}
closedir($dp);
if(
$_POST['Submit']=="Get File"){
$filename=$_POST['selectfile'];
}
if(
$_POST['Submit']=="Submit"){
$fp=fopen($path.$_POST['filename'],"w");
fwrite($fp,$_POST['data']);
fclose($fp);
}
?>
<form action="" method="post" name="fileform">
<select name="selectfile">
<?php 
foreach ($filearray as $key=>$value){
?>
<option <?php if($filename==$value) echo " selected='selected'"?>><?php echo $value?></option>
<?php ?>
</select>
<input name="Submit" type="submit" value="Get File" />
</form>
<?php

if ($filename){?>
<form method="post" name="editform"> 
<textarea name="data" cols="100" rows="20"><?php echo(file_get_contents($path.$filename))?></textarea><br />
<input name="filename" type="hidden" value="<?php echo $filename ?>" />
<input name="Submit" type="submit" value="Submit" />
</form>
<?php }?>
Quote:
Originally Posted by SIMONR85 View Post
if anybody can write me script to do this then name me a price!!!
£50
__________________
They came for my 404 and I said nothing
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #5 (permalink)  
Old 16-01-07
John Jupp's Avatar
The New 'Arfur Daley
 
Join Date: Mar 2004
Location: Kent UK
Posts: 2,354
Thanks: 34
Thanked 40 Times in 30 Posts
John Jupp is an unknown quantity at this point
  Re: looking 4 a php script that edits selected pages of my site

Bob you're a Bandit.
__________________
Read Our Blog, London/New York/San Francisco Affiliate Program Management - Contact Us
My Contact Details: Terrasip: 21100004227 @ terrasip.net Skype: john_jupp
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 18-01-07
SIMONR85's Avatar
Registered User
 
Join Date: Mar 2006
Location: Preston
Posts: 219
Thanks: 0
Thanked 0 Times in 0 Posts
SIMONR85 is an unknown quantity at this point
  Re: looking 4 a php script that edits selected pages of my site

cheers donk that script is nearly perfect for what i want but it puts these (\\\) in every time i save the file, so if i save twice i get (\\\\\\)

heres what i mean

<my original code>

<a class="navitab" href="index.php">Welcome</a><span class="hide"> | </span>
<a class="navitab" href="index2.php">Bio</a><span class="hide"> | </span>
<a class="navitab" href="#">Discography</a><span class="hide"> | </span>
<a class="navitab" href="#">Downloads</a><span class="hide"> | </span>
<a class="navitab" href="#">Photos</a><span class="hide"> | </span>
<a class="navitab" href="#">Tour</a><span class="hide"> | </span>
<a class="navitab" href="#">Merchandise</a><span class="hide"> | </span>




<after saving>did this:


<a class="\\\navitab\\\" href="\\\index.php\\\">Welcome</a><span class=\\\"hide\\\"> | </span>
<a class="\\\navitab\\\" href="\\\index2.php\\\">Bio</a><span class=\\\"hide\\\"> | </span>
<a class="\\\navitab\\\" href="#\\\\\\\">Discography</a><span class=\\\\\\\"hide\\\"> | </span>
<a class=\\\\\\\"navitab\\\\\\\" href=\\\\\\\"#\\\\\\\">Downloads</a><span class=\\\\\\\"hide\\\\\\\"> | </span>
<a class=\\\\\\\"navitab\\\\\\\" href=\\\\\\\"#\\\\\\\">Photos</a><span class=\\\\\\\"hide\\\\\\\"> | </span>
<a class=\\\\\\\"navitab\\\\\\\" href=\\\\\\\"#\\\\\\\">Tour</a><span class=\\\\\\\"hide\\\\\\\"> | </span>
<a class=\\\\\\\"navitab\\\\\\\" href=\\\\\\\"#\\\\\\\">Merchandise</a><span class=\\\\\\\"hide\\\\\\\"> | </span>

can you see the problem?
__________________
Sim cards - all UK networks./Fishing Tackle Shop UK /Cheap Broadband providers/ Outdoor patio heaters
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 18-01-07
Keith's Avatar
Moderator
 
Join Date: Aug 2003
Location: Richmond North Yorkshire
Posts: 2,116
Thanks: 19
Thanked 5 Times in 4 Posts
Keith seems to know their stuff
  Re: looking 4 a php script that edits selected pages of my site

looks like you need to add the strip slashes function somewhere in your code http://uk.php.net/stripslashes
__________________
Keith
My Blog general ramblings. Internet Marketing Blogs UK all the blogs together in one place (pm for inclusion)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #8 (permalink)  
Old 18-01-07
SIMONR85's Avatar
Registered User
 
Join Date: Mar 2006
Location: Preston
Posts: 219
Thanks: 0
Thanked 0 Times in 0 Posts
SIMONR85 is an unknown quantity at this point
  Re: looking 4 a php script that edits selected pages of my site

Quote:
Originally Posted by Keith View Post
looks like you need to add the strip slashes function somewhere in your code http://uk.php.net/stripslashes
Will it matter where abouts in the code?
__________________
Sim cards - all UK networks./Fishing Tackle Shop UK /Cheap Broadband providers/ Outdoor patio heaters
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 18-01-07
Registered User
 
Join Date: Feb 2006
Location: Gillingham
Posts: 503
Thanks: 0
Thanked 0 Times in 0 Posts
Donk is an unknown quantity at this point
  Re: looking 4 a php script that edits selected pages of my site

The problem occurs because your server had "magic_quotes_gpc = on" and mine "magic_quotes_gpc = off"

Just add stripslashes in the line:

PHP Code:
fwrite($fp,stripslashes($_POST['data'])); 
Regards
__________________
They came for my 404 and I said nothing
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 18-01-07
SIMONR85's Avatar
Registered User
 
Join Date: Mar 2006