php

PDF file download using PHP is getting corrupted in server

Hi, I've implemented a download script using PHP headers to download PDF files. My script is working fine and downloading the corresponding PDF file also in my localhost but that script is not working in my server. My code is: header("Content-Disposition: attachment; filename='dfile.pdf'"); header("Cache-Control: must-revalidate, pos...

PHP - Links: From Thumbs to page.php

Hi guys, I need to link 9 thumbs called: project1.jpg, project2.jpg, project3.jpg... to php pages with the same name: project1.php, project2.php, project3.php. It's my code so far: <?php $dir = 'portfolio/print/img/thumbs/'; $main_page ='portfolio/print/project1'; // How can I make $main_page to show the right project each time? $sc...

How to implement an automatically login system under php and javascript?

As the title implies, the automatically login system is wildly used by many websites. But I could not figure it out by myself. Could you please give me some hint. EDIT: Yes, I mean the remeber me feature like google. thanks. ...

Check if a rtmp-stream is running and start ffmpeg with PHP / Shell-Script / Ruby

Hi, I'm using ffmpeg to transcode a rtmp-stream and re-stream it with ffmpeg. I have 2 problems: how can I check if the remote rtmp-stream is running and then start ffmpeg sometimes ffmpeg brake up transcoding and it must be restartet automatically Any hints to do this with a shell-script, ruby or php? ...

php try catch error reporting

I have an application which relies on a soap server to produce content. Additionally authentication to the site is based on a seperate LDAP server. Obviously if either of these are down or not responding the site is down. I am trying to lay out a design such that I can have error reporting for site admins and also give a nice messag...

How do I query for data that falls between two dates?

I have an html form to select two dates from dropdown. Now I need to retrieve all records from a MySQL database which lie between those dates. Can anyone help me? ...

problem in file upload

If the file name is fin's xyz.mp3 then it is not uploading because of this fin(')s single quote. How should I use move_uploaded_file($tmp,$dest) in PHP? Example: $name1=$_FILES['FileName']['name']; $tmp1=$_FILES['FileName']['tmp_name']; $target = "../music_files/"; $up=uniqid().$name1; $target = $target.$up; move_uploaded_file($tmp1,$...

Create a VERY simple form in Drupal

Hi, All I need to do is have a form that does this: User enters postcode in text box Upon submit user is redirected to mysite.com/[user postcode] That's it! I know validation etc. would be desirable as well, but I just need to get this working for now. I don't mind if it's harcoded or utilises the Drupal form API (actually I'd prefe...

PHP's in_array vs. MySQL SELECT

I need to check if some integer value is already in my database (which is growing all the time). And it should be done several thousand times in one script. I'm considering two alternatives: Read all those numbers from MySQL database into PHP array and every time I need to check it, use in_array function. Every time I need to check the...

Get values from html table using codeigniter

Hi, How can I get the values from a html table and pass that to a controller in codeigniter? I'm passing an array to a view. I walk that array and display its content in a table where the user can alter the table. For example, adding a row, or deleting one, but changing values is a possibility too. But then the user saves the data by pr...

Extract string between html tags in php

Hi, I want to extract string between html tags and convert it into other language using google api and to append the string with html tags. For example, <b>This is an example</b> I want to extract the string "This is an example" and convert it into other language and then again append the string with bold tag. Could anyone know how...

How to drop all tables in database without dropping the database itself ?

I would like to delete all the tables from database, but not deleting the database itself. Is it possible ? I'm just looking for shorter way than removing the database and create it again. Thanks ! ...

PHP unwanted error

There isnt an actual error, but it's still displaying an error message when a user who is not the buyer or seller goes to the page. Is it possible to suppress the error message? Direct link to images http://i37.tinypic.com/2m5ijvq.jpg http://i36.tinypic.com/148kads.jpg //transaction id $transactionid = $_GET['id']; //Retriev...

Why doesn't my SSI work ?

I am having problems with passing query params into SSI include from within my zend framework application. I am trying to include a PHP file inside another PHP: <!--#include virtual='/ssi/test.php?x=hello' --> This executes properly, if my hellotest.php (which contains the above line) resides in my document root. If, however I do th...

PDO begintransaction vs MySQL db lock

what is the advantage of using pdo begintransaction, is this and mysql db lock are same? I have a table with urls and status column, whenever my application loads 10 urls I need to update the status column as loaded. This application will be accessed by couple of users simultaneously, how would I prevent user B from loading the same url...

Integrate a Zend application into Drupal 6 / 7

Hi there, Given a "nacked" Zend application - is it possible to use the Drupal based layout and navigation? What is the best way to integrate a Zend application into Drupal 6 / Drupal 7? For Example: User X visits my Drupal page. He wants to use the Zend-Application called "Feedback". This "Feedback" application should be able to...

replace double quotes with single quotes in a string

Hi, I know this sounds simple, and probably is, but I can't seem ot get this working. Just want to replace all occurences of a double quote with a single quote...tired this but it doesn't work: $con = str_replace("\"", "'", $content); ...

PHP: Show first word for last name

I wish to make something that cuts the name to e.g: Alex Andersson to uppercase first word after space(first name) "A" like this: Alex A. Right now it displays the full name like this: echo $data["full_name"]; Hope you understand what I mean. ...

best method for large File transfer via http(s) using PHP (POST) invoked via shell

I want to setup a automated backup via PHP, that using http/s I can "POST" a zip file request to another server and send over a large .zip file , basically, I want to backup an entire site (and its database) and have a cron peridocally transmit the file over via a http/s. somethiling like wget http://www.thissite.com/cron_backup.php?d...

Wordpress loop repeat itself

Hey there, Lets say i have a blog with 10 posts. I want to display 20 posts on my frontpage. How can i make the wordpress loop repeat itself till it reaches 20? if ( have_posts() ) : while ( have_posts() ) : the_post(); endwhile; endif; Btw... i do not want two loops... easy answer would be to have 2 loops, each with 10 posts, making...