Tutorials:
| Utilizing the tools in Villavu | How to create Pythagoras theorem calculator in JavaScript | How to make a live signature of your Pascal Script | Concepts of Programming Tutorial | Worked on Frog Random with Justin for RS07
Very useful in the future my friend! Good job.
Right so I've been trying to follow this guide, but wanting to make something slightly different.
Firstly the simba code:
Simba Code:program new;
function AddAccount(login, password: String; TutIsland:Boolean; MageLevel:Integer):Boolean;
var
i : Integer;
a: String;
begin
i := InitializeHTTPClient(False); //this creates a client
//login, pw, TutIsland, MageLevel
AddPostVariable(i, 'login', login);//This adds our info to the client
AddPostVariable(i, 'pw', password);
AddPostVariable(i, 'TutIsland', ToStr(TutIsland));//This adds our info to the client
AddPostVariable(i, 'MageLevel', IntToStr(MageLevel));
a := Lowercase(PostHTTPPageEx(i, 'http://tkfarm.esy.es/AddAccount.php'));
Result := Pos('true', a) <> 0;//Then this posts it
Writeln(a);
FreeHTTPClient(i);//Remember to free it
end;
begin
Writeln(AddAccount('srl@gmail.com', 'gg', false, 1));
end.
The output from this isCode:<!doctype html public "-//ietf//dtd html 2.0//en"> <html><head> <title>302 found</title> </head><body> <h1>found</h1> <p>the document has moved <a href="http://error.hostinger.eu/403.php?">here</a>.</p> </body></html> False
So its clearly not working correctly, though I have no idea why...
here's the php code:
PHP Code:
<?PHP
$user_name = "u791978145_tk"; //Username for the account you created earlier
$pass_word = "removed"; //Password for the account you created earlier
$database = "u791978145_tk"; //The name of the database you created earlier
$server = "mysql.hostinger.co.uk"; //With 000webhost this can be found by going to your control panel then clicking MySQL
$login = $_POST['login'];//The things in the [] can be anything you want, but remember these for later
$pw = $_POST['pw'];
$tutisland = $_POST['TutIsland'];
$magelevel= $_POST['MageLevel'];
// Create connection
$conn = new mysqli($server, $user_name, $pass_word);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO Accounts (Login, Pw, TutIsland, MageLevel) VALUES ('". $login . "' ,'" . $pw . "', '" . $tutisland . "', '" . $magelevel . "');";//Or whatever you called your table and script
$result = $conn->query($sql);
print $login . $pw . $tutisland . $magelevel;
print $sql;
print $result;
if($result)
print "True";
else
print "False";
?>
I guess thats an accidental double quote, but thanks a lot Olly, I'll try and make a list of the changes that are needed to this thread and get an admin to update it
edit: I was making some other scrub mistakes, but I figure that stuff out, not setting the user agent was my main problem
There are currently 1 users browsing this thread. (0 members and 1 guests)