PasteBin

Published  Jun 27, 2010
Updated  Apr 08, 2012

Description

Upgraded for HTML5 and CSS3. Added support for user accounts, hidden/private posts, ability to comment on posts, admin privileges, deleting pastes/comments, and syntax highlighting with Google Code Prettify

[b]to upgrade:

ALTER TABLE users ADD COLUMN admin TINYINT(1) NOT NULL DEFAULT 0 AFTER email;
UPDATE users SET admin = 1 WHERE username = 'YOUR_USERNAME_HERE' LIMIT 1

where YOUR_USERNAME_HERE is the username you want to give admin privileges to[/b]

Click here for an example

[list=1]installation:
[]Download and unzip script to your server
[
]edit configuration section of scripts/main.php
[*]run SQL_FILE.sql in the database you want and your done
[/list]

Screenshots

Download

Filename
Size
Date
Downloads
72.07 KB
Apr 08, 2012
57
394.78 KB
Apr 06, 2012
55
393.25 KB
Apr 04, 2012
49
44.9 KB
Mar 25, 2012
52
32.95 KB
Dec 12, 2010
59
5.86 KB
Jun 29, 2010
61

Comments

Sign in to comment.
sunslayer   -  Apr 09, 2012

@Hawkee thanks that worked

 Respond  
Hawkee   -  Apr 09, 2012

You can adjust your code to apply the slashes only if magic_quotes are off by checking ini_get( 'magic_quotes_gpc' ). Or you can always run stripslashes() on the content before you run mysql_real_escape_string().

 Respond  
sunslayer   -  Apr 09, 2012

@Hawkee the web hosting i'm using for the example add's them automatically probably as a security feature but it should run normally on other hosts

 Respond  
Hawkee   -  Apr 09, 2012

@sunslayer Nice work, although I notice it added backslashes on your demo there.

 Respond  
sunslayer   -  Apr 08, 2012

added the ability to delete your own comments and pastes, as well as added an admin functionality to delete other's. and replaced the geshi syntax highlighter with Google's Code Prettify that will automatically detect the language.

to upgrade open your mysql editor in the database for this file and type

ALTER TABLE users ADD COLUMN admin TINYINT(1) NOT NULL DEFAULT 0 AFTER email;
UPDATE users SET admin = 1 WHERE username = 'YOUR_USERNAME_HERE' LIMIT 1

to give yourself admin privileges

 Respond  
DarkOneMatter   -  Apr 07, 2012

thx :) thats help

 Respond  
sunslayer   -  Apr 06, 2012

@DarkOneMatter sorry i keep forgetting to silence notices :/ just put

error_reporting(E_ALL ^ E_NOTICE);

back in main.php

 Respond  
DarkOneMatter   -  Apr 06, 2012

first:

Notice: Undefined index: user_id in C:xampphtdocspastebincoreuser.class.php on line 6

and under wiew:

otice: Undefined index: user_id in C:xampphtdocspastebincoreuser.class.php on line 6

Notice: Use of undefined constant PASTE_NOT_VALID - assumed 'PASTE_NOT_VALID' in C:xampphtdocspastebincorepaste.class.php on line 2

Notice: Use of undefined constant PASTE_NOT_EXIST - assumed 'PASTE_NOT_EXIST' in C:xampphtdocspastebincorepaste.class.php on line 3

Notice: Use of undefined constant PASTE_GESHI_NOT_EXIST - assumed 'PASTE_GESHI_NOT_EXIST' in C:xampphtdocspastebincorepaste.class.php on line 4

Notice: Use of undefined constant PASTE_PASS_INCORRECT - assumed 'PASTE_PASS_INCORRECT' in C:xampphtdocspastebincorepaste.class.php on line 5

Notice: Undefined index: id in C:xampphtdocspastebincorepaste.class.php on line 13

Notice: Undefined index: pass in C:xampphtdocspastebincorepaste.class.php on line 14

and under register;

Notice: Undefined variable: success in C:xampphtdocspastebinregister.php on line 49
Create an Account
Notice: Undefined variable: error in C:xampphtdocspastebinregister.php on line 5

