256 Kilobytes

Server-Side

Type All Category Server-SideDiscuss server-side development, such as PHP. Tag All

Profile Photo - August R. Garcia

[PHP] How to Add rel="nofollow", rel="nofollow ugc", rel="nofollow sponsored" and/or Other rel Attributes to Links

Articles in Server-Side | By August R. Garcia

Published 4 days agoSun, 15 Sep 2019 23:37:47 -0700 | Last update 4 days agoMon, 16 Sep 2019 03:37:33 -0700

Profile Photo - August R. Garcia

Without writing some garbage RegEx

MoreUntil like five minues ago, the standard way to attempt to attempt to disincentivize link spam on forms, article comments, and so on was to add&n...
🗨
0
🐏
1
👁
58
Profile Photo - Some Guy

How do I solve "Cannot use object of type stdclass as array"?

Answers in Server-Side | By Some Guy

Published 9 months agoSun, 16 Dec 2018 09:40:02 -0800

Profile Photo - Univa

Last Reply When we use json_decode();, we get an object of type stdClass as return type.  1. Cast the object to array. This can be achieved as follows.... Univa,

When we use json_decode()...

Wed, 08 May 2019 08:38:04 -0700 4 months ago
🗨
1
🐏
0
👁
211
Profile Photo - Some Guy

[PHP] Push to associative array?

Answers in Server-Side | By Some Guy

Published 8 months agoSun, 13 Jan 2019 04:31:06 -0800

Profile Photo - Univa

Last Reply It will merge two arrays and combine their items in a single array. Example Code - $existing_array = array('a'=>'b', 'b'=>'c'); $new_arra... Univa,

It will merge two arrays...

Wed, 08 May 2019 08:16:57 -0700 4 months ago
🗨
1
🐏
0
👁
169
Profile Photo - Some Guy
Profile Photo - Default

Last Reply Linting is a term for a program to analyze code for potential errors. This just means the query can't be validated but IIRC you can still ru... JJJJJ,

Linting is a term for a p...

Wed, 24 Apr 2019 12:08:09 -0700 4 months ago
🗨
1
🐏
0
👁
1,089
Profile Photo - Some Guy
Profile Photo - Univa

Last Reply Log in as root in phpMyAdmin Create a database called PHPMyAdmin Create a user called pma and set the "host" to the hostname or IP address... Univa,

Wed, 24 Apr 2019 08:13:19 -0700 4 months ago
🗨
1
🐏
0
👁
186
Profile Photo - August R. Garcia
Profile Photo - Some Guy

Last Reply Also, this tool is fairly useful: https://incarnate.github.io/curl-to-php/ Some Guy,

Also, this tool is fairly...

Sun, 14 Apr 2019 03:35:46 -0700 5 months ago
🗨
1
🐏
0
👁
167
Profile Photo - August R. Garcia
Profile Photo - August R. Garcia

For "Authorization: Bearer "

MoreThe PHP Function <?php // This function makes the equivalent of the cURL call below: // curl -v<200b> https://api.sandbox.paypal.com/v...
🗨
0
🐏
0
👁
148
Profile Photo - Some Guy
Profile Photo - August R. Garcia

Last Reply This line: unset( $recent($key) );  Should be: unset( $recent[$key] );  August R. Garcia,

This line:

Sun, 07 Apr 2019 12:10:37 -0700 5 months ago
🗨
2
🐏
0
👁
205
Profile Photo - Some Guy

Fix "Port 80 in use by "unable to open process" with pid 4!"?

Answers in Server-Side | By Some Guy

Published 9 months agoSun, 16 Dec 2018 09:43:26 -0800

Profile Photo - Univa

Last Reply Some of the program that may be using Port 80: Skype: Skype uses port 80/443 by default.  Go to tools >options > advanced >conn... Univa,

Some of the program that...

Thu, 28 Mar 2019 11:56:18 -0700 5 months ago
🗨
1
🐏
0
👁
197
Profile Photo - Some Guy

How to write "correct horse battery staple" passwords in PHP?

Answers in Server-Side | By Some Guy

Published 6 months agoTue, 19 Mar 2019 19:19:24 -0700

Profile Photo - August R. Garcia

