Okay, I am working on a facebook for my school, and I need help creating the signup/login/profile pages... Connecting to the database and stuff.. if someone could help me here or on MSN?

[email snipped]

Thanks,

Really looking forward to it!

Dani AI

Generated

A short, practical plan for building signup / login / profile pages in PHP with a database (notes on the thread: wants PHP; is right that learning MySQL+PHP is required; suggested flat files — acceptable for tiny prototypes but not for a multi-user social site).

Start with a simple users table (utf8mb4). Example schema:

CREATE TABLE users (
  id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  email VARCHAR(255) NOT NULL UNIQUE,
  password_hash VARCHAR(255) NOT NULL,
  display_name VARCHAR(100),
  bio TEXT,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  last_login TIMESTAMP NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

Minimal PHP wiring: use PDO with exceptions, always use prepared statements, and use PHP built-in password helpers. Example connection and snippets:

$pdo = new PDO('mysql:host=localhost;dbname=app;charset=utf8mb4', 'user', 'pass', [
  PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
  PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
]);

$hash = password_hash($plainPassword, PASSWORD_DEFAULT);
$stmt = $pdo->prepare('INSERT INTO users (email, password_hash, display_name) VALUES (?, ?, ?)');
$stmt->execute([$email, $hash, $displayName]);

$stmt = $pdo->prepare('SELECT id, password_hash FROM users WHERE email = ?');
$stmt->execute([$email]);
$user = $stmt->fetch();
if ($user && password_verify($plainPassword, $user['password_hash'])) {
  session_start();
  session_regenerate_id(true);
  $_SESSION['user_id'] = $user['id'];
}

Key security and troubleshooting points: always store hashes with password_hash/password_verify; enforce prepared statements to avoid SQL injection; set PDO to throw exceptions to surface DB errors; use utf8mb4 to avoid charset issues; add CSRF tokens on forms; validate and sanitize inputs; treat flat files as a learning tool only (concurrency, locking, search and backup are painful). For authoritative references see the PHP manual on PDO and password functions and OWASP authentication/password storage guidance:

PHP PDO manual
password_hash / password_verify
OWASP Authentication Cheat Sheet

Recommended Answers

All 4 Replies

what language you prefer to use???

Firstly: what is your exact problem? if its the Database, then forget it to create a page like facebook, because you need much more things of the database, or leartn how to use MySQL with PHP.

Secondly: We do not code something for you, you can ask for help if something you have coded does not work

PHP...

I dont want someone to code it for me, I want someone to help me with it.

Hi

I would recommend using flat file databases as they would be eaiser to design.

check out w3schools http://www.w3schools.com/php/

Calum

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.