php

Restrict access to images on my website except through my own htmls

Hi, On my website I store user pictures in a simple manner such as: "image/user_1.jpg". I don't want visitors to be able to view images on my server just by trying user_ids. (Ex: www.mydomain.com/images/user_2.jpg, www.mydomain.com/images/user_3.jpg, so on...) So far I have three solutions in mind: I tried using .htaccess to passwor...

Displaying MySQL data into HTML table (clearly explained)

Ok, I have an app as described in this post: http://stackoverflow.com/questions/1623105/good-database-structure-for-a-new-web-app I've prepared a scenario to make my question as clear as possible: Users table: +----------+-----------------+ | user_id | email | +----------+-----------------+ | user_1 | user1...

What does question mark in PHP represent other than Ternary Operator?

Is there any other use of the question mark ? in PHP other than being part as the Ternary Operator. Just to take note: I know about how it works in regex and all that. I am talking about the PHP language itself, not regex or what. I know how it works in opening and closing tags. I am more concerned about tokenizing a PHP script. Is the...

Looping through an array of arrays, changing output on a given line(s)

This is what im using to loop through an array of arrays. $csvpre = explode("###", $data); $i = 0; $bgc = 0; foreach ( $csvpre AS $key => $value){ $info = explode("%%", $value); $i++; if($i == "1"){ echo "<tr bgcolor=#efefef><td></td>"; foreach ( $info as $key => $value ){ echo "<td>$value</td>"; } ...

comparing 2 phpinfo settings

I'd like to compare the settings I have on 2 different servers. Both are shared hosting so I don't think I have enough access to do it any other way but programmatically with phpinfo. So now that I have the 2 outputs, I'd like to compare them without examining them manually. Is there an automated way for this? Also, as a side but relate...

php to pdf or php to jpeg library or function ?

Hello, I have trying to achieve like this. I have one page which is written with php. There will be one button, which i click that button, that page will be converted to imageformat or pdf. Which function can i use? Is there any built it ? Which one will be more easier ? Creating imageformat or pdf? Please kindly point me out. Thanks. ...

About xml and php

Hi all, I have to insert the xml processing instruction into xml file without opening that file means i have to insert that through PHP.anyone please helpme. ...

How to configure PHP5.2.11, MYSQL with smarty?

im new into PHP. how to configure the PHP5.2.11, MYSQL with smarty? I have installed mysql, PHP separately. How to configure mysql with PHP, PHP with smarty? ...

splitting an array at a given line into two parts, inserting another line, and rejoining them

I have an array full of sub arrays. I need to break apart the first array at a given line number, and then insert a new line, and then combine them all back into their original structure. This is what im working with now $csvpre = explode("###", $data); $i = 0; $bgc = 0; foreach ( $csvpre AS $key => $value){ $info = explode(...

Find where a class was instantiated

I have trying to solve the error : Fatal error: Cannot redeclare class I have been looking everywhere and I can't find where the class was instantiated. Is there anyway I can print debug info about the existing instance of that class. ...

What is thread safe or non thread safe in PHP

I saw different binaries for php, like non thread or thread safe ? What does it mean this ? What is the difference between this packages ? ...

PHP Mail Piping

Hi, I don't know much about this and was just curious because i had an idea :) I know with my cPanel hosting i can pipe an email inbox to a script, but what i want to do is: send to [email protected] pipes to mail.php mail.php reads the subject, and a .txt attachment the contents of the subject and .txt attachment are stored in the database ...

Listing blog entries by month

I am writing custom code to create a blog. I need the archives page to list all the blog entries by month. I cannot come up with a way to do that. I guess it should not be too tough as it is a common feature on all blogs. The table structure is (postid, posttitle, publishdate, .....) ...

Axis web service hangs because no connection-close is returned

I have a Axis 1.4 (with Spring) web service client consuming a PHP web service (running on Apache). This works perfectly in the development environment, but in the production environment the code execution hangs somewhere in the Axis library directly after the client has received the SOAP response. I have identified with Wireshark that t...

Can I use array_filter() on a class array?

I'm attempting to intercept and filter items out of a class set array, $this->_vars, in a stripped down version of Smarty (not my choice :| ) Here's what I've been attempting to use: Class callback function private function callback_check($var){ if(!in_array($var['link_id'], $this->returned_array['items'])) return false; else return...

Print using javascript for more than 1 printers

Hi all I want to print 2 kind of documents on 2 different printers. I use "Always print silent" on firefox so the print window doesn't show up on every print. But now I want 2 different prints I can not use this option and I really don't want the print window to show up. Any idea how I can do this like changing the default printer using ...

Searching using mySql together with PHP

I'm busy developing an application where users can search within multiple table, now I'm not sure if I'm doing it the correct way. My sample code looks as follows SELECT s.name, s.surname, s.id_nr, s.student_nr, s.createdate, s.enddate FROM Student AS s, Student_Results AS sr WHERE sr.innovation =...

Calculate lat/lng of corners of ground overlay from kml-file

I need to find the corners in lat/lng of a ground overlay given in a kml-file either in php or javascript. I.e. for a specific example I need to get from: <LatLonBox> <north>60.406505416667</north> <south>60.400570555556</south> <east>5.3351572222222</east> <west>5.3190577777778</west> <rotation>3.7088732260919</r...

how can i run an sql file with multipile create commands using php without manually parsing the sql file ?

Hello I'm building a web application using PHP5.3 and Zend Framework 1.9.4. i have an sql file that creates and populates the relevant tables. is there a way to install this sql file using PHP or even some component of Zend Framework ? for now i just search for the mysql client binary and install using it. ...

Need help on how to convert PHP code from object to procedural?

I was hoping someone can help me convert this piece of code from object form to procedural form. So I can have a sense of what to do for when I try to convert the larger piece of code that is all in object form that this snippet came from. I'm a brand new beginner. $sql = "SELECT id, label, link_url, parent_id FROM dyn_menu ORDER BY ...