php

Value of variable changing before function is finished running

I have an image uploading script in which i use the following setup to assign names to uploaded images; $saltdate = date( 'U' ); $saltuser = $_SERVER[REMOTE_ADDR]; $saltname = md5($saltdate.$saltuser); // Recieve, Process, Save uploaded image // Update database with image name The problem that i encounter is ...

accessing php javascript object in asp.net user control

Hi, I have a website in php which is using 4 frames(top, left, middle and right). The middle frame contains the web user control coded in asp.net. Now, in the right frame( which is coded in php ) some javascript contains the id of the items selected in right frame. I need to get those ids to the middle frame on asp.net user control. Ho...

how to include .pl (PERL) file in PHP

i have two pages one in php(index.php) and another one in Perl(dbcon.pl). basically i want my php file to show only the UI and all the data operations would be done in Perl file. i have tried in index.pl <?php include("dbcon.pl");?> <html> <br/>PHP</br> </html> and dbcon.pl has #!/usr/bin/perl use strict; use warnings; use DBI; ...

How reliable are URIs like /index.php/seo_path

I noticed, that sometimes (especially where mod_rewrite is not available) this path scheme is used: http://host/path/index.php/clean_url_here --------------------------^ This seems to work, at least in Apache, where index.php is called, and one can query the /clean_url_here part via $_SERVER['PATH_INFO']. PHP even kind of advertises t...

How to read pdf, ppt, xl, doc files content into a string in php/python

Pls suggest me any inbuilt command or package? ...

PHP/Zend: How to remove all chars from a string and keep only numbers.

I want to keep only numbers and remove all characters from a variable. For example: input: +012-(34).56.(ASD)+:"{}|78*9 output: 0123456789 ...

What this phrase "Try to make you architecture more horizontal rather than vertical" means?

Hello, I've just listened to http://www.zend.com/webinar/PHP/70170000000bAuS-webinar-php-performance-principles-and-tools-20100218.flv (Zend webinar about PHP performance). I can't understand what this phrase means "Try to make you architecture more horizontal rather than vertical" (see screenshot) Thank you. ...

Difference between mod_deflate and zlib output_compression

Can anyone tell me the difference between using mod_deflate and zlib output_compression? I understand that zlib is done in PHP and mod_deflate is done in Apace, my .htaccess file looks like: php_flag zlib.output_compression On or: SetOutputFilter DEFLATE BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-...

PHP mySQL database check

Hi guys, I am having endless troubles with duplicate entries, so I need to check the database, and if a user has already entered that day, their entry will not be submitted and they will be redirected to a landing page that tells them they have already entered that day, and that they may only enter again tomorrow. The field I would like...

PHP - dynamic page via subdomain

Hi, im creating profile pages based on a subdomains using the wildcard DNS setting. Problem being, if the subdomain is incorrect, I want it to redirect to the same page but without the subdomain infront ie; if ( preg_match('/^(www\.)?([^.]+)\.domainname\.co.uk$/', $_SERVER['HTTP_HOST'], $match)) { $DISPLAY_NAME = $match[2]; $query = "...

CakePHP Auth component redirect issue

I am having trouble getting the Auth component do the redirects I want in a CakePHP 1.2.6 app. I have a login form that appears on all pages and I want to keep the user on the page he logs in on. For example, if he is viewing another user's profile, I want to keep him there after logging in, not redirect him to the $this->Auth->loginRe...

Replacing keywords in text with php & mysql

Hello, I have a news site containing an archive with more than 1 million news. I created a word definitions database with about 3000 entries, consisting of word-definition pairs. What I want to do is adding a definition next to every occurence of these words in the news. I cant make a static change as I can add a new keyword everyday, ...

How to use crystal reports with php

Hi everybody... I need to use crystal reports with php... I googled around for a long time but was not able to find a good tutorial or book that will explain the process easily and efficiently... Can anyone point me towards a place where i can get a simple tutorial about using crystal reports with php....? Thanks a lot for your sugges...

Checking if records exist in DB: in single step or two steps?

Suppose you want to get a record from database which returns a large amount of data and requires multiple joins. So my question would be, is it better to use a single query to check if data exists and get the result if it exists? Or do a more simple query to check if data exists then id record exists, query once again to get the result...

CK editor and missing image URL

I have integrated CKeditor with my admin panel (php) I have writtien a function for calling editor: function editor(){ $txt = '<script type="text/javascript"> CKEDITOR.replace( "kabst",{ filebrowserUploadUrl : "'.UPLOAD_SCRIPT.'" }); </script>'; return $txt; } and define: ...

Inline widget-like templates in MODx

Hi, I'm developing my first ever MODx site and I need to have three blocks on the frontpage that contain headline, picture, image caption, long text and a short text. For these I would like to create a custom template that allows me to create sub-resources of "Home" with only these five fields (of which one will allow me to upload imag...

Send POSTs to a PHP script on a server

I have a PHP script on a server <?php // retrieve POST vars $comment = $_POST['comment']; $email = $_POST['email']; // remove trailing whitespace etc $comment = trim($comment); $email = trim($email); // format date accoring to http://www.w3schools.com/php/func_date_date.asp $date_time = date("Y-m-d-H-i-s"); // i.e. 2010-04-15-09-45-2...

Zend/PHP: How to remove all leading 0s from string ?

I have a string which contains only numbers. Now I want to remove all leading 0s from that string For example: input: 000000001230 output: 1230 input: 01000 output: 1000 Is there any function in PHP/Zend for this? Thanks ...

Drupal: link to latest node of a certain content type

I have a link within a block. At the moment it goes to a list of newsletter nodes: <p><a href="<?php global $base_url; print $base_url;?>/news-events/newsletter">Read our latest newsletter</a></p> What I would prefer is to have it go to the latest node of the content type 'newsletter', is this possible? ...

Nested table height in TCPDF

Is it possible to make nested table fit height of its parent cell in TCPDF? My code: <?php require_once('tcpdf/config/lang/eng.php'); require_once('tcpdf/tcpdf.php'); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); $pdf->SetFont('times...