vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Community Lounge (https://vborg.vbsupport.ru/forumdisplay.php?f=13)
-   -   A little help?? (https://vborg.vbsupport.ru/showthread.php?t=76606)

ryancooper 02-18-2005 11:50 PM

A little help??
 
Ok this has nothing to do with VB but i figured with all the smart people here someone may be able to help me.

I have a text file on my server that I would like to be able to edit online via a form. This is so i don;t have to download it, update the file, then reupload it.

Does anyone have anyclue how i can do this?

Thanks!

Ryan :pirate:

Blam Forumz 02-19-2005 06:49 AM

The only FTP Client which i've discovered that can use this is FlashFXP, right click on the file, then edit, edit it on your server :P

Oblivion Knight 02-19-2005 08:29 AM

FTP Voyager can also achieve the above.. :)

There's an option built in to cPanel IIRC which allows you to edit files via a form on the File Manager..

Deaths 02-19-2005 08:57 AM

You can do this with Confixx' WebFTP aswell :)

ryancooper 02-19-2005 12:12 PM

Quote:

Originally Posted by Deaths
You can do this with Confixx' WebFTP aswell :)

I understand I can do this with a FTP proggie BUT i would like to do a form directly in the html that i can load and edit the file from.

Is this possable?

Deaths 02-19-2005 12:14 PM

It's possible using vBulletin templates, I guess...

Or you could use MySQL for this, ofcourse.

Marco van Herwaarden 02-19-2005 12:45 PM

Quote:

Originally Posted by Blam Forumz
The only FTP Client which i've discovered that can use this is FlashFXP, right click on the file, then edit, edit it on your server :P

Sorry but also FlashFXP can't do this, simply because th FTP standard have no commands making this possible. What FlashFXP does (and a lot of others, like the free FlashFXP clone UltraFXP) is download the file to a local file, let you edit it, and then reupload it.

ryancooper 02-19-2005 01:32 PM

Quote:

Originally Posted by MarcoH64
Sorry but also FlashFXP can't do this, simply because th FTP standard have no commands making this possible. What FlashFXP does (and a lot of others, like the free FlashFXP clone UltraFXP) is download the file to a local file, let you edit it, and then reupload it.

That is what i am doing now is downloading it edit and reupload. What i want to do is beable to edit it like i edit the VBulletin templates. HAve a form open up have it load the text file so i can edit it then when i hit save it saves the changes.

??? Any ideas?

Deaths 02-19-2005 01:45 PM

MySQL is the key my friend.

Gio~Logist 02-19-2005 01:48 PM

i use core ftp and it allows me to do just that i believe

Deaths 02-19-2005 02:13 PM

He wants to do it without a program, he wants to edit it like templates.

Dean C 02-19-2005 02:48 PM

Let's write a quick script then :):

PHP Code:

<?php

$filepath 
'test.txt';
$password 'Dean_is_cool';

if(empty(
$_POST['do']))
{
    
$handle fopen($filepath'r');
    while(!
feof($handle))
    {
           
$buffer fgets($handle4096);
           
$contents .= $buffer;;
       }
    
fclose($handle);
    echo 
'<form action="' $_SERVER['PHP_SELF'] . '" method="post">';
    echo 
'<input type="hidden" name="do" value="send" />';
    echo 
'Contents<br />';
    echo 
'<textarea name="contents" rows="20" cols="70">' $contents '</textarea>';
    echo 
'<br /><br />Password: <input type="password" name="pswd" value="" /><br /><br />';
    echo 
'<input type="submit" name="submit" value="Submit" />';
    echo 
'</form>';
}
else
{
    
$contents $_POST['contents'];
    
$pswd $_POST['pswd'];

    if(
$password == $pswd)
    {
        
$handle fopen($filepath'w');
        if(
fwrite($handle$contents) === FALSE)
        {
            echo 
'File could not be written';
            exit;
        }
        
fclose($handle);
        echo 
'All done';    
    }
    else
    {
        echo 
'Wrong password';
    }
}
    

?>


Deaths 02-19-2005 02:51 PM

Darn, you beat me to it ^^

ryancooper 02-19-2005 05:49 PM

Man if this works you are AWESOME!!

I will try it when I get home from work

Thanks,
Ryan

Well it works BUT. . . when it saves the text file the url's show up as:

<a target=\"_blank\" href=\"http://www.myurl.com\"><img border=\"0\" src=\"http://www.myurl.com/test/ad.gif\" width=\"468\" height=\"60\"></a></p>

Can I ahve it so id doesnot save the "\"

Thanks!

And every time i save it another / is added:

<a target=\\\"_blank\\\" href=\\\"http://www..myurl.com\\\"><img border=\\\"0\\\" src=\\\"http://www.myurl.com/test/ads.gif\\\" width=\\\"468\\\" height=\\\"60\\\"></a></p>

Dean C 02-19-2005 06:28 PM

Urgh you have magicquotes turned on. Use this:

PHP Code:

<?php

set_magic_quotes_runtime
(0);

function 
stripslashes_deep($value)
{
    
$value is_array($value) ? array_map('stripslashes_deep'$value) : stripslashes($value);
    return 
$value;
}

if(
get_magic_quotes_gpc())
{
    
$_GET array_map('stripslashes_deep'$_GET);
    
$_REQUEST array_map('stripslashes_deep'$_REQUEST);
    
$_POST array_map('stripslashes_deep'$_POST);
    
$_COOKIE array_map('stripslashes_deep'$_COOKIE);
}

$filepath 'test.txt';
$password 'Dean_is_cool';

if(empty(
$_POST['do']))
{
    
$handle fopen($filepath'r');
    while(!
feof($handle))
    {
           
$buffer fgets($handle4096);
           
$contents .= $buffer;;
       }
    
fclose($handle);
    echo 
'<form action="' $_SERVER['PHP_SELF'] . '" method="post">';
    echo 
'<input type="hidden" name="do" value="send" />';
    echo 
'Contents<br />';
    echo 
'<textarea name="contents" rows="20" cols="70">' $contents '</textarea>';
    echo 
'<br /><br />Password: <input type="password" name="pswd" value="" /><br /><br />';
    echo 
'<input type="submit" name="submit" value="Submit" />';
    echo 
'</form>';
}
else
{
    
$contents $_POST['contents'];
    
$pswd $_POST['pswd'];

    if(
$password == $pswd)
    {
        
$handle fopen($filepath'w');
        if(
fwrite($handle$contents) === FALSE)
        {
            echo 
'File could not be written';
            exit;
        }
        
fclose($handle);
        echo 
'All done';    
    }
    else
    {
        echo 
'Wrong password';
    }
}
    

?>


ryancooper 02-19-2005 08:01 PM

Hey Dean. Thanks a million does exactly what i wanted!! ;)

Dean C 02-19-2005 08:52 PM

You're welcome :)


All times are GMT. The time now is 04:47 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01328 seconds
  • Memory Usage 1,780KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (17)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete