Looking for a mentor on php/mysql

Daniel A. ldrada at gmail.com
Wed Feb 22 22:08:06 PST 2006


Hi,
While the idea of a "mentor" is quite widespread amongst people who
wish to learn a new field within IT, I find it that not many people
who want one get one.

I can, though, suggest that you in no circumstance save user passwords
in plaintext. I could find that file on a live server and retrieve all
user passwords.

The best way to learn any programming language (Or anything else, for
that matter) is to just play with it. Find some good guestbook script,
or some other type of not-so-complex code, and hack at it. Add
features, edit current features to your liking, etc.. That is how I
got good at coding PHP.


On 2/22/06, fbsd_user <fbsd_user at a1poweruser.com> wrote:
> I am trying to teach my self php/mysql/html programming.
> I have done native static html web sites before.
> Running FreeBSD 6.0 with apache13, php, and mysql all installed and
> working.
>
> Have read a few php books and searched the web for code snippets.
> Have been on some of the php forum sites, but responses are not forth
> coming.
>
> Looking for a mentor to guide me with puting all the pieces together.
> I have a working panel for registering a user that writes to a flat
> text file.
> Need guidance in changing this to use mysql. Would email you direct
> outside of the questions list.
>
>
>
>
> <html>
> <head>
> <meta http-equiv="Content-Language" content="en-us">
> <title>learning PHP </title>
> </head>
> <body>
> <h1 ALIGN="center">&nbsp;</h1>
> <h1 ALIGN="center"><font size="6">&nbsp;Membership
> Registration</font></h1>
> <font FACE="Courier New" SIZE="2"><p>&nbsp;</p>
> <p>Enter your info below.</font></p>
> <p>&nbsp;</p>
>
> <form method="POST" action="<?php echo($PHP_SELF); php?>">
>    <input type="hidden" name="action" value="add"><br>
>   <p>Account ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> &nbsp;&nbsp;
>   <input type="text" name="id" size="20"></p>
>   <p>Account Password&nbsp;&nbsp;
>   <input type="text" name="pw" size="20"></p>
>   <p>First
> Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> &nbsp;&nbsp;
>   <input type="text" name="first-name" size="20"></p>
>   <p>Last
> Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> &nbsp;&nbsp;
>   <input type="text" name="last-name" size="20"></p>
>   <p>Address
> Line&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   <input type="text" name="address" size="20"></p>
>
> <p>City&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
> sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
> nbsp;&nbsp;
>   <input type="text" name="city" size="20"></p>
>
> <p>State&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
> bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
>   <input type="text" name="state" size="20"></p>
>
> <p>Zip&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
> p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   <input type="text" name="zip" size="20"></p>
>   <p>&nbsp;</p>
>
> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
> nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   <input type="submit" value="Submit" name="B1"><input type="reset"
> value="Reset" name="B2"></p>
> </form>
>
> <p>&nbsp;</p>
> <?php
> $file_directory = $_SERVER["DOCUMENT_ROOT"];
> $user_ip = $_SERVER["REMOTE_ADDR"];
> $error = 'Could not open the file! Verify permissions & path are
> correct.';
>
>
> if($_POST['action'] == "add")
>  {
>  if($filehandle = fopen("$file_directory/members.php", "a"))
>    {
>     flock($filehandle, 2);      // lock file
>     fputs($filehandle,
> $_POST['id'].":".$_POST['pw'].":".$_SERVER['REMOTE_ADDR'].":".$_POST['
> first-name'].":".$_POST['last-name'].":".$_POST['address'].":".$_POST[
> 'city'].":".$_POST['state'].":".$_POST['zip']."\n");
>     flock($filehandle, 3);     // unlock file
>     fclose($filehandle);
>     print("Successfully added ".$_POST['id']." to the file");
>    }
>    else
>    {
>     echo($error);
>    }
>  }
> php?>
> </body></html>
>
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
>


More information about the freebsd-questions mailing list