« first day (2310 days earlier)      last day (2620 days later) » 

user6061856
12:00 PM
"Never trust the client."
 
should i make a cookie for each error then when it goes back to the homepage, it can read the cookies and display them?
 
keep it in session instead of cookie
 
you probably should use sessions, because that will let you in general share data between various pages
 
user6061856
Use sessions.
 
im gonna have to research sessions now
 
12:01 PM
you will also have to use session to store "who has logged in"
 
where are sessions stored?
 
a web developer is born today...
 
on the server
 
i just did that in a cookie teresko, but im gonna change it now
oh ok
 
!!? how session works
 
12:02 PM
Search for "how session works" (https://www.google.com/search?q=how+session+works&lr=lang_en)
• language agnostic - What are sessions? How do the… - 27 sep. 2010 - I am just beginning to start learning web application development, … Does it store t… (http://stackoverflow.com/questions/3804209/what-are-sessions-how-do-they-work)
• How do PHP sessions work? (not "how are they used… - 8 okt. 2009 - Session files are usually stored in, say, /tmp/ on the server, and named … Take a loo… (http://stackoverflow.com/questions/1535697/how-do-php-sessions-work-not-how-are-they-used)
 
thats a big relife, i was walking to the shops ealier thinking about doing it all in cookies
 
user6061856
@RachelDockter People can change cookies. Not safe.
 
session works with cookie
 
session works without cookies too
 
oh right, at the moment i have a cookie with their username and it logs you in from there, so if i change the cookie to "admin" i can log in the admin account
 
12:03 PM
yes
 
user6061856
Yep that's why you want sessions. So people can't change that data.
 
sounds good
 
user6061856
Well, you can, but from what I've read it's extremely hard.
 
user6061856
Practically impossible.
 
user6061856
Thank god for that.
 
12:06 PM
so are sessions just like global variables?
 
moin
!!docs session
 
That manual page seems to be in a format I don't understand
[ Session Handling ] Session Handling book
 
@RachelDockter ^
 
this looks good
so i can store an array in a session too right?
 
yup
 
12:09 PM
well $_SESSION is an array itself, you can store pretty much anything you want in it
 
thats amazing
 
!!? php global variables
 
Search for "php global variables" (https://www.google.com/search?q=php+global+variables&lr=lang_en)
• PHP: Variable scope - Manual - This can cause some problems in that people may inadvertently change a global variable. In PHP glob… (http://php.net/manual/en/language.variables.scope.php)
• References all variables available in global scop… - An associative array containing references to all variables which are currently defined in the glob… (http://php.net/manual/en/reserved.variables.globals.php)
 
$_SESSION['foo'] = ['array', 'of', 'things'];
 
thats perfect, im gonna use it to store the errors when someone tries to register
and then display them on the homepage
 
12:11 PM
You cannot to resources (e.g. file handles, database connections) in it, and some types of object can be problematic
 
@RachelDockter don't forget to the error message's key from the session after that you show the error message
 
ok right
 
4th time lucky? @AdilIlhan
:-P
/me eats
 
what do you mean? i didn't get that
 
i remember when i first started programming, i was doing c# win app and i didnt know what a variable was so the whole screen was filled with numericUpDowns which i used as variables to store different numbers
my teacher laughed at it
 
12:14 PM
php guys think "what the fuck numericUpDowns"
 
lol basicily an input but for numbers only
 
user6061856
Interesting.
 
@RachelDockter that's… clever I guess :D
 
----registration.php------
$_SESSION["LoggedUser"] = $username;

header("location: profile.php");


------profile.php------
echo "welcome to your profile " . $_SESSION["LoggedUser"];
is this how its meant to work lol
im getting undefined variable
i did follow w3schools so forgive me
 
you should write session_start
session_start();
 
user6061856
12:20 PM
Yeah, otherwise session won't work.
 
session_start();
$_SESSION["LoggedUser"] = $username;
like this
 
user6061856
And you have to call session_start() before any html.
 
session_start();
echo "welcome to your profile " . $_SESSION["LoggedUser"];
 
ah so i call that everytime i use it
 
user6061856
Yeah
 
12:21 PM
cool it works now thanks
i know i ask alot of questions soz if i get anoying
 
you should google it though
 
user6061856
I gtg it's almost 4 am
 
i was following w3schools but i missed the session start bit
 
you can find lots of articles about these problems
 
Wes
<?php use const true as false; if (false) { echo "f*ck"; } // https://3v4l.org/6vhM0
 
12:31 PM
@bwoebi what's your ip?
 
Anonymous
Moin
 
is it safe to give ur ip out like that lol
 
Anonymous
@RachelDockter yes
 
i used to play a game called runescape where nobody gave out their ip otherwise u get ddosed and die on the game
 
@PeeHaa 192.168.YOUR.MOM
 
12:38 PM
Could be worse
Could be 127.0
 
@RachelDockter actually, I wouldnt advise doing that
 
@PeeHaa No that's her IP
 
unless the IP you are actually giving out is for some server of yours
 
I assume you are this awake at this hour because you are working on dnslib?
 
can u get ppls ip from here? lol
 
12:39 PM
giving out your current home IP would be a dumb idea
@RachelDockter on
 
thats what i was thinking
 
@PeeHaa No although I did do this last night
 
oh wow
 
Which includes this
 
@RachelDockter but you can make a page, where you link people to and which collects everyone's IP and then associate it to peoples user names by scaping stackoverflow.com
 
12:43 PM
You're not entirely useful after all \o/
ooooh json api
 
uh oh
 
it would require some work though
and developers are notoriously lazy
 
@PeeHaa It's not completely up and running yet but it will be later today
 
cool
 
12:48 PM
I feel like I am going to find alot of issues in wp stuff today
 
@DaveRandom can you test something for me please?
can you try sshing into gitamp please?
 
@DaveRandom i managed to get the errors working where it tells u whats wrong with ur input gyazo.com/1cd208e59f9ef598cec65a47d7c5a468
 
cool
 
why are you not using "email" as the "username"?
 
12:53 PM
@PeeHaa why? 88.207.163.157 currently
 
or where they specifically mentioned in the requirements?
 
its for a snake game so i didnt think it would look good havign each player be called by their email
 
oh
in that case, do you really need name ad surname?
 
not really, just thought id add it anyway
 
@bwoebi Trying to see why you cannot log in to gitamp
 
12:55 PM
i dont ive ever seen a registration where u only enter your first name
 
no, I mean, it's a sname-grame
do you really think people will want to enter there name, surname, address and social security number?
 
lmao just first and second name
 
I was trying to explain the point
 
yeh i think its ok though, ppl can just put anything if they want
plus it wont ever be online its just to give in to uni and never look at again
 
sure, like "Dick Buttmore"
 
12:59 PM
lmao exacly
 
@bwoebi lots of fun open ports ;)
 
do you guys normally clear all your sessions when someone goes on your website
 
what do you mean Rachel?
 
like i just restarted the server and the sessions are still there and i didnt know if i should clear them when someone goes on the homepage
 
if you do that, I guess you would log everybody out of their session?
 
1:10 PM
yeh i need to plan this
 
I am not sure why you want to do it that? The session life time and such can be configured
 
are you going to write unit tests of this project?
 
its just atm when someone registers, all the errors like their name is invalid is on the homepage and wont go away
dont think so adil
 
@RonniSkansing why fun? :-P
 
1:14 PM
VLC
just alot of exposed stuff
 
You exposing yourself again?
 
@RonniSkansing yeah, just remote desktop
 
I always find those ports a bit fun
take it as part of my weirdiness =)
afp
 
Yeah, I've manually forwarded these ports to specific machines
 
well I guess of all, you know what you are doing
Cause I would surely fuck it up sooner or later, like vnc, I always shut the port down when Its not activly being used
are any of the http/https (like 8089) dev servers?
 
1:25 PM
Why the compiler does not generate an error in Java when using string concatenation with some math the behavior seems inconsistent System.out.println("String " + x * 2) compiles fine, but System.out.println("String " + x - 2) generates an error? What is so special about the minus sign?
 
looks at the room name
It's not the binary minus that's special, it's the binary plus
It's overloaded.
 
@PeeHaa so…?
 
@bwoebi Utterly clueless :(
 
@PeeHaa does he have the correct pubkey?
 
> ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDN0QY7L0lEfEdnVePB5tsWzI2l5AwMwdy5yhZ2VF3SDltH/ov4‌​‌​4jIFTd+/pQ6wcFOLu2evEkhGat19yBP6ei7aKAnj0TZ/L243pCqYTW9INJpLS8i1/QZrM8FOGjHtw+h‌​vV‌​1nMuLItp8cgPoHK2R1c0XsEaqVWqEFwNC1omQoZCwE9Zn8bHAwg0nec7IwbJnUBlTcegYlR+54czd‌​iJxb‌​ZQAdU34QamN1/FM6FiX1aP98H9p9+Qu+/0fyXBk/xI8yzS1jXccv+eiISkJkZfqpag5HwFQZ1jy‌​Bl2TmK‌​5vwRMTK6tuerld+qFLcIEwVcU51dPaMv4bjeKEz5vVBRkz8GH bob@Bobs-MacBook-Pro-2.local
 
1:34 PM
@littlepootis I'm talking about inconsistency so that room name matches :) though just kidding
 
@PeeHaa yeah
 
All I see is
> Feb 11 15:07:41 GitAmp-Ubuntu sshd[5368]: Connection closed by 88.207.163.157 port 50316 [preauth]
Feb 11 15:08:43 GitAmp-Ubuntu sshd[5372]: Connection closed by 88.207.163.157 port 50340 [preauth]
Feb 11 15:09:52 GitAmp-Ubuntu sshd[5381]: Connection closed by 88.207.163.157 port 50347 [preauth]
Feb 11 15:11:05 GitAmp-Ubuntu sshd[5393]: Connection closed by 88.207.163.157 port 50351 [preauth]
Feb 11 15:11:42 GitAmp-Ubuntu sshd[5395]: Connection closed by 88.207.163.157 port 50360 [preauth]
Feb 11 15:52:15 GitAmp-Ubuntu sshd[5795]: Connection closed by 88.207.163.157 port 50699 [preauth]
permissions are correct on the key
user is correct
groups seem correct
I blame gremlins
!!horoscope aries
 
Wes
happy caturday \o
 
> ♈ Aries | March 21 to April 19
Fun and despair will be in the air this week when a nearby confetti factory explodes, killing sixty-three employees.
http://www.theonion.com/features/horoscope
 
1:38 PM
@Wes hey wesley o/
 
@PeeHaa ssh -vvv says just packet type 51 returned… which is failure…
 
weeeeird
 
there's def no issue on my end, the key pair works on other servers too
 
Might have another look later today in that case when I am drunk
 
@tereško would u be able to look at this, the password hash is messing up the log in because its making the same passwords into different strings so when i try to match them, its not logging me in
$username = $_POST['username']; //set the username/ password varaibles
$password = $_POST['password'];
$hashPass = password_hash($password, PASSWORD_DEFAULT); //Encrypt the password

$sql = "SELECT * FROM users WHERE username = ? AND password = ?;"; //Select all usernames and passwords
$stmt = $conn->prepare($sql);
$stmt->bind_param("ss", $username, $password);
$stmt->execute();
$result = $stmt->get_result();
$count = mysqli_num_rows($result); //Count how many results there are

if($count == 1) //If there is 1 account that matches
i know you said something about verifying it but i cant see where i would
 
Wes
1:52 PM
when user registers to the site you do $hashedPassword = password_hash($plainPasswordUserEntered); and save $hashedPassword in the database
 
thats what i do, but password_hash seems to make the same string different strings
so password = "ngsjknsjndfrjnwern" if i make a new user with the pass as password, it will equal "43453u8568343"
even though its the same password
 
Wes
when user logins to the site you do $userRow = ... "SELECT * FROM users WHERE username = ?"
then if(password_verify($passwordUserUsedToLogin, $userRow['saved_password'])){ // success } else { // failure }
 
hold on 1 sec
i put this in, but its still not working
if (password_verify($password, $userRow['password']))
{
what is $userRow
 
Wes
the row of the resultset of "SELECT * FROM users WHERE username = ?"
 
hmm still not working, i think ill ask it on stackoverflow, thanks for the help anyway
 
Wes
2:01 PM
show the code you are using, pastebin.com
 
ignore the count variables, ill shorten that after it works
 
@RachelDockter Check that the hash saved in the database is the same as the generated hash (look at the length / last characters). A common mistake is to make the field holding the hash too short (it needs to be at least 60 chars) and by default older versions of MySQL do not error - they trim the value instead (read up on sql_mode if you want to change this).
 
i changed it from varchar to text earlier @AllenJB
 
Wes
@RachelDockter

$resultSet = $stmt->get_result()->fetch_array();
 if (password_verify($password, $resultSet[0]['password'])){
dunno if that works, i don't know/remember mysqli - edit that perhaps is right
 
still saying incorrect :/
 
Wes
2:07 PM
define incorrect. does it error?
do var_dump($resultSet);
 
$resultSet has no value apparently
 
Wes
$resultSet = $stmt->get_result()->fetch_array();
did you add this...........
 
when i say its incorrect i just mean it runs the code at the bottom and returns "username or pass is incorrect"
oh u changed it
hold on
now its giving me this
which is that line
 
Wes
 
coming up password is incorrect still :/
i think i have an idea though
 
2:30 PM
.. was playing ork genocide simulator
what did I miss?
@RachelDockter start by making a small example: copy the hash from the datasbase and manually assignb it to a variable
then try using password_verify with it
 
thats what i was trying to do ealier but couldnt get it in a variable
its ok now i asked it as a question
 
wat?
$foo = 'copy-pasted-hash-from-database";
 
$sql = "SELECT password FROM users WHERE username = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("s", $username);
$stmt->execute();
$result = $stmt->get_result();
i tried making $result equal to their hashed password
 
I said: manually
 
ohhhhhhhhhhhhhhhhhh
good idea
 
2:33 PM
you need to make sure what part is not actually working
to debug something, you need to isolate the suspect-code from all the "moving parts"
 
Wes
"genocide simulator" is exactly the kind of game i thought you played :D
 
@Wes Shadow of Mordor
ok, a really serious question, people: pizza or sushi?
 
pizza
 
took your advice (ordered this and this)
 
they look good
 
2:46 PM
so, is your code working, if you feed the values directly?
 
no i did this and its still not working
	$result = "$2y$10$kzj4XFuQgns4Oax22zAM5u4Nz4NAQh8M/PYAwyterimckns.CyGdK";

    if(password_verify($password, $result )){
its hurting my head
when i print result. its shows
Array ( [0] => $2y$10/PYAwyterimckns.CyGdK [1] => U
which is weird because thats not the same
 
@RachelDockter works here: 3v4l.org/i4Mbd
 
this is the part of programming i hate
how does it work there but not on my code
ffs
 
try not using "asdasd" but 'asdsad'
maybe php is trying to put variables somewhere there
 
i have no idea what asdasdas is
 
2:52 PM
ya know, as in $foo = "my name is $name";
@RachelDockter a random string
 
uhhhhhhhhhh
 
hi all
 
	$result = "$2y$10$FJpd8Au/FkKkWKbS4z.jgOkWiMk/Drcj2oyBvwGf8yO0s1PxX054S";

    if(password_verify("test", $result ))
	{
		array_push($errors, "matches");
	}
not even this works and i used ur example
 
because $ in string with double quotes is interpreted as start of a variable
 
i dont understand
 
2:58 PM
a variable is $variable meaning $result="$ohnoanothervariable";
 
@RachelDockter 3v4l.org/ZoCFb
 
wait a second
ok im too confused but it works now doing it manually so ill leave it at that lol
 
anyone good at mysql subqueries?
 
ayyy i got it working
finally
@tereško so i need to make a feed like twitter, would u recommend making a seperate db with id, username and post where the id links to the same id in the users table?
i know you can link dabases like that in microsoft access but not sure if u can with sql
 
3:15 PM
I would make a separate table inside the same database
 
oh yeh thats what i meant
 
also, I would use foreign key to associate the "tweets" table with the "users" table
 
ok yeh im gonna give that a go
just to clarify i should assign all my variables with strings around single quotation marks instead of double right
otherwise it will mess up
 
you should use double-qoutes ONLY if you want that variable-inserting behaviour
 
right ok
thanks
 
3:36 PM
so i can saw i can store images in the database which is cool to add like a profile picture
 
you shouldnt store file in other files :P
instead you should store the path to the profile image
 
wouldnt that mean u can only set a profile picture as something from like imgur for example and not upload one yourself
unless i implement uploading ur own pics on my server i guess
 
you still ahve uploading
but you store the uploaded images in the webserver and in the database only save the location of the file
 
ah ok
@tereško just tell me if im asking too many questions, but if u was to make a website would u store the persons username in a session, then when u want to access their info, do a query from there. or store all their info in the session instead when they log in so you only do 1 query from the start
im just trying to optimise this the best i can
actuallly nevermind, its better to do a query each time so you dont have to log out for it to update
 
3:53 PM
@RachelDockter you can cache it
use memcached or something
 
I wouldnt introduce moar tech
But focus on simply solving the exercise
 
yeh thats what im thinking lol
im really enjoying this assignment so far
 
4:28 PM
@JoeWatkins ping
 
4:40 PM
@PeeHaa, @FélixGagnon-Grenier, I've been able to sort the array submission to the database.
 
dont suppose anyone knows how to add datetime to sql database from procedure query in php
cant use now(); :/
 
Everything is working fine except for the multiple file system not copying to the folder i specified and as such am stuck there for a while now. I created a question on that again, please house, i need help on this link: stackoverflow.com/questions/42178354/…
 
gah
 
5:31 PM
"meeeeee"
 
@Danack do u have any experience with sql and php?
 
yes, thanks.
 
would u have any idea why its echo'ing every row in my table except the first row. its returning all of them but not displaying the first one in the while loop
$sql = "SELECT * FROM posts WHERE user_id = ?"; //Select all usernames and passwords
$stmt = $conn->prepare($sql); //Prepare the query
$stmt->bind_param("i", $id); //bind username as a string
$stmt->execute(); //Execute the query

$result = $stmt->get_result();
$row = $result->fetch_assoc();
$count = mysqli_num_rows($result);

if (($result->num_rows > 0)) //If there is one post
{
    while($row = mysqli_fetch_assoc($result)) {
        echo $row["username"]. ": " . $row["post"]. " " . $row["date"]. "<br>";
 
@RachelDockter No, but I would recommend stepping through that code with a debugger:
 
hmm ok thanks
 
5:49 PM
Morning all
!!dad
 
What is the one-handed guy doing in the mall? He is looking for a second hand shop!
 
@Jeeves lol
Why jeeves isn't replying?
 
Cleverbot changed so i have disabled terminator
 
Ah
 
6:41 PM
@RachelDockter Well i prefer doing a query each time
 
Wes
(i disagree with that rfc though)
trait Foo implements Bar{} means that Foo can only be used in a class implementing Bar, and Foo itself might implement all or part of Bar
 
7:03 PM
omg. was installing php on freebsd that simple? it's like... the port just works™
thanks whoever maintains that
 
this is probably not the best page for gitlab to be advertising a "risk-free" trial
 
@PaulCrovella Why not? It's a trial, and the risk is free as part of that trial.
 
@FélixGagnon-Grenier freebsd's ports collection tends to be pretty good like that
 
evening lads
 
7:11 PM
o/
 
o/
 
shiite... the road from creating a droplet to serving content was so more efficient with DO than AWS... or maybe I suck a little bit less
 
DO is quite easy, but I guess so is AWS if you know their API and etc
but yea I use DO too, used to use Linnode which was also great
but I think AWS might be cheapest in some cases (like spot instance) with the most features
 
... hosting the cheapest instance on aws costed me like 70$ per month ahh
I have a 5$ droplet that does exactly what I want it to do...
 
7:27 PM
@RachelDockter i think this line making a problem remove this and try. $row = $result->fetch_assoc();
 
Anyone knows how to block the single URL/Request that is taking too much time in multi_curl while continuing with the remaining requests.
 
@Susan make a timing exception
 
@Wes I was confused while reading till open issues section, then found it may make traits more usefull than now, good references especially CSharp (also found out there are template like traits in C# - nice to have when generics came)
 
@Gourav. Thanks. Trying the same thing. Not able to execute. Will post the code soon.
 
Wes
@brzuchal so bad we can't have nice things
 
7:33 PM
@Susan catch (InvalidArgumentException $e) try this .. don't know it will work or not but atleast try
 
Wes
maybe in 20 years.... or 30...
 
@Susan catch (InvalidArgumentException $e) try this .. don't know it will work or not but atleast try
 
@Wes we need to have a hope, or implement it and pass the RFC path
 
Wes
we need a leader - and a fork of php
6
 
Yeah, I also think there's need for a leader and some roadmap
Forking isn't practical because you need community and IDE support
:)
 
bob
7:40 PM
anyone familiar with processwire?
 
@FélixGagnon-Grenier yea its real nice =)
 
@Wes those numbers are hopeless, and just sad but may be valid
 
user6061856
Morning. :D
 
am i stupid for thinking this will work, its displaying both forms
<? $a = 2;
if ($a == 1) { ?>
        //display form 1
<?  } else
{ ?>
	    //display form 2

<? } ?>
 
2 hours ago, by Danack
@RachelDockter No, but I would recommend stepping through that code with a debugger:
How did you get on with using that debugger?
 
7:55 PM
@gourav Thanks, Will try and update
 
@Danack i didnt need it, i took out a line that i thought was dodgy and it worked
 

« first day (2310 days earlier)      last day (2620 days later) »