PASTEBIN
| #1 paste tool since 2002
create new paste
tools
api
archive
real-time
faq
PASTEBIN
create new paste
trending pastes
sign up
login
my alerts
my settings
my profile
Got an iPhone or iPad? We have a brand new Pastebin App for both devices, and it's totally free!
Click here to download the new Pastebin App for iOS
.
Public Pastes
Untitled
1 sec ago
Untitled
2 sec ago
Untitled
5 sec ago
Untitled
6 sec ago
Untitled
6 sec ago
Untitled
8 sec ago
Untitled
11 sec ago
Mighty Fine 2012 M...
23 sec ago
New Paste
// K, background story: I installed a chat on my website, it's coded with a mixture of JavaScript, PHP, and MySQL. // MySQL tables are ajaxim_blocklists (blocked users), ajaxim_buddylists (this one should be obvious :P), ajaxim_chats (chatrooms), ajaxim_messages //(messages sent), and ajaxim_users (once again, obvious). //Fields for blocklists: id, user, buddy //Fields for buddylists: id, user, buddy, group //Fields for chats: room, user, id //Fields for messages: recipient, sender, message, type, stamp, id //Fields for users: username, password, email, is_online, last_ping, last_ip, banned, admin, buddyicon, profile, id //So, I registered a user named "ChatBot", but didn't use the site to log in //Instead, I went into PHPMyAdmin, and set is_online to '1' (meaning online) //Next, I created a .php file "Bot.php" <?php require('config.php'); mysql_connect($sql_host, $sql_user, $sql_pass); mysql_select_db($sql_db); $res = mysql_query("SELECT message FROM ".SQL_PREFIX."messages WHERE type = 'msg'"); while($arr = mysql_fetch_row($res)){ echo $arr[0]."<br />"; } ?> //So, that tells it to select the messages. //My first problem is that I need it to select more than just the message. I need it to select sender, recipient, and message. //Next problem is saving it to text. //I asked someone how to use PHP to save something to a .txt file. //He gave me this: $myFile = "File.txt"; $fh = fopen($myFile, 'w') or die("can't open file"); $stringData = "$log\n"; fwrite($fh, $stringData); $stringData = "meow\n"; fwrite($fh, $stringData); fclose($fh); //Next step, he said, was to save $res to a string, and write that string to the document, but he signed out before I had time to ask him how //to do that. //Another thing I want to do, is perhaps instead of .txt, make it .html, so I can format it, if at all possible. I want to have a table, sort of //like this: __________________________________________________________________ | Sender | Recipient | Message | ------------------------------------------------------------------ | * | * | * | ------------------------------------------------------------------ //Where * corresponds to the text that goes in that field. //Except, hopefully an actual table, instead of just symbols. //Then, based off of this, I'll be able to create tables where type = 'event' or type = 'chatmsg'
Optional Paste Settings
Syntax Highlighting:
None
Bash
C
C#
C++
CSS
HTML
HTML 5
Java
JavaScript
Lua
None
Perl
PHP
Python
Rails
-------------
4CS
6502 ACME Cross Assembler
6502 Kick Assembler
6502 TASM/64TASS
ABAP
ActionScript
ActionScript 3
Ada
ALGOL 68
Apache Log
AppleScript
APT Sources
ASM (NASM)
ASP
autoconf
Autohotkey
AutoIt
Avisynth
Awk
BASCOM AVR
Bash
Basic4GL
BibTeX
Blitz Basic
BNF
BOO
BrainFuck
C
C for Macs
C Intermediate Language
C#
C++
C++ (with QT extensions)
C: Loadrunner
CAD DCL
CAD Lisp
CFDG
ChaiScript
Clojure
Clone C
Clone C++
CMake
COBOL
CoffeeScript
ColdFusion
CSS
Cuesheet
D
DCS
Delphi
Delphi Prism (Oxygene)
Diff
DIV
DOS
DOT
E
ECMAScript
Eiffel
Email
EPC
Erlang
F#
Falcon
FO Language
Formula One
Fortran
FreeBasic
FreeSWITCH
GAMBAS
Game Maker
GDB
Genero
Genie
GetText
Go
Groovy
GwBasic
Haskell
HicEst
HQ9 Plus
HTML
HTML 5
Icon
IDL
INI file
Inno Script
INTERCAL
IO
J
Java
Java 5
JavaScript
jQuery
KiXtart
Latex
Liberty BASIC
Linden Scripting
Lisp
LLVM
Loco Basic
Logtalk
LOL Code
Lotus Formulas
Lotus Script
LScript
Lua
M68000 Assembler
MagikSF
Make
MapBasic
MatLab
mIRC
MIX Assembler
Modula 2
Modula 3
Motorola 68000 HiSoft Dev
MPASM
MXML
MySQL
newLISP
None
NullSoft Installer
Oberon 2
Objeck Programming Langua
Objective C
OCalm Brief
OCaml
OpenBSD PACKET FILTER
OpenGL Shading
Openoffice BASIC
Oracle 11
Oracle 8
Oz
Pascal
PAWN
PCRE
Per
Perl
Perl 6
PHP
PHP Brief
Pic 16
Pike
Pixel Bender
PL/SQL
PostgreSQL
POV-Ray
Power Shell
PowerBuilder
ProFTPd
Progress
Prolog
Properties
ProvideX
PureBasic
PyCon
Python
q/kdb+
QBasic
R
Rails
REBOL
REG
Robots
RPM Spec
Ruby
Ruby Gnuplot
SAS
Scala
Scheme
Scilab
SdlBasic
Smalltalk
Smarty
SQL
SystemVerilog
T-SQL
TCL
Tera Term
thinBasic
TypoScript
Unicon
UnrealScript
Vala
VB.NET
VeriLog
VHDL
VIM
Visual Pro Log
VisualBasic
VisualFoxPro
WhiteSpace
WHOIS
Winbatch
XBasic
XML
Xorg Config
XPP
YAML
Z80 Assembler
ZXBasic
Paste Expiration:
Never
10 Minutes
1 Hour
1 Day
1 Month
Paste Exposure:
Public
Unlisted
Private (members only)
Paste Name / Title:
Hello
Guest
Sign Up
or
Login
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login