Good vs. Evil

  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

GamerwithnoGame

Over-Achiever
Jan 29, 2015
2,808
1,507
224
48.
49. With your English muffins and "biscuits?"
Nah we don’t actually eat English muffins in a full English. Usually buttered toast, maybe fried bread. And no, actual biscuits are an accompaniment to a cup of tea.

Egg (fried, poached or scrambled), sausage, bacon, baked beans, fried tomato, fried mushroom, hash brown. In some places you might have black pudding; in the most southwest of British counties, you might be offered hog’s pudding instead.
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
49 when you login the alert box gets filled with the last 10 alerts that you haven't seen yet.
When you click on the alert box it now also sets all alerts in it to "watched".

So... now its time to make a page where you can see all your alerts and then its time to hook up the two servers and make some real alerts that get processed.
All three of those are boring or in the case of hooking the servers up annoying. It also means I need to work with php's curl functions, which isn't something I'm looking forward too.

Did you know that when you let php make a http request it outputs the result of said request by default? Or that you are working with what is basically an object except it doesn't have methods and you need to pass it around to functions which should have just been methods of said objects?. Isn't PHP nice....
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
51 in phps defense, the cURL api was probably made before PHP had objects. That doesn't mean they shouldn't have updated it though.
Also, you know what is fun? The diffrent things 1 line of php code can do
Code:
@fopen('http://example.com/not-existing-file', 'r');
Can you guess them all, along with when it does it?
  • If PHP was compiled with --disable-url-fopen-wrapper, it won’t work. (Docs don’t say what “won’t work” means; returns null, throws exception?) Note that this flag was removed in PHP 5.2.5.
  • If allow_url_fopen is disabled in php.ini, this still won’t work. (How? No idea.)
  • Because of the @, the warning about the non-existent file won’t be printed.
  • But it will be printed if scream.enabled is set in php.ini.
  • Or if scream.enabled is set manually with ini_set.
  • But not if the right error_reporting level isn’t set.
  • If it is printed, exactly where it goes depends on display_errors, again in php.ini. Or ini_set.
Answer taken from https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
52
Another "fun" fact about php is about its password_hash function
This takes 2 arguments, the password that needs to be hashed and the other to say how difficult the hash needs to be.
The difficulty has an default value so you would guess you just need to write it like
Code:
passsword_hash($password);
And for a lot of functions, you would be right except for this one. To use it with its default value you instead need to write
Code:
password_hash($password,PASSWORD_DEFAULT);

Having said that, its really nice that php offers functions to work with passwords correctly in an easy to use manner.
password_hash returns a string containing a correctly hashed password (thus with salt added) the salt itself and which hash algorithm got used. Just put this in your database and you are done hashing the password.

For checking if a password matches there is the password_verify. This takes the string generated by password_hash and the password the user entered and returns a boolean and this function is even safe against timing attacks.

Thus with just using those 2 functions you are already handling passwords pretty much correctly. There is however one more utility function to make life even better and that is password_needs_rehash.

This function takes a hash generated by password_hash and looks if the used hash algorithm is still safe.

As a result you can very easily make a system that stores passwords correctly, compares passwords correctly and rehashes passwords if needed using a better algorithm whenever a user logs in.

You can say all you want about PHP but you have to admit that stuff like that is pretty cool
 

duckfan77

Popular Member
Mar 18, 2013
80
683
118
51 That's cool. Although if it's that easy, it just makes it more disappointing how many sites get it wrong.
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
53 I wonder if functions like http://nl1.php.net/manual/en/function.metaphone.php ever get used
Calculates the metaphone key of str.

Similar to soundex() metaphone creates the same key for similar sounding words. It's more accurate than soundex() as it knows the basic rules of English pronunciation. The metaphone generated keys are of variable length.
And yes, php has 2 functions that deal with how you pronounce a piece of text.
 

GamerwithnoGame

Over-Achiever
Jan 29, 2015
2,808
1,507
224
54. My wife got the money back from PayPal after someone hacked her account, to the tune of about £300, so today is turning out OK so far (touch wood); I'm also getting pretty hype to play A Polychromatic World again :D
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
53 so... yesterday I had kind of a scare because there was apparently some assignment due at 00:00 for that day (I discovered this at 22:43)
Today I got a mail that some teacher wants us to be done a certain amount for some other stuff for tomorrow. I haven't even started yet at that stuff because that whole thing doesn't have to be completed for a long while.....
 

duckfan77

Popular Member
Mar 18, 2013
80
683
118
52 I got a similar scare last night/early this morning. We got a CSCI Project drop last night with a due date of Friday...
I got most of it done last night because I have 2 essays to write, and then this morning it gets pushed back a couple weeks.
 

GamerwithnoGame

Over-Achiever
Jan 29, 2015
2,808
1,507
224
51. Yikes! These sound like bad things :(

I can't believe its nearly 5pm already (well, for those in GMT); got to get shopping, fuel and then home.
 

GamerwithnoGame

Over-Achiever
Jan 29, 2015
2,808
1,507
224
51. I managed to not fall asleep, and play a bit last night! I might alternate between Horizons III and A Polychromatic World - I think that will help me be more focussed when I am on.
 

duckfan77

Popular Member
Mar 18, 2013
80
683
118
51 MEH. They uploaded a file after I had finished my project, and now I need to redo some of it to incorporate their solution, rather than my own.