Go Back   vb.org Archive > Community Central > Community Lounge
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 02-19-2005, 02:13 PM
Deaths Deaths is offline
 
Join Date: Oct 2004
Location: Europe, Belgium
Posts: 679
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

He wants to do it without a program, he wants to edit it like templates.
Reply With Quote
  #12  
Old 02-19-2005, 02:48 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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';
    }
}
    

?>
Reply With Quote
  #13  
Old 02-19-2005, 02:51 PM
Deaths Deaths is offline
 
Join Date: Oct 2004
Location: Europe, Belgium
Posts: 679
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Darn, you beat me to it ^^
Reply With Quote
  #14  
Old 02-19-2005, 05:49 PM
ryancooper ryancooper is offline
 
Join Date: Jul 2002
Posts: 433
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
Reply With Quote
  #15  
Old 02-19-2005, 06:28 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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';
    }
}
    

?>
Reply With Quote
  #16  
Old 02-19-2005, 08:01 PM
ryancooper ryancooper is offline
 
Join Date: Jul 2002
Posts: 433
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey Dean. Thanks a million does exactly what i wanted!!
Reply With Quote
  #17  
Old 02-19-2005, 08:52 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You're welcome
Reply With Quote
Reply


Posting 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


All times are GMT. The time now is 04:48 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.06440 seconds
  • Memory Usage 2,245KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete