Hi,
Is it possible to catch simplexml file errors? I'm connecting to a webservice that sometimes fails, and I need to make the system skip a file if it returns some http error or something similar.
Thanks!
...
Hi,
I've a php script to deal with uploaded images.
it works fine if i upload a file like file.jpg.
But i got trouble if i try to upload file.JPG. Even if its the same file renamed.
The code:
if(isset($_FILES["arq"])){
@getimagesize($_FILES['arq']['tmp_name']) or $err=5;
($_FILES['arq']['error']==0) or $err=$_FILES['arq']['error...
I'm trying to stuff a variable into a SQL query to return a value to a page.
$sql = 'SELECT account FROM users WHERE uid = arg(1)';
Where arg(1) = the user currently being viewed. I am outputting arg(1) at the top of the page, so I know it's there, but Drupal doesn't seem to want to take it. I've tried escaping several different ways....
I need to get the amount before a :- sign.
So the string would be: bla bla 120:-
And then store only 120 in a variable
...
I've written a helper in order to make my main nav. Part of this helper checks if there is a user logged in by checking if a user has been assigned to the view
if($this->view->user)
{
//do stuff
}
However when I call this helper in my layout script it is unable to access $this->view->user; it has NULL value (although var_dump($this->v...
I know questions like this have been asked a hundred of times, but mine is a little different.
I know about all the common and widely-known security issues like SQL injection, XSS etc. But what about issues that often appear but are not recognized most of the times or not judged as vulnerabilities? Are there any?
...
How can I pass xml data from php to flash, without using xml file?
Sincerely,
John
...
I am trying to write something similar in javascript
function Spin($txt){
$test = preg_match_all("#\{(.*?)\}#", $txt, $out);
if (!$test) return $txt;
$toFind = Array();
$toReplace = Array();
foreach($out[0] AS $id => $match){
$choices = explode(”|”, $out[1][$id]);
$toFind[]=$match;
$toReplace[]=trim($choices[rand(0, count($choices)-...
When i use this code,
$ch = curl_init($url);
$statuses = curl_exec($ch);
curl_close($ch);
I am returned what i want, but if i just use that - $statuses is echoed out onto the page, how can i stop this?
...
Hi,
Wondering if someone can suggest a refactoring 'best practice' or more ideally a "check-list" that we can go through and refactor against common issues.
Some of these ideas were pretty good: http://my.safaribooksonline.com/9780321620293
But looking for more.
Thanks.
...
I have a page on my website (high traffic) that does an insert on every page load.
I am curious of the fastest and safest way to (catch an error) and continue if the system is not able to do the insert into MySQL. Should I use try/catch or die or something else. I want to make sure the insert happens but if for some reason it can't I ...
I was using str_replace for other bbcodes, but I'm stuck with the url portion.
I need to convert:
[url=http://maps.google.com/maps?ie=UTF-8&oe=utf-8&rls=org.mozilla:en-US:official&client=firefox-a&um=1&q=brits+pub&near=Pasadena,+CA&fb=1&cid=0,0,17926180203917841249&sa=X&oi=local_result&resnum...
Hey guys,
I am a web freelancer and had been doing all coding by myself using netbeans (set up to use a remote server (ftp)).
Recently, I started working with 2 other guys. They help me with php and css. The problem is that sometimes we want to work at the same time. Obviously one can immediately see the problems were having. Fil...
Take a look at the code below, it is a simple PHP script that uses cURL's multi handles feature:
// Initialize multi handle
$m = curl_multi_init();
// Initialize the actual curl handles
$c1 = curl_init();
curl_setopt($c1, CURLOPT_URL, 'http://speedtest.bbned.nl/download/file32mb.bin');
curl_setopt($c1, CURLOPT_RETURNTRANSFER, 1);
cur...
Here's my config file:
<?php
#config variables
$host = ''; #your database host
$user = ''; #your database username
$password = ''; #your database password
$database = ''; #your database title
$page_title = ''; #this appears at the top of the webpage and in the browser tab/window.
$tbl_prefix = ''; #the prefix...
Is there a simple HTTP server that can be run in the current PHP project path, like Rails' script/server (webrick)?
...
I am writing a PHP function that will need to loop over an array of pointers and for each item, pull in that data (be it from a MySQL database or flat file). Would anyone have any ideas of optimizing this as there could potentially be thousands and thousands of iterations?
My first idea was to have a static array of cached data that I w...
Hi,
I use a script (http://www.webmotionuk.co.uk/php-jquery-image-upload-and-crop-v11/) that handles an image and then create a thumbnail.
Actually I don't want to store images on the file system but I want to store them in a mysql db in a BLOB field.
I could first store the created thumbnail on the fs, store the file in the DB and af...
I'm trying to determine the neighborhood for a location, based on Zillow's freely published Shapefile data.
I don't really know anything about the Shapefile format, and am having some trouble finding tutorials online -- but I basically want to take latitude/longitude pairs, and run it against the Shapefile data to determine the correspo...
I have a data set that is setup for comments. I have levels and a sort column but now I would like to either get this in an array or display it somehow in a meaningful way:
id comment Parentid Level sortcol
2 Test NULL 0 0x00000002
4 This is the Second NULL 0 0x00000004
5 First Reply ...