php

Javascript variable in quotes

hai I want to give a javascript variable within a double Quotes , Can any one help me? ...

Being new to Freelancing, how can i get projects. Give me tips and tricks in winning bids and getting project successfully

I want to become a Freelancer. When i entered into a freelancing site, being a new user i am unable to get the project. ...

How to protect PHPSESSID in php?

I am really clueless on how to protect PHPSESSID. Does the value of session_id come from PHPSESSID? It would be disastrous if the session_id got compromised. Anyone have any ideas? ...

Make 1d Array from 1st member of each value in 2d Array | PHP

How can you do this? My code seen here doesn't work for($i=0;i<count($cond);$i++){ $cond[$i] = $cond[$i][0]; } ...

Page cache in PHP that handles concurrency?

I've read previous answers here about caching in PHP, and the articles they link to. I've checked out the oft-recommended Pear Cache_Light, QuickCache, and WordPress Super Cache. (Sorry - apparently I'm allowed to hyperlink only once.) Either none deal with concurrency issues, or none explicitly call out that they do in their document...

php mail on MAMP

hi, I need to test some script using PHP's mail. I'd like to be able to finally get this working locally. I am using MAMP. Is there a way to do this without installing any third party software? I've done some searching on this but haven't found anything appealing. Thanks ...

Acessing other webapps while one is in document root

I have a Zend Framework project on a local machine, and as recommended its /public subfolder is made a DocumentRoot in httpd.conf. So I access this app simply with http://localhost. This new requirement makes me unable to access other web apps in a former webserver root (which contains a few regular php apps and a couple of zend framewo...

How to return the correct content-type for JSON in CakePHP?

Hi, I'm trying to set the content-type header for a JSON response accessed with an AJAX GET request. I've followed tutorials on blogs and the bakery but I always receive 'text/html' back from CakePHP. How do I set the content-type header correctly? Here's my code at the moment: http://bin.cakephp.org/view/668011600 Any help would be ap...

Store news from mysql in php array!

Hello! I have following script: $cbid = 0; $arrayid = 0; while ($FINDNEWSresult = mysql_fetch_array($FINDNEWSquery)) { echo "<tr>"; // Prvi stolpec - označevanje (checkbox) echo "<td class=\"middlerow checkbox\"><input id=\"" . $FINDNEWSresult['NEWSid'] . "\" type=\"checkbox\" /></td>"; echo "<td class=\"middlerow\"><a class=...

Is Markdown (with strip_tags) sufficient to stop XSS attacks?

I'm working on a web application that allows users to type short descriptions of items in a catalog. I'm allowing Markdown in my textareas so users can do some HTML formatting. My text sanitization function strips all tags from any inputted text before inserting it in the database: public function sanitizeText($string, $allowedTags = "...

Creating a game schedule with PHP _ Harder than I thought

I have an array of an unknown length which will always have an evenly divisible amount of values, for example: print_r($initialarray); Array ( [0] => 30 [1] => 31 [2] => 32 [3] => 33 [4] => 34 [5] => 35 ) I need to create sets: Set 1: 30 v 35; 31 v 34; 32 v 33; Set 2: 30 v 34; 31 v 33; 32 v 35; Set 3: 30 v 33; 31 v 32; 34 v 3...

Joining two images in php

How can I join a head image and body image so that the head image is precisely fixed over the neck in body image. Files are at: Head Image: http://yajurinfotech.com/projects/stickers/head1.gif Body Image: http://yajurinfotech.com/projects/stickers/body2.gif I have made an attempt at http://yajurinfotech.com/projects/stickers/preview...

PHP session variable will not work properly

I have a if/elseif statement that I am passing a GET variable into. Once inside the corrent block, I can echo something to make sure that I am in the right place. Once there, I have tried several times to set a session variable but it isn't working properly. I'm sure that I'm not doing something right. if(isset($_GET['mygetvar'])){ $_...

PHP Sessions - Warnings

I asked the question "php warning - headers already sent after server move" yesterday and I have made changes since to try and fix the problem but im still not getting it! I am working on code that has been made by another company! Im not moving the site off their server and putting it on ours but the my problem is that sessions are not...

Setting the correct InvokeArg when executing Zend Framework controller in Zend_Test harness

According to this mailing list discussion, the recommended way to access the application resources in a Zend MVC controller is: $this->getInvokeArg('bootstrap')->getResource('foo'); This works in production (when browsing to the corresponding Web page). However, when testing a controller action containing this code with Zend_Test_PHPU...

[PHP] - Don't allow > 2mb images

HI! How do i check if the users are trying to upload bigger than 2mb files? I would like to deny that and put an error message to the user who is trying to do that. I know it is something like this, but what shall i change the 50000 to to become 2mb? if ($_FILES['imagefile']['size'] > 50000 ) { die ("ERROR: Large File Size"); } ...

php to htaccess rewrite - redirect if no $_POST data

if( count( $_POST ) < 1 ) { // determine if this was a secure request - we use a non standard HTTPS port so the SERVER_HTTPS_PORT define should always be used in place of 443 $protocol = $_SERVER['SERVER_PORT'] == SERVER_HTTPS_PORT ? 'https' : 'http'; header( "HTTP/1.0 301 Moved Permanently" ); header( "Status: 301" ); /...

Downscale/resize?

Hey! How do i resize/downscale the images that gets uploaded with my upload script down to 350x100 if they are over 350x100? My script: $allowed_filetypes = array('.png','.PNG'); $filename = $_FILES['strUpload']['name']; $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); if(in_array($ext,$allowed_filetypes)) { ...

NetBeans Code Templates ${date} ?

I have this code template in Eclipse @since ${date} when entered i get something like this : @since 4.8.2009 But when i add the same template (@since ${date}) to NetBeans it outputs @since date Can someone help ? No answer yet ? Is this not possible in Netbeans ??? ...

mysqli multiple queries - set variable produces boolean error/how to skip this?

Got the following simple query which works fine through phpmyadmin but when I add it to my php website no results are returned and no error/warning messages either. If I remove "SET @N=-1;" then it works fine. <?php $db_connect = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD, true); mysql_select_db(DB_NAME, $db_connect); $test_query = m...