• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • 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.

Ho-oh 112's mySQL Trade System

i knew it. u cant script. copiing the script failed and youhave no idea what to do.
my opinion cya
 
i knew it. u cant script. copiing the script failed and youhave no idea what to do.
my opinion cya

????? I'm taking a break because I found a new game called edgeworld you dope AND WHERE DID I COPY THIS FROM?? I MADE IT FROM SCRATCH!!!!

Note: Scripting myself out for a week can be tiring so DON'T SAY IT'S NOT HARD WORK!
 
I can't wait to php file, please make it quickly.

I'm starting to script again tommorow or next monday. so it'll be done before long.
 
UPDATES:

Hey people I got the base structure of the php file ready! It's only a very unstable base but if you can improve fix any errors I didn't find then please do so.

Code:
<?php
$host="Localhost";
$user="root";
$pass="";
$base="pokemon";
$port=3306;
$sql=mysql_connect($host,$user,$pass,$base,$port) or die("Cannot connect to MySQL");
$request = $_GET['Request'];

if ($request == "delete_pokemon") {
$code = $_GET['Code'];
mysql_query("DELETE FROM Trades WHERE Code=$code") or die("Cannot delete".$code."From Trades");
}

if ($request == "taken_pokemon") {
$poke=$_GET['Pokemon'];
$ech=mysql_query("FROM Trades SELECT Taken WHERE Pokemon=$poke") or die("Cannot Select".$Poke."From Trades");
}

if ($request == "send_pokemon") {
$code=$_GET['Code'];
$poke=$_GET['Pokemon'];
$level=$_GET['Level'];
$level1=$_GET['Level1'];
$level2=$_GET['Level2'];
$wanted=$_GET['Wanted'];
mysql_query("INSERT INTO Trades Code=$code,Pokemon=$poke,Level=$level,Wanted=$wanted,Level1=$level1,Level2=$level2,Taken='No'") or die("Cannot insert Query.");
}

if ($request == "get_pokemon") {
$poke=$_GET['Pokemon'];
$level1=$_GET['Level1'];
$levle2=$_GET['Level2'];
$ech=mysql_query("FROM Trades SELECT * WHERE Pokemon=$poke and Level>$level1 and Level<$level2") or die("None");
}

if ($request == "get_all") {
$ech=mysql_query("FROM Trades SELECT *") or die("Error!");
}
die($ech);
$sql_close;

?>
 
Ok so i tested it, i got few errors, pokemon stores online but cant finish trade + some bugs. here are screens.
First screen Pokemon is stored but is not on the lsit but when i press space it continue.
https://dl.dropbox.com/u/4212314/Gts errpr/capture018.png

And here is something messed
https://dl.dropbox.com/u/4212314/Gts errpr/capture019.png

and error when want to finish trade.
Spoiler:
 
Ok so i tested it, i got few errors, pokemon stores online but cant finish trade + some bugs. here are screens.
First screen Pokemon is stored but is not on the lsit but when i press space it continue.
https://dl.dropbox.com/u/4212314/Gts errpr/capture018.png

And here is something messed
https://dl.dropbox.com/u/4212314/Gts errpr/capture019.png

and error when want to finish trade.
Spoiler:


AHHHH I Forgot to add the new version of the trade system....

EDIT: I'm fixing up some more bugs I found + making the php file better.
 
Last edited:
Thankyou for this awesome feature
Can you help me? after pressing search for pokemon and put the pokemon i want i get this error:

Spoiler:
 
Thankyou for this awesome feature
Can you help me? after pressing search for pokemon and put the pokemon i want i get this error:

Spoiler:

still working on a huge fix I noticed a small complicated error that'll take me a few to fix...
 
Hope it will be out soon.


Yeah I'm going to start working on this before H-Mode 7 until this works I just realized I can't compile the pokemon but I need to instead send all the different values of the pokemon...
 
A few comments about your php script. Bolded is how to improve/fix the issue

First off, pbpPostData in essentials sends requests using $_POST not $_GET.
Any $_GET should be $_POST

Also, any variables you send from the essentials script need to be sanitised before use in php otherwise you'll be open to sql injection which could potentially wipe out your database or have others insert unauthorised data into it if they managed to get hold of the url, which is pretty easy to do
You need to use mysql_real_escape_string() on all variables
e.g.
$ech=mysql_query("FROM Trades SELECT * WHERE Pokemon=".mysql_real_escape_string($poke)." and Level>".mysql_real_escape_string($level1)." and Level<".mysql_real_escape_string($level2)."") or die("None");


Your final $sql_close; at the end won't do anything since anything after a die() call isn't executed. You shouldn't be using die() to output data anyway.
Change the die to an echo or print

Its better to use elseif statements not several ifs since you're only going to be sending one request at once, and for each request its going to go through the whole script each time, which takes more time in the long run than elseif. With elseif it'd go through only until the criteria is met.
Use elseifs
e.g.
if(this>1){
do this
} elseif (this>2) {
do this
} else
do this
}
 
A few comments about your php script. Bolded is how to improve/fix the issue

First off, pbpPostData in essentials sends requests using $_POST not $_GET.
Any $_GET should be $_POST

Also, any variables you send from the essentials script need to be sanitised before use in php otherwise you'll be open to sql injection which could potentially wipe out your database or have others insert unauthorised data into it if they managed to get hold of the url, which is pretty easy to do
You need to use mysql_real_escape_string() on all variables
e.g.
$ech=mysql_query("FROM Trades SELECT * WHERE Pokemon=".mysql_real_escape_string($poke)." and Level>".mysql_real_escape_string($level1)." and Level<".mysql_real_escape_string($level2)."") or die("None");


Your final $sql_close; at the end won't do anything since anything after a die() call isn't executed. You shouldn't be using die() to output data anyway.
Change the die to an echo or print

Its better to use elseif statements not several ifs since you're only going to be sending one request at once, and for each request its going to go through the whole script each time, which takes more time in the long run than elseif. With elseif it'd go through only until the criteria is met.
Use elseifs
e.g.
if(this>1){
do this
} elseif (this>2) {
do this
} else
do this
}
EDIT:
Fixed up the problems with the scripts now I gotta test/make sql file...
 
Last edited:
UPDATES:
Fixed the PHP file and improved it to what Desbrina said
Fixed some errors with the Main script

Version: 2.0 Full


EDIT:
sql configuration table:

Table Name: trades
Column1: Code, Varchar(45)
Column2: Pokemon, Varchar(45)
Column3: Level, smallInt
Column4: Wanted, Varchar(45)
Column5: Level1, smallInt
Column6: Level2, smallInt
COlumn7: Taken, Varchar(45)
 
I don't know what I do bad, but when i call script pbStartGTS() and choose my Pokemon to trade nad press "Trade" i have an error: No pokemon chosen. This is screen for this error:

[PokeCommunity.com] Ho-oh 112's mySQL Trade System


Ho-oh doy you know, what i do bad?
 
I don't know what I do bad, but when i call script pbStartGTS() and choose my Pokemon to trade nad press "Trade" i have an error: No pokemon chosen. This is screen for this error:

[PokeCommunity.com] Ho-oh 112's mySQL Trade System


Ho-oh doy you know, what i do bad?


Did you click trade on the storage screen?
 
Back
Top