PDA

View Full Version : Rare Values Script



Invent
19-11-2007, 06:39 PM
Hi,

I know a few people on Habbo who want one of these, so I've decided to make a (quite) advanced Habbo Rare Values System.

The system will have all the basics you would imagine and it will be displayed in rows (like on Habbox).

If you have any ideas for the script, post them below.

Thanks!
Simon

P.S: I expect this to be done by the end of the week.

GoldenMerc
19-11-2007, 06:41 PM
Hover over,
So the manager can choose what it says,E.g This was released in 2003
Will this be free(Hopes not)

redtom
19-11-2007, 06:42 PM
POWERvalues!

Sorry had to say it, Goodluck, I think you'll do a great job.

Invent
19-11-2007, 06:45 PM
POWERvalues!

Sorry had to say it, Goodluck, I think you'll do a great job.Lol! :P


Hover over,
So the manager can choose what it says,E.g This was released in 2003
Will this be free(Hopes not)I'll have a form which will be used for Hover text :)
And yes, it will be free and open source!

OH and should I code this in Classes or just regular PHP? What would people prefer (bearing in mind you may want to tweak the panel).

GoldenMerc
19-11-2007, 06:50 PM
Please dont make it open source :'(
It just ruins it :[
I enjoy buying products that people have to put money into :(

craigg.
19-11-2007, 06:55 PM
I would use classes. Keep it classy! Ha! Get it?

It's a good thing you are releasing as opensource, gives others the opportunity to change the panel to suit their needs. I would still reserve some rights if I were you.

Invent
19-11-2007, 06:56 PM
I would still reserve some rights if I were you.

Of course ;)

Invent
19-11-2007, 07:21 PM
Just started the script.

Just done part of the SQL class.



<?php
/**
################################################## #####################
# Database Class - For use with RVS
################################################## #####################
# @copyright The original creator of this script (Invent!) reserves
# the right to be able to cease any use of this panel by
# anyone at any time. The copyright must also stay intact
# on every page the panel uses.
# @author Invent!/Simon Fletcher
# @version 1 (BETA)
################################################## #####################
**/

class db
{

var $hostname;
var $username;
var $password;
var $database;

/**
### Connection function
### This is used to check if the script can connect to the server and database, if it can it runs the next function, if it cant it dies.
**/

function startConnection()
{

if(empty($this->hostname) || empty($this->username) || empty($this->database))
{

die("You have not defined the required connection variables, see the readme for information on how to define them.");
exit;

}
else
{

$this->sqlConnect();

}

}

/**
### SQL Connect function
### This is used to connect to the SQL Server and Database if the variables are set and specified.
**/

function sqlConnect()
{

$connect = mysql_pconnect($this->hostname, $this->username, $this->password) or die("RVS could not connect to the MySQL Server using the specified details, MySQL says: ".mysql_error());

$select_db = mysql_select_db($this->database, $connect) or die("RVS could not tell MySQL to select the specified database, MySQL said: ".mysql_error());

}

/**
### Query function
### This is used to run SQL Queries throughout the system.
**/

function query( $query )
{

$query_action = mysql_query( $query ) or die("Could not perform SQL Query (".$query."), MySQL Said: ".mysql_error());

return $query_action;

}

/**
### Fetch function
### This is used to fetch information from a database by using a query variable.
**/

function fetch( $fetch, $assoc )
{

if($assoc == "yes")
{

## Associative array

$fetch_action = mysql_fetch_assoc( $fetch ) or die("Could not perform SQL Fetch, MySQL Said: ".mysql_error());

}
else
{

$fetch_action = mysql_fetch_array( $fetch ) or die("Could not perform SQL Fetch, MySQL Said: ".mysql_error());

}

return $fetch_action;

}

/**
### Num function
### This is used to get the amount of rows in an SQL Table by using a query variable.
**/

function num( $num )
{

$num_action = mysql_num_rows( $num) or die("Could not number SQL Rows, SQL Said: ".mysql_error());

return $num_action;

}

}

?>


:)!

Blob
19-11-2007, 07:30 PM
Simon, why do you put spaces after your brackets?

Invent
19-11-2007, 07:32 PM
I only use spaces in some circumstances, like in the bottom functions in the above Class.

I like using spaces as it makes variables more clearer which helps with debugging :)

Invent
19-11-2007, 07:55 PM
<?php
/**
################################################## #####################
# Miscellaneous Class - For use with RVS
################################################## #####################
# @copyright The original creator of this script (Invent!) reserves
# the right to be able to cease any use of this panel by
# anyone at any time. The copyright must also stay intact
# on every page the panel uses.
# @author Invent!/Simon Fletcher
# @version 1 (BETA)
################################################## #####################
**/

class misc
{

/**
### Print Headers function
### This is used to print all the information that goes in the <head> tags of any document.
**/

function printHeaders()
{

$db = new db; # Initializes the Database class for use with queries, etc.

$query = $db->query( "SELECT `head`, `meta`, `css`, `js` FROM `configuraton`" ); # Grabs all configuration data.

$fetch = $db->fetch( $query ); # Fetches the data found in the Query.

$returns .= $fetch["head"]; # Grabs header data such as DOCTYPE, TITLE, etc.
$returns .= $fetch["meta"]; # Grabs meta data such as Robots information, etc.
$returns .= $fetch["extcss"]; # Grabs external CSS data such as links to external stylesheets.
$returns .= $fetch["intcss"]; # Grabs internal CSS data such as quick styles.
$returns .= $fetch["extjs"]; # Grabs external JS data such as links to external javascript files.
$returns .= $fetch["intjs"]; # Grabs internal JS data such as fixes etc.

return $returns; # Returns all the header data back to the script

}

/**
### Cleaning function
### This is used to clean specified variables so they are fit to be used in an SQL Query, etc.
**/

function clean( $variable )
{

$variable = htmlspecialchars( $variable, ENT_QUOTES); # Converts html markup into entities.

if( get_magic_quotes_gpc( ) )
{

$variable = stripslashes( $variable ); # Removes all slashes added because of form submittion (This could be a potential security risk without
# the added use of mysql_real_escape_string, do not keep this if you remove that cleaning line!

}

$variable = htmlentities( $variable ); # Does the same job as htmlspecialchars except with htmlentities(), all characters which have HTML character entity equivalents are translated into these entities.

$variable = mysql_real_escape_string( $variable ); # Cleans a variable completely so it can be used in an SQL Query

return $variable; # Output the cleaned variable back to the script

}

/**
### Encrypting function
### This is used to encrypt specified variables so they are safe to be stored in SQL Tables, etc.
**/

function encrypt( $variable )
{

$salt = "jDu3Jop92xN" # Random variable to make the MD5 Encryption harder, customize this if you so wish.

$variable = md5( $variable.$salt ) # MD5 Encrypts the variable with an added salt (see above).

$variable = mcrypt_ecb( MCRYPT_3DES, $salt, $variable, MCRYPT_ENCRYPT ); # Mcrypts the variable using the salt

$variable = md5( $variable ); # To be on the safe side :P

return $variable; # Output the encrypted variable back to the script

}

}

?>


:o! Sorry, bored :P

Beau
19-11-2007, 08:43 PM
You should use a dynamic salt (ie. salt is randomly generated and stored in user's entry in the database).

Also, make sure it has a 'last edited' entry for each value. Nothings worse than viewing rare values you thought were recent, but haven't been edited in like three months.

Invent
19-11-2007, 09:01 PM
You should use a dynamic salt (ie. salt is randomly generated and stored in user's entry in the database).

That was my original idea, but I haven't coded it like yet as I haven't set up the SQL yet ;)


Also, make sure it has a 'last edited' entry for each value. Nothings worse than viewing rare values you thought were recent, but haven't been edited in like three months.

There is an ALT text field which you need to edit every time you update a value.

GoldenMerc
19-11-2007, 09:01 PM
Make a thing saying last edited at:
Damn already said :[

Invent
19-11-2007, 09:13 PM
<?php
<?php
/**
################################################## #####################
# Rares Class - For use with RVS
################################################## #####################
# @copyright The original creator of this script (Invent!) reserves
# the right to be able to cease any use of this panel by
# anyone at any time. The copyright must also stay intact
# on every page the panel uses.
# @author Invent!/Simon Fletcher
# @version 1 (BETA)
################################################## #####################
**/

class rares
{

/**
### Add category function
### This is used to add a new category into the SQL Table.
**/

function addCategory( $name, $currency )
{

$misc = new misc;
$db = new db;

$name = $misc->clean( $name );
$currency = $misc->clean( $currency );

$query = $db->query( "INSERT INTO `categories` (`name`, `currency`) VALUES ('".$name."', '".$currency."'" );

return "The category (".$name.") has been added successfully!";

}

/**
### Remove category function
### This is used to remove a category from the SQL Table.
**/

function removeCategory( $id )
{

$misc = new misc;
$db = new db;

$id = $misc->clean( $id );

$query = $db->query( "DELETE FROM `categories` WHERE `id` = '".$id."'" );

return "The category has been removed successfully!";

}

/**
### Add rare function
### This is used to add a new 'rare' into the SQL Table.
**/

function addRare( $name, $category, $img, $price, $currency, $alt )
{

$misc = new misc;
$db = new db;

$name = $misc->clean( $name );
$category = $misc->clean( $category );
$img = $misc->clean( $img );
$price = $misc->clean( $price );
$alt = $misc->clean( $alt );
$currency = $misc->clean( $currency );

if($currency != "T" && $currency != "HC")
{

die("Invalid currency parameter!");

}

$query = $db->query( "INSERT INTO `rares` (`name`, `category`, `img`, `price`, `currency`, `alt`) VALUES ('".$name."', '".$category."', '".$img."', '".$price."', '".$alt."', '".$currency."'" );

return "The rare (".$name.") was added successfully!";

}

/**
### Remove rare function
### This is used to remove a 'rare' from the SQL Table.
**/

function removeRare( $id, $category )
{

$misc = new misc;
$db = new db;

$id = $misc->clean( $id );
$category = $misc->clean( $category );

$query = $db->query( "DELETE FROM `".$category."` WHERE `id` = '".$id."'" );

return "The category has been removed successfully!";

}

/**
### Update rare function
### This is used to update a 'rare' from the SQL Table.
**/

function updateRare( $name, $id, $category, $img, $price, $currency, $alt )
{

$misc = new misc;
$db = new db;

$name = $misc->clean( $name );
$category = $misc->clean( $category );
$id = $misc->clean( $id );
$img = $misc->clean( $img );
$price = $misc->clean( $price );
$alt = $misc->clean( $alt );
$currency = $misc->clean( $currency );

$query = $db->query( "UPDATE `rares` SET `name` = '".$name."', `category` = '".$category."', `img` = '".$img."', `price` = '".$price."', `alt` = '".$alt."', `currency` = '".$currency."' WHERE `id` = '".$id."'" );

return "The rare (".$name.") was updated successfully!";


}

}

?>
Bah.
I have no idea why I'm posting these classes.

Invent
19-11-2007, 09:33 PM
Update:
I've added an 'updateCategory' function to the 'rares' class.

RedCrisps
20-11-2007, 03:35 PM
HOW ABOUT selecting how many rares viewed per line :]

Invent
20-11-2007, 03:56 PM
You can already choose how many rares per line to display as the display rares page just has this:



<?php
/**
################################################## #####################
# Display Rares - For use with RVS
################################################## #####################
# @copyright The original creator of this script (Invent!) reserves
# the right to be able to cease any use of this panel by
# anyone at any time. The copyright must also stay intact
# on every page the panel uses.
# @author Invent!/Simon Fletcher
# @version 1 (BETA)
################################################## #####################
**/

require("class/db.inc.php");
require("class/rares.inc.php");
require("class/misc.inc.php");

$rares = new rares;
$rares->category($_GET["category"]);
$rares->per_line = "5";
$rares->showRares();

?>

rh4u
20-11-2007, 04:17 PM
i look forward to using this :)
Your just too smart :P

Invent
20-11-2007, 04:21 PM
http://invent.no-ip.org/rvs/display_rares.php?category=reg

Basic look so far. I haven't made a design for it yet, just a quick CSS style :)

GoldenMerc
20-11-2007, 04:23 PM
Will their be a option say if we pay we get get the like signiture of it saying you made it ect..

Invent
20-11-2007, 04:25 PM
Will their be a option say if we pay we get get the like signiture of it saying you made it ect..

? Explain more please :P

GoldenMerc
20-11-2007, 04:28 PM
Like you may know with Ipb you can pay like £30 and it takes of his thing saying Made by Zero or w.e

Invent
20-11-2007, 04:29 PM
Like you may know with Ipb you can pay like £30 and it takes of his thing saying Made by Zero or w.e

Nah. It's free & opensource, that's all. I wouldn't want people having to pay for it.

Chippiewill
20-11-2007, 05:41 PM
Looks nice hopefully eventually youll combine it with all your other brilliant scripts into yet another habbo site panel 'YAHSP' :S

Jordy
20-11-2007, 06:27 PM
Erm, include a form for people to submit values optionally or for them to apply for jobs ;)

A calculator would be great, like on the right next to the values.

You click the values and they appear in the calculator, and you add them up.

E.g. You click throne twice, HC 3 times, and a marquee, and click equal. Then it says:
That is worth 47.9 HCs or 520 credits

And options in the calculator to trade 3 thrones for 2 dino eggs, and it says how much profit you make etc, would be great ;)

Invent
20-11-2007, 06:32 PM
E.g. You click throne twice, HC 3 times, and a marquee, and click equal. Then it says:
That is worth 47.9 HCs or 520 creditsA calculator is a cool idea, infact I REALLY like the idea! :)

I made a php values calculator a year ago, but this one could be done using JS seeing as the values are already decided :)

I think I'll develop the calculator now and then work on backend pages (I've coded the classes for the pages, you just can't run them from a page yet).

http://invent.no-ip.org/rvs/display_rares.php?category=reg for a new preview!

Johno
20-11-2007, 06:37 PM
Couldn't the "Last Updated" thing automatically update itself, or will that be happening?

.:; Johno

Invent
20-11-2007, 06:40 PM
Couldn't the "Last Updated" thing automatically update itself, or will that be happening?

Yeah, I think I'm gonna do that. :)

iTechnical
20-11-2007, 06:45 PM
Going good Simon!

edit:
Like with the calc have the ability to change into:
T's
Credits,
Rd
etc.

MrCraig
20-11-2007, 07:04 PM
LOL, merc is probably the most disappointed person at not having to pay i have ever met in my life :P

Erm. Yh, looks good. Make a file uploader on it to upload the rare values images. =]

Verrou
20-11-2007, 08:15 PM
When adding a new rare, maybe have an iFrame with the directory of the rare images (/rares) or whatever, and when you click on one it dynamically puts the link into the "image url" box. Because i hate having to get the address manually. This idea is lazy, but efficient.

GoldenMerc
20-11-2007, 08:31 PM
Nah i just think most open sources go crap,Like theirs a huge error no one can be bothered to fix it ;[

MrCraig
20-11-2007, 08:34 PM
yh true..

But most people get the major error's sorted out in beta stages when they can still be bothered. So like not as if theres gonna be undefined functions or anything.

Invent
20-11-2007, 08:38 PM
I think I might not make the calculator in this version and just focus on getting the script working well.

Moh
21-11-2007, 11:35 PM
I remember doing Habbo Banks in rows :)
Cant remember where it is though :(

Agnostic Bear
21-11-2007, 11:45 PM
Lol! :P

I'll have a form which will be used for Hover text :)
And yes, it will be free and open source!

OH and should I code this in Classes or just regular PHP? What would people prefer (bearing in mind you may want to tweak the panel).

.... since when was a class not normal php?

Verrou
22-11-2007, 06:27 AM
Can you make it display rares in rows? Rather than columns

Invent
22-11-2007, 01:52 PM
.... since when was a class not normal php?

I was waiting for that :P

I think you understand what I mean, but yeah I did expect you trying to be a smart *** Dan, lol.

Anyway, I'm Ill (:\) so I might be working on this a bit more than I have been during the next few days.

Dentafrice,
22-11-2007, 01:56 PM
1. Why echo the query back out to the user, if the error happens while a normal user / "hacker" is there.. he could easily see the query that is being performed and then use that information to better yet organize his hacking attempt.

Invent
22-11-2007, 02:08 PM
1. Why echo the query back out to the user, if the error happens while a normal user / "hacker" is there.. he could easily see the query that is being performed and then use that information to better yet organize his hacking attempt.

I doubt (s)he could use the query information to help him/her. Plus it really makes no difference as if the hacker did manage to find an exploit he could simply run a query like "SHOW TABLES" or whatever it is and that would produce the same information.

If people would like me to remove the echo, I will.

Topps
22-11-2007, 02:51 PM
I doubt (s)he could use the query information to help him/her. Plus it really makes no difference as if the hacker did manage to find an exploit he could simply run a query like "SHOW TABLES" or whatever it is and that would produce the same information.

If people would like me to remove the echo, I will.

Who would be sad enough to hack a rare values system anyway? :P

GoldenMerc
22-11-2007, 03:00 PM
I agree with above,I think that copyright should be £5 to remove xD

Agnostic Bear
22-11-2007, 04:28 PM
I was waiting for that :P

I think you understand what I mean, but yeah I did expect you trying to be a smart *** Dan, lol.

Anyway, I'm Ill (:\) so I might be working on this a bit more than I have been during the next few days.

Yeah yeah I understood what you meant :rolleyes:

also hug for illness.

redtom
22-11-2007, 05:36 PM
I agree with above,I think that copyright should be £5 to remove xD

How would he enforce that though?

Trigs
24-11-2007, 04:00 PM
hmm Are you gonna do a staffcp with it. Something like:
---Administrator---
Full Rights
---Rare Values Management---
Add Rare Values
Edit Rare Values
Delete Rare Values
Add New Rare Valuists
---Rare Valuist---
Add Rare Values
Edit Rare Values

Beau
24-11-2007, 09:14 PM
hmm Are you gonna do a staffcp with it. Something like:
---Administrator---
Full Rights
---Rare Values Management---
Add Rare Values
Edit Rare Values
Delete Rare Values
Add New Rare Valuists
---Rare Valuist---
Add Rare Values
Edit Rare Values

TBH I think that's getting too messy. Just have two usergroups, and have the Administrator group control user management. You don't need to have two usergroups for Rare Valuists.

GoldenMerc
25-11-2007, 05:05 PM
Yeh why would RVR need to add rares that could cause mahem

Verrou
25-11-2007, 06:44 PM
Being released soon?

Verrou
16-12-2007, 04:29 AM
Soz for double and bump, but is this still happening or was it trashed, really looked forward to the release ;( lol

Edited by Agesilaus (Forum Moderator): Please do not multiple post, unless you are adding new information when the 15 minute edit time is up and please do not bump old threads.

Flisker
16-12-2007, 08:44 AM
PM Invent :P

Black_Apalachi
16-12-2007, 12:50 PM
Omg I'm gonna have a heart attack. This sounds BOSS. Providing one had a decent team behind it, this could actually rival Habbox?????

Btw, prepare for a noob comment: is what we are seeing here, simply a layout, if you like, for your own rare values on your own site?


Erm, include a form for people to submit values optionally or for them to apply for jobs ;)

A calculator would be great, like on the right next to the values.

You click the values and they appear in the calculator, and you add them up.

E.g. You click throne twice, HC 3 times, and a marquee, and click equal. Then it says:
That is worth 47.9 HCs or 520 credits

And options in the calculator to trade 3 thrones for 2 dino eggs, and it says how much profit you make etc, would be great ;)

*DRUUUUUEEEEELLLLLLL* :O


LOL, merc is probably the most disappointed person at not having to pay i have ever met in my life :P

Erm. Yh, looks good. Make a file uploader on it to upload the rare values images. =]

Rofl. Ross you posh noob, accept free stuff!!!! :P


I agree with above,I think that copyright should be £5 to remove xD

There's no point. I'd only want to do that if it was some proper nooby name like !!...:::11111AMGZiAMfit:11111::::...!!!Callie.

Invent
16-12-2007, 01:54 PM
Aha, I forgot about this script! :P

I'll get it finished this week I think ;)

Black_Apalachi
16-12-2007, 04:02 PM
Aha, I forgot about this script! :P

I'll get it finished this week I think ;)

YEAAAAHHHH you will ;).

GoldenMerc
16-12-2007, 05:00 PM
Omg I'm gonna have a heart attack. This sounds BOSS. Providing one had a decent team behind it, this could actually rival Habbox?????

Btw, prepare for a noob comment: is what we are seeing here, simply a layout, if you like, for your own rare values on your own site?



*DRUUUUUEEEEELLLLLLL* :O



Rofl. Ross you posh noob, accept free stuff!!!! :P



There's no point. I'd only want to do that if it was some proper nooby name like !!...:::11111AMGZiAMfit:11111::::...!!!Callie.
Im so getting a name change to

!!...:::11111AMGZiAMfit:11111::::...!!!Callie

Chippiewill
16-12-2007, 11:14 PM
At above: lol

I hope the calculator is put in, it would be so cool

Verrou
23-12-2007, 09:31 PM
And the week goes past. *nudges Simon*

Trigs
24-12-2007, 12:44 AM
Give him a break :)

Im sure its comin ^^

Want to hide these adverts? Register an account for free!