Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #14268

Re: Is there anyone who could build this?

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: Is there anyone who could build this?
Date 2014-10-02 12:35 -0400
Organization A noiseless patient Spider
Message-ID <m0jus3$2gh$1@dont-email.me> (permalink)
References <6dae4e9c-6aa9-4b98-b10a-d3648f42641c@googlegroups.com>

Show all headers | View raw


On 10/2/2014 11:16 AM, andrewpaulford@gmail.com wrote:
> Is there anyone that can build this php because so far i havent been able to get anything to work its a social media network thats suppose to be built to these specs  https://docs.google.com/presentation/d/1_vjLMhxMPToGR8E937ZHIF7X9YmU680AK5IZcR4B9J0/edit#slide=id.p
> 
> 
> 
> so far i have written this but dont know where to go from here is there anyone that could build what i have around these requirements to help me please.
> 
> 
> 
> ////my login page
> 
> 
> <?php
> 
> include 'private/users.php';
> 
> $message = 'Please login:';
> 
> if($_SERVER['REQUEST_METHOD'] == 'POST')
> {
> 	// Try to find a user with the posted username and password
> 	if($user = findUserByCredentials($_POST['username'], $_POST['password']))
> 	{
> 		// if a user is found we make a new UID for this session
> 		$user['uid'] = generateUID($_POST['username'], $_POST['password']);
> 		
> 		// update new login time
> 		$user['lastlogin'] = date('d-m-Y H:i:s');
> 		
> 		// save userdetails
> 		updateUser($user);
> 		
> 		// redirect to the memberpage and exit this script
> 		header('Location: members.php?uid=' . $user['uid']);
> 		exit;
> 	}
> 	
> 	$message = 'Wrong credentials!';
> }
> ?>
> 
> 
> 
> <!doctype html>
> <html>
>     <head>
>         <meta charset="utf-8">
>         <title>Login</title>
>     </head>
>     
>     <body>
>         <p><strong><?php echo $message; ?></strong></p>
>         <form method="post" action="">
>         <input type="text" name="username" /><br>
>         <input type="password" name="password" /><br>
>         <input type="submit" value="Login" />
>         </form>
>     </body>
> </html>
> 
> 
> 
> 
> 
> this would be greatly appreciated.
> 

Need help with your homework?  Have you talked with your professor
and/or other students for hints?

I understand the professor is trying to limit what you have to use for
this project (i.e. no database), but you need to store this information
somewhere - which basically means a flat file.  So you will have to
define the format of that flat file, store the information in it, then
retrieve the information from it.

The easiest way would probably be to store a flat file with a name
related to the user's name.  Not very secure unless you can store it
outside of the website's document root.  If you can't, I would suggest
something like encrypting the filename based on the user's name.

Alternatively, you can store all of the users information in one file,
but then you have problems parsing the information.  Additionally, if
someone edits their profile, you will have to rewrite the entire file.
This could cause problems if two people try to update their profiles at
the same time.

Maybe this will give you a start.  Just a word of caution - this is not
how it's done in "real life" - people use both cookies and databases.
And having to parse the file makes it harder than it has to be.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Is there anyone who could build this? andrewpaulford@gmail.com - 2014-10-02 08:16 -0700
  Re: Is there anyone who could build this? "J.O. Aho" <user@example.net> - 2014-10-02 18:32 +0200
  Re: Is there anyone who could build this? Jerry Stuckle <jstucklex@attglobal.net> - 2014-10-02 12:35 -0400
    Re: Is there anyone who could build this? Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-02 16:49 +0000
      Re: Is there anyone who could build this? Jerry Stuckle <jstucklex@attglobal.net> - 2014-10-02 13:34 -0400
      Re: Is there anyone who could build this? "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-10-02 19:49 +0200
        Re: Is there anyone who could build this? Jerry Stuckle <jstucklex@attglobal.net> - 2014-10-02 15:56 -0400
  Re: Is there anyone who could build this? Doug Miller <doug_at_milmac_dot_com@example.com> - 2014-10-02 17:53 +0000
    Re: Is there anyone who could build this? Doug Miller <doug_at_milmac_dot_com@example.com> - 2014-10-02 18:00 +0000
      Re: Is there anyone who could build this? Matthew Carter <m@ahungry.com> - 2014-10-02 15:37 -0400
  Re: Is there anyone who could build this? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-10-06 22:13 +0100

csiph-web