Skip to content

Instantly share code, notes, and snippets.

@titomus
titomus / redirect.php
Created February 13, 2022 11:01
Redirection PHP
<?php
header("Status: 301 Moved Permanently", false, 301);
header("Location: http://www.exemple.net/repertoire/page.php");
exit();
@titomus
titomus / name-to-url.php
Created February 13, 2022 11:03
Seo name to url
function seo_name($title) {
return preg_replace('/[^a-z0-9_-]/i', '', strtolower(str_replace(' ', '-', trim($title))));
}
@titomus
titomus / breadcrumbs-wordpress.php
Last active February 13, 2022 10:52
breadcrumbs Wordpress
<?php
/*=============================================
= BREADCRUMBS =
=============================================*/
// to include in functions.php
function the_breadcrumb() {
$sep = ' > ';
@titomus
titomus / male-alpha.html
Last active September 25, 2018 12:27
Psychologie du mâle Alpha - code formulaire
<form action="http://le-saint-homme.fr/wp-comments-post.php" method="post" id="commentform" class="comment-form" novalidate="">
<p class="comment-form-comment">
<label for="comment">Commentaire</label>
<textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" required="required"></textarea></p><p class="form-submit"><input name="submit" type="submit" id="submit" class="submit" value="Laisser un commentaire"> <input type="hidden" name="comment_post_ID" value="116" id="comment_post_ID">
<input type="hidden" name="comment_parent" id="comment_parent" value="0">
</p><input type="hidden" id="_wp_unfiltered_html_comment_disabled" name="_wp_unfiltered_html_comment" value=""><script>(function(){if(window===window.parent){document.getElementById('_wp_unfiltered_html_comment_disabled').name='_wp_unfiltered_html_comment';}})();</script>
</form>
@titomus
titomus / fake-df.php
Created August 10, 2017 07:46
Fake Dofollow
<?php
function fake_df(){
header("X-Robots-Tag: nofollow", true);
}
// utilisation (ATTENTION: à utiliser avant affichage de la page sinon ERROR)
fake_df
<?php
/*
--------------------------------------------
$title contains the title of the page you're sending
$url is the url of the page
$debug true print out the debug and show xml call and answer
--------------------------------------------
the output is an array with two elements:
status: ok / ko
msg: the text response from pingomatic
@titomus
titomus / scrape-links.php
Created August 10, 2017 07:26
Récupérer les liens présents sur une page
@titomus
titomus / get_site_kw.php
Last active August 10, 2017 07:24
Récupérer les mots clés d'un site web via sa balise meta keywords
<?php
function get_site_kw($url){
$meta = get_meta_tags($url);
$keywords = $meta['keywords'];
$keywords = @explode(',', $keywords );
$keywords = array_map( 'trim', $keywords );
$keywords = array_filter( $keywords );
return $keywords;
@titomus
titomus / racine-referer.php
Created August 10, 2017 07:19
Récupérer la racine du referer
<?php
function racine_referer()
{
if (!isset($_SERVER['HTTP_REFERER'])){
return false;
}else{
$parser_url = parse_url(trim($_SERVER['HTTP_REFERER']));
return trim($parser_url[host] ? $parser_url[host] : array_shift(explode('/', $parser_url[path], 2)));
}
}
@titomus
titomus / is_bot.php
Created August 10, 2017 07:11
Detecter les crawlers des moteurs de recherche
<?php
/**
* Is_bot
* traque la présence d'un bot par plage d'ip
*
* @param string $ip
* @param array $array_bots
* @return string|false
*/