Nov 22, 2009

Forms, Text Files, And Php For A Signature Generator. - Help a little.

free web hosting
Open Discussion > MODERATED AREA > Computers > Programming Languages > PHP Programming

Forms, Text Files, And Php For A Signature Generator. - Help a little.

Imtay22
Hello everyone! I am in need of some code a for a signature generator I am making. I am using BuffaloHELP's code for the php file, now I am trying to improve that code by making a form in a html file that will have the user say what is on the sig! But now, I need help getting the form data that is posted by the user to get into that sig! There is a file, sig.txt, where that tells the php file what text will go on the sig. But how can I make the form data in the html file go into the text file so it will go onto the sig? You might want to read BuffaloHELP's code. You can find it in probably simalar topics or scroll down some in the php forum. Thanks All!

PS. BuffaloHELP's Topic is called dynamic image/ sig generator.

Comment/Reply (w/o sign-up)

alex7h3pr0gr4m3r
You need to use the fopen and fwrite functions. That is if I understand you right.

So have the html form submit to a php page that gets all of the vars that the form sent to you and use something like this to modify the text file:

CODE
$file=fopen("name of text file.txt", 'w');
fwrite($file,"Data to put into the text file");
fclose($file);


For the mode (the second paramater of the fopen function), here is a list of what strings do different stuff.

(taken from php.net)
QUOTE
r' Open for reading only; place the file pointer at the beginning of the file.
'r+' Open for reading and writing; place the file pointer at the beginning of the file.
'w' Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.
'w+' Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.
'a' Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
'a+' Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
'x' Create and open for writing only; place the file pointer at the beginning of the file. If the file already exists, the fopen() call will fail by returning FALSE and generating an error of level E_WARNING. If the file does not exist, attempt to create it. This is equivalent to specifying O_EXCL|O_CREAT flags for the underlying open(2) system call. This option is supported in PHP 4.3.2 and later, and only works for local files.
'x+' Create and open for reading and writing; place the file pointer at the beginning of the file. If the file already exists, the fopen() call will fail by returning FALSE and generating an error of level E_WARNING. If the file does not exist, attempt to create it. This is equivalent to specifying O_EXCL|O_CREAT flags for the underlying open(2) system call. This option is supported in PHP 4.3.2 and later, and only works for local files.


I hope this helps!

 

 

 


Comment/Reply (w/o sign-up)



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : forms, text, files, php, signature, generator,

  1. Php Form Generator Class
    (2)
  2. Php - Fetching Random Line From A Text File
    and displaying it using AJAX/iframe (0)
    What you should know: HTML, PHP basics (executing php scripts) Examples: Using AJAX Using
    iframe Download Examples Using this script you can display a random quote/fact every time a
    visitor clicks the link. It happens dynamically without reloading the whole page. Useful for keeping
    a site fresh and lively. For example, you can have it in "About Me" page of a website which is
    rarely updated. All the quotes are stored in a text file separated by a line break. Although I have
    included a sample collection, you are free to modify or create your own. Thanks to Davi....
  3. Need Some Help In File Browser
    listing all sub folders and files in them. (8)
    Hey I want to create a very simple file browser, so that, it reads all the sub-folders which are
    places in a directory, and the files inside the sub-folders (It reads only files inside sub-folders
    and list them in simply. ) Also, it creates a directory (any name) inside each sub folder. My
    Following code reads on the files inside the main directory, it does not read the files inside the
    sub-folders.. I appreciate any help. CODE $path = "./"; $dir_handle = @opendir($path) or
    die("Unable to open $path"); while ($file = readdir($dir_handle)) { if($file == "." || $fil....
  4. Download Script For Mp3 Files
    (0)
    Hello, I'm looking for a download script for sound files (e.g. mp3, avi, wma, and other ones).
    i have found a few download scripts but they would not work for sound files for some reason. also
    this will not be used for allowing downloading of illegal or riped music, what i will be using this
    script for is i'm making a site for my church and the pastor wants to be able to recored the
    services and then have me upload them to the site so that the church members can download them for
    what ever reason. If some one could tell me how to make one or could show me a plac....
  5. Restrictions On Php & Forms?
    $_GET/POST/REQUEST? (2)
    alright, so heres me again (theres probably a contact page on the website but I figure somebody
    has/will have this question and they'll want to know it so why not ask and share the love &
    knowladge (minus the love)) so I've been working on a two part contact page. contact.php
    CODE   class="head">Contact!      *Name:      *E-mail Address: E-mail
    Subject: Information Request Quote Request     Check if you are Human.*
        (This is for your security)      *Message/Comments: fields denoted with * are
    req....
  6. Php & Forms Question
    (2)
    okay, so i have a form on a php script i am working on, and i want the form to submit to the page it
    is on... CODE echo " \n"; so say the page it loads on is something like
    index.php?page=article&id=8 when i submit the form, it ignores the query string and just goes back
    to index.php i tried something like CODE $action = $_SERVER . "?" . $_SERVER ; echo " \n \n";
    or CODE $action = $_SERVER . "?" . $_SERVER ; echo " \n"; is there anyway around this
    still using a form? if not, i could just list the form options as hyperlinks and pass the variab....
  7. I Just Wrote A Script For A Php Text Editor!
    (8)
    Yes, I just wrote out a script for a PHP text editing program. It is very basic but I would like to
    be able to actually use this and update it. First, I need version 0.7 to be proofread. It will be
    upgraded to 0.8 after closed beta, 0.9 after open beta, 1.0 when ready. I would love to have some
    people help with this project. Right now it is a simple PHP script and HTML form. Here is the
    current script. I would like it to be proofread. $fileName = "$_REQUEST "; $fHandle =
    fopen($fileName , 'w') or die("Can't write file."); $fContent = "$_REQUEST "; fwrit....
  8. Php Text Editor
    (1)
    Is there any possible way using XML and PHP that you could create a text editor that can save files
    in your documents and also make a hotlink to your site. Much like a online notepad. I would like to
    know how I would make on of these and whether or not MySQL or XML would be a good language to use
    for storing data. My current idea deals with only PHP and iframes. It really isn't an editor
    though, more like a notes page. I would like a way though to be able to create a database with info
    stored from the PHP script which and be able to save to your hard drive. Also, i....
  9. Grabt Access To My Protected Files
    grabt access to my protected files (2)
    Hi all, I am sure all of you are great programers but First i am no code programmer i am just
    trying to learn to run my sites, will the problem is i got a code from the web to protect my files
    ,1st i want to know how to work it out then i will try other things but can't let it go without
    a fight thanx all php: CODE if ( ! defined( 'myname' ) ) {         print "You
    cannot access this file directly.";         exit(); } customer data here ?> now i
    can't access my files what is the method to access them all i want is to protect the f....
  10. Security Issue Writing Files
    Security issue writing files (1)
    Hi, first, sorry about my english. i am a beginner with php and i have some question about writing
    files using php in a shared hosting. is a risk?, use database to store data is a better way? i just
    want make an interface (in php) that write the data in a .html extension file to show to everybody
    the html page and just the php interface is to the content manager. thanks in advance ....
  11. [php]simple Flat File Text Manipulator
    Example on how to use forms to write to files in PHP (3)
    I made a simple flat file text editor, that can show you probably how simple it is to use forms with
    php and write that data to file. This example has 2 files, submit.php, and postit.html. Submit.php
    is used to write title, and some text, and add html tags, and paragraph tags where new paragraphs
    are. Here's the file with comments. I think that HTML really doesn't need some more
    explaining. CODE Title: Text: if (@$_POST =="" || @$_POST
    ==""){      echo "Enter text to save!"; } else {      //this is path to file      $filena....
  12. Form Generator
    (9)
    I am making a form generator like the one trap17 uses to make the code for website requests. well i
    have everything set up, i studied the code from the trap17 generator and learned from it, then i
    tried to make my own, but when i click the generate button, the code isnt filled out. if you would
    like an example please visit my website at www.notapplicable.rifehost.com/forms/wrf.php the
    problem is that it doesnt fill in the the answers. can anyone help? i will put credits on the
    affilates page and on the gen pages. Here is my code: (this is the form) Website ....
  13. Reading Files From Directory To Array, And Using $_get To Get Them
    Simple way to manage lot's of files (2)
    Some user posted a similar problem i had when i tried to figure out how to update content on my
    website in less work as possible. This is just part of the "big" plan i have for my site but it can
    be helpfull to you guys if you like FlatFile. I hope that mod's don't mind me posting the
    same code here and on their forums, couse if they do i'll delete it from their forums
    /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> So
    here's the situation. Let's say you have a folder called 'myfilesdirectory' on your
    s....
  14. Help Php: How To Load String From Text File (solved)
    Loading string from text file when you click on your link (9)
    I learned the way to load other files with the code posted on this forum. Now i wanted to try
    something for my side menu. I am calling this a string, --> $tekst , maybe it's called
    something else i'm not sure Now let's say i have a file called details.txt In that file i
    would like to have something like this $detailsaboutphp1 = ("details details details 1");
    $detailsaboutphp2 = ("details details details and even more details 2"); How to make a code that
    loads those $strings on click of a mouse. When we tried to load external file we used this:
    ....
  15. Writing To Files And Such
    (3)
    Ok lets say i have a config.php file, i want to edit something without open it, i know every line
    number and that, now how would i do this? I will show you a example: CODE $CONFIG
                =    'root'; $CONFIG         =    'localhost'; $CONFIG
                =    '******'; $CONFIG             =    '******'; $CONFIG
            =    '1'; $CONFIG             =    'en'; ?> Now lets say i want to
    change $CONFIG , HOW would i do this without open the file? Thanks /smile.gif"
    style="vertical-align:middle" emoid=":)" bor....
  16. Php Forum Signature
    (10)
    Hey /tongue.gif" style="vertical-align:middle" emoid=":P" border="0" alt="tongue.gif" /> Having
    browsed this and other sites I've come up with the following signature-code for generating text
    on an image: CODE header("Content-type: image/png"); $select = rand(1,3); if($select==1)$img
    = "gow.png"; if($select==2)$img = "gow2.png"; if($select==3)$img = "gow3.png"; $image =
    imagecreatefrompng("$img"); //imagecolorallocate($image, R, G, B) in HEX values $font_white =
    imagecolorallocate($image, 255, 255, 255); $font_grey = imagecolorallocate($image, 128, 128, ....
  17. Files Required?
    (5)
    I want to learn php and I am already on the first steps to doing it. I have set up my server using
    easyPHP as well as XAMPP which is a package containing FileZilla, Apache and MySQL. Other than
    easyPHP, XAMPP and MySQL, what other softwares are required to be set up for me to successfully
    learn how to program with PHP?....
  18. String/text Formatting?
    (4)
    right i was wondering if someone could help me with this: I notice on this site if i make a topic
    for example WAppY rOCks WaP, it will come out like Wappy Rocks Wap. I also want to do this to my
    forums, can anyone give me the code to format a string of text in this way? THANKS IN ADVANCE ....
  19. Displaying Files Of A Directory
    (2)
    I want to display the contents of a directory.. i have the following code.. It gives the output in
    one column only... like file1 file2 file3 file4 . . . . . Since there are lot of files so this
    column gets very long..i want to display the x number of files in each column.. like if there are 22
    files.. then file 1 file 11 file 21 file 2 . file 22 file 3 .. . . . file 10
    file 20 This was just an example..I know it can be done by using but i dont know how to do it
    with loop. Please help me. QUOTE $dir = './'; $handle = opendir($....
  20. Simple Text Counters
    Counters i use on wap sites ;-) (15)
    First create a dir "counters" in root add to it dailyhits.txt, hits.txt, online.txt an CHMOD 0777,
    place this on index: CODE //online counter $tim = 120+time(); $time = time(); $f =
    "counters/online.txt"; $nusk = file($f); $sk = count($nusk); $in = $HTTP_USER_AGENT.$REMOTE_ADDR;
    $fp = fopen($f, "w+"); for($i=0; $i $time) { fwrite($fp,$nusk ); }} fwrite($fp, "$in|$tim|\n");
    fclose($fp); $xfile=file('counters/online.txt'); $onlinecount=count($xfile); echo "-Online:
    $onlinecount "; //day hits counter $fn = "counters/dayhits.txt";     $fp = fopen($fn, "a+");  ....
  21. Logging Dowload Files From Your Server Onto A Html File
    (1)
    Well, i had the idea of logging the downloads from my web in a html file few weeks ago, and i solved
    it with a lil php page included in my homepage. You could name the links with a name like
    "download.php?file=filename.ext" and then, in the download.php put the next code: (well you put
    the html and head and body tags if u want, i only write the php here) CODE if (isset($_GET ))
    $file=$_GET ; //so it gets the GET data from url (file=filename.ext); $ip=$_SERVER ;
    $file=fopen('download_log.html','a'); $date=date('d-m-y H:i:s'); $text="
    ".$....
  22. How To List Files In A Directory + Subdirectory And Then Use Them.
    (8)
    So lets say i have folders called friends and work in a folder called pics. how would i make a
    function that lists the files in those folderscalled images kinda like this: CODE
    $directory = "./" function listfiles($directory) { //here should go the script to list the files in
    those directories. so that i can continue to work with them. like for example if there were images
    it would list all  the images and i could write a script to make a thumb of them and then save it
    into a thumb folder(not asking for all of that). but how would i make it list it. // basic....
  23. Directory Files Displaying
    (5)
    I have many files in a directory..I want to create a page , like A B C D E F ..... when some one
    click on A , it should display all the files starting from letter A , and when clicks on B , it
    should show all the files in that directory starting from B , and so on... I have no idea how to
    display the files of the directory iin that way. Kindly assist me......
  24. Displaying Latest Added Files Of Subdirectories ?
    (5)
    For example,i have a directory , which has 3 sub directories a,b and c...and i have some files in
    all subdirectories.. is it possible that i can display the latest added files to any of sub
    directory a,b, or c.?i think i will have to use sort by date function but how it should be done that
    it compares the files of all the subdirectories directories ?....
  25. How To Sort Files Of A Directory using Php
    (13)
    The following code displays the files of folder...but they are displaced by the order of adding... i
    want to sord the files / folders alphabetically and sord by accending order and by decending
    order.. can some one help me. $path = ""; $dir_handle = @opendir($path) or die("Unable to open
    $path"); echo "Directory Listing of $path "; while($file = readdir($dir_handle)) {
    if(is_dir($file)) { continue; } else if($file != '.' && $file !=
    '..') { echo " $file "; } } //closing the directory
    closedir($dir....
  26. What Kind Of Files Are .lib
    (2)
    I want to know , if we use some pre-made php script , there are often many files with other
    extension..i have been watching many times some files names ".lib" . what kind of files these are
    ... there's written C/C++ inline file.. why these kinds of files are needed in php scripts.. and
    are there some replacements for it ? (So that we can do things without it ?)... for example im
    pasting the coding of a file.. ban.lib ..i want to ask, why it is .lib file..why it cant be .php....
    CODE function file2str($p){if($p=="") return ""; $f=@fopen($p,"r");if(!$f) return ""....
  27. Dynamic Image / Signature Generator
    a simple code to change text on an image (12)
    In search of dynamically changing quote, saying or all other types of text on an image I came across
    a code that I have modified to fit my initial usage. This procedure requires two files and short
    knowledge of PHP. If you are familiar with Trap17's sig rotation code you will understand this
    procedure very fast. Code 1: dynamic_sig.php (you can rename this to index.php and you'll see
    at the end why) Code 2: a simple text file named anything (I will call it name.txt ) Code 1
    CODE header("Content-type: image/png"); $image = imagecreatefrompng("../i....
  28. Change Permission With Php Code
    code to change files' and folders' permissions? (3)
    As everyone know, there two ways (that I can think of) to change files' and directories'
    permissions. One is to change it in your cPanel's Disk Manager and the other is with an FTP
    client that supports chmod. Well, I'm doing something for my site that requires files to have
    full permissions (Execute, Write, and Read on all three groups). At first, I thought that if I made
    the directory 777, then every file created in that directory will be 777 as well. I'm wrong. An
    alternative to doing this is to change each file permission myself, but that would be....
  29. Getting List Of Directories And Files Using Php
    PHP Function for Directory and File List (6)
    is there a php function that lists the content of some folder.... example: /New folder new.txt
    left.gif download.zip dc.exe ....so is there..? /rolleyes.gif' border='0'
    style='vertical-align:middle' alt='rolleyes.gif' /> ....
  30. Random Message Generator
    (8)
    Here comes another one of Inspired's "amazing" PHP scripts. This little script lets you display
    a random message every time the user visits that particular page. It's not really that useful,
    but it does make the page a bit more "dynamic". CODE $randMsg = array("Hi, welcome to my
    page!", "Hey you! Thanks for visiting!", "Bonjour, mon ami!", "So, do you like the site?", "Come
    one, come all!"); $MsgNum = count($randMsg); $MsgGenNum = floor(rand(MsgNum)); echo $randMsg ;
    You can edit those values in the array if you want. Add more if you so choose. Enj....

    1. Looking for forms, text, files, php, signature, generator,
Similar
Php Form Generator Class
Php - Fetching Random Line From A Text File - and displaying it using AJAX/iframe
Need Some Help In File Browser - listing all sub folders and files in them.
Download Script For Mp3 Files
Restrictions On Php & Forms? - $_GET/POST/REQUEST?
Php & Forms Question
I Just Wrote A Script For A Php Text Editor!
Php Text Editor
Grabt Access To My Protected Files - grabt access to my protected files
Security Issue Writing Files - Security issue writing files
[php]simple Flat File Text Manipulator - Example on how to use forms to write to files in PHP
Form Generator
Reading Files From Directory To Array, And Using $_get To Get Them - Simple way to manage lot's of files
Help Php: How To Load String From Text File (solved) - Loading string from text file when you click on your link
Writing To Files And Such
Php Forum Signature
Files Required?
String/text Formatting?
Displaying Files Of A Directory
Simple Text Counters - Counters i use on wap sites ;-)
Logging Dowload Files From Your Server Onto A Html File
How To List Files In A Directory + Subdirectory And Then Use Them.
Directory Files Displaying
Displaying Latest Added Files Of Subdirectories ?
How To Sort Files Of A Directory using Php
What Kind Of Files Are .lib
Dynamic Image / Signature Generator - a simple code to change text on an image
Change Permission With Php Code - code to change files' and folders' permissions?
Getting List Of Directories And Files Using Php - PHP Function for Directory and File List
Random Message Generator

Searching Video's for forms, text, files, php, signature, generator,
See Also,
advertisement


Forms, Text Files, And Php For A Signature Generator. - Help a little.

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com