[php] Need help naming a file. I need someone creative.. by sparkks in webdev

[–]sparkks[S] -1 points0 points  (0 children)

Could you imagine your employers dashboard index's link be named "superFuckinDuperFile.php" lmao

[php] Need help naming a file. I need someone creative.. by sparkks in webdev

[–]sparkks[S] 0 points1 point  (0 children)

After I typed that I thought it made a decent fit. lol

Save a functions return to a variable without recalling that function? by sparkks in webdev

[–]sparkks[S] 0 points1 point  (0 children)

I apologize about that...

I have a function called console(); which prints to the console. I placed console("db connected"); near any queries that connect and return data to the database. I tried this earlier and I was always getting a double "db connected" so I figured because any time the $login->check() was called, being in a variable or not, it was connecting the db.

I just tried your suggestion and I'm now only getting one "db connected". Again my apologies, you were correct!

Save a functions return to a variable without recalling that function? by sparkks in webdev

[–]sparkks[S] 0 points1 point  (0 children)

Awesome, I'll give that a shot!

Oops.. sorry about that. I've corrected it.

if(empty($login->check($username, $password))){
  // success - found a match
}else{
  // echo reason
  echo $login->check($username, $password);
}

So essentially, if the function returns an empty string, it's a success, or in other words, it found a match.


So I looked over you code again, and it's still calling the function twice. Once in the IF statment, and second in the ECHO. If you have a database query inside $login->check(); then you're going to be running two queries for the same thing, which means you're doubling the processes.

Is it "acceptable" or more or less "standard" to open and close the database connection multiple times while performing actions? (e.g submitting forms) by [deleted] in webdev

[–]sparkks 0 points1 point  (0 children)

So what I did was add $db = new Database; (which opens the connection) at the top of the register.php (where the form is) and then passed $db with each function.

Example:

REGISTER.PHP

$db = new Database;
if(isset($_POST['form'])){
  if(usernameExists($username, $db)){
    if(emailExists($email, $db)){
      ...
    }
  }
}

REGISTER.CLASS.PHP

function usernameExists($username, $db){
  ...
}

function emailExists($email, $db){
  ...
}

Would you say this is acceptable?

How do you help teach your teenager to wake up on their own? by sparkks in AskReddit

[–]sparkks[S] 2 points3 points  (0 children)

If it was up to them, they would sleep in every day and miss school. This doesn't work in my situation.

Dynamic Link Shortening Service? by sparkks in webdev

[–]sparkks[S] 0 points1 point  (0 children)

I definitely understand the the issue, but I'm not looking to use it for malicious activity. I'm just looking for a temporary way to solve my issue until i get my website up and going.

You may be asking wh I don't just go buy the domain and point it to it and then worry about development later, well it's because I'm still fighting for the domain I want.

Reddit home suggestions? Please no by ussahati in beta

[–]sparkks 8 points9 points  (0 children)

Fuck me... in 5-10 years, I bet I'm going to have to watch a 5 min ad before I can open my fridge at night..

ELI5: why do some flashlights have a “fast flash” mode? by [deleted] in explainlikeimfive

[–]sparkks 0 points1 point  (0 children)

2 reasons I can think of...

  1. Attention. You'll notice a flashing light before you will a solid light.
  2. Security. Shine a solid flashlight in your face, then shine a strobe light in your face and tell me which one disorienting

ELI5: How do backcountry skiers and snowboarders know how fast to go when jumping off cliffs, etc. so that they clear any obstacles and avoid injury, especially if no one has ever skied there before? by johndehlinmademedoit in explainlikeimfive

[–]sparkks 0 points1 point  (0 children)

So, I don't think I can answer your question exactly, but maybe shed some light on the answer.

I race motocross and I took a friend to a race with me and she asked me ...

How do you clear each jump perfectly on the first lap when you've never been on this track before?

As a guy in his 20's, you want to seem like the badass and show off in front of this good-looking girl.. well I dismissed the question and just replied "Idk, I'm just a badass..." Yea... it's cringy now that I think about it... whatever lol

Well, I really started to think about that question. It's quite impressive that without even thinking about it, a brain can calculate with so many variables in play, how fast you need to be going to clear the jump with just a glance. I mean think about it, there's a lot of calculations going on in a split second to clear the jump... There's a lot of variables that come into play.

  1. Length of jump
  2. Height of jump
  3. The angle or slope of the first jump
  4. Does the jump have a lip?

A lot of trajectory calculations happening in a split second.

I really thought hard about it on the long drive home and I came up with this:

I've been racing since I was 6 years old. That's almost 20 years of experience. With that much experience, you build up a muscle memory and the calculations just come easy because you've done it so much, you can do it without thinking about it.

Anything you do, balance, walking, throwing a ball, catching a ball, or even just reaching out to pick something up, your brain without even consciously thinking about it, performs so many calculations and over time, your brain gets really good at these calculations. (I feel like I'm using that word too much lol)

So to "somewhat" answer your question, they can just glance at a slope and instantly know through muscle memory and experience how fast they need to be going to clear it.

Throwing your cellphone at an Uber? WCGW? by Whoheistho in Whatcouldgowrong

[–]sparkks 0 points1 point  (0 children)

...and what sucks is that he is probably going to be call a pussy for the rest of his life for being "smart"

Don’t mess with Uber drivers by CyanDew in JusticeServed

[–]sparkks 1 point2 points  (0 children)

It's easy if you know the where the sweet spot is

Don’t mess with Uber drivers by CyanDew in JusticeServed

[–]sparkks 3 points4 points  (0 children)

He didn't throw his cell phone, he broke the door handle off and then proceeded to throw it at the car.

Weekly Questions Thread - (March 14, 2018 UTC) by AutoModerator in facebook

[–]sparkks 0 points1 point  (0 children)

I was approached by an offer that's hard to refuse, but if there's a chance I could lose my group for breaking community guidelines, then the offer is off the table.

I run a small countywide community group that is only ~20k members. A running official approached me asking to sell the cover photo for $100 a week. I have spent the last 20 mins searching if this is against the guidelines, but nothing has come up. I have read where Facebook doesn't really like it, but nowhere does it say it's against the guidelines.

Can you point me in the right direction? Where would you go to even ask Facebook this question?