Last Reply function correct_horse_battery_staple() { // The file that contains the words you want to use $f_contents = file(public_path() .... August R. Garcia,

Tue, 19 Mar 2019 19:23:10 -0700 6 months ago
🗨
1
🐏
0
👁
198
Profile Photo - Hash Brown

How to use GZip compression on your website

Articles in Server-Side | By Hash Brown

Published 6 months agoSun, 10 Mar 2019 20:51:00 -0700

Profile Photo - Hash Brown

GZip is a form of file compression that...

MoreIn the quest for peak website performance you will come across GZip compression. This is something that can be used by the majority of websites to...
🗨
0
🐏
0
👁
254
Profile Photo - Hash Brown

How to add expires headers

Articles in Server-Side | By Hash Brown

Published 6 months agoSat, 09 Mar 2019 20:44:06 -0800

Profile Photo - Hash Brown

Expires headers are a great thing to add...

MoreIf you're trying to make your website load faster one thing you're going to need to look at is browser caching. What are expires headers? Expire...
🗨
0
🐏
1
👁
269
Profile Photo - Hash Brown

Preventing Hotlinking with .htaccess

Articles in Server-Side | By Hash Brown

Published 6 months agoSat, 09 Mar 2019 19:30:44 -0800

Profile Photo - Hash Brown

Hotlinking can be bad. It can choke your...

MoreIt's fairly common for people to steal images on the internet. Sometimes that's fine, you don't care, you might never even find out. On the otherha...
🗨
0
🐏
1
👁
264
Profile Photo - Some Guy

[Dreamhost] Increase PHP memory limit?

Answers in Server-Side | By Some Guy

Published 8 months agoSun, 13 Jan 2019 04:30:36 -0800

Profile Photo - August R. Garcia

Last Reply Also, if you're running out of memory, note that for shared hosting and VPS setups, MySQL runs on a separate machine/partition from your website's fil... August R. Garcia,

Also, if you're running o...

Sat, 23 Feb 2019 01:54:09 -0800 6 months ago
🗨
2
🐏
0
👁
262
Profile Photo - August R. Garcia

[PHP] Embed and Autolink Everything with One Function Call: Vimeo, YouTube, DailyMotion, Imgur, and Gyazo

Articles in Server-Side | By August R. Garcia

Published 7 months agoSun, 10 Feb 2019 22:12:12 -0800 | Last update 7 months agoSun, 10 Feb 2019 22:20:37 -0800

Profile Photo - August R. Garcia

Last Reply Footnote - This post is part of a work-in-progress for 256Kilobyte's patch 1.6.0. May update this post later with minor bug fixes / QOL updates to the... August R. Garcia,

Footnote - This post is p...

Sun, 10 Feb 2019 22:23:57 -0800 7 months ago
🗨
1
🐏
0
👁
307
Profile Photo - Some Guy
Profile Photo - August R. Garcia

Last Reply Something like this should work: function greentext(DOMDocument $xml_doc) { // Get all P tags $nodes = $xml_doc->getElementsBy... August R. Garcia,

Something like this shoul...

Wed, 06 Feb 2019 19:51:25 -0800 7 months ago
🗨
1
🐏
0
👁
372
Profile Photo - Some Guy

[PHP] Add ids to domdocument?

Answers in Server-Side | By Some Guy

Published 8 months agoSun, 13 Jan 2019 04:35:36 -0800

Profile Photo - August R. Garcia

Last Reply There is also some code in this article that does this: https://www.256kilobytes.com/content/show/3104/php-how-to-configure-a-website-to-show-jump-... August R. Garcia,

There is also some code i...

Sat, 02 Feb 2019 22:32:32 -0800 7 months ago
🗨
2
🐏
0
👁
178
Profile Photo - Some Guy

[PHP] Sort associative array by value?

Answers in Server-Side | By Some Guy

Published 8 months agoSun, 13 Jan 2019 04:32:36 -0800

Profile Photo - August R. Garcia

Last Reply PHP documentation for arsort(): http://php.net/manual/en/function.arsort.php Also, there are a few other array sorting options: sort() -... August R. Garcia,

PHP documentation for ars...

Sat, 02 Feb 2019 22:07:44 -0800 7 months ago
🗨
2
🐏
0
👁
189
Profile Photo - Some Guy

How to delete a database in PHPmyadmin?

Answers in Server-Side | By Some Guy

Published 8 months agoSun, 13 Jan 2019 04:32:06 -0800

Profile Photo - August R. Garcia

Last Reply You can also directly run these commands through the PHPMyAdmin UI: SHOW DATABASES; If you need to look up the database name(s) DROP... August R. Garcia,

You can also directly run...

Sat, 02 Feb 2019 21:43:54 -0800 7 months ago
🗨
2
🐏
0
👁
200
Profile Photo - Some Guy
Profile Photo - roxblade

Last Reply First of all, make sure you restart Apache (server) after you have modified the php.ini. Also, ensure that the file that's causing this error to pop u... roxblade,

First of all, make sure y...

Sat, 02 Feb 2019 07:07:27 -0800 7 months ago
🗨
1
🐏
0
👁
323
Profile Photo - Some Guy

[PHP] sort multidimensional array by value?

Answers in Server-Side | By Some Guy

Published 8 months agoSun, 13 Jan 2019 04:33:56 -0800

Profile Photo - roxblade

Last Reply Before PHP 5.2, you will need to define a custom sorting function to do that. Let's say it goes like this: function sortByOrder($a, $b) { re... roxblade,

Before PHP 5.2, you will...

Fri, 01 Feb 2019 03:00:53 -0800 7 months ago
🗨
1
🐏
0
👁
187
Profile Photo - Some Guy
Profile Photo - roxblade

Last Reply This is most probably happening because DNS lookup is failing. If you're particularly sure that the server is accessible and you can open it otherwise... roxblade,

This is most probably hap...

Fri, 01 Feb 2019 02:57:17 -0800 7 months ago
🗨
1
🐏
0
👁
183
Profile Photo - Some Guy

[PHP] Specify timezone in a date object?

Answers in Server-Side | By Some Guy

Published 8 months agoSun, 13 Jan 2019 04:34:56 -0800

Profile Photo - roxblade

Last Reply Use the setTimezone function for this. This works from PHP 5 up until the latest version. DateTime::setTimezone -- date_timezone_set This w... roxblade,

Use the setTimezone funct...

Fri, 01 Feb 2019 02:52:46 -0800 7 months ago
🗨
1
🐏
0
👁
166
Profile Photo - Some Guy

How to remove/rewrite all "index.php" strings in a URL using .htaccess?

Answers in Server-Side | By Some Guy

Published 8 months agoSun, 13 Jan 2019 04:35:16 -0800

Profile Photo - roxblade

Last Reply It's simple. Add the following code to your .htaccess file and all .index.php will be removed from your URLs. <IfModule mod_rewrite.c>... roxblade,

It's simple. Add the foll...

Fri, 01 Feb 2019 02:50:49 -0800 7 months ago
🗨
1
🐏
0
👁
171
Profile Photo - Some Guy

How to escape user input for an HTML input's "value" attribute?

Answers in Server-Side | By Some Guy

Published 9 months agoSun, 02 Dec 2018 03:42:29 -0800

Profile Photo - August R. Garcia

Last Reply Note that if you're talking about an attribute, by default htmlspecialchars() does not encode the single quote ( ' ) chara... August R. Garcia,

Note that if you're t...

Sun, 20 Jan 2019 18:33:20 -0800 7 months ago
🗨
2
🐏
0
👁
203
Profile Photo - Some Guy

[PHP] What is an associative array?

Answers in Server-Side | By Some Guy

Published 8 months agoSun, 13 Jan 2019 04:31:36 -0800

Profile Photo - Hash Brown

Last Reply In PHP there are two types of array, indexed and associative. Which one is best for you depends on what you're doing. Indexed Arrays Thes... Hash Brown,

In PHP there are two type...

Sun, 20 Jan 2019 18:18:18 -0800 7 months ago
🗨
1
🐏
0
👁
180
Profile Photo - Some Guy

[PHP] Is it possible to get the next item's value in a PHP foreach loop?

Answers in Server-Side | By Some Guy

Published 8 months agoSun, 13 Jan 2019 04:31:46 -0800

Profile Photo - Hash Brown

Last Reply Hello, If your array keys are continuous, it's very simple to do. foreach ($arr as $key => $val) { if (isset($arr[$key+1])) {... Hash Brown,

Hello,

Sat, 19 Jan 2019 07:06:31 -0800 8 months ago
🗨
1
🐏
0
👁
187
Profile Photo - Some Guy

[PHP] Swap two variables without using third?

Answers in Server-Side | By Some Guy

Published 8 months agoSun, 13 Jan 2019 04:32:46 -0800

Profile Photo - Hash Brown

Last Reply Hello, There is no function that will do this but it's pretty easily done using lists and arrays list($a,$b) = array($b,$a); Learn mo... Hash Brown,

Hello,

Mon, 14 Jan 2019 16:56:14 -0800 8 months ago
🗨
1
🐏
0
👁
179
Profile Photo - Some Guy

[PHP] Get longest word in string?

Answers in Server-Side | By Some Guy

Published 8 months agoSun, 13 Jan 2019 04:31:56 -0800

Profile Photo - Hash Brown

Last Reply This is fairly simple homie. A basic solution of this would be to explode the string on spaces to turn the string into an array of words. We can... Hash Brown,

This is fairly simple hom...

Mon, 14 Jan 2019 16:47:58 -0800 8 months ago
🗨
1
🐏
0
👁
278
Profile Photo - Some Guy

[PHP] Convert a decimal to a percent?

Answers in Server-Side | By Some Guy

Published 8 months agoSun, 13 Jan 2019 04:31:26 -0800

Profile Photo - Hash Brown

Last Reply This is more a maths thing than anything else. If you have the decimal (0 to 1) and want to turn it into a percentage you simply multiply by 100.... Hash Brown,

This is more a maths thin...

Mon, 14 Jan 2019 16:39:07 -0800 8 months ago
🗨
1
🐏
0
👁
151