GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Anyone know of a PHP script that does this? (https://gfy.com/showthread.php?t=1069147)

$5 submissions 05-23-2012 05:37 PM

Anyone know of a PHP script that does this?
 
You put it on your Forum signature (VB) and it randomly pulls titles from your blog. it is clickable.

Thanks in advance

pornmasta 05-23-2012 05:49 PM

the forum needs to allow links that generate dynamically code (i wouldn't).

With a picture (.jpg for example) and an url rewrite you can call a picture and you can generate it dynamically, but nothing more.
If the forum allows swf sig, it is possible

notjoe 05-23-2012 05:51 PM

Quote:

Originally Posted by $5 submissions (Post 18962160)
You put it on your Forum signature (VB) and it randomly pulls titles from your blog. it is clickable.

Thanks in advance

Create a script that generates an image and sets a cookie on the surfer's computer. Have that image linked to another script that will read the cookie to figure out what post it is and send the surfer to the blog post. It's not exactly what you were looking for but it'll work.

pornmasta 05-23-2012 05:54 PM

Quote:

Originally Posted by notjoe (Post 18962171)
Create a script that generates an image and sets a cookie on the surfer's computer. Have that image linked to another script that will read the cookie to figure out what post it is and send the surfer to the blog post. It's not exactly what you were looking for but it'll work.

good idea.
But one link per picture

sarettah 05-23-2012 05:56 PM

Quote:

Originally Posted by $5 submissions (Post 18962160)
You put it on your Forum signature (VB) and it randomly pulls titles from your blog. it is clickable.

Thanks in advance

I have stuff that can do that. Not using it to pull titles from blogs per se, just from a list of phrases. But if it was had acces to the bog db then real easy to pull titles. If no access, harder, but still doable.



.

$5 submissions 05-23-2012 06:21 PM

The mainstream wm forum dp has this feature but it does not RANDOMLY pull posts from your blog

sarettah 05-23-2012 06:36 PM

Quote:

Originally Posted by $5 submissions (Post 18962198)
The mainstream wm forum dp has this feature but it does not RANDOMLY pull posts from your blog

I just switched out my sig to point at my little rotator script. I haven't made it clickable because I need to go look at code I haven't used in a while before I do that, but I can make it clickable.

I think Smokey might have some similar stuff. I know he was messing with the same technique about the same time I was playing with it a lot.

.

potter 05-23-2012 07:10 PM

Quote:

Originally Posted by $5 submissions (Post 18962198)
The mainstream wm forum dp has this feature but it does not RANDOMLY pull posts from your blog

Doesn't really matter where it pulls them from. You just need to write a small secondary script to create a similar file/database to the one it currently pulls from, and then have the script pull from that new file/database.

sarettah 05-23-2012 07:37 PM

Mine is now pulling from one of my blogs. Took about 10 minutes to switch around, mostly turning off code ;p

I will make it clickable/trackable later on or tomorrow.


.

sarettah 05-23-2012 07:59 PM

Quote:

Originally Posted by notjoe (Post 18962171)
Create a script that generates an image and sets a cookie on the surfer's computer. Have that image linked to another script that will read the cookie to figure out what post it is and send the surfer to the blog post. It's not exactly what you were looking for but it'll work.

Problem there is unless it is your own forum and you are running the scripts there, then you are dealing with third party cookie shit. You can't set a cookie from an image generation type script unless it is on the same domain.

I looked at registering third party cookies a while back. Looked like a pain in the ass to me so I didn't go that route.

Easiest way is just to send them to whichever one was the last one you displayed. It is not a00% accurate but a hell of a lot easier ;p

btw, the sig is cliskable now.

.

sarettah 05-23-2012 08:38 PM

Just reading back through this and I find I need to apologize for all my typos, I am actually literate to a certain extent. lol.

Typing fast on my laptop kb does not work well.



.

$5 submissions 05-23-2012 09:00 PM

Sarettah

I need text, not an image. Nice script by the way

sarettah 05-23-2012 09:07 PM

Quote:

Originally Posted by $5 submissions (Post 18962355)
Sarettah

I need text, not an image. Nice script by the way

You can only do that if you have control of the forum code itself, or I guess if they would let you put an iframe in your sig.

No way that I have ever figured out to inject text into a page from outside.

As far as I have been able to figure, from outside the forum the best you can do is a clickable image.

Now, if it is your own forum it would be extremely simple to hard code a routine in if there isn't a plugin to handle it already,

.

d-null 05-23-2012 09:58 PM

I'm thinking that there is a way you could fudge this together using imagemagick :2 cents:

sarettah 05-23-2012 10:45 PM

Quote:

Originally Posted by sarettah (Post 18962297)
Easiest way is just to send them to whichever one was the last one you displayed. It is not a00% accurate but a hell of a lot easier ;p

btw, the sig is cliskable now.

.


The sig is now keeping track by ip and refer string of what image was last seen and then grabbing the associated url for the redirect.

Won't be perfect because of dynamic ip schemes and proxies but it should be pretty close ;p

.

$5 submissions 05-23-2012 11:33 PM

Sarettah, does your script handle different FONTs and COLORs?

pornmasta 05-24-2012 06:03 AM

i learn stuff everyday

Oracle Porn 05-24-2012 06:47 AM

nice sig sarettah

now give up the code please :)

sarettah 05-24-2012 07:53 AM

Quote:

Originally Posted by Oracle Porn (Post 18962874)
nice sig sarettah

now give up the code please :)

