Although I realise there are different approaches to securing upload process, I'm still confused when it comes to basic principles. I want to allow users to upload any kind of file they want, but keep my app secure. So my question is:
Is it sufficient to store the files with their original names in 'uploads' folder outside 'webroot' and...
I have a site which I have been testing in a sub-folder of my client's site-root.
I had no log in problems during testing, but then I moved the new site files from a sub-directory to the main site root, and now I'm losing my logged in state after almost every page refresh in secure areas.
I am running a $_session based login system that...
When searching for some websites on google, it shows the first result like this:
eBay - New & used electronics, cars, apparel, collectibles
Motors Computers & Networking
Electronics Home & Garden
Clothing, Shoes & Accessories Cell Phones & PDAs
Sporting Goods
I guess it ha...
Am trying to use something like:
$newdata = preg_replace($pattern, $replacement, $data);
Now my replacement is something like
$pattern = "/START(.*?)END/is";
$replacement = "START $config END";
Now, $config contains contents like
array('Test\\\'s Page')
The problem is that after I write the content, $newdata becomes
START array...
Hey all
Are there any pre-made scripts that I can use for PHP / MySQL to prevent server-side scripting and JS injections?
I know about the typical functions such as htmlentities, special characters, string replace etc. but is there a simple bit of code or a function that is a failsafe for everything?
Any ideas would be great. Many tha...
Hi guys,
I'm using imagecache_create_path() and getimagesize() to get the path of a imagecache-generated image and its dimensions. However, if it's the first time we access the page that image doesn't exist yet and imagecache_create_path doesn't generate it either.
Here's the code:
// we get the image path from a preset (always return...
I want to use preg_match() such that there should not be special characters such as `@#$%^&/ ' in a given string.
For example :
Coding : Outputs valid
: Outputs Invalid(String beginning with space)
Project management :Outputs valid (space between two words are valid)
'Design23' :Outputs valid
23Designing : outputs invalid
123 :Outputs ...
I trying to parse this string:
$right = '34601)S(1,6)[2] - 34601)(11)[2] + 34601)(3)[2,4]';
with following regexp:
const word = '(\d{3}\d{2}\)S{0,1}\([^\)]*\)S{0,1}\[[^\]]*\])';
preg_match('/'.word.'{1}(?:\s{1}([+-]{1})\s{1}'.word.'){0,}/', $right, $matches);
print_r($matches);
i want to return array like this:
Array
(
[0] => ...
I've been beating my head against my desk for the last two days over this one. I'm making an app that displays info from a db, the title/link, thumbnail, and time saved wrapped in an unordered list, like so:
What I'm trying to do is have a minimize button on the element, toggling the thumbnail and time saved on and off: I can accomplis...
I'm a little new to drupal but have been using things like devel module and theme developer to speed up the learning process.
My question, is it possible to theme an entire views BLOCK from a single views tpl.php page OR even a preprocess?
When I'm grabbing the $view object I can see results $node->result, it has all of the results, bu...
I have a website which works fine in all browsers except in IE6. The pages content is inside a div loaded with a background image. The page layout gets very nasty and image does not load when the page is opened for first time, but when the same page is opened for the second time and any subsequent times, then it loads perfectly. This sce...
I have a string in the format yyyy-mm-ddThh:mm:ss and I want to convert it to a date object. How would I do this?
...
Hello
I have a site I'm deploying and I've hit a problem. I was testing my code in a sub-directory of my clients hosting package and everything seemed fine. However I've moved the folders/files to the site root and now I'm intermittently losing all session data.
I've taken a look with LiveHeaders in Firefox and these cookies are being ...
Guys and Gals,
Im getting this error
Internal zval's can't be arrays, objects or resources in Unknown on line 0
on a site that was built in drupal, it appears to be crashing httpd.exe
Faulting application httpd.exe, version 2.2.14.0, time stamp 0x4aeb9704, faulting module php5ts.dll, version 5.3.1.0, time stamp 0x4b06c41d, exception...
I've run into a typical problem here. Till now i was doing
strstr($filename,".");
$filename is the file i got from $_FILE i.e uploaded file.It was running fine until i hit a filename of the type i mentioned.
Even doing
pathinfo($filename);
gives me
.gz
I need to see whether it is EXACTLY
.tar.gz
...
Hi I have a class called User and a method called insertUser().
function insertUser($first_name, $last_name, $user_name, $password, $email_address, $group_house_id)
{
$first_name = mysql_real_escape_string($first_name);
$last_name = mysql_real_escape_string($last_name);
$user_name = mysql_real_escape_string($user_name);
...
I'm passing a varaible to a iframe but can't seem to access this variable via the global get variable.
<iframe src="uploadContract.php?clientid={$clientid}" frameborder="0" height="95"></iframe>
in uploadContract.php I try to access the variable like $_GET['clientid'];
Somehow I can't seem to get the value via the Get global
What am...
I have this function inside a php file:
mysql_query("SET NAMES 'utf8'") or die(mysql_error());
mysql_query("SET CHARACTER SET 'utf8'") or die(mysql_error());
some stuff happening here,
rename($src, $dest.$cat);
Thats on the server, and is the setup I have today which works (atleast on my browsers).
Now, on my local machine (my...
Hi I want to get image from another site but I requires referrer information to show image.
image address is: http://www.foo.com/hist.gif?21918+201020
this adress show gif image if you came this page from foo.com
Think I can do this with curl but I don't know how to do this.
I have to show image with img tag
...
I am thinking about setting the
php.ini, my.cnf and httpd.conf default charsets=UTF-8
The website is in swedish lang only.
I have some folders with special chars in them, also some files.
Is there any harm by doing this?
Is it cross-browser safe?
Thanks
...