php

using php and HTTP_REFERER to create a condition for loading js

Hi, I'm trying to create a splash page effect on a site I'm working on (I know splash pages are bad etc but I have my reasons), and basically I want to call the script that runs the splash image overlay only if the visitor is coming to the index from an external website. That way if a visitor clicks "home" from an internal page the splas...

Issues installing PHP on an Apache server

Hi, I am trying to install PHP locally so I can run PHP files. The problem is that I am not able to install it properly although I am trying to follow the instructions. So I am following the instructions provided in this site for example: http://www.sitepoint.com/blogs/2009/04/13/how-to-install-php-on-windows/ and I can't find the file...

PHP export to Excel opens twice

I'm using the Spreadsheet_Excel_Writer plug-in to perform a data export from a PHP web app. All has worked well for quite some time now, but my client just informed me that in the last couple days the export behavior has changed: the downloaded file opens in Excel, then starts a new Excel instance and opens again. If you try to edit eith...

creation of pie and bar charts in php website

HI. I wanted to know if we could create pie and bar charts based on info from the database on a php website. I want to grab some information from the database and show it as an image so better analysis. Is there anyway to do this? Also, If i am using fpdf to generate pdfs from php and mysql, can i also design pie charts in that pdf and ...

Where to place .htpasswd generated by PHP?

I am creating a PHP based web application which requires simple authentication to use. The application is made to be installed on a web server and used only be the owner of the web hosting/server, so there will only be one user and password. I figured there was no point in creating a complicated login system. I would just create a GUI to...

passing URL variables to exec() with php

I have a dedicated server that I use to crunch lots of data. The way I have it now, I can open a script with a process ID like example.php?ex_pid=123 and just let it go. It downloads a small portion of data, processes it, then uploads it into a database then starts again. Ideally, I would like to call example.php?ex_pid=123 directly and...

Speed up forum conversion

I'm converting a forum from myBB to IPBoard (the conversion is done through a PHP script), however I have over 4 million posts that need to be converted, and it will take about 10 hours at the current rate. I basically have unlimited RAM and CPU, what I want to know is how can I speed this process up? Is there a way I can allocate a huge...

json date object to php date

Hi, I am calling a webservice which return me back a json object. The json object encodes the date. I am trying to find a way to convert that date to m-d-Y format in php. Json object is {"DateOfBirth":"\/Date(387518400000-0400)\/"} this date is 02-15-1982. The webservice which I am calling is in .NET, and it converts the date to the...

PHP - Question about uploading & uploaded image file

Hello all, I have read the following tutorial "Uploading Files To the Server Using PHP" and have several questions related to the topics. Q1> The tutorial mentions that "Note that PHP must have write access to $uploadDir or else the upload will fail" For me, I only allow the user to upload the file after the user has login t...

Running PHP exec() asynchronously/multi-processes

I'm currently running these lines in a PHP script: foreach ($list as $route) { exec('php-cgi ./nextbus-route_stop_predictions.php route=' . $route['route_id']); } nextbus-route_stop_predictions.php takes about 15 seconds to run and exec() is ran about 12 times. I was wondering if PHP was able to run these those command lines without n...

Magento Custom Backend functionality

Hi, ok i need some help with magento. I have been using it for about 6 months now mainly using the built in functionality and have looked briefly at some of the more advanced features. I am looking now at building in some custom features to the backend but dont know exactly where to start. Basically, all of the documentation seems to ...

PHP: remove string character found in another string....

Hi guys. I am trying to compare two strings and remove any characters that appear in second string. For example: $stringA="abcdefg" ; $stringB="ayfcghifh" ; I want $stringB to be "yhih". Are there any ways to do it? Thanks for the help... ...

opencart mp3 preview

hello, stackoverflowers. my client has an opencart e-commerce site. i am tasked with responsibility of creating an audio preview. it allows users to listen to a small portion of a mp3 file, like 2-3 minutes, before paying and downloading the whole file. kinda like itune thingy. i am thinking when a file is uploaded, i extract the first...

Multiple foreach without nesting

This first block of code works as expected. It's a foreach to print values from an $fnames key-value array. foreach($fnames as $fname){ echo $fname; } The $fnames array has an $lnames array that correspond to it, and I'd like to print the lname with the fname at the same time, something like this: but it doesn't compile foreach($f...

Ordering by two fields

Hello, The input below sorts submissions by a timestamp field called "datesubmitted" in reverse chronological order. This field is in a MySQL table called "submission." Another MySQL table "comment" has another timestamp field called "datecommented." Each submission has only one "datesubmitted" but it could have several comments, e...

PHP: intval() for decimals?

What is the PHP command that does something similar to intval() but for decimals? Eg. I have string "33.66" and I want to convert it to decimal value before sending it to MSSQL. Thanks. ...

PHP mySql update works fine on localhost but not when live

I have a a php page which updates a mySql database it works fine on my mac (localhost using mamp) I made a check if its the connection but it appears to be that there is a connection <?php require_once('connection.php'); ?> <?php $id = $_GET['id']; $collumn = $_GET['collumn']; $val = $_GET['val']; // checking if there is a ...

passing search parameter through jquery

i have a form in which if the user enters the search query, its parameter should be passed through jquery and after getting the results it should load the results in the div container. since i'm not very well-versed with jquery, how would i do this? html: //currently the data is being displayed on pageload: $(document).ready(fu...

regex for parsing xml string with multiple text block

I'm not very good in regex... so if somebody could help me with this one (maybe trivial) [update] First i'm not looking for the best way of manipulating xml (SimpleXMLElement,DOM etc... is fine). I'm just looking for this regex out of the context off XML. i have xml like that <myxml> <node>21</node> som text with <entite>some</entite...

onbeforeprint() and onafterprint() equivalent for non IE browsers (PHP, MySQL, JavaScript, HTML)

Hi all, I want to send some info back to my database when a user prints a certain web page. I can do this in IE with onbeforeprint() and onafterprint() but I would like to browser agnostic way of doing the same thing. Don't care which combination of technologies I have to use (PHP, MySQL, JavaScript, HTML) so long as it gets done. Any...