F@H: PHP / MySql programmer help appreciated

Soldato
Joined
18 Oct 2002
Posts
10,573
Location
Seattle
I'm a numpty, completely and utterly. I fudge my way through php / mysql learning commands as necessary to tweak existing scripts. What I'm not good at is actually writing programs from scratch / designing programs from scratch. I thought I'd query here as its a much more interested market.
Something I've been pondering for quite a few months now is an automated way of producing the same (or 99%) of the stats that go into the weekly F@H stats.

In theory this should be simple.

Every couple of hours or so my server grabs

http://vspx27.stanford.edu/teamstats/team10.txt

then clears the db:
Code:
$sql = 'DELETE FROM `fah`';
$result = mysql_query($sql);

$sql = 'DELETE FROM `teamrank`';
$result = mysql_query($sql);

and then explodes the text file (stored as $fp)
Code:
/* Take the rank and insert it into a seperate table in the DB */
$teampos = $fp[6];
$pieces = explode (" ",$teampos);
$query = "INSERT INTO `teamrank` (`rank`) VALUES ('".$pieces[2]."')";
$result = mysql_query($query);

/* Grab all the user data from the source and put it into a table */
$number_of_lines = count($fp);
for ($i=10; $i<$number_of_lines; $i++)
        {
        //split up each line
        $line = explode( "\t", $fp[$i]);
        $query = "INSERT INTO `fah` (`rank`, `teamrank`, `name`, `credit`, `total`, `workunits`) VALUES ('".$line$
        $result = mysql_query($query);
        }
?>


If there is anyone with good php / mysql skills around and fancies having a stab, I'm confident this should be easy to achieve, and just as easy to make the output bbcode friendly too :)
 
My PHP knowledge is extremely poor, but I could do it in C# or god fobid Delphi. Don't see that it would need to be written in php or mysql.

Might have a go over Christmas if I get bored.

Whoever would be having a go, you'd need to sort out (probably with Rich) exactly what you wanted it to do.

// EDIT // Looking at Berserker's work though, I think he'd do a better job :o
 
Last edited:
Seti team is doing well. Somebody should make this forum more seti-friendly, at the moment it's all folding. Or get the seti-ers folding, I don't mind :p Nice work anyway.
 
A.N.Other said:
Whoever would be having a go, you'd need to sort out (probably with Rich) exactly what you wanted it to do.
There's not a lot to it really - the hard bit is knowing how to make a program to do it for you
Must admit to being a complete n00b when it comes to starting this sort of thing from the ground up - I'm not too bad with existing systems :o
 
joeyjojo said:
Seti team is doing well. Somebody should make this forum more seti-friendly, at the moment it's all folding. Or get the seti-ers folding, I don't mind :p Nice work anyway.

Well this page still works.
Unfortunately two of those projects have fallen out of favour.
I don't know how hard it would be to update it to show things like Einstein and Rosetta.
I'm having grand schemes for Boinc rotating sigs now which I'm, completely unable to make reality since my knowledge of PHP is the same as my folding output. :o ;)
 
Pumpkinstew said:
I'm having grand schemes for Boinc rotating sigs now which I'm, completely unable to make reality since my knowledge of PHP is the same as my folding output. :o ;)
Rotating sigs are easy - there's a guide about it somewhere on these forums
All you need then is some images and a webserver and you're sorted :)
 
rich99million said:
Rotating sigs are easy - there's a guide about it somewhere on these forums
All you need then is some images and a webserver and you're sorted :)

I can do the rotating sig bit it's having the stats from boinc projects update live onto each one that's awkward.

ie rotates through Seti Sig>Einstein Sig>Rosetta Sig>LHC Sig etc

EDIT: Jesus Rich! How did you post that reply within a minute? :eek:
 
Pumpkinstew said:
I can do the rotating sig bit it's having the stats from boinc projects update live onto each one that's awkward.

ie rotates through Seti Sig>Einstein Sig>Rosetta Sig>LHC Sig etc
ahhh right - well that would be a fair bit harder I would imagine :o

Pumpkinstew said:
EDIT: Jesus Rich! How did you post that reply within a minute? :eek:
Answered your own question? :p
 
Pumpkinstew said:
I can do the rotating sig bit it's having the stats from boinc projects update live onto each one that's awkward.

ie rotates through Seti Sig>Einstein Sig>Rosetta Sig>LHC Sig etc

Hmm..

Code:
<?php
srand((double)microtime()*10000000);
$dir = 'images';
$h = opendir($dir);
while($f = readdir($h))
        if(!is_dir($dir.'/'.$f))
                $imgs[count($imgs)] = $f;
header('Location: '.$dir.'/'.$imgs[array_rand($imgs)]);
?>
]);
?>

Thats all my rotating sig is. In theory it should be easy to have that read in a random script from a subfolder, which in turn will do the necessary jiggery pokery to return the relevant stats / image.
 
I too would be interested in helping. However I should make it clear that much like Garp describes himself I have very little PHP experience and bodge my way through things. FAHStat is pretty much the only thing I've ever achieved and I'm surprised I managed it. I've never used MySQL but am very willing to learn.

So if I can be of any use I'm very glad to help. I've actually been meaning to overhaul FAHStat for a long time now but just never got around to it, so instead this sounds like a good project.

null :)
 
Pumpkinstew said:
I can do the rotating sig bit it's having the stats from boinc projects update live onto each one that's awkward.

ie rotates through Seti Sig>Einstein Sig>Rosetta Sig>LHC Sig etc
Just finished doing a bit of tidying up of my sig generator (FAHSTat) and to finish up decided to make myself a sig rotater (actually its random not a rotation). Thought I would post the code here incase it's of any use. It's really simple too :)
Code:
<?php

$locations = array("http://fahstat.piggott.me.uk/?mode=user&gen_uid=piggott&gen_canvas=protein2.jpg", "http://fahstat.piggott.me.uk/?mode=user&urnk_font=Alien-Encounters-Solid-Regular.ttf&urnk_size=12&urnk_x=260&urnk_y=45&unm_en=0&pts_font=Alien-Encounters-Solid-Regular.ttf&pts_size=12&pts_x=260&pts_y=25&wus_en=0&tpts_en=0&twus_en=0&trnk_en=0&avg_font=Alien-Encounters-Solid-Regular.ttf&avg_size=12&avg_x=260&avg_y=65&gen_uid=piggott&gen_qual=90&gen_canvas=piggot-ocuk-blank.jpg");

$key = array_rand($locations);
readfile($locations[$key]);

?>
or click http://venus.piggott.me.uk/ocuk/rotate.phps.

null :)
 
Last edited:
Pumpkinstew said:
Well this page still works.
Unfortunately two of those projects have fallen out of favour.
I don't know how hard it would be to update it to show things like Einstein and Rosetta.
I'm having grand schemes for Boinc rotating sigs now which I'm, completely unable to make reality since my knowledge of PHP is the same as my folding output. :o ;)
Lots and lots and lots. I can add the other two projects that have stats, but that's it.

For now anyway. I too have grand schemes, but they've been on hold for about the last 12 months. :/
 
Berserker said:
Lots and lots and lots. I can add the other two projects that have stats, but that's it.

For now anyway. I too have grand schemes, but they've been on hold for about the last 12 months. :/

The other two would be BURP and Einstein?
That would be cool actually as most of my points are in Einstein. The only missing project would then be Rosetta.

A little Christmas present to us Boincers Mr Berserker? :)
And thanks for all the other useful bits of script above everyone.

Remember: The swisher the sig, the bigger the pimp. ;) :D
 
Back
Top Bottom