php

Wrapping long text in CSS

Hello, I have text like <div style="float:left; width: 250px"> PellentesquePellentesquePellentesquePellentesquePellentesquePellentesquePellentesquePellentesquePellentesquePellentesquePellentesquePellentesquePellentesquePellentesquePellentesque feugiat tempor elit. Ut mollis lacinia quam. Sed pharetra, augue aliquam ornare vestibulu...

Invoke external shell script from PHP and get its process ID

How can I invoke an external shell script (Or alternatively an external PHP script) from PHP itself and get its process ID within the same script? ...

Quick & easy PHP/Javascript graphs

I'm looking for a simple and easy to integrate graph to display sales stats in a web application. I will basically supply it the name of the month, and a numerical number of sales in that month. I'd like it to then chart out a graph showing the stats. What's the best solution for this? I would prefer something attractive but still eas...

How to "print" to a paper in PHP?

What I mean is, lets say I have a content: "Stackoverflow is the best, bla bla bla..." I want to print the content in a paper, not computer monitor, how to do that? I saw a lot of CMS using php, have a print icon, and able to print it? (Well, I am not creating a CMS, just wondering how the printing works in php) ...

How to add silverlight player to browser and load our own video using PHP?

Im Implementing a video broadcasting website. For that I planned to use silverlight player to load videos. But I dont know how to integrate silverlight player into browser and load my own video in that player. Please Give me some code snippets or Some good references. Any help will be highly appreciated. ...

technique for remembering url

Hello everyone, I am trying to achieve a functionality that is able to redirect a user to the URL/address to which he was trying to have access before logging in. For example: A user is trying to access a registered members only area. He is given the message that he is not logged in and redirected to the index page. How do I redire...

php date functions

I've rarely touched PHP date functions, and now I need to do the follows: get current date, get date of three days later get date of three weeks later get date of three month later get date of three years later and finally to implement such a function: function dage_generate($number,$unit) { } $unit can be day/week/month/years ...

Conceptual differences between PHP and ASP

I'm working on an open source PHP project for websites, and once I release version 1.0, I want to provide the same product for websites using the IIS/ASP.NET platform. When the time comes I'll go ahead and learn ASP.NET to do the translation, but it would be helpful for me to know already if there are any fundamental conceptual or archi...

Reversing an MD5 Hash

I have passwords stored in a database using md5, and was wondering if there was a way to reverse the hash to email the user's password to him in case they forget it. If that's not the most appropriate method, what is the appropriate method for dealing with a lost password? ...

Why is PHP printing my number in scientific notation, when I specified it as .000021?

In PHP I have the following code: <?PHP $var = .000021; echo $var; ?> the output is 2.1E-5 ! Why? it should print .000021 ...

PHP - SQL Server 2005 express to 2008 standard problem

I have a PHP app running happily on the following system: web app: PHP version 5.2.3 OS: Windows Server 2003 Standard 32 bit database: SQL Server 2005 (express) web server: IIS 6 I'm trying to get the same thing running on the following: web app: PHP version 5.2.11 OS: Windows Server 2008 Standard 64 bit database: SQL Server 2008...

Question abt PHP variables by refernce & Zend_Auth

its possible to do a $auth = Zend_Auth::getInstance(); $result = $auth->authenticate($adapter); but i thought that is not passing a variable by reference? ... or do i need to use the instance of Zend_Auth by instance anyway? ...

PHP publishing a javascript

I have a PHP script that publishes a customised javascript based on the parameter, with header type as text/javascript. This PHP url is included in src of a script tag. However, there seem to be some issue. That script seems to be non functional.As in, I have a alert inside that, which should be executed immediately after inclusion. Its ...

How do i detach a behavior in Symfony/Doctrine?

Hi, I have doctrine's softdelete behavior attached to all of my models. Is there a way I can hard delete a particular record? In cakephp I remember detaching the behavior... deleting the record and then re attaching the behavior. Is there something similar in symfony/doctrine ? If so then how do I detach a behavior? Cheers ...

How to escape only "'" in PHP?

I'm doing something like following to transfer value from PHP to javascript: var str = '<?php echo $v; ?>'; If there is no "'" in $v, it'll just be fine. But in case there is "'" in $v, obviously error will be reported. So far I've only used mysql_real_escape, which is not applicable now. ...

SQL: Select * from

i hava a query of the following form select * from tablename where id= $var now sometimes i need to select a recod with a particular id ,and sometimes i need to select recore with any id so i intent to something of follwoing form $v = $_GET['id']; if($v== -1) $var = '*' //here i want to select all recods else $var = $v //sele...

PDO - Working with table prefixes

I like to prefix my tables in case I need to install the application to a host with only one database. I was wondering if there is a simple way of working with table prefixes using the PDO class? At the moment, I am having to overwrite each method in my own database wrapped, replace %p with the prefix, and call the super method. It's wo...

Where do you get your PHP documentation from?

Most IDEs come with complete documentation that can be installed locally, but I have a particular problem with PHP, as even the Netbeans PHP IDE links to online docs. How do you manage yours? Is there a hidden downloadable docs for PHP somewhere? ...

What's the most concise way to check if a variable matches one of a range of values in PHP?

I'm currently using this for a nav list to highlight the active page: <?= ($current_page == 'thema_list' ? 'class="on"' : '') ?> Extending this to check another page would be: <?= ($current_page == 'thema_list' || $current_page == 'thema_edit' ? 'class="on"' : '') ?> Is there a way to avoid this repetition? ...

Strip Tags thats are NOT in [code] [/code] segment

I'm trying to find a way to strip tags from a user-inputted string except from tags that are wrapped in the [code] [/code] BB style tag. For example, a user may enter this: <script>alert("hacked");</script> [code]<script>alert("hello");</script>[/code] What I would like is the "hacked" alert to be removed, but not the "Hello" alert. ...