Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by ignace

  1. In a terminal type: $ sudo nano /etc/hostsThis is something that isn't normally there and is a technique employed when using one of their products illegally. Removing the rule means your adobe products will stop working.
  2. Use mysql workbench to sync your database. MySQL Workbench Tutorial
  3. English please. And what exactly is the problem?
  4. Since it a SEO heavy website it's best to separate route from the controller otherwise you'll be renaming your controllers alot. Using silex or some other framework: $silex->get('/Home', function() { .. }) ->get('/PropertyOwner/OwnerFaq', function() { .. });
  5. You come here for help and when people give it, you tell them they are wrong while in fact they are correct. Fuck off!
  6. That's correct. Of course there are some things to consider when doing this, like you should block all incoming traffic and refer them to a maintenance page. You should keep track of changed files and the changes to the database should be possible to be reversed. So it's best to leave the decision of updating to the user and deleting database fields should be avoided.
  7. Put the file under the webroot. PHP can still read/write it, but you can't request it through a browser.
  8. Same as topic: http://forums.phpfreaks.com/topic/283709-my-first-class/?do=findComment&comment=1457483 with the same answer.. If you are going to use objects at least learn to use them properly: $cheeseMen = new TrainSloppyCheeseMen($amount); $cheeseMen->getTurns();Where getTurns contains your switch code and operates on $this->amount
  9. Try out our beta testing section, provide the link, an owner verification link, and a user/pass to play with, a lot of members here are quite good at finding exploits/breaking things.
  10. The X-Requested-With is send by all popular javascript libraries. Put it in comments and it would still have the same effect.
  11. https://github.com/geocoder-php/Geocoder Simply chain Google, Yahoo, MapQuest, OpenStreetMaps, etc.. If you hit your limit, it simply selects the next one in the chain.
  12. Basically your script would call a script on your server, passing the version number. Something like: $latest_version = file_get_contents('http://yourdomain.top/get-latest-version.php?version=' . $current_version); switch (version_compare($latest_version, $current_version)) { case 0: // equal echo 'You have the latest version'; break; case 1: // newer echo 'Update to version ' . $latest_version; break; }To get the update patch is a little more difficult. Assuming you use git and tag your releases with the version numbers you can: $version = $_GET['from_version']; $filename = $_GET['filename']; // validate $version and $filename exec('git diff --name-only ' . $version . ' HEAD', $output); // iterate over $output to get all $changed_files $temp = tempnam('/tmp', 'zip_'); $zip = new ZipArchive(); if ($zip->open($temp)) { foreach ($changed_files as $file) { $zip->addLocalFile($file); } $zip->close(); } // send it as a download header('Cache-Control: private'); header('Content-Disposition: attachment; filename=' . $filename . '.zip'); header('Content-Type: application/octet-stream'); header('Content-Length: ' . filesize($tempnam)); header('Content-Transfer-Encoding: binary'); readfile($tempnam);The calling script then unzips the file and overwrites all files. Updating the database is a little more tricky. Your script would need to know how the database "should" look to be able to generate the alter table statements, you can do this using Doctrine's DBAL which allows you to define your tables in PHP code and then run a diff against the actual database to get the needed changes or you can try write it yourself: $tables = array( 'table1' => array( 'fields' => array( 'field1' => array('mysql' => 'INTEGER UNSIGNED NOT NULL AUTO_INCREMENT', 'sqlite' => '..', ..), .. ), 'indexes' => array( 'index1' => array('..') ), ), 'table2' => array( .. ) );then iterate over each table, does it exist? if not, create the table and the fields and it's indexes otherwise iterate over all fields and indexes. If you come across a field that does not exist in the fields array then delete it, if the field is not in the database, create it, if it exists check if the definition matches. update if it doesnt.
  13. Reformatted your code and corrected the misspelled reflector instances. $csLength = 110; $cs = range(1, $csLength); $reflectorIn = range(1, $csLength); $reflectorOut = range(1, $csLength); shuffle($cs); shuffle($reflectorIn); shuffle($reflectorOut); function generateReflector() { global $reflectorIn, $reflectorOut; $resultOut = array(); for ($i = 0; $i < count($reflectorIn); $i++) { testOutput($i, $reflectorOut[$i]); } for ($i = 0; $i < count($reflectorIn); $i += 2) { array_push($resultOut, $reflectorOut[$i] . "," . $reflectorOut[$i + 1]); } echo "<br />Input: \n"; for ($i = 0; $i < count($reflectorIn); $i++) { echo "<item>" . $reflectorIn[$i] . "</item>\n"; } echo "<br />Output: \n"; for ($i = 0; $i < count($resultOut); $i++) { echo "<item>" . $resultOut[$i] . "</item>\n"; } } function testOutput($currentPosition, $currentValue) { global $reflectorIn, $reflectorOut; if ($currentPosition != 0) { if ($reflectorIn[$currentPosition - 1] == $currentValue) { swapOutput($currentPosition, $currentValue); } } if ($currentPosition < count($reflectorOut)) { if ($reflectorIn[$currentPosition + 1] == $currentValue) { swapOutput($currentPosition, $currentValue); } } if ($reflectorIn[$currentPosition] == $currentValue) { swapOutput($currentPosition, $currentValue); } } function swapOutput($currentPosition, $currentValue) { global $reflectorIn, $reflectorOut; $endSwap = false; while (!$endSwap) { $keys = array_rand($reflectorOut); $newKey = $keys[0]; $newValue = $reflectorOut[$newKey]; if ($newKey != 0) { if ($reflectorIn[$newKey - 1] == $currentValue) { continue; } if ($reflectorIn[$newKey - 1] == $newValue) { continue; } } else if ($newKey < count($reflectorOut)) { if ($reflectorIn[$newKey + 1] == $currentValue) { continue; } if ($reflectorIn[$newKey + 1] == $newValue) { continue; } } else if ($reflectorIn[$currentPosition] == $currentValue) { continue; } else { $reflectorOut[$newKey] = $currentValue; $reflectorOut[$currentPosition] = $newValue; break; } } }
  14. Inspect the form through your browser and copy what's in the action attribute. The form is probably using method="post" so you can mimic the form using curl: http://davidwalsh.name/curl-post Use a regex to get the cd-key from $result.
  15. You need JavaScript for this. <form action="" method="post"> <input type="button" name="button1" value="1" class="increase-value"> </form> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script> $('.increase-value').click(function() { var $this = $(this); $this.val(parseInt($this.val(), 10) + 1); alert($this.val()); }); </script>
  16. What is it exactly that you want to match? What is your current code? $regex = "/Let'?s all go on holiday (: )?America/i"; foreach (array("Let's all go on holiday : America", "Lets all go on holiday America") as $text) { if (preg_match($regex, $text, $matches)) { echo '<div style="color: green">' . $text . '</div>'; } else { echo '<div style="color: red">' . $text . '</div>'; } }
  17. $sql = 'SELECT QuestionId FROM Questions WHERE CategoryId = ?'; // prepare(), execute(), ... $questionIds = $statement->fetchAll(PDO::FETCH_COLUMN, 0); shuffle($questionIds); // store in session $_SESSION['question_ids'] = $questionIds; $_SESSION['question_pos'] = 0;
  18. You need strtr which does not have this problem since it does single-byte translations. $eng = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k' ,'l' ,'m', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'); $udc = array('u', 'd', 'c', 'b', 'o', 'h', 'g', 'f', 'i', 'n', 'm', 'l', 'k', 'j', 'e', 't', 's', 'r', 'q', 'p', 'a', 'z', 'y', 'x', 'w', 'v'); echo strtr('test', array_combine($eng, $udc));
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.