Skip to content

Tag: php

how to get session variables using session id

I have the session id of my application. now i want to get all the session variables by using this session id. I used <?php echo session_id()?> to get the session id but how to get all the session object values by using this session id? Answer According to php.net: There are several ways to leak an exis…

Custom Error 403 Page PHP

I created a .htaccess inside a directory in which I don’t want the files to be directly accessed. It works and fires the default 403 page (Access forbidden!) of the Apache server. How can I create a custom 403 page? Thanks! Answer In your .htaccess file you can specify what document you want as your def…

Alternative to “header” for re-directs in PHP

I am working on a project and I am required to run my program on someone else’s webserver. It is a pretty simple login page that I am having the problem with. The program works correctly if I run it through my local host via WAMP. The problem I am having is that the re-direct portion is not working corr…

Where can I find php.ini?

A few years ago I installed Apache 2.2x and PHP 5.3.1 on a Linux server I maintain. I used .tar.gz’s and built them as instructed (instead of rpms and what-have-you). And all was fine. Today I need …

Magento, getSubtotal and getGrandTotal always return zero

I have a weird problem. I have developed a module which adds a line to totals according to some value in database. But in my module model (which is inherited from Mage_Sales_Model_Quote_Address_Total_Abstract) when I call or or any other totals method, I get zero (0) returned. But in phpmyadmin, I see that th…

How to search in an array with preg_match?

How do I search in an array with preg_match? Example: Answer In this post I’ll provide you with three different methods of doing what you ask for. I actually recommend using the last snippet, since it’s easiest to comprehend as well as being quite neat in code. How do I see what elements in an arr…

PHP XML how to output nice format

Here are the codes: If I print it in the browser I don’t get nice XML structure like I just get And I want to be utf-8 How is this all possible to do? Answer You can try to do this: You can make set these parameter right after you’ve created the DOMDocument as well: That’s probably more conc…