Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Dec 2013
    Location
    USA
    Posts
    16
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Exclamation Reading a form to create a text file

    I an trying to make a website that controls an android device. I need to make a php script that reads the signup username field and makes a file named what ever is entered in the username field. Sorry if this is confusing, its hard to explain. I'm a beginner php programmer and I need help. Thanks!

  • #2
    New Coder
    Join Date
    Nov 2011
    Location
    Ratio, Logic
    Posts
    55
    Thanks
    3
    Thanked 6 Times in 6 Posts
    Give us your code of what do you have so far.

  • Users who have thanked Tpojka for this post:

    masonmilby (12-08-2013)

  • #3
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    2,958
    Thanks
    2
    Thanked 304 Times in 296 Posts
    Web sites that have users and display user information (profile, comment wall, photos, forum topics/posts...) don't have a separate file for each user. When a user signs up, his/her user information is stored in a database table (i.e. users.) This assigns a user id for each user. This user id is used to relate information stored in other database tables back to the user it belongs with.

    There is typically only one index.php file on such a web site and the URL's that contain the user name/user id in them are actually rewritten to request that one index.php file with the user name/user id and the 'content' type converted and supplied as GET parameters to that one file.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • Users who have thanked CFMaBiSmAd for this post:

    masonmilby (12-08-2013)

  • #4
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    2,958
    Thanks
    2
    Thanked 304 Times in 296 Posts
    Web sites that have users and display user information (profile, comment wall, photos, forum topics/posts...) don't have a separate file for each user. When a user signs up, his/her user information is stored in a database table (i.e. users.) This assigns a user id for each user. This user id is used to relate information stored in other database tables back to the user it belongs with.

    There is typically only one index.php file on such a web site and the URL's that contain the user name/user id in them are actually rewritten to request that one index.php file with the user name/user id and the 'content' type converted and supplied as GET parameters to that one file.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • Users who have thanked CFMaBiSmAd for this post:

    masonmilby (12-08-2013)

  • #5
    New Coder
    Join Date
    Dec 2013
    Location
    USA
    Posts
    16
    Thanks
    13
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Tpojka View Post
    Give us your code of what do you have so far.
    When the user clicks signup what ever is in the username field needs to be the name of the file. Then it will redirect them to the homepage. I need the text file because it will have variables in it that are all off and when you hit the on button on the control page it will change it to off and the app will read that for a certain user.

    <?php
    $File = "username.txt";
    $Handle = fopen($File, 'w');
    $Data = "lostmode=off";
    fclose($Handle);
    header("Location: http://www.lostmode.bugs3.com");
    exit;
    ?>

  • #6
    New Coder
    Join Date
    Dec 2013
    Location
    USA
    Posts
    16
    Thanks
    13
    Thanked 0 Times in 0 Posts
    I figured it out! Thanks everyone! You all get a thanks.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •