I have some code on my PHP powered site that creates a random hash (using sha1()) and I use it to match records in the database. This is to obfuscate things like id's in query strings which can (and usually are) sequential, and I don't want anyone changing it in the query string to get other information.
What are the chances of a collis...
Can someone suggest me a good free php script to use as a poll for a web-site? I'd need a simple script to show on the web page with the standard multiple option vote + bar chart graph. Also an admin interface with add / edit / delete poll would be required.
...
In PHP 5.2 there was a nice security function added called "input_filter", so instead of saying:
$name = $_GET['name'];
you can now say:
$name = filter_input (INPUT_GET, 'name', FILTER_SANITIZE_STRING);
and it automatically sanitizes your string, there is also:
FILTER_SANITIZE_ENCODED
FILTER_SANITIZE_NUMBER_INT
FILTER_SANITIZE_EM...
$sourcePath = 'images/'; // Path of original image
$sourceUrl = '';
$sourceName = 'photo1.jpg'; // Name of original image
$thumbPath = 'thumbs/'; // Writeable thumb path
$thumbUrl = 'thumbs/';
$thumbName = "test_thumb.jpg"; // Tip: Name dynamically
$thumbWidth = 100; // Intended dimension of thumb
// Beyond this point is simply code.
$s...
The vim * star / asterisk search (:help star) is a great feature which lets you find the next occurrence of the word the cursor is over. Unfortunately it treats dollar-prefixes as part of the string, so if I press * while over the "SearchTerm" in the class name it finds "SearchTerm" in the comment, and "$this->SearchTerm", but not "$Sear...
I have a server-side web service that serves to multiple clients. Clients include web browsers, iPhone, BlackBerry, Android etc. My question is, I need to be able to generate dynamic content for views to these clients. Be it a full blown HTML template, an HTML snippet, JSON, XML, etc. Depending on the user-agent of the requesting client,...
I'm starting to try and test my Doctrine objects with PHPUnit, and would like to reload the DB from my model objects afresh each time.
My first attempt looks something like this:
class Tests_User extends PHPUnit_Framework_TestCase
{
public function setUp()
{
Doctrine_Manager::connection('mysql://user:pass@localhost/te...
I want to build a multiplayer online boardgame like monopoly using php, mysql. I want to run the game in the browser. Multiple people connect to the game, then each person takes turn rolling the die, making trades etc...
I was curious how other game developers achieve the "turn base" functionality in real-time. Does the client browser...
I want to send an array constructed in javascript with the selected values of a multiple select. Is there a way to send this array to a php script using ajax?
...
CodeIgniter allows access to POSTed data via:
$this->input->post('input_name');
where 'input_name' is the name of a form field. This works well for a static form where each input name in known ahead of time.
In my case, I am loading a collection of key/value pairs from the database. The form contains a text input for each key/value p...
Hi,
I've been trying to build a simple prototype application in Django, and am reaching the point of giving up, sadly, as it's just too complicated (I know it would be worth it in the long-run, but I really just don't have enough time available -- I need something up and running in a few days). So, I'm now thinking of going with PHP ins...
So far, i've tried Vanilla (from lussumo) which keeps breaking, specially on the session handling, and PHPbb which feels like using a bfg9000 to make a phone call.
I self host my blog, and would love to know what's out there. To top it off, this is a would-be site for designers, so flash (not adobe) and content over functionality (e.g.,...
Hi,
I am sending the echo to mail function via PHP from variable that includes HTML code. The strange thing is, that this
<����}im�
shows up AFTER the string.. but I do not manipulate with it anymore. The charset of mail function (the attachment) is same as charset of HTML code.
...
Hello,
I have a class which has a private member $content. This is wrapped by a get-method:
class ContentHolder
{
private $content;
public function __construct()
{
$this->content = "";
}
public function getContent()
{
return $this->content;
}
}
$c = new ContentHolder();
$foo = array();
$foo[...
We have some integer arithmetic which for historical reasons has to work the same on PHP as it does in a few statically typed languages. Since we last upgraded PHP the behavior for overflowing integers has changed. Basically we are using following formula:
function f($x1, $x2, $x3, $x4)
{
return (($x1 + $x2) ^ $x3) + $x4;
}
Howev...
I am working on my website, and I am trying to get the url parameter "page" which is an integer that tells which entry to read in the MySQL database that hols the HTML for all the pages. Here is my code, with the MySQL username and password removed for security reasons:
if ($_GET["page"]) {
$con = mysql_connect("localhost","username...
Hi, how do I get information about a photo like the author, the license using PHP?
...
hi, I am running a site about PHP Frameworks, but I can't find a exact definition for it, and I am always thinking a question, how to make out a good PHP framework? Features? Manual? Efficiency? Or something?
I want to know your point.
thanks.
wood
...
for example
<script type="text/javascript" src="assets/scripts/somescript.php"></script>
will my browser still cache this just by not setting this scripts headers meta tag cache to must-revalidate?
...
In a PHP application I am writing, I would like to have users enter in text a mix of HTML and text with pointed-brackets, but when I display this text, I want to let the HTML tags be rendered by the non-HTML tags be shown literary, e.g. a user should be able to enter:
<b> 5 > 3 = true</b>
when displayed, the user should see:
5 > 3 = ...