php

Apache / PHP output caching

I'm working on a PHP script which generates large (multi-MB) output on the fly without knowing the length in advance. I am writing directly to php://output via fwrite() and have tried both standard output and using Transfer-Encoding: chunked (encoding the chunks as required) but no matter what I try the browser waits until all the data i...

How to write verbose information into file?

I'm using CURL in my php script and I want to write information from CURLOPT_VERBOSE into file. I tried CURLOPT_STDERR but without luck. It still print everything in cmd window. I'm not sure if parameter in curl_setopt($ch, CURLOPT_STDERR, $errFileHandle); should be file handler or file name (both not work). ...

Finding correct php regex for this complex element

Hi since hours im trying to get a regex which is able to find the following part in a string. [TABLE|head,border|{ #TEXT|TEXT|TEXT# TEXT|TEXT|TEXT TEXT|TEXT|TEXT TEXT|TEXT|TEXT }] Its from a simple self made WYSIWYG Editor, which gives the possibility to add tables. But the "syntax" for a table should be as simple as the one above. N...

email send request to user with database

i have this code and i am trying to write code to send email or of the side or send to link of this side how can i write that code with database <form action="mail.php" method="post"> <label for="email">your friend email</label> <input name="email" type="edit"/> <input type="submit" value="send link to friend"/> </form> <? if (isset($_...

How can i parseFloat a php var inside javascript

I need to parseFloat this then to replace the dot with a comma: sum="<?php echo substr($_tarif_membre,0,-2).'.'.substr($_tarif_membre,-2,2) ?>" * $('#tarif_membre').val() total_total= sum.replace('.',',') $('#total_total').val(sum) if i dont multiply the php echoed variable by $('#tarif_membre').val() it will still show the result a...

PHP counting user clicks

Wondering what would be the most efficient way to do the following. Game play. Player can train and every 8 mins a captcha verify kicks in to stop them from using bots/scripts to auto train. However thats still a lengthy amount of time. So thinking about making it per 100 clicks the verify enables. Now I could do this simply in the da...

SMARTY: ${ obj->render} doesn't render anything

Hi All I'm sending one of my object to smarty like $smarty->assign('test', new MyObject ) ; .... $smarty->display('main.tpl'); the MyObject class has a function called 'render' which returns a string representation of itself. So in main.tpl I want to render this object like {$test->render()} Unfortunately it doesn't show anythi...

how to create an object from given class name in php?

I have a variable $className which is name of declared class in php and I want create an object of this class lunch a static method of this class ...

How is my approach to reuse view logic in my project?

Aim To implement a proper and efficient view architecture for my project (with maximum reuse of repeated units) About my project My project involves classes taken by tutors and packs published by tutors. No framework has been used but object orientation and class hierarchies are present for model, controller part. I have the followin...

why do we need to calculate time from year 1970?

In most of the Programming or scripting language such as PHP or JavaScript, i have come across the time function which tends to calculate the time from year 1970. for example in javascript if i use the function getTime() or in PHP the time() it returns an integer value. In PHP. the code with <?php echo time(); ?> returns an integer v...

selective node update to cached xml feed and/or feedreader

Over at rsscache they offer a mechanism that caches your website's feed. They claim that if a new node gets added to your feed, instead of flushing and refilling the entire cache(for the current user, they proably do for new users), they only send the new node to the current users newsreader, and the reader adds it within the other nodes...

Amazon S3 PHP - accessing private files via URLs

Hi, I am am using Amazon S3. I am trying to access files inside the buckets using URLs (we store the URLs in a database) but I dont want just anyone to be able to access these URLs. So for example we store a lot of images in one table and ideally id like to just be able to use to load the image in with the src being the URL inside the ...

could somebody explain to me how to use mod_rewrite to create pretty permalinks like wordpress does?

i am writing a site from scratch using php/mysql and am using GET requests to pass data between the pages. at the moment my links look like: http://pkh:55/?service=213971&amp;type=FSD but i would like to use mod_rewrite to make them more relevant, ie: http://pkh:55/FSD/services/football-youth-club/ i've had a look through the word...

PHP Variable in Select Statement

Hey, first sorry that i had written it in german. Ok in english: i've written this PHP-Script which is working, and now i want to change the rowname into a variable to (not sure if row is correct), i mean the "name" from the select name... I've tried near everything, but nothing gave me the right result. I know that the normal thing ho...

How to manage references to permissions in the code and in the database?

How do people manage permissions between their code base and the database? For example, my application is becoming littered with: if($objects['username']['access_type'] == 'edit'){ // print the HTML to edit the username } or in OO: if($user->getPermission('username')->canEdit()){ // print the HTML to edit the username } How...

How to avoid display of HTML tags in mail function

I have a mail function, and it works fine, I get mails. But the problem is that I also get the HTML tags as it is. I have code as follows: $from=$_REQUEST['id']; $to = '[email protected]'; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers = "From: $from \r\n" . ...

= sign in gmail message body

I'm retrieving the messages of my Gmail account, and I'm finding '=' signs in the body, with some hex codes. This is an example: Na pagina= para anunciar poderia ter as op=C3=A7=C3=B5es de Estados , Cidades e Bair= ros . Ex : S=C3=A3o paulo Diadema , Sant= I have highlighted in bold these parts. Of course, in Gmail thes...

How to force a file to download in PHP

I have list of images and I want a "Download" link along with every image so that user can download the image. so can someone guide me How to Provide Download link for any file in php? EDIT I want a download panel to be displayed on clicking the download link I dont want to navigate to image to be displayed on the browser ...

How do I read the value of PHP sess_ files?

Hi, At localhost (Debian Sid machine), PHP creates session files in /var/lib/php5. When I open sess_cd2ct9hud284gn01os13nk5mi7, for example, i can see something like that: Qms6wztHQ9u79B7jjiihLX0cKc_fXgwo0NeVE34jFhdE__1JDOliUDteHQVXgMAjcGZgJ1EkBft0IUsqBdWrck7s0Vjghsm3vk681u_GV8KRK-ExrAEbvbgXfl51Z83tyh5h2JtRy0qLZmhqwLtUFykm1XbdBBxx5xJpNp...

Accessing Windows' special named folders in PHP fopen streams

Hi Everyone, http://en.wikipedia.org/wiki/Special_Folders I am having a problem with accessing a special folder in a fopen stream in php. Example $fp = fopen("%USERPROFILE%/Desktop/text.txt", 'wb'); fwrite($fp, $data); fclose($fp); I try this with sysinternals process monitor running to try and see what is actually happening and it...