PHP Help

Started by G_G, January 16, 2010, 12:37:49 am

Previous topic - Next topic

G_G

January 16, 2010, 12:37:49 am Last Edit: January 16, 2010, 01:50:08 am by game_guy
1st Problem Resolved:

New Problem.
Okay so I got everything working, even a registration page. Only downside is that when you try to login with an account that was registered on the site and not the game you get disconnected.

Here's my registration code.
<html>
<body>
<?php
$entryu = $_POST['entryn'];
$entryp = $_POST['entryp'];
$entryp2 = crypt($entryp, 'PN');
$entryp = substr($entryp2, 2);
$host = "209.159.196.99";
$user = "root";
$pass = "knight";
$connection = mysql_connect($host, $user, $pass) or die ("Couldn't Connect To Server");
$db = mysql_select_db("rmxosdb", $connection) or die ("Couldn't Connect to Database");
$result = mysql_query("SELECT * FROM users;") or die ("Couldn't Connect to Database");
$row_count = mysql_num_rows($result);
$query = "INSERT INTO `rmxosdb`.`users` (`user_id` ,`username` ,`password` ,`usergroup` ,`banned` )VALUES ($row_count+1, '$entryu', '$entryp', 0, 0);";
$result = mysql_query($query) or die ("Registration Failed.");
echo "Registration success. You may now log into the game.";
?>
</body>
</html>


It may be a problem with the game, or my PHP code. I'm not sure. But I registered two different accounts with the same password. One with the site, and one on the game. The passwords matched in the database so that can't be the problem.

Aqua

Not sure but...
Is it because you're echoing a value instead of a string?

G_G

January 16, 2010, 01:16:47 am #2 Last Edit: January 16, 2010, 01:49:02 am by game_guy
The value is a string though. IN the SQL Database the Save_data is set to Text. Hmm..I really need to fix this >__>

EDIT: Fixed. New problem.

Blizzard

There's more stuff you need to add into the database. I automatically also add the proper userdata in other tables. Refer to the ActionHandler#try_register in RMX-OS. It should be in one of the ActionHandler files in the Data folder.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

G_G

Thanks blizzard! I looked in the the ActionHandler 1. Really all I had to do was make it register a date. Now I have a fully functional registration page.

edwardthefma

can you post the finished product please
i am the lead dev for the shellium mmorpg project
http://wiki.shellium.org/w/Mmorpg
shellium.org :) free linux shells pm me and i will gladly
help you get 1