php

php blocking when calling the same file concurrently

hi guys, i'm having some really strange problem. i wrote a filemanager in PHP with the ability to download files -- which works fine. the whole script is built as one big file. now, while downloading a big file i'm not able to use the script at the same time for, say, browsing folder contents. it does nothing but keep loading. as soon ...

When INSERTing into a table can I get the value of the automatically incremented primary index?

I am inserting a row into a table and would like to get the value of the automatically incremented primary index. The primary index is the only unique value in the table so I don't want to do anything like "SELECT [primary index] FROM [table] WHERE [the columns = the data I just inserted]" to prevent ambiguity. I also don't want to SELE...

Returning a PHP Array from a PHP SoapServer

I'm relatively new to Soap on the "creating the service side", so appologies in advance for any terminology I'm munging. Is it possible to return a PHP array from a Remote Procedure Soap Service that's been setup using PHP's SoapServer Class? I have a WSDL (built by blindly following a tutorial) that, in part, looks something like this...

Creating hashes for passwords

I am creating a custom CMS and have built a login system and was wandering how vulnerable hashing the passwords this way would be compared to just using the md5 php function like this: <?php $token = md5($salt . $password . $pepper); ?> Most people just add a salt but adding pepper just makes sense if your going to add salt :) Here i...

How To Find Out If You are Using HTTPS Without $_SERVER['HTTPS']

I've seen many tutorials online that says you need to check $_SERVER['HTTPS'] if the server is connection is secured with HTTPS. My problem is that on some of the servers I use, $_SERVER['HTTPS'] is an undefined variable that results in an error. Is there another variable I can check that should always be defined? Just to be clear, I am...

Is there a way to convert a PDF to HTML / CSS using PHP?

I know solutions exist to get HTML / CSS to PDF, but is there one that works the opposite way? I want to be able to automatically take uploaded PDFs, and turn them into HTML / CSS to be displayed on a website between a header and footer etc. Thanks ...

How can I tell my wordpress to do something in the header if its a blog page?

Hi there, In a previous post (http://stackoverflow.com/questions/1172335/dont-show-this-if-the-url-contains-the-following) I asked how I would go about having my header echo a div if the user loaded a URL with /blog in the header. What I didn't take into consideration, was that I don't want the div to display if its not just got /blog...

Joining and searching multiple MySQL tables with one-to-many relationships

I've been furiously googling trying to figure this out, with surprisingly little luck; I would guess this is a common issue. I have 5 tables: orders, addresses, notes, transactions, line_items, and shipments. transactions, addresses and notes all have indexed order_id fields - line_items and shipments have indexed transaction_id fields...

need help with mysql joins

Users table user_id pic_url name friends table auto_id userid friendid status actions table auto_id userid type subject body datetime I want to make a friend stream of updates thats shows updates, could be a blog post, status change, anything but should only show the ones that are from a friend of the logged in user Her...

How can I select and upload multiple files with HTML and PHP, using HTTP POST?

I have experience doing this with single file uploads using <input type="file">. However, I am having trouble doing uploading more than one at a time. For example, I'd like to be able to select a series of images, then upload them to the server, all at once. It would be great to use a single file input control, if possible. Does anyo...

facebook application update

Hi, I developed a simple application on Facebook using PHP and I want to know how the people can add this application, and after adding the application a update is generated (e.g vipin join this application). Thanks ...

Uploadify - files not showing up

I'm trying to use Uploadify (a jQuery plugin) with my CakePHP app. Locally (WampServer), it works great, but when I try it on my live server (Dreamhost), the files don't show up. I've properly chmod'ed the folders, checked the paths, etc, and I can't make any sense of why it isn't working. Here's upload.php: if (!empty($_FILES)) { ...

how to create php scheduled process?

Hi, I was asked to create an web apps that will send updates to user for certain time. for example user1 asking for updates every 5 minutes from June - August 2009 user2 asking for updates every 10 minutes for today only user3 asking for updates every 1 day from june - august 2009 I have no idea how to automatic the background p...

How do I write internal style sheets in Zend Framework?

I would like to write an internal style sheet to a view in Zend Framework as such <head> <style type="text/css" media="all"> body{ background: #FFFFFF; } </style> </head> I understand that I can write an external style sheet using $this->view->headLink()->appendStylesheet('style.css'); However I cannot find a way to writ...

problem with sending xml (declaration xml) with php

Hello, my question is actually What kind off structure would I use to send xml as part off a REST service if I have most off the logic in a class. I call/include the class at the top off my php index page if it becomes clear a service is being requested. Someone mentioned to me that a class method should not output anything. Then wher...

Google Calendar PHP Retrieve events by specified date range

Hey everyone, I know that you can retrieve events for a specified date range, but how can I retrieve events for one specified date (a single day)? I tried setting both setStartMin() and setStartMax to the same date, but that doesn't work. It seems that there has to be at least one day in between Min and Max. Here is the code I am usin...

Help with regex replace in php

I have a bunch of urls in static html files which need to be changed. They look like this now: <img src="/foldera/folderb/folderc/images/imgxyz.jpg" /> They need to look like this: <img src="imgxyz.jpg" /> So, I just wrote a php script that opens each and does a preg_replace(). My regex (with the double escaped backslashes, yes...

Accessing session data outside Joomla

Hello, I am trying to run an application outside Joomla (not as a plugin) and I would like to access the logged in user's information (userid). I am wondering how should I go about doing that? Is there a file which I can include? I tried using $_SESSION but it shows empty. Is there a simple solution to my problem? Thank you for your ti...

Php: Find first img or object tag in string

function get_first_image(){ global $post, $posts; $first_img = ''; ob_start(); ob_end_clean(); $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches) || preg_match_all('/<object[0-9 a-z_?*=\":\-\/\.#\,<>\\n\\r\\t]+<\/object>/smi', $post->post_content, $matches); ...

Is it possible to loop through all the items of two arrays using foreach?

I have two arrays: $Forms and $formsShared. <?php foreach ($Forms as $r): ?> $("#shareform<?=$r['Form']['id'];?>").hide(); $(".Share<?=$r['Form']['id'];?>").click(function () { $("#shareform<?=$r['Form']['id'];?>").toggle("show"); }); <?php endforeach; ?> Currently, I have this hide and toggle function for each For...