Thanx.

lol. Considering it.

It is a project (have actual domains for it and everything) that I started on 5 years ago and then shelved with the full intent of getting back to it.

It was not shelved for lack of interest but rather because of lack of income. I could finish it and maybe have something to sell and maybe make enough money or I could do outside contracting and definitely make enough money. I chose the sure thing.

But ya know how that goes.

So, right now (last night I spent an hour or so reviewing my code) I do NOT have a fully functioning user control panel for it yet. I have a 75% one but that doesn't really help much.

I also have the blog pull just slammed in there, that would need to be dynamic so you could point it at various blogs etc.

To the question can I do different fonts, colors? yep. You can control the foreground color, background color. I do not have it set up to use multiple foreground colors but that is possible I believe. The fonts are pulled from a font folder on my server. I loaded it up with a bunch of fonts that someone was passing around back then. A zip full of free/public domain (supposedly) fonts, mainly ttf. I say supposedly because there are tons of what are supposed to be free fonts out there that when you check them they are not actullay free. Since I support copyrights I would not distribute the fonts I have with the code. But since the program reads the fonts directory for the selection it offers up you just need to go find your own set of ttf fonts.

Reading back on that, god I suck at typing and I don't even have my laptop keyboard to blame this time. So, sorry again for the typos but I ain't going back and fixing them this time.

;p

.

sarettah 05-27-2012 01:47 PM

Ok, you need a folder for the make sigs script. This folder has htaccess that redirects any .jpg or .gif call to the make sigs program.

So htaccess looks something like this:

AuthUserFile /dev/null
AuthGroupFile /dev/null

RewriteEngine On

ReWriteRule .*\.(jpg|gif)$ http://www.domain_installed_on/sigs/make_sig.php [R,L]

Then I have a config file for the hook ups to the database and some other stuff:

<?php

function hookitup()
{

// full server path to ttf font library
$font_path='/home/xxxxxxxx/ttffonts/';

// font name to use for sig
$font_name='Loungy.ttf';

//font size to use for sig
$font_size='18';

// name of blog being pulled from
$blog_name='yourblogname.com';

// put mysql credentials necessary for your main database here

$main_host='xxxxxxxx';
$main_user='xxxxxxx';
$main_pass='xxxxxx';
$main_dbname='xxxxxxx';

// put mysql credentials necessary for your blog database here

$blog_host='xxxxxxxxx';
$blog_user='xxxxxxxx';
$blog_pass='xxxxxxxxxx';
$blog_dbname='xxxxxxxxx';

$maindb = mysql_pconnect($main_host,$main_user,$main_pass);
if(!$maindb)
{
die("could not hook up to the main database");
}
if($main_host==$blog_host && $main_user==$blog_user && $main_pass==$blog_pass)
{
// if all data is in one db then use the same connection

$blogdb=$maindb;
}
else
{
// if data is in different dbs then we need 2 connections
$blogdb = mysql_pconnect($blog_host,$blog_user,$blog_pass);
if(!$blogdb)
{
die("could not hook up to the blog database");
}
}

$returnit=array(
"maindb"=>$maindb,
"blogdb"=>$blogdb,
"main_dbname"=>$main_dbname,
"blog_dbname"=>$blog_dbname,
"font_path"=>$font_path,
"font_name"=>$font_name,
"font_size"=>$font_size,
"blog_name"=>$blog_name
);

return $returnit;
}
?>

