php

How do I convert RTF to PDF from my PHP web page using OpenOffice?

My OS is Windows XP, and I'm using IIS 5.1 and PHP 5.2.9. I'm trying to call a PHP script from my PHP page in order to convert an RTF doc to a PDF, using OpenOffice. The script works just fine when I call it directly from the command line, but I'm not having any success getting the very same script to work when launched from my PHP w...

Maybe a simple question on html/php/sql

I'm am extracting (using php) some text entries from an Oracle 10g DataBase. The problem is that I also need to add a comment form to every text entry so that users can respond to the original text ( it's like stackoverflow really: the original texts are the questions and attached to every questions there's a form for answering ). When I...

Wrap Text in P tag

Hi, I'm trying to figure out how to wrap text like this : Morbi nisl tortor, consectetur vitae laoreet eu, lobortis id ipsum. Integer scelerisque blandit pulvinar. Nam tempus mi eget nunc laoreet venenatis. Proin viverra, erat at accumsan tincidunt, ante mi cursus elit, non congue mauris dolor ac elit. Maecenas moll...

Regular expressions / parsing dig output / extracting text from double quotes

Hi, I need help figuring out some regular expressions. I'm running the dig command and I need to use its output. I need to parse it and get it neatly arranged as an array using php. dig outputs something like this: m0.ttw.mydomain.tel. 60 IN TXT ".tkw" "1" "20090624-183342" "Some text here1" m0.ttw.mydomain.tel. 60...

Why is my PHP Socket Server hanging?

I created a PHP Socket Server with PHP_NORMAL_READ mode. So, a message to the server is read when it ends with \n or \r. I tried it by connecting to the server with multiple telnet instances, and it works great. However, when I connect to the server with 1 flash application and 1 telnet application (I first start the flash one), the fla...

Being redirected to the wrong place - sometimes...

I have a javascript setInterval that checks an external page every 5 seconds for mail, I am finding sometimes that if I login or click a form submit at the same time as the request goes out, I sometimes find myself looking at a Y or a N (what my JS was to intercept) instead of the real link I wanted to go to. How does one debug this? I...

Nginx - Treats PHP as binary

We are running Nginx+FastCgi as the backend for our Drupal site. Everything seems to work like fine, except for this one url. http:///sites/all/modules/tinymce/tinymce/jscripts/tiny_mce/plugins/smimage/index.php (We use TinyMCE module in Drupal, and the url above is invoked when user tries to upload an image) When we were using Apache,...

Best scaling methodologies for a highly traffic web application?

We have a new project for a web app that will display banners ads on websites (as a network) and our estimate is for it to handle 20 to 40 billion impressions a month. Our current language is in ASP...but are moving to PHP. Does PHP 5 has its limit with scaling web application? Or, should I have our team invest in picking up JSP? Or, i...

PHP: Best random numbers

Hello! I heard that PHP's rand() function doesn't give good random numbers. So I started to use mt_rand() which is said to give better results. But how good are these results? Are there any methods to improve them again? My idea: <?php function rand_best($min, $max) { $generated = array(); for ($i = 0; $i < 100; $i++) { ...

What is this loop using PHP $$ syntax doing?

I found this PHP code in an app I have to modify... $links = mysql_query($querystring); foreach (mysql_fetch_array($links) as $key=>$value) { $$key = $value; } I'm a bit stumped. Is it really iterating over the query results and copying the value into the key? If so, what would be the point of this? Also, what is the double $$...

Any way to optimize this mysql query?

This is the query. Im mostly interested if there is a better way to grab the stuff I use GROUP_CONCAT for, or if thats a fairy good way of grabbing this data. I then explode it, and put the ids/names into an array, and then use a for loop to echo them out. SELECT mov_id, mov_title, GROUP_CONCAT(DISTINCT categories.cat_nam...

Jquery Validation with Identical Form Names

I have a form that does 2 things: Pass a first name and email address to PHP. Dynamically add a new set of name/email fields on a click, in case the user wants to submit more than one or two sets of data. Since I don't know exactly how many sets every user may choose to submit, I pass the data to PHP in an array (using a name followe...

Unlimited fields in PHP?

How do I do unlimited fields in php? Here is the scenario: At first, there are only 2 fields, lets called: first name1, last name1 What I want to do is, when I click the "add" button, it will add another 2 fields in new row, the fields label/name should be first name2, last name2. And when I click again, it will have first name3, last ...

Help with gmail message reading with php

Hi ALl I need to read emails from gmail but i cant connect to gmail pop3 server. Can anyone help me here ? Here the code: $pop3 = new POP3; $pop3->server = 'pop.gmail.com'; $pop3->user = 'username'; $pop3->passwd = 'password'; $pop3->debug = true; $pop3->pop3_connect() The result: Warning: fsockopen() [function.fsockopen]: unable t...

PHP get_browser: how to identify ie7 versus ie6?

Is there any way to differentiate IE7 versus IE6 using PHP's get_browser() function? ...

Php safe output

Hola When outputting user input I use this function: function bbkoda($text) { $text = htmlspecialchars($text); $text = nl2br($text); $hitta = array( "'\[b](.*?)\[/b]'is", "'\[i](.*?)\[/i]'is" ); $byt = array( "<b>\\1</b>", "<i>\\1</i>" ); $text = preg_replace($hitt...

Create unique Poll/vote/survey in php

The unique poll/vote/survey i mean here is, user can only vote once. How do i do that? Track their ip? Login? Beside login, what else? (login is my last option, thus beside login, is there anything else I can do?) ...

Does Adobe AIR work on linux ? how do i install because linux does not support exe format

I am beginner so have some doubt about Adobe AIR. How do I install my AIR project in linux, or mac os because my project out .air(execute file).os does not support execute file ? Does it support multi language in Adobe air? And one more, how can I embed css not use an external css file? Does it support live streaming video in deskto...

Convert param into python ?

Hello everyone, I am trying to learn web programming in python. I am converting my old php-flash project into python. Now, I am confused about how to set param value and create object using python. FYI I used a single php file, index.php to communicate with flash.swf. So, my other php files like login.php, logout.php, mail.php, xml.php ...

PHP returning page error on simplexml print_r

The problem is only happening with one file when I try to do a DocumentDOM/SimpleXML method, so it seems like the issue is with that file. No clue what it could be. If I do the following: $file = "test1.html"; $dom = DOMDocument::loadHTMLFile($file); $xml = simplexml_import_dom($dom); print_r($xml); in Chrome, I get a "Page Unavaila...