Skip to content

Tag: php

session wiped out between pages

I’m making a login page and for some reason the session will not persist between where I set it and the page where I am forwarding to. I can comment out the header in the page where the session was initialized and see that the session has the data in it. However, when I do a print_r in the target

How can I set the PHP version in PHPStorm?

Is it possible to set the PHP version value, say 4.0+ and have PHPStorm highlight functions that wouldn’t work with the oldest version? For example, for PHP4 this should highlight static function etc. I have a PHP installation on my PC but I don’t want to install an older PHP version for every sma…

multiple buttons on a form

I have a clear button that I want to tie into some php coding. how do I detect if the clear button is pressed. When the user press clear, i’m going to have it update a sql table to clear out entries. …

A numeric string as array key in PHP

Is it possible to use a numeric string like “123” as a key in a PHP array, without it being converted to an integer? $blah = array(‘123’ => 1); var_dump($blah); prints array(1) { [123]=> …

PHP + FTP delete files in folder

I just wrote a PHP Script which should connect to FTP and delete all files in a special folder. It looks like this, but I have no clue what command I need to delete all files in the folder logs. …

PHP parse_ini_file TC_CONSTANT warning

I’ve got a weird issue, weird as in nothing comes up on Google. I’m trying to parse an ini file full of HTTP status codes, StatusCodes.ini. I’ve tested in three different environments, locally (WAMP) on a shared host (Hostmonster.com) and now on a dedicated machine running CentOS w/ CPanel/W…

Escaping data – stripslashes, strip_tags

Why do a lot of people use both these functions on a string? I see a lot of stripslashes(strip_tags($field)); (or the other way around) Isn’t strip_tags enough to filter any xss stuff and such things? Answer Escaping data has nothing to do with strip_tags or stripslashes. These functions filter certain …

What is PHP session_start()

Does it start a current session based on cookies? Got that from the PHP website. How does PHP control the session? If I start a session when a user opens up my login page, what do I even use that session for? Can I use the current session to get info about the logged in user? Answer The PHP session