NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page simple code help

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 08-17-2005, 12:43 PM THREAD STARTER               #1 (permalink)
Senior Member
Join Date: May 2005
Location: Ontario Canada
Posts: 3,088
unknowngiver is a splendid one to beholdunknowngiver is a splendid one to beholdunknowngiver is a splendid one to beholdunknowngiver is a splendid one to beholdunknowngiver is a splendid one to beholdunknowngiver is a splendid one to beholdunknowngiver is a splendid one to beholdunknowngiver is a splendid one to behold
 


Diabetes

simple code help


Hey
I need a simple code tht does this

OKay so i have this file called nav.txt

Now i want to make a page where i can edit nav.txt ONLINE

so i need a code
tht first displays wts on nav.txt in a text area

and then a SAVE button below it
so the user can edit w.e they want in the text area and then when they press SAVE...it saves the file
unknowngiver is offline  
Old 08-17-2005, 03:06 PM   #2 (permalink)
Senior Member
 
Eric's Avatar
Join Date: Mar 2005
Posts: 4,948
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
Something like this would probably work:
????: NamePros.com http://www.namepros.com/programming/116375-simple-code-help.html

PHP Code:
<?php
????: NamePros.com http://www.namepros.com/showthread.php?t=116375
$loadcontent 
"nav.txt";
    if(
$save_file) {
        
$savecontent stripslashes($savecontent);
        
$fp = @fopen($loadcontent"w");
        if (
$fp) {
            
fwrite($fp$savecontent);
            
fclose($fp);
print 
'<a href='.$_SERVER[PHP_SELF].'>Refresh</a>';
print 
"<html><head><META http-equiv=\"refresh\" content=\"0;URL=$_SERVER[PHP_SELF]\"></head><body>";

}
}
    
$fp = @fopen($loadcontent"r");
    
$loadcontent fread($fpfilesize($loadcontent));
    
$lines explode("\n"$loadcontent);
    
$count count($lines);
    
$loadcontent htmlspecialchars($loadcontent);
    
fclose($fp);
for (
$a 1$a $count+1$a++) {
$line .= "$a\n";
}
?>
<form method=post action="<?=$_SERVER[PHP_SELF]?>">
<input type="submit" name="save_file" value="Save">
<table width="100%" valign="top" border="0" cellspacing="1" cellpadding="1">
<tr>
<td width="3%" align="right" valign="top">
<pre name="lines" cols="4" rows="<?=$count+3;?>"><?=$line;?></pre>
</td>
<td width="97%" align="left" valign="top">
<textarea name="savecontent" cols="150" rows="<?=$count;?>" wrap="OFF">
<?=$loadcontent?>
</textarea>
</td>
</tr>
</table>

<br>
<input type="submit" name="save_file" value="Save">
</form>
Eric is offline  
Old 08-17-2005, 03:14 PM   #3 (permalink)
DomainersUniversity.com
 
Gene's Avatar
Join Date: Feb 2005
Location: Oswego, NY
Posts: 4,735
Gene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond reputeGene has a reputation beyond repute
 


Member of the Month
April 2005
Ethan Allen Fund Cancer Survivorship Baby Health Cystic Fibrosis Marrow Donor Program Parkinson's Disease Child Abuse Save a Life Animal Rescue Save a Life Save a Life Animal Rescue
Wow... NICE! That's very useful! Will it work with html files as well?

Originally Posted by SecondVersion
Something like this would probably work:

PHP Code:
<?php
$loadcontent 
"nav.txt";
    if(
$save_file) {
        
$savecontent stripslashes($savecontent);
        
$fp = @fopen($loadcontent"w");
        if (
$fp) {
            
fwrite($fp$savecontent);
            
fclose($fp);
????: NamePros.com http://www.namepros.com/showthread.php?t=116375
print 
'<a href='.$_SERVER[PHP_SELF].'>Refresh</a>';
print 
"<html><head><META http-equiv=\"refresh\" content=\"0;URL=$_SERVER[PHP_SELF]\"></head><body>";

}
}
    
$fp = @fopen($loadcontent"r");
    
$loadcontent fread($fpfilesize($loadcontent));
    
$lines explode("\n"$loadcontent);
    
$count count($lines);
    
$loadcontent htmlspecialchars($loadcontent);
    
fclose($fp);
for (
$a 1$a $count+1$a++) {
$line .= "$a\n";
????: NamePros.com http://www.namepros.com/showthread.php?t=116375
}
?>
<form method=post action="<?=$_SERVER[PHP_SELF]?>">
<input type="submit" name="save_file" value="Save">
<table width="100%" valign="top" border="0" cellspacing="1" cellpadding="1">
<tr>
<td width="3%" align="right" valign="top">
<pre name="lines" cols="4" rows="<?=$count+3;?>"><?=$line;?></pre>
</td>
<td width="97%" align="left" valign="top">
<textarea name="savecontent" cols="150" rows="<?=$count;?>" wrap="OFF">
<?=$loadcontent?>
</textarea>
</td>
</tr>
</table>

<br>
<input type="submit" name="save_file" value="Save">
</form>
__________________
.
.

Expired Domain Search -- ExpiredDomainBoss.com | Sell Domain Names -- DomainProfitsClub.com
-----------------------------------------------------------------------------------------------
Gene is offline  
Old 08-17-2005, 03:19 PM   #4 (permalink)
Account Closed
 
tony84's Avatar
Join Date: Oct 2004
Location: Manchester, UK
Posts: 624
tony84 is on a distinguished road
 



thats a really useful script
tony84 is offline  
Old 08-17-2005, 04:06 PM THREAD STARTER               #5 (permalink)
Senior Member
Join Date: May 2005
Location: Ontario Canada
Posts: 3,088
unknowngiver is a splendid one to beholdunknowngiver is a splendid one to beholdunknowngiver is a splendid one to beholdunknowngiver is a splendid one to beholdunknowngiver is a splendid one to beholdunknowngiver is a splendid one to beholdunknowngiver is a splendid one to beholdunknowngiver is a splendid one to behold
 


Diabetes
Thanks second that was really really really helpfull
Can you please guide me to a website where i can find fopen kinda help..{file tutorials with php...tht teachs u stuff like the script u gave me }
Thanks
unknowngiver is offline  
Old 08-17-2005, 04:36 PM   #6 (permalink)
Senior Member
 
Eric's Avatar
Join Date: Mar 2005
Posts: 4,948
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
Originally Posted by Gene
Wow... NICE! That's very useful! Will it work with html files as well?
Yes, it will work with html files. Pretty much any file as long as it's writable, of course.

Originally Posted by unknowngiver
Thanks second that was really really really helpfull
Can you please guide me to a website where i can find fopen kinda help..{file tutorials with php...tht teachs u stuff like the script u gave me }
Thanks
One of the best places to learn php.net

http://us2.php.net/function.fopen Start there
Eric is offline  
Closed Thread


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Basic HTML Tutorial webgear Webmaster Tutorials 8 04-02-2005 03:20 PM
2 Huge Name Forsale Vegas Entertainment Domains For Sale - Make Offer 9 09-21-2004 03:37 PM
Tutorial: Creating a simple cgi hit counter for your site using Perl deadserious Webmaster Tutorials 3 05-29-2004 02:31 AM

Liquid Web Smart Servers  
All times are GMT -7. The time now is 01:25 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger