Jump to content

sfxworks

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

sfxworks's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. How do I turn print_r into a variable string that I can put in an array for an http_build_query method? I tried print_r($nbt->root,true); but that did nothing. I am working with php version 5.1.2.
  2. I've successfully decoded an NBT file. Now, I am trying to convert it to a bo2 file. I am...ofcourse...running into multible issues with this. So far, I have been able to print the entire nbt into text. I can convert this to a string relatively easy I assume. From there...how do I get certain values? I guess what im saying is, how would I get a string after another string? For instance, the Length, Width, and Height. I need those, and I need to be able to get the data values and put them into an array. Well, I don't really have to but it would make things a lot easier. In the types of NBT files I am working with, they are easy to find with my HANDY DANDY cntrl F. [3] => Array ( [type] => 2 [name] => Height [value] => 2 ) [11] => Array ( [type] => 2 [name] => Length [value] => 3 ) [12] => Array ( [type] => 2 [name] => Width [value] => 3 ) [8] => Array ( [type] => 7 [name] => Data [value] => Array ( [0] => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 [14] => 5 [15] => 0 [16] => 0 [17] => 0 [13] => Array ( [type] => 7 [name] => Blocks [value] => Array ( [0] => 4 [1] => 4 [2] => 20 [3] => 4 [4] => 1 [5] => 57 [6] => 4 [7] => 4 [8] => 4 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 [14] => 76 [15] => 48 [16] => 0 [17] => 0 As you can see, they are always marked as [3],[8],[11],[12],and [13]. So what I am trying to do is get those datavalues and...basically, re arrange the text while getting rid of the rest. 11 contains the length, 12 contains the width, 3 contains the height, 13 contains the block data, and 8 contains additional data for the block data (if any). For that example, a bo2 would look something like this. [META] version=2.0 spawnOnBlockType=2 spawnSunlight=False spawnDarkness=True spawnWater=False spawnLava=False underFill=True randomRotation=True dig=True tree=False branch=False needsFoundation=False rarity=1 collisionPercentage=1 spawnElevationMin=0 spawnElevationMax=64 spawnInBiome=Forest,Plains,Rain Forest,Savanna,Seasonal Forest,Shrubland,Swampland,Taiga,Tundra //All of the variables above would be specified in an html form. [DATA] 1,0,0:4 1,1,0:4 0,1,0:4 -1,1,0:4 -1,0,0:4 -1,-1,0:4 0,-1,0:57 1,-1,0:20 0,0,0:1 -1,1,1:48 0,-1,1:76.1 //This is the important part. This is where the main data is stored. Format (X,Y,Z,:BlockData.AdditionalBlockData) Given the length, width, and height, I suppose setting up coordinates would be somewhat simple. Yet im still left with the issue on how to capture the data from the GIANT string. Any tips? Help? I am SO close to breaking this. I am using Php 5 with the GMP extension. Windows 7x64. Find what I have so far here http://mcserver1337.servegame.com/_usr/sfxworks/Sandbox/NBTDecodePHP/test.php.
  3. http://gmplib.org/#DOWNLOAD The GMP download. When I download it, it came in a compressed file. The dll is in the folder already. It's just not saying its available. I thought I needed those files and folders in order for the dll to work properly?
  4. Right...details. PHP 5.3.4 Using WAMP server. OS = Windows 7x64
  5. I have a script that requires GMP (http://www.php.net/manual/en/gmp.installation.php). I am using WAMP server. I found the ini file and got rid of the ; next to extension=php_gmp.dll. Yet, I have this folder that I downloaded from it. Where do I put it?
  6. Let me explain. I host a game. When a player talks, creates, destroys, or does anything of the sorts, it gets logged into the mysql database. When I hosted this locally, everything was completely instant. Now, im having to constantly restart my server because the queue to the databse keeps getting overloaded (in the thousands). Is this a latency issue? I mean, I bought my server...
  7. $subject = "sfxworks minecraft server"; $message = "Thank you for pre-registering. You have been automatically added to the whitelist and authentication database. When you login for the first time, use the command /redeem to recieve a full set of leather armor, iron tools, and 7 diamonds! Keep yourself posted at sfxworksmc.blogspot.com! \n -sfxworks"; $from = "donotreply@sfxworks.net"; $headers = "From:" . $from; mail($_POST['email'],$subject,$message,$headers) or die("Failed." . mysql_error()); echo $_POST['email']; ...Why in the world is this not working? Does my web server have to have donotreply@sfxworks.net registered? I mean, I got it once, but it was from some other email address. ( sfxworks@p3nlhg656.shr.prod.phx3.secureserver.net) ...Help?
  8. sfxworks

    Forums...

    So just have a column that specifies its type in the table?
  9. sfxworks

    Forums...

    So. Going to make my own forum from scratch. I mean...The way I see it...Each Schema is a board, each table is a topic, and each row is a new post? Or is that horribly, horribly wrong....
  10. Result Query: INSERT INTO accounts (playername, password, email, registerdate, lastlogindate, lastloginip, registerip, active) VALUES ('usernameTest', 'aef6502bca2e6d92d57a4e8eaf383983cec31863eabea778d2ae5637782813138a4e758beebd620202b3484df49a44ae584e13f36b73aa3ea28d50ce5aa15740fd9a895e3371', 'email@email.com', '2011-6-26 1:58:51', '75.181.82.15', '2011-6-26 1:58:51', '75.181.82.15', 0 ) Failed with error: Incorrect datetime value: '75.181.82.15' for column 'lastlogindate' at row 1 Problem: Vars mismatched. Modified $query $query = "INSERT INTO accounts (playername, password, email, registerdate, lastlogindate, lastloginip, registerip, active) VALUES ('usernameTest', '$encpass', 'email@email.com', '$dateFormat', '$dateFormat', '{$_SERVER['REMOTE_ADDR']}', '{$_SERVER['REMOTE_ADDR']}', 0 )"; mysql_query( $query ) or die ( "<br>Query: $query<br>Failed with error: " . mysql_error() ); mysql_close($con); No Errors traced. Static data successful added to database. Thank you.
  11. My apologies for double posting. Added line $encpass = encryptPassword('passwordTest'); Modified query mysql_query("INSERT INTO accounts (playername, password, email, registerdate, lastlogindate, lastloginip, registerip, active) VALUES ('usernameTest','$encpass','email@email.com','$dateFormat','$_SERVER[REMOTE_ADDR]','$dateFormat','$_SERVER[REMOTE_ADDR]',0)"); No traced errors. No new data in table. Unsuccessful.
  12. No SQL error is traced. Only the information echoed by the script. MySQL NOW(). New method learned. Will try to apply.
  13. Problem: Trying to insert static data into columns on a table in MySQL using PHP. Mysql Version 5.1.57-community PHP Version 5.2.* Checked http://www.w3schools.com/php/php_mysql_insert.asp and other sources that dwarf w3schools. Applied. Ran into 101 problems involving remote access. Ran into over 9000 problems involving re-installation of mysql. Successfully communicated between remote server and localhost. Successfully created a table on the localserver with a php script on a remote server. Successfully added data to a column. mysql_query("INSERT INTO test (name) VALUES ('ThisIsAName')"); Added function for encrypting password. Added function for getting date. Failed to add static data to a pre-created table. Table information: id---INT(10) Primary Key, Not Null, Unsigned Datatype, Auto Increment playername---VarChar(255) Not Null password---VarChar(100) regiserdate---DateTime regiserip---Char(15) lastlogindate---DateTime lastloginip---Char(15) active---TinyInt(1) Code for query: mysql_query("INSERT INTO accounts (playername, password, email, registerdate, lastlogindate, lastloginip, registerip, active) VALUES ('usernameTest',encryptPassword('passwordTest'),'email@email.com',$dateFormat,'$_SERVER[REMOTE_ADDR]',$dateFormat,'$_SERVER[REMOTE_ADDR]',0)"); Entire: <?php function encryptPassword($password) { $salt = substr(hash('whirlpool', uniqid(rand(), true)), 0, 12); $hash = hash('whirlpool', $salt . $password); $saltPos = (strlen($password) >= strlen($hash) ? strlen($hash) : strlen($password)); return substr($hash, 0, $saltPos) . $salt . substr($hash, $saltPos); } $today=getdate(date("U")); $dateFormat = "$today[year]-$today[mon]-$today[mday] $today[hours]:$today[minutes]:$today[seconds]"; //$encPass = encryptPassword($_POST['password']); Disabled until static data is successfully tested. $con = mysql_connect("[s]localmachineaddress[/s]","[s]localmachineusername[/s]","[s]localmachinepassword[/s]"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("[s]schemaName[/s]", $con); //mysql_query("INSERT INTO [s]tableName [/s](playername, password, email, registerdate, registerip) Disabled until static data is successfully tested. //VALUES ('$_POST[playername]',$encPass,'$_POST[email]',$dateFormat,'$_SERVER[REMOTE_ADDR]'"); Disabled until static data is successfully tested. mysql_query("INSERT INTO accounts (playername, password, email, registerdate, lastlogindate, lastloginip, registerip, active) VALUES ('usernameTest',encryptPassword('passwordTest'),'email@email.com',$dateFormat,'$_SERVER[REMOTE_ADDR]',$dateFormat,'$_SERVER[REMOTE_ADDR]',0)"); echo "Posted the following values... <br /> Your encrypted password = " . encryptPassword('passwordTest') . "<br /> The date sumbited = " . $dateFormat . "<br /> Your ip address = " . $_SERVER[REMOTE_ADDR]; echo "<br />Closing.."; mysql_close($con); ?> Traced static data: Posted the following values... Your encrypted password = 52fa46eac9d07bfcf4764a35b2c4132a70332c8885bc780abcf748f991198fbc8a0b0075cc0223050c8cc4c835ff09b32518b32308aa1b73de8a4d74ec09a74a4c1cb592bd5d The date sumbited = 2011-6-26 0:51:10 Your ip address = MyIpAddress Closing.. Possibilities- Argument types must match column types in VALUES ('usernameTest',encryptPassword('passwordTest'),'email@email.com',$dateFormat,'$_SERVER[REMOTE_ADDR]',$dateFormat,'$_SERVER[REMOTE_ADDR]',0)"); If this is the case, method of doing so?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.