• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Free PHP scripts for you to use! ^_^ <3

Black Rose

Heehee ^_^
39
Posts
15
Years
  • ^_^ I was bored, so I figured I might as well put my scripting knowledge to use :)

    These are free to use, and you don't have to give credit. You can if you want ^_^ but I don't require it :) A simple thanks here would suffice =D

    .


    Full Scripts

    Login Script:
    Spoiler:

    Registration Script (improved security and validation):
    Spoiler:

    .


    Functions:

    Validate form
    Spoiler:



    I'll add more as soon as I can think of them. ^_^ Possibly even some independent functions =D

    ~BR

    .


    Thanks to /*.Ooka.*/ for the awesome security improvements =D
     
    Last edited:

    Ooka

    [font=Maven Pro][color=#A75EE2]Cosmic[/color][/fon
    2,626
    Posts
    16
    Years
  • Eww... those are extremely unsafe.

    Before connecting to a database, protect your strings first.

    PHP:
    function protect ($string){
    		$string = mysql_real_escape_string($string);
    		$string = strip_tags($string);
    		$string = addslashes($string);
    		
    		return $string;
    }

    Use this method to protect variables in Register:

    PHP:
    	$username = protect($_POST['username']);
    	$password = protect($_POST['password']);
    	$confirm = protect($_POST['passconf']);
    	$email = protect($_POST['email']);
    	$name = protect($_POST['name']);


    Also, you don't need to connect twice, just make a functions.php folder and put this in it:

    PHP:
    function connect (){
    	$con = mysql_connect("host","username","password") or die (mysql_error());
    	$db = mysql_select_db("database", $con);

    Then, in the folder you're connecting with, put this before anything:

    PHP:
    include_once "functions.php";
    
    connect();
     

    Black Rose

    Heehee ^_^
    39
    Posts
    15
    Years
  • @Ooka: These weren't meant to be commercial grade scripts, they're for fan-sites/games. How many fan-sites out there use high security? ^_^

    @Squeenix: See above.

    These are simply for foundation, you can add whatever you want to these scripts. By "Full Script" I'm saying that you can use them "as-is", but that doesn't mean you have to. These are just pre-made to save you a bit of time :)

    ~BR
     

    j_

    226
    Posts
    16
    Years
    • Seen Oct 19, 2008
    @Ooka: These weren't meant to be commercial grade scripts, they're for fan-sites/games. How many fan-sites out there use high security? ^_^

    @Squeenix: See above.

    These are simply for foundation, you can add whatever you want to these scripts. By "Full Script" I'm saying that you can use them "as-is", but that doesn't mean you have to. These are just pre-made to save you a bit of time :)

    ~BR

    SQL Injection is bad. It doesn't matter what size your site is! :P

    It's not a matter of "high security" its a matter of someone dropping your database table if they feel like it! The extra 3 lines it takes to make any user input safe is definately worth it!

    :)
     
    Last edited:

    Squeenix

    Meow
    207
    Posts
    16
    Years
  • Mysql injection = bad
    They could just go on your site and put a username in that field and 1=1 in the password field
    They could also just put in, DROP TABLE accounts in the stupid fields

    Mysql injection protection is a MUST for all websites dealing with mysql

    EDIT: Injection and protection rhymes :D
     
    Back
    Top