Skip to content

Instantly share code, notes, and snippets.

View aligundogdu's full-sized avatar

Ali GÜNDOĞDU aligundogdu

View GitHub Profile
<VirtualHost *:80>
ServerName zaa.dev
## Vhost docroot
DocumentRoot "/var/www/zaa/public"
## Directories, there should at least be a declaration for /var/www/veteriner/
public
<?php
/*
* (c) Mark Badolato <mbadolato@gmail.com>
*
* This content is released under the {@link http://www.opensource.org/licenses/MIT MIT License.}
*/
namespace Bado\ScoreCalculator;
was just looking into how to solve this same problem, but I also want my function to create a token that can be used for password retrieval as well. This means that I need to limit the ability of the token to be guessed. Because uniqid is based on the time, and according to php.net "the return value is little different from microtime()", uniqid does not meet the criteria. PHP recommends using openssl_random_pseudo_bytes() instead to generate cryptographically secure tokens.
A quick, short and to the point answer is:
bin2hex(openssl_random_pseudo_bytes($bits))
which will generate a random string of alphanumeric characters of length = $bits * 2. Unfortunately this only has an alphabet of [a-f][0-9], but it works.
Below is the strongest function I could make that satisfies the criteria (This is an implemented version of Erik's answer).
function crypto_rand_secure($min, $max) {
$range = $max - $min;
<?php
$metin = "{{<strong>selami</strong><br/>}}askldjakldjadkljas{{şahin}}"; //İlk Deneme
$metin = '{{</w:t></w:r><w:proofErr w:type="gramStart"/><w:r w:rsidR="00B01C59" w:rsidRPr="00B01C59"><w:t>Sinif.isim</w:t></w:r><w:proofErr w:type="gramEnd"/><w:r w:rsidR="00B01C59" w:rsidRPr="00B01C59"><w:t>}}'; //Orj
$metin = '{{isim}} {{</w:t></w:r><w:proofErr w:type="gramStart"/><w:r w:rsidR="00B01C59" w:rsidRPr="00B01C59"><w:t>Sinif.isim</w:t></w:r><w:proofErr w:type="gramEnd"/><w:r w:rsidR="00B01C59" w:rsidRPr="00B01C59"><w:t>}}'; //Son
echo $metin;
$metin = preg_replace('/<[^>]*>/', '', $metin); //Regex ile diret stip tags
preg_match_all("/\{\{(.*)\}\}/USi", $metin, $array);
print_r($array);
add_filter("the_title","mapStringConvert");
function mapStringConvert($url){
$s = array("&#215;","&#038;","×");
$d = array("x","&","X");
return str_replace($s,$d,$url);
}
function mapStringConvert($url){
$s = array("&#215;","&#038;");
$d = array("x","&");
return str_replace($s,$d,$url);
}
$dm = $this->get('doctrine_mongodb')->getManager();
$product = $dm->getRepository('AcmeStoreBundle:Zips')->find('526b80de20de4cbaa60c9946');
print_r($product);
<body>
<div>
<ul class='bir'>
<li>
<a href='' class='deneme'>Test</a>
</li>
<li class='aktif'>
<a href='' class='aikin'>Test</a>
</li>
</ul>
$arrays[] = $column1;
$arrays[] = $column2;
$arrays[] = $column3;
$arrays[] = $column4;
$return = array();
for($x=0;$x<3;$x++){
for($y=0;$y<4;$y++){
server {
listen 80; ## listen for ipv4; this line is default and implied
server_name .siteadi.com;
if ($host == 'www.siteadi.com' ) {
rewrite ^/(.*)$ http://siteadi.com/$1 permanent;
}
root /var/www/siteadi.com;