Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • sibidharan/php-challenges
  • rii/php-challenges
  • jagadeesh491/php-challenges
  • Hariharan6/php-challenges
4 results
Show changes
Commits on Source (10)
......@@ -16,5 +16,4 @@ You have been supplied with a book in `txt` format called `polnoe-esenin.txt`. Y
## Notes
- The book is in Russian, intentionally, to see how you handle UTF-8 (*Also, Esenin was a great poet*).
- Think about *regular expressions*
\ No newline at end of file
- The book is in Russian Cyrillic, intentionally, to see how you'll handle UTF-8 (*Also, Esenin was a great poet*).
\ No newline at end of file
Senior challenges
=========================
**You choose one of the two offered challenges.**
**You choose two of the three offered challenges.**
- Challenge #1 is created to test the deepest knowledge of PHP. You should prevent eye strain by giving up after 8 hours of looking at it in wonder.
- Mammoth task is created to test the deepest knowledge of PHP. You should prevent eye strain by giving up after 8 hours of looking at it in wonder.
- Challenge #2 offers your a deal with the devil. The challenge takes an open-source project that will be used in our forthcoming adventures, and gives it to you for review. You have to tell me what you would do with that code, or even better, actually code and submit pull requests. Look at TODOs, current code, consume the code. Keep in mind that it has to be impressive to make up for the fact that you gave up solving the first challenge like a chicken.
- Open source review challenge offers your a deal with the devil. The challenge takes an open-source project that will be used in our forthcoming adventures, and gives it to you for review. You have to tell me what you would do with that code, or even better, actually code and submit pull requests. Look at TODOs, current code, consume the code. Keep in mind that it has to be impressive to make up for the fact that you gave up solving the first challenge like a chicken.
- Refactor challenge will test your skills with existing code, best practices, structuring and security. Also, documentation is imperative.
## Vagrant box for senior challenges
......
.vagrant/
\ No newline at end of file
Review/improve an open-source project
====================================
This is a real-life working project that I've been developing a couple of years back, and recently, started updating it while constantly laughing at some choices I made. The library is called ZLO, it's a gettext-like inline translation and localization object that will be used in our new project. It's writen from scratch and thus independent from any external libraries.
There is broken code, there is code that's implemented but not used. It's PSR-4 compatible and you can load it using Composer too by listing `zamphyr/zlo` as a dependency.
## Your task
- Look at TODOs and code
- Review the current code, suggest improvements
- Review TODOs, suggest implementations
- Share your ideas
Check out or fork the code at: `https://github.com/zamphyr/php-zlo`
\ No newline at end of file
Refactor
========================
## Task
This code creates and executes a terrible authentification system on an SQLite database in memory. Your task is to refactor this code. Watch for:
- Hashing/encryption implementation
- PSR compliance
- Separation of concernes
- SQL
Document the code and leave notes on improvements.
\ No newline at end of file
<?php
echo "<!doctype html>\n";
$username = @$_GET['username'] ? $_GET['username'] : $argv[1];
$password = @$_GET['password'] ? $_GET['password'] : $argv[2];
$password = md5($password);
$pdo = new PDO('sqlite::memory:');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo->exec("DROP TABLE IF EXISTS users");
$pdo->exec("CREATE TABLE users (username VARCHAR(255), password VARCHAR(255))");
$rootPassword = md5("secret");
$pdo->exec("INSERT INTO users (username, password) VALUES ('root', '$rootPassword');");
$statement = $pdo->query("SELECT * FROM users WHERE username = '$username' AND password = '$password'");
if (count($statement->fetchAll())) {
echo "Access granted to $username!<br>\n";
} else {
echo "Access denied for $username!<br>\n";
}
?>
\ No newline at end of file