What are the common errors or pitfalls to watch out for when creating PHP scripts for user registration and file manipulation in a web development project?

One common error when creating PHP scripts for user registration is failing to sanitize user input, which can leave the application vulnerable to SQL injection attacks. To prevent this, always use prepared statements when interacting with a database to ensure data is properly sanitized.

// Example of using prepared statements for user registration
$stmt = $pdo->prepare("INSERT INTO users (username, email, password) VALUES (:username, :email, :password)");
$stmt->bindParam(':username', $username);
$stmt->bindParam(':email', $email);
$stmt->bindParam(':password', $hashedPassword);
$stmt->execute();
```

Another common pitfall when manipulating files in PHP is not properly checking file permissions, which can lead to security vulnerabilities. Always ensure that the appropriate permissions are set for files and directories to prevent unauthorized access.

```php
// Example of checking file permissions before file manipulation
if (is_writable($file)) {
    // Perform file manipulation here
} else {
    echo "File is not writable.";
}