Hi all,
I use vim for web development. These are almost always .php files, which also contain HTML and sometimes Javascript. While working in a block of PHP, indenting works fine. The syntax highlighting is okay, but only really useful for the PHP-code. When I want to edit an HTML block, I usually switch: :set ft=html, so that highlight...
In my below code when the $artist or $title variables contain " it causes the JavaScript command to break.
Is there another way I can encode these other than addslashes() to fix this?
$artist = addslashes($row['artist']);
$title = addslashes($row['title']);
echo '<div class="play" style="display: inline"><a href="javascript:playSong...
I want to upload mp3 files to server by using ftp in php language.I did a raw code script for this.In server image,pdf,doc files are uploaded but i can not upload mp3 files.
Plz,anyone would help me??I am in serious trouble!!!
It shows file does not exist when i am going to upload mp3 files
Here is my code,--
<?php
// FTP Configurat...
I need to mimic the exact functionality of the ceil(), floor() and round() functions on bcmath numbers, I've already found a very similar question but unfortunately the answer provided isn't good enough for me since it lacks support for negative numbers and the precision argument for the round() function is missing.
I was wondering if a...
Hi Folks,
I just wondered if anybody can point me in the right direction: I'm looking to make a script whereby the logo on my site changes depending on the date; so for instance a haloween style one soon.
I started off by having 2 arrays, 1 of start dates and 1 of end dates(not sure even if this is the best way!):
<?php
$start_dates...
Recently, I had an audit run on some of my sites by a client. One of the things they came back with was that I could be sanitizing the input data a little better as people could still cause potential harm to the database.
The function below is what I am currently using (a leftover from the old developer) but I cannot see where the pot...
I want to remove the comma off the end of a string. As it is now i am using
$string = substr($string,0,-1);
but that only removes the last character of the string. I am adding the string dynamically, so sometimes there is no comma at the end of the string. How can I have PHP remove the comma off the end of the string if there is one a...
Hi,
I've been working on a site that uses binary mlm system.
Illustration here
So I have a two tables in database, users anad relationships. There is ID and personal data columns in users. Relationships has 4 columns: ID, parentID, childID, pos. Where pos is either left or right.
I have succesfully written a function that recursively...
I am using bin2hex to create unique id's for my users as an Identifier and I don't want to connect to MySQL for checking repetition .
...
I want to get the single digits from two digits.for example if 36 I need to store 3 and 6 in different variables.Is it possible?
...
I need to convert HTML documents (generated from DocBook XML documents) to the Wiki mark up language, in particular to the PM Wiki mark up language. The goal is to include the company's application operations guides in our newly created wiki. This means that I actually have two options:
Convert the HTMLs (generated from DocBook XMLs) t...
Appeared a strange error in the error log in PHP, but the script that generated this error is often used and never generated this error, and occurred only once so far. Would anyone tell me why this happened mistake?
Error: [client {some IP}] ALERT - canary mismatch on efree() - heap overflow detected (attacker '{some IP}', file '{some s...
Is there any way to log (record) the time it takes to download a file from a web server via the browser? The file is written on the HDD and the environment is LAMP.
Thanks.
...
I've been struggling to get Eclipse to format my php arrays like vim indentation does.
What eclipse does (press CTRL+SHIFT+F)
<?php
$array = array(
'key1' => 'value1',
'key2' => array(
'child_key1' => 'child_value1',
'child_key2' => 'child_value2',
),
);
What vim does (press keys:gg=G)
<?php
$array = array(
'key1' => 'value1',
'...
I have a submit form with method POST, I want to write a script that can automatically submit this form, the reason why I need this is for testing purposes. I need a lot of data in little time in order to test a search based on those form fields, and I do not have time to mannulally do this. Is this possible?
...
Hi,
I'm fairly new to Zend and am having some difficulties with creating my unit tests. I've stripped it down to a minimal test class that still replicates the problem in the hope that it is something daft that I'm doing:
class UserRegistrationsTest extends PHPUnit_Framework_TestCase
{
protected $db;
public function __construct($na...
I have a an array called $ran = array(1,2,3,4);
I need to get a random value out of this array and store it in a variable, how can I do this?
...
Hi there,
how can i use result of Agregate function in where in Doctrine?
For example i want to know user with silly much numbers.
SELECT u.name, COUNT(p.id) AS users_phonenumber_count
FROM users u
INNER JOIN phonenumbers p ON p.user_id = u.id
WHERE
users_phonenumber_count > 10
GROUP BY
u.id
How can i access the *use...
We have an application that is comprised of a couple of off the shelf PHP applications (ExpressionEngine and XCart) as well as our own custom code.
I did not do the actual analysis so I don't know precisely how it was determined, but am not surprised to hear that too many MySQL connections are being left unclosed (I am not surprised bec...
For example, I'd like to have my registration, about and contact pages resolve to different content, but via hash tags:
three links one each to the registration, contact and about page -
www.site.com/index.php#about
www.site.com/index.php#registration
www.site.com/index.php#contact
Is there a way using Javascript or PHP to resolve t...