php

Best way to limit access to images... is this about right?

I want to limit access to images, therefore, I will be putting them outside of the web root, and when a user links to an image, it will authenticate them via user/pass from our database, and then (if authenticated) read the image file, and output it with the appropriate mime type. Any image links will be something like: <img src="/imag...

Does ob_gzhandler correctly determine buggy Internet Explorer versions?

I can't seem to find an answer to this anywhere. It's well known that certain versions of IE6 and earlier incorrectly declare they accept gzip encoding. Does ob_gzhandler correctly detect these versions or do you need to do that separately? ...

Automatically detect the server's proxy settings in PHP

I have a PHP script which is running on a windows server. The script creates a soapclient object which can be given proxy_host and a proxy_port. Rather than hardcoding these values or making them a config option, I'd like the PHP script to automatically detect the local server's proxy settings so that if they change or if the script is...

Can I start a script so it's independent of its parent process on Linux?

Is there a way to start a script from another process, so that if the process dies/ends, the script still continues? Will setuid do this? If I were to set the owner to root, and then start the script? For example, if I have some PHP code starting a script, but httpd dies or gets killed, I think that it takes my script with it. Is the...

Get index of element in an array by the value

I have this array in PHP: array( [0] => array( 'username' => 'user1' ) [1] => array( 'username' => 'user2' ) ) If I have the 'username' string how can I get the index value as a number? Example, if I have 'user1' how can I get 0? ...

<br /> tags appearing in textarea output

I have an input form with two textareas allowing a user to type in words separated by commas in each. <form action="http://www.example.com/output.php" method="post"> <table border="0"> <tr> <td> <h3 class="title">Prefix</h3> <textarea cols="34" rows="8" name="cat[]"></textarea></td> <td> <h3 class="title">Suffix</h3> <textarea cols="34"...

How do I call static variable in a separate class in PHP?

How can I access a static variable in a separate class in PHP? Is the scope resolution operator the wrong tool for the job? Example: class DB { static $conn = 'Connection'; } class User { function __construct() { DB::conn; //throws "Undefined class constant 'conn' error. } } ...

How to retrieve isp through php?

How to know who is my ISP provider? Is it possible to use php to track it? EDIT: if i use : gethostbyaddr($_SERVER['REMOTE_ADDR']); it returns my ip address, not my host name... ...

Is there a PHP script that can convert HTML table data to various formats?

Using PHP, I can convert MySQL data or static table data to csv, Excel, JSON, MySQL etc but is there a useful conversion script or tool that can convert table data into other formatted/styled formats such as PDF and/or JPG/PNG using the PHP GD Library or other? ...

How to restrict JSON access ?

I have a web application that pulls data from my newly created JSON api. My static HTML pages dynamically calls the JSON api via JavaScript from the static HTML page. How do I restrict access to my JSON api so that only I (my website) can call from it? In case it helps, my api is something like: http://example.com/json/?var1=x&amp;var...

iPhone App: How to get data from an API, parse, and store for later use?

I'm new to iPhone app development so excuse me if I use the wrong terminology, or ask the wrong questions. Basically, I'm trying to write an App that includes downloading a dataset, saving it for later, and checking if the dataset has been updated, but I don't know where to begin. When I say dataset, I mean a multi-dimensional array of ...

How to work with PHP on Windows XP?

Hi I want to do a sample program in PHP on Windows XP. Do I need any special software to get this to work? I am afraid that I simply open notepad type the PHP program and save it with php extension. Then I open it with the browser as a HTML file. But it does not work. Please help Thanks in advance ...

Digitally sign in PHP using private key, verify in C#

I am working on a feature that needs me to digitally sign a short string in PHP, and verify the string's signature in C#. I would really like to use openssl_sign in PHP, because of its simplicity, but all the information I can find on Google indicates that this will not work. There are some external libraries that claim to do this well...

PHP: Converting a 64bit integer to string

I'm trying to use a hardcoded 64bit integer in a string variable. Simplfied I want to do something like this: $i = 76561197961384956; $s = "i = $i"; Which should result in s being: i = 76561197961384956 This does obviously not work as PHP cast big integers to float, therefore s is: i = 7.65611979614E+16 While several other meth...

Is there some way to convert json to xml in PHP?

is there some way to convert json to xml in PHP? I know that xml to json is very much possible. ...

Does python have a call_user_func() like PHP?

Does python have a function like call_user_func() in PHP? PHP Version: call_user_func(array($object,$methodName),$parameters) How do I achieve the above in Python? ...

PHP, how to create count down timer?

How to do this: "you will be redirected to domain.com in 5..(4,3,2,1) seconds" in php??? ...

How to invoke a siebel web service from a PHP web application?

I am developing a Portal in which i have to pull some data from a siebel Call center application through one of the published web services. I would be glad if some body provides some code snippet for a sample application. ...

I need to push into an array values based on a specific condition, what is the correct way to do this?

I have a forcycle that contains a condition (and an incremental value i): if(condition)){$arr[$i] = array("value" => $node->nodeValue));} else{$arr[$i] = array("string" => $node->nodeValue);} In the end I need to have an array like this: Array ( [1] => Array ( [string] => abc [value] => 0,999 ) [2] => Array ( [string...

Cookies are Not Being Set Properly in PHP Script

Im very new in php and try to use cookie but it is not woking in my site, can anyone guide me please , what is going wrong in my code: <?php session_start(); ?> <script> function Redirect(url) { location.href = url; } </script> <?php define('_VALID_ACCESS', true); include_once "includes/connect.php"; include_once "includes/login.php...