Then there is the make_sigs script (please not that I have some hardcodes in there for gfy, these were dynamic but I hardcoded the changes I made a few days ago for the blog pull in and demo and I have not gotten back to changing it up:

<?php
error_reporting(0);

$ip2use=$_SERVER['REMOTE_ADDR'];
if(!isset($_SERVER['HTTP_REFERER']))
{
$refer2use='';
}
else
{
$refer2use=mysql_real_escape_string($_SERVER['HTTP_REFERER']);
}

require_once('../sig_config.php');

$dblist=hookitup();

$maindb=$dblist['maindb'];
$blogdb=$dblist['blogdb'];
$maindbname=$dblist['main_dbname'];
$blogdbname=$dblist['blog_dbname'];
$fontpath=$dblist['font_path'];
$fontname=$fontpath . $dblist['font_name'];
$fontsize=$dblist['font_size'];
$blogname=$dblist['blog_name'];

// This assumes the blog is WP and the posts table is wp_posts
$sql_str="select id, post_title from " . $blogdbname . ".wp_posts order by rand() limit 1 ";
$result = mysql_query($sql_str,$blogdb);
//echo "result=" . $result . "<br>";
$blog=mysql_fetch_array($result);
$id2use=$blog['id'];

// mod to handle blogs. Not bringing in multi lines from blog database
$numlines=1;

$lines=array();

$sql_str="select * from " . $maindbname . ".sig_track where ";
$sql_str .="ip='" . $ip2use . "' ";
$sql_str .="and refer='" . $refer2use . "' ";
$result=mysql_query($sql_str,$maindb);
//echo "sql=" . $sql_str . "<br>";
//echo "result - pull from sig_track=" . $result . "<br>";
if($result)
{
if(mysql_num_rows($result)>0)
{
$sql_str="update " . $maindbname . ".sig_track set currid='" . $id2use . "' where ";
$sql_str .="ip='" . $ip2use . "' ";
$sql_str .="and refer='" . $refer2use . "' ";
$result=mysql_query($sql_str,$maindb);
//echo "result - update sig_track=" . $result . "<br>";
}
else
{
$sql_str="insert into " . $maindbname . ".sig_track(ip, refer, currid) values(";
$sql_str .="'" . $ip2use . "', ";
$sql_str .="'" . $refer2use . "',";
$sql_str .="'" . $id2use . "')";
$result=mysql_query($sql_str,$maindb);
//echo "result - insert into sig_track=" . $result . "<br>";
}
}

$sql_str="update " . $maindbname . ".currentid set currid='" . $id2use . "'";
$result = mysql_query($sql_str,$maindb);

$line2use=$blogname . ' - ' . $blog['post_title'];
$lines[1]=$line2use;

$lines2use=1;

$imwidth=0;
$imheight=0;

// should be reading this in from table for gfy make 900
$width2use=900;

// hardcode for gfy
$maxwidth=900;
//$maxwidth=0;

$maxheight=0;
$outstr='';

$linechk=imagettfbbox($fontsize,0,$fontname, 'test');
$height2use=($linechk[1] - $linechk[7]) + 5;

for($linecnt=1;$linecnt<=$numlines;$linecnt++)
{
$workstr=$lines[$linecnt];
if (strlen($lines[$linecnt])>0)
{
$linechk=imagettfbbox($fontsize,0,$fontname, $lines[$linecnt]);
$currwidth=$linechk[2] - $linechk[0];
$parts=0;
$breakit=0;
$breaklen=0;
$holdstr='';
if($currwidth>$width2use and strlen($workstr)>0)
{
$parts=intval($currwidth/$width2use);
if (($currwidth/$width2use-$parts)>0)
{
$parts=$parts + 1;
}
}
if($parts>0)
{
$holdstr='';
$lines2use=$parts;
$breakit=$parts;
$chklen=strlen($workstr);
while($breakit>0)
{
$linechk=imagettfbbox($fontsize,0,$fontname, $workstr);
$breaklen=$linechk[2] - $linechk[0];
if($breaklen>$width2use)
{
while($breaklen>$width2use)
{
$chklen=$chklen-1;
$strtochk=substr($workstr,0,$chklen);
$linechk=imagettfbbox($fontsize,0,$fontname, $strtochk);
$breaklen=$linechk[2] - $linechk[0];
}
$currwidth=$breaklen;
$newlen=intval($chklen);
$testchar=substr($workstr,$newlen,1);
if($testchar<>' ')
{
while($testchar<>' ')
{
$newlen=$newlen-1;
$testchar=substr($workstr,$newlen,1);
}
}
$holdstr=$holdstr . substr($workstr,0,$newlen);
$workstr=trim(substr($workstr,$newlen));
$holdstr=$holdstr . chr(13) . chr(10);
$lines2use=$lines2use + 1;
$breakit=$breakit-1;
}
else
{
$breakit=$breakit-1;
}
}

$workstr=$holdstr . $workstr;
$maxheight=$maxheight + ($lines2use * $height2use);
}
else
{
$lines2use=$lines2use+1;
$maxheight=$maxheight + $height2use + 5;
}

if($currwidth>$maxwidth)
{
$maxwidth=$currwidth;
}
}
else
{
$lines2use=$lines2use+1;
$maxheight=$maxheight + $height2use + 5;
}
$outstr=$outstr . $workstr . chr(13) . chr(10);
}

//$maxwidth=$maxwidth+25;

header ("Content-type: image/gif");
$im = imagecreate ($maxwidth, $maxheight);

// hardcoded colors for gfy
$background = imagecolorallocate ($im, 51, 51, 51);
$foreground = imagecolorallocate ($im, 255, 255, 255);
imagettftext ($im, $fontsize, 0, 5, 20, $foreground, $fontname, $outstr);
imagegif ($im);
imagedestroy ($im);

?>


Database tables I am using:

--
-- Table structure for table `currentid`
--

CREATE TABLE IF NOT EXISTS `currentid` (
`currid` char(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


--
-- Table structure for table `sig_track`
--

CREATE TABLE IF NOT EXISTS `sig_track` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ip` char(15) NOT NULL,
`refer` varchar(254) NOT NULL,
`currid` char(10) NOT NULL,
PRIMARY KEY (`id`),
KEY `ip` (`ip`,`refer`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1102 ;



I think that does it.

Enjoy :thumbsup




.

PMProducoes 05-27-2012 01:58 PM

sarettah
:2 cents::2 cents::2 cents::2 cents:

not going to use it...
but your action deserves some :2 cents:

sarettah 05-27-2012 02:13 PM

Quote:

Originally Posted by PMProducoes (Post 18967798)
sarettah
:2 cents::2 cents::2 cents::2 cents:

not going to use it...
but your action deserves some :2 cents:

Wow, 8 cents? I'm agoin to the casino tonight :thumbsup




j/k, thanx

.

sarettah 05-27-2012 03:02 PM

Fuck, I just realized that there is one more piece that I di not put up there.
The clicksig piece is the piece that handles when the sig is clicked on and redirects it to the right url for the image they are on.

The clicksig piece:

<?php

$id2use='';
$url2use='';

$ip2use=$_SERVER['REMOTE_ADDR'];
if(!isset($_SERVER['HTTP_REFERER']))
{
$refer2use='';
}
else
{
$refer2use=mysql_real_escape_string($_SERVER['HTTP_REFERER']);
}

require_once('sig_config.php');

$dblist=hookitup();
$maindb=$dblist['maindb'];
$maindbname=$dblist['main_dbname'];

$sql_str="select * from " . $maindbname . ".sig_track where ";
$sql_str .="ip='" . $ip2use . "' ";
$sql_str .="and refer='" . $refer2use . "' ";
$result=mysql_query($sql_str,$maindb);
if($result)
{
if(mysql_num_rows($result)>0)
{
$work=mysql_fetch_array($result);
$id2use=$work['currid'];
}
else
{
$sql_str="select currid from " . $maindbname . ".currentid";
$result = mysql_query($sql_str,$db);
if($result)
{
$idrow=mysql_fetch_array($result);
$id2use=$idrow['currid'];
}
}
}

if(!empty($id2use))
{
$url2use="http://your_base_wp_singlepost_url_here/p=" . $id2use;
}
else
{
$url2use="http://your_default_url_here";
}

Header("Location: " . $url2use);

?>

sarettah 05-27-2012 03:04 PM

To put it together where you want to use it.

href or url tag = your_domain_url.com/clicksig.php
img src or img tag = your_domain_url.com/sigs/any_old_name_will_do.jpg

georgeyw 05-27-2012 03:57 PM

You realise that op is going to use this to spam links and sell as a "service" to people?

woj 05-27-2012 04:13 PM

you just need the script login to the board, and change the sig... not exactly rocket science... :2 cents:

If you are looking to invest a few bucks for this technology, hit me up, icq: 3337524

raymor 05-27-2012 04:22 PM

Quote:

AuthUserFile /dev/null
AuthGroupFile /dev/null
RewriteEngine On
ReWriteRule .*\.(jpg|gif)$ http:// www.domain_installed_on/sigs/ make_sig.php [R,L]
FYI there's no need to set the null password and group files. Those two lines are better left off.

$5 submissions 05-27-2012 06:59 PM

Thanks, Sarettah


All times are GMT -7. The time now is 05:56 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123