Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Feb 2006 07:08:04 +0100
From:      "Daniel A." <ldrada@gmail.com>
To:        fbsd_user@a1poweruser.com
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Looking for a mentor on php/mysql
Message-ID:  <5ceb5d550602222208m44417ba7n3f7f718856521d85@mail.gmail.com>
In-Reply-To: <MIEPLLIBMLEEABPDBIEGKEINHCAA.fbsd_user@a1poweruser.com>
References:  <MIEPLLIBMLEEABPDBIEGKEINHCAA.fbsd_user@a1poweruser.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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@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=3D"Content-Language" content=3D"en-us">
> <title>learning PHP </title>
> </head>
> <body>
> <h1 ALIGN=3D"center">&nbsp;</h1>
> <h1 ALIGN=3D"center"><font size=3D"6">&nbsp;Membership
> Registration</font></h1>
> <font FACE=3D"Courier New" SIZE=3D"2"><p>&nbsp;</p>
> <p>Enter your info below.</font></p>
> <p>&nbsp;</p>
>
> <form method=3D"POST" action=3D"<?php echo($PHP_SELF); php?>">
>    <input type=3D"hidden" name=3D"action" value=3D"add"><br>
>   <p>Account ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> &nbsp;&nbsp;
>   <input type=3D"text" name=3D"id" size=3D"20"></p>
>   <p>Account Password&nbsp;&nbsp;
>   <input type=3D"text" name=3D"pw" size=3D"20"></p>
>   <p>First
> Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> &nbsp;&nbsp;
>   <input type=3D"text" name=3D"first-name" size=3D"20"></p>
>   <p>Last
> Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> &nbsp;&nbsp;
>   <input type=3D"text" name=3D"last-name" size=3D"20"></p>
>   <p>Address
> Line&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>   <input type=3D"text" name=3D"address" size=3D"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=3D"text" name=3D"city" size=3D"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=3D"text" name=3D"state" size=3D"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=3D"text" name=3D"zip" size=3D"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=3D"submit" value=3D"Submit" name=3D"B1"><input type=3D"rese=
t"
> value=3D"Reset" name=3D"B2"></p>
> </form>
>
> <p>&nbsp;</p>
> <?php
> $file_directory =3D $_SERVER["DOCUMENT_ROOT"];
> $user_ip =3D $_SERVER["REMOTE_ADDR"];
> $error =3D 'Could not open the file! Verify permissions & path are
> correct.';
>
>
> if($_POST['action'] =3D=3D "add")
>  {
>  if($filehandle =3D 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@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.o=
rg"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5ceb5d550602222208m44417ba7n3f7f718856521d85>