Search found 653 matches

by chorn
Sun Sep 01, 2019 11:05 pm
Forum: PHP coding => General
Topic: Php code not displaying anything
Replies: 5
Views: 754

Re: Php code not displaying anything

then you are missing the error reporting

Code: Select all

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
by chorn
Sun Sep 01, 2019 10:59 pm
Forum: PHP coding => General
Topic: PHP Fatal error: Uncaught Error
Replies: 1
Views: 534

Re: PHP Fatal error: Uncaught Error

"fetch_object() on boolean" mostly relies on a failed query, because then you would get FALSE as a result, so on your development machine you should throw errors

Code: Select all

mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
by chorn
Mon Jul 15, 2019 10:25 pm
Forum: PHP coding => General
Topic: Get Modified Date of Remote File - How?
Replies: 2
Views: 790

Re: Get Modified Date of Remote File - How?

make a script on your remote server that returns the modified date of the file, or configure your remote webserver to publish this info within the http response header.
by chorn
Mon Jun 03, 2019 6:26 am
Forum: PHP General
Topic: Analyzing a string
Replies: 5
Views: 2010

Re: Analyzing a string

that problem is already solved and i told you the way.
by chorn
Tue May 28, 2019 4:36 am
Forum: PHP General
Topic: Analyzing a string
Replies: 5
Views: 2010

Re: Analyzing a string

if you already know that what's the problem making one?
by chorn
Sun May 26, 2019 11:06 pm
Forum: PHP coding => General
Topic: Exclude dates from a php DatePeriod output
Replies: 4
Views: 1067

Re: Exclude dates from a php DatePeriod output

As your periods include the time part starting at your current time like 9:03:12 i would recommend comparing the string representation within your exclusion list like

Code: Select all

$exclusion = ['2019-06-17', '2019-08-07'];
foreach(...){
 if(!in_array($date->format('Y-m-d'), $exclusion)) ...
}
by chorn
Thu May 23, 2019 5:54 am
Forum: PHP General
Topic: is PHP right for this ?
Replies: 2
Views: 1041

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: 854

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: 5
Views: 2010

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: 955

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: 987

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: 1641

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: 994

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: 592

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: 1608

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: 1608

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: 1608

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: 1484

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: 1484

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: 1135

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: 991

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: 939

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: 921

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: 417

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: 921

Re: Comparing two arrays and extracting values

So you got a list of needed functions, did you try any?