Search found 597 matches

by chorn
Thu May 23, 2019 5:54 am
Forum: PHP General
Topic: is PHP right for this ?
Replies: 2
Views: 14

Re: is PHP right for this ?

what kind of API is this?
by chorn
Wed May 22, 2019 10:21 pm
Forum: PHP coding => General
Topic: 5 minutes past midnight?
Replies: 2
Views: 19

Re: 5 minutes past midnight?

thx for clarification, i didn't see that.
by chorn
Mon May 20, 2019 2:17 am
Forum: PHP General
Topic: Analyzing a string
Replies: 1
Views: 13

Re: Analyzing a string

So you need something like a "php sql tokenizer"
by chorn
Tue May 14, 2019 1:12 am
Forum: PHP General
Topic: Hiding .php with .htaccess file
Replies: 1
Views: 23

Re: Hiding .php with .htaccess file

mod_rewrite
by chorn
Sun May 12, 2019 10:20 pm
Forum: PHP coding => General
Topic: Get users current location using api. No ip or physical address is sent
Replies: 2
Views: 36

Re: Get users current location using api. No ip or physical address is sent

I am trying to create an api which gets the users current latitude
That makes no sense.

You either create an API and provide these data, or you are requesting an API to receive this data.
by chorn
Mon Apr 29, 2019 1:46 am
Forum: mySQL & php coding
Topic: group and sort Hierarchicaly array in php
Replies: 2
Views: 70

Re: group and sort Hierarchicaly array in php

so you have a task... and what did you try yourself to achieve this?
by chorn
Thu Apr 25, 2019 10:08 pm
Forum: PHP coding => General
Topic: Problem with html form & session??
Replies: 3
Views: 85

Re: Problem with html form & session??

Have a look at your webdevelopers console first. Are you beeing redirected? Then look at the part of your script that is redirecting. Use var_dump() to view alle variables involved.
by chorn
Thu Apr 11, 2019 10:44 pm
Forum: PHP coding => General
Topic: Replace null in jsonencoded array
Replies: 2
Views: 154

Re: Replace null in jsonencoded array

you can just array_walk() or array_walk_recursive() over the array to change certain values.
by chorn
Mon Apr 01, 2019 10:25 pm
Forum: mySQL & php coding
Topic: Need help - password hashing with sha 256
Replies: 5
Views: 343

Re: Need help - password hashing with sha 256

Code: Select all

$query = $pdo->prepare('select passwordhash from users where user = ?');
$query->execute([$username]);
$user = $query->fetch();

if(password_verify($password, $user['passwordhash'])){ OK... }
by chorn
Mon Apr 01, 2019 6:06 am
Forum: mySQL & php coding
Topic: Need help - password hashing with sha 256
Replies: 5
Views: 343

Re: Need help - password hashing with sha 256

if password = $password, I can log into the page with passwords that arn't hashed.
So the password you store in the database is just not hashed, you have to verify your hasing process, have a look at all variables with var_dump().
by chorn
Mon Apr 01, 2019 5:20 am
Forum: mySQL & php coding
Topic: Need help - password hashing with sha 256
Replies: 5
Views: 343

Re: Need help - password hashing with sha 256

Your code is incomplete to test. Also you are lackign a definitive error description. Here's a short working example <?php $user = 'test'; $pass = 'test123'; $hash = hash('sha256', 'test123'); $pdo = new PDO('sqlite::memory:', '', ''); $pdo->query('create table users(user text, password, text)'); $i...
by chorn
Wed Mar 27, 2019 11:11 pm
Forum: PHP General
Topic: Dynamically display images in a container depending on page height
Replies: 7
Views: 393

Re: Dynamically display images in a container depending on page height

I would do something like giving a serverside list of possible images to javascript and then let it calculate how many/which images are to be displayed.
by chorn
Tue Mar 26, 2019 5:34 am
Forum: PHP General
Topic: Dynamically display images in a container depending on page height
Replies: 7
Views: 393

Re: Dynamically display images in a container depending on page height

PHP is serverside and knows nothing about any height a browser is rendering.
by chorn
Wed Feb 27, 2019 2:09 am
Forum: PHP General
Topic: How to change a date via a variable
Replies: 3
Views: 361

Re: How to change a date via a variable

there's a shorter, more flexible and human readable way with the DateTime class, e.g.

Code: Select all

<?php

$date = new DateTime('2014-06-01 14:00:00');
print_r($date);

$date->modify('+1 hours');
print_r($date);

$date->modify('+12 minutes');
print_r($date);

$date->modify('+123 years');
print_r($date);
by chorn
Sun Feb 03, 2019 10:34 pm
Forum: PHP General
Topic: contact form - check ip blacklist
Replies: 2
Views: 229

Re: contact form - check ip blacklist

At least i don't see you using the service anywhere. You can create simple GET request with file_get_contents() on an URL and get a string back. as it seems to be JSON, you can parse the result with json_decode().
by chorn
Wed Jan 30, 2019 10:56 pm
Forum: PHP coding => General
Topic: Hiding passwords
Replies: 6
Views: 449

Re: Hiding passwords

If you can configure where the domain of your projects leads to, you should use a sub-directory as the entry point and place all other files obove this directory, e.g. /files /config db.php <-- store password here /www index.php <-- set your domain to this point so even if the webserver struggles, n...
by chorn
Tue Jan 29, 2019 2:39 am
Forum: PHP coding => General
Topic: Comparing two arrays and extracting values
Replies: 6
Views: 441

Re: Comparing two arrays and extracting values

That makes no sense for me. If you're using SQL you have build-in sorting funtionality with ORDER BY. But that collides with your NC-value, because that's not a number, so your table layout may be wrong. If you want to "ignore" these values, just set an apprpriate WHERE condition.
by chorn
Tue Jan 29, 2019 2:34 am
Forum: PHP coding => General
Topic: PDF files from PHP mail function not opening
Replies: 1
Views: 196

Re: PDF files from PHP mail function not opening

why dont you use some wrapper like PHPMailer? It's really straigth forward and deals with a lot of problems very well.
by chorn
Fri Jan 25, 2019 4:47 am
Forum: PHP coding => General
Topic: Comparing two arrays and extracting values
Replies: 6
Views: 441

Re: Comparing two arrays and extracting values

So you got a list of needed functions, did you try any?
by chorn
Fri Jan 25, 2019 4:14 am
Forum: PHP coding => General
Topic: Comparing two arrays and extracting values
Replies: 6
Views: 441

Re: Comparing two arrays and extracting values

What does "top 5" mean, any sorting by number?

array_combine
ksort
array_keys
array_values
array_sum

https://secure.php.net/manual/en/ref.array.php
by chorn
Tue Jan 22, 2019 4:42 am
Forum: PHP coding => General
Topic: Parsing a json
Replies: 14
Views: 752

Re: Parsing a json

just have a look at print_r($datas) and you see "tables" is previously contained by another key. Tip: you're missing something from your first code. Protip: you may want to use array_column() instead.
by chorn
Tue Jan 22, 2019 2:34 am
Forum: PHP coding => General
Topic: Parsing a json
Replies: 14
Views: 752

Re: Parsing a json

[tables] => Array ( [0] => stdClass Object ( [tableName] => Unique League Table [table] => Array ( [0] => stdClass Object ( [teamName] => Liverpool on each item from "tables" you have a key "table" which you can iterate over again and read the key "teamName" foreach($datas['tables'] as $table){ for...
by chorn
Tue Jan 22, 2019 2:17 am
Forum: PHP coding => General
Topic: Parsing a json
Replies: 14
Views: 752

Re: Parsing a json

If you print_r($Datas) you see there's a key called "tables" you could iterate over with foreach().
by chorn
Tue Jan 22, 2019 1:10 am
Forum: PHP coding => General
Topic: Parsing a json
Replies: 14
Views: 752

Re: Parsing a json

Then post an example with var_export.
by chorn
Tue Jan 22, 2019 12:44 am
Forum: PHP coding => General
Topic: Parsing a json
Replies: 14
Views: 752

Re: Parsing a json

Just post a valid example.