GFXVoid Graphic Design Forum

Remove Text Formatting
Loading...

» Online Users: 1,877

0 members and 1,877 guests
No Members online

» Site Navigation

 > FAQ

» Stats

Members: 35,443
Threads: 103,072
Posts: 826,684
Top Poster: cc.RadillacVIII (7,429)
Welcome to our newest member, Lekelindids
Results 1 to 8 of 8
  1. #1
    Join Date
    Mar 2005
    Posts
    190

    Default

    Code:
    <html>
    <head>
    <title></title>
    </head>
    <body><?php
    echo"<align='center'>Registration Form</align>";
    echo"<p><form name='registration'>Username:<input type='text' name='Username' maxlength='20'><p>";
    echo"<p>Password:<input type='password' name='Password' maxlength='20'></p>";
    echo"<p><form action='post'><input type='submit' input name='registration' value='Register'></form></p>";
    $name = $_post['$Username'];
    $pass = $_post['$Password'];
    $myFile = "name.php";
    $fh = fopen($myFile, 'w') or die("can't open file");
    
    $stringData='$Username';
    fwrite($fh, $stringData);
    
    $stringData='$Password';
    fwrite($fh, $stringData);
    fclose($fh);
    ?>
    </body>
    </html>
    Can you guys adjust this code so that it creats a new file with the Username and Password saved in there?
    I kno it's not a safe way to do it, but I'm learning PHP now... Wrote this script myself btw.

  2. #2
    Join Date
    Jan 2005
    Location
    USA
    Posts
    2,155

    Default

    Resident father figure.

  3. #3
    Join Date
    Mar 2005
    Posts
    190

    Default

    I already followed several tutorials, but it just won't work..

  4. #4
    Join Date
    Jan 2005
    Location
    USA
    Posts
    2,155

    Default

    you problable don't have permissions set correctly on the server. write a small php script that writes a file. if they file isn't created you don't have permission to do so on the server.
    Resident father figure.

  5. #5
    Join Date
    Mar 2005
    Posts
    190

    Default

    I got that right now... But the prob is now that the file doesn't save the Username and Password, it's just an empty file... I kno it's not safe, but it's just to practice a bit.

  6. #6
    Join Date
    Jun 2005
    Posts
    4,178

    Default

    Dont you need a server that runs PHP and MySQL?

  7. #7
    Join Date
    Jan 2005
    Location
    USA
    Posts
    2,155

    Default

    <div class='quotetop'>QUOTE(BlackOut &#064; Apr 21 2006, 06&#58;23 PM) [snapback]166392[/snapback]</div>
    Dont you need a server that runs PHP and MySQL?
    [/b]
    Just PHP

    I&#39;m drunk wo I can&#39;t really hep much. but suffieccced to say you need to put the write command into the same page as the password acceptance page, and use th e paddword vairable and the usernemrna variable for the file diet.
    Resident father figure.

  8. #8
    Join Date
    Mar 2005
    Location
    Stockholm, Sweden
    Posts
    156

    Default

    Sorry for reviving such an old thread, but i&#39;d thought i&#39;d shed some light on this, there is SO much wrong in this code.

    Code:
    &#60;html&#62;
    &#60;head&#62;
    &#60;title&#62;&#60;/title&#62;
    &#60;/head&#62;
    &#60;body&#62;
    &#60;?php
    echo &#39;&#60;div align=&#34;center&#34;&#62;Registration Form&#60;/div&#62;&#39;;
    echo &#39;&#60;p&#62;&#60;form name=&#34;registration&#34; action=&#34;&#34; method=&#34;post&#34;&#62;Username&#58;&#60;input type=&#34;text&#34; name=&#34;Username&#34; maxlength=&#34;20&#34;&#62;&#60;p&#62;&#39;;
    echo &#39;&#60;p&#62;Password&#58;&#60;input type=&#34;password&#34; name=&#34;Password&#34; maxlength=&#34;20&#34;&#62;&#60;/p&#62;&#39;;
    echo &#39;&#60;p&#62;&#60;input type=&#34;submit&#34; name=&#34;registration&#34; value=&#34;Register&#34;&#62;&#60;/form&#62;&#60;/p&#62;&#60;/p&#62;&#39;;
    
    // This will get you some nice warnings if you have error-reporting on E_ALL & E_NOTICE.
    &#036;name = &#036;_POST&#91;&#39;Username&#39;&#93;; // Dunno what you were trying here.
    &#036;pass = &#036;_POST&#91;&#39;Password&#39;&#93;; // same as above.
    &#036;myFile = &#34;users.txt&#34;;
    &#036;fh = fopen&#40;&#036;myFile, &#39;a&#39;&#41; or die&#40;&#39;can&#39;t open file&#39;&#41;; // dont truncate file, add to end.
    
    fwrite&#40;&#036;fh, &#036;name . &#39;&#58;&#39; . &#036;pass&#41;; // add users in the username&#58;password syntax &#40;cleartext&#40;&#33;&#41;&#41;
    
    fclose&#40;&#036;fh&#41;;
    ?&#62;
    
    &#60;/body&#62;
    &#60;/html&#62;
    http://peksa.se - photos by me.

Similar Threads

  1. System of a Down!!!
    By luigi in forum The Void
    Replies: 24
    Last Post: 06-04-2006, 08:32 PM
  2. system of a down
    By DrksYd665 in forum Sigs & Manips
    Replies: 3
    Last Post: 12-07-2005, 09:17 PM
  3. System Restore
    By Invision in forum The Void
    Replies: 7
    Last Post: 05-08-2005, 09:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBadvanced CMPS v4.1.1