no way, to much fail :(

 Respond  
DarkOneMatter   -  Apr 06, 2012

nice, gonna check out now :)

 Respond  
sunslayer   -  Apr 06, 2012

I've added a user and paste class that should make creating your own files much easier. simply create them and they will automatically get all of their respective information and i've moved all the required files into a directory called core.

 Respond  
DarkOneMatter   -  Apr 05, 2012

sound rly nice!

i have alot of idées, just say if you need some :)

 Respond  
sunslayer   -  Apr 05, 2012

replace account.php with myaccount.php on the link that doesnt work and i'm currently working on cleaning up the CSS and forms so it will be easier to create new pages because its pretty sloppy right now

 Respond  
DarkOneMatter   -  Apr 05, 2012

then, where should i edit, if not myaccount.php? :)

and, could you put an clean template on it?, so i could mate more page on thats site? :)

 Respond  
sunslayer   -  Apr 05, 2012

@DarkOneMatter it was actually the link that was incorrect, the filename should be myaccount.php although it doesn't really matter what you name it as long as your consistent

 Respond  
DarkOneMatter   -  Apr 05, 2012

from:
/pastebin/view.php
to:
http://project-x.re/pastebin/account.php
where account.php was myaccount.php before :)

 Respond  
sunslayer   -  Apr 05, 2012

hmm where was it that you were clicking?

 Respond  
DarkOneMatter   -  Apr 05, 2012

when i'm trying to go to my acc, i annt.. becouse it will go to /account.php, but the file name is myacount, i just rename it to account, and now can i go tå my acc :)

 Respond  
sunslayer   -  Apr 05, 2012

@Hawkee thanks Geshi was the first one i came across that did what i needed

 Respond  
DarkOneMatter   -  Apr 05, 2012

Worked :)

 Respond  
Hawkee   -  Apr 05, 2012

@sunslayer You might want to look at CodeMirror as an alternative to Geshi. We were using Geshi for a while, but we just started using CodeMirror which is quite nice. There's also Prettify which actually detects the language.

 Respond  
sunslayer   -  Apr 05, 2012

thanks, just remove the & after the =

 Respond  
DarkOneMatter   -  Apr 05, 2012

i find another :P

 Deprecated: Assigning the return value of new by reference is deprecated in C:xampphtdocspastebinview.php on line 7 

lines is:

 $geshi =& new Geshi(html_entity_decode($paste['text']),$paste['language']);
 Respond  
DarkOneMatter   -  Apr 05, 2012

Thank you, thats works just fine :) i like your pastebin very mucg, and hope you will take a look on my idées :)

 Respond  
sunslayer   -  Apr 05, 2012

sorry, put it above "session_start();"

 Respond  
DarkOneMatter   -  Apr 05, 2012

You mean in the top?, line 1?

 Respond  
sunslayer   -  Apr 05, 2012

@DarkOneMatter try logging in that should remove the error, i forgot to suppress errors before i uploaded the script. adding

error_reporting(E_ALL ^ E_NOTICE);

to the beginning of main.php should fix that.

edit: thanks for the suggestions i've been contemplating adding a control panel so it might make it in the next update

 Respond  
DarkOneMatter   -  Apr 05, 2012

and i got this on the new:

Notice: Undefined index: user_id in C:xampphtdocspastebinscriptsmain.php on line 83

and line 83 is:

$user = new User($_COOKIE['PHPSESSID'], $_SESSION['user_id']);
 Respond  
DarkOneMatter   -  Apr 05, 2012

could it be possible to add RSS feeds to the page?
and maybe an admin panel where you can put a header on the page, see how many pastes are in DB, slightly different stats.
and perhaps a small state box at the front where many users, pastes, stuff? :)

I really love your Pastebin, it consumes a lot! :).
Hope you will continue to work on it :)

 Respond  
ulquiorra4   -  Apr 04, 2012

wow html5 thanks sunslayer i like it :D

 Respond  
sunslayer   -  Apr 04, 2012

thanks

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.