Jump to content

Kryllster

Members
  • Posts

    186
  • Joined

  • Last visited

Everything posted by Kryllster

  1. I am in search of a free php hosting company that supports Sqlite 2. Also supporting .mp3 files of my own for a game I have been working on for the past 2 years off and on. I have tried different searches here as well as google and I dont seem to see anything of the sort. Another alternative is hosting here at my home. I have a p3 800 mhz with 256 mb ram and a 40 gb hardrive which I could use. Being a gamer I have a higher upload speed than normal. Has anyone had any long term personal home servers up for a considerable amount of time? Just kind of frustrated with how to go about getting this game hosted with some decent performance?? Thanks, Kryllster
  2. Is there a free php hosting server that supports Sqlite and writable folders I have been looking all over the place and cant find the answer or find a suitable host for my website. * This may be in the wrong spot but I couldn't decide where to post this question. Kryllster
  3. I have spent most of the night trying to figure out how to do what should be a simple rewrite rule. essentially I want to change the document root ie http://somewhere.homelinux.net to http://somewhere.homelinux.net/~user/ but display it as the first. Im not finding anything about it I dont want to change the doc root just the url of the user directory to display as doc root RewriteEngine on RedirectMatch ^/$ /home/user/public_html I tried that but no use Thanks Kryll
  4. finally some success after going thru this I downloded sqlitemanager and basically created the db thru there. I changed some of the code to this and it worked! //$db = $_SERVER['DOCUMENT_ROOT']."../sqlitemanager/crimsond.sq"; $db = "sqlitemanager/crimsond.sq"; $handle = sqlite_open($db) or die("Could not open database"); $sql = "SELECT username FROM cr_diamond WHERE username='{$_POST['username']}'"; if ($result = sqlite_query($handle, $sql)) { // changes $db in the first parameter with $handle if (sqlite_num_rows($result)) { echo "That Username is already taken please choose another!"; I went to the success page and then checked it in the sqlitemanager and the info was there. I undoubtably will run into more problems. I thank you for helping me out I learned a lot. Things I learned: php error logging, sqlite commands, and that I have a long way to go. My question is how do I make it secure as now its not as far as I know. I will check into that as well! Thanks Again, Any other pointers are welcome too.
  5. Ok I had enabled logging errors to a text file in the doc root in php. Here is what is in there several times [05-Feb-2009 19:35:11] PHP Warning: sqlite_query() expects parameter 1 to be resource, string given in C:\Apaph\WebDocs\create_character.php on line 33 [05-Feb-2009 19:35:11] PHP Warning: sqlite_last_error() expects exactly 1 parameter, 0 given in C:\Apaph\WebDocs\create_character.php on line 133 Also when I run the script I get this output: SELECT FAILED SELECT username FROM cr_diamond WHERE username='Terry' not an error Another thing I did is placed the database 1 level below the doc root as well and created a new data base with this script: <?php $db = sqlite_open('../crimsond.sq') or die("Could Not open Database"); // create cr_diamond table $makecdtable = 'CREATE TABLE cr_diamond( "player_id" INTEGER PRIMARY KEY , "username" TEXT NOT NULL , "password" TEXT NOT NULL , "email" TEXT NOT NULL , "sex" TEXT NOT NULL , "race" TEXT NOT NULL , "fclass" TEXT NOT NULL , "armor" TEXT NOT NULL , "armor_bonus" INTEGER NOT NULL, "weapon" TEXT NOT NULL , "weapon_bonus" INTEGER NOT NULL , "level" INTEGER NOT NULL , "hitpoints" INTEGER NOT NULL , "onhand" INTEGER NOT NULL , "skill1_name" TEXT NOT NULL , "skill2_name" TEXT NOT NULL , "skill3_name" TEXT NOT NULL , "skill1_bonus" INTEGER NOT NULL , "skill2_bonus" INTEGER NOT NULL , "skill3_bonus" INTEGER NOT NULL , "special_item" TEXT NOT NULL , "special_bonus" INTEGER NOT NULL , "diamond" INTEGER NOT NULL , "dbalance" INTEGER NOT NULL, "rubie" INTEGER NOT NULL , "rbalance" INTEGER NOT NULL, "rations" INTEGER NOT NULL, "bank" INTEGER NOT NULL , "advance" INTEGER NOT NULL, "avatar" TEXT NOT NULL)'; @sqlite_exec($db, $makecdtable); sqlite_close($db); ?> So I have php_pdo.dll and php_sqlite.dll enabled in php.ini. I see that there is something in the database it shows 4k. ????? What next
  6. Yes Sir I did here is what I have: <input type="submit" name="submit" value="Create Account"> </form> I am wondering if it is the server config tho. I usually dont have a hard time trying to solve problems, but this one has me stumped?? http://us.php.net/sqlite_query this is what I have been referring to for this. And the download there says PECL (whatever that is) is not bundled and I think it also says it only supports Sqlite3. Also says something about PDO not sure about that either. So I am at a loss other than to make a smaller app to learn instead of this?? Thanks
  7. Either my server is configured incorrectly or I am a complete dumb $^5. 1 of the 2 most likely the latter. Anyway I copied and pasted the entire rewrite you did for me and pulled up a blank page. I did a .csv dump from firefox sqlite manager and the table is correct, yet it does not get populated once the form is processed. No error messages or anything, just a blank page. Any recommendations where to go next?? I am on XP btw, does that matter?? Thanks for spending the time on rewriting this! Kryllster
  8. I checked out the sqlite_exec() where it was suggested also have been looking all day for a reliable source of info. I even abandoned my own Wamp for another. As well as trying PDO and Using firefox sqlite addon all with no luck. I suppose there is something Im missing however I dont see what that is. Not sure where to go from here?? Thanks for helping tho! Kryllster
  9. Ok you may laugh at this puny attempt to make a character creation page for a game. I had been using mysql but I have been wanting to switch to Sqlite. Here is the code. <?php // Define form variablesand checks $connectionError = "This did not work this time."; $message = "Please do NOT leave any fields empty Thank You!!"; // Start the process of creation $username = $_POST['username']; $email = $_POST['email']; $password = $_POST['password']; $sex = $_POST['sex']; $race = $_POST['race']; $fclass = $_POST['fclass']; if (empty($_POST['username'])){ echo $message; exit(); } elseif (empty($_POST['email'])){ echo $message; exit(); } elseif (empty($_POST['password'])){ echo $message; exit(); } elseif (empty($_POST['sex'])){ echo $message; exit(); } elseif (empty($_POST['race'])){ echo $message; exit(); } elseif (empty($_POST['fclass'])){ echo $message; exit(); } // connect to database $db = $_SERVER['DOCUMENT_ROOT']."../database/crimsond.db"; $handle = sqlite_open($db) or die("Could not open database"); // select table and check for duplicates $query = "select * from cr_diamond where username='" . $_POST['username'] . "'"; // compare $result = sqlite_open($db); if (sqlite_num_rows($result) >= 1) { echo "That Username is already taken please choose another!"; } // continue if all these checks are ok Im hoping else { // Encrypt Password $encrypted_passwd = md5($password); $password = ($encrypted_passwd); // These variables below are added as starting resource's for each player $armor = "Leather Outfit"; $armor_bonus = 0; $weapon = "Big Club"; $weapon_bonus = 0; $advance = 1; $level = 1; $skill1_name = "None"; $skill1_bonus = 0; $skill2_name = "None"; $skill2_bonus = 0; $skill3_name = "None"; $skill3_bonus = 0; $special_item = "None"; $special_bonus = 0; $hitpoints = 15; $onhand = 2000; $diamond = 5; $dbalance = 5; $rubie = 10; $rbalance = 5; $rations = 1; $bank = 5000; $avatar = 00; $dbquery = "INSERT INTO cr_diamond (username, email, password, sex, race, fclass, armor, armor_bonus, weapon, weapon_bonus, advance, level, skill1_name, skill1_bonus, skill2_name, skill2_bonus, skill3_name, skill3_bonus, special_item, special_bonus, hitpoints, onhand, diamond, dbalance, rubie, rbalance, rations, bank, avatar) Values('$username','$email','$password','$sex','$race','$fclass','$armor','$armor_bonus','$weapon','$weapon_bonus','$advance','$level','$skill1_name','$skill1_bonus','$skill2_name','$skill2_bonus','$skill3_name','$skill3_bonus','$special_item','$special_bonus','$hitpoints','$onhand','$diamond','$dbalance','$rubie','$rbalance','$rations','$bank','$avatar')"); // Close Database sqlite_close($handle); // Direct on Creation Success testing sqlite echo "<META HTTP-EQUIV=\"Refresh\"CONTENT=\"0; URL=create_success.php\">"; //echo "The Initial test has worked check database for confirmation!"; } ?> um the database is there and the table is created I just cant seem to get it populated when the user signs up? I have been searching all over the web google, sqlite website, php and here. Any help on this will be appreciated. Thanks Kryllster
  10. Thanks for your reply I read that and also your signature and well it had me thinking and of course I took a break from it for a while and I found out why it was not working. Solution = instead of a form <form action="d3learnskills.php?buy=lightpush" metod="post"> <br> <input type="radio" name="skill" value="Light Push"> <br> <input type=submit value="Learn This Skill"> That will not work with the script that way. However this will: <a href="d3learnskills.php?buy=lightpush">Learn this Skill</a> I could write different code to set it up in the way of a form but the one that works is fine for me. I learned 2 things 1 if something frustrates you sleep on it and come back to it. 2 How to accomplish what your wanting to do specifically. Thanks again.
  11. Sorry for the lack of information. For 1 I am using wamp2.0f and mysql version 5.1.30. I have 6 fields in my database skill1_name, skill1_bonus, skill2_name, skill2_bonus, skill3_name, skill3_bonus. I use this command to execute the script from a form. d3learnskills.php?buy=firethunder what it does do is this, it will change the data for the money and the skill bonus but will not change the skill name in the appropriate location ie it puts a skill3_name in the skill1_name slot and sometimes it will not do that. Now if I write 6 separate scripts to do this it will work I'm just trying to consolidate. I dont get any errors at all it just runs the script but it just seems kinna buggy. 1 more thing I get this warning in phpmyadmin: Your PHP MySQL library version 5.0.51a differs from your MySQL server version 5.1.30. This may cause unpredictable behavior. could this be the culprit?? I hope that makes it a little easier to help?? Thanks
  12. here is the code Im working on. <?php session_start(); $username = $_SESSION['username']; // php shorthand from the PhPFreaks forum $buy = (!isset($_GET['buy'])) ? 'main' : $_GET['buy']; switch($buy){ case 'firethunder': $skillbonus = mt_rand(1,5); // db config include('includes/db_config.php'); // Select data from database $sql = "SELECT * FROM $tbl_name WHERE username='$username'"; $result = mysql_query($sql); // Put info into array Hopefully while($row = mysql_fetch_assoc($result)) { // player config include('includes/player_config.php'); // check for money if they dont have it let them know else go with transaction if($row['onhand'] < '350000'){ header("Location: mainview.php?show=warnmoney"); exit(); } else{ // Update database $sql="UPDATE $tbl_name SET onhand = onhand - 350000, skill1_name = replace(skill1_name, '$skill1_name', 'Fire Thunder'), skill1_bonus = $skillbonus WHERE username='$username'"; mysql_query($sql) or die (mysql_error()."<p>$sql</p>"); //header("Location: mainview.php?show=d3buyskills"); echo "<META HTTP-EQUIV=\"Refresh\"CONTENT=\"0; URL=mainview.php?show=d3buyskills\">"; exit(); } break; } case 'lightpush': $skillbonus = mt_rand(1,5); // db config include('includes/db_config.php'); // Select data from database $sql = "SELECT * FROM $tbl_name WHERE username='$username'"; $result = mysql_query($sql); // Put info into array Hopefully while($row = mysql_fetch_assoc($result)) { // player config include('includes/player_config.php'); // check for money if they dont have it let them know else go with transaction if($row['onhand'] < '350000'){ header("Location: mainview.php?show=warnmoney"); exit(); } else{ // Update database $sql="UPDATE $tbl_name SET onhand = onhand - 350000, skill1_name = replace(skill1_name,'$skill1_name','Light Push'), skill1_bonus = $skillbonus WHERE username='$username'"; mysql_query($sql) or die (mysql_error()."<p>$sql</p>"); //header("Location: mainview.php?show=d3buyskills"); echo "<META HTTP-EQUIV=\"Refresh\"CONTENT=\"0; URL=mainview.php?show=d3buyskills\">"; //exit(); } break; } case 'cleave': $skillbonus = mt_rand(1,5); // db config include('includes/db_config.php'); // Select data from database $sql = "SELECT * FROM $tbl_name WHERE username='$username'"; $result = mysql_query($sql); // Put info into array Hopefully while($row = mysql_fetch_assoc($result)) { // player config include('includes/player_config.php'); // check for money if they dont have it let them know else go with transaction if($row['onhand'] < '475000'){ header("Location: mainview.php?show=warnmoney"); exit(); } else{ // Update database $sql="UPDATE $tbl_name SET onhand = onhand - 475000, skill2_name = replace(skill2_name,'$skill2_name','Cleave'), skill2_bonus = $skillbonus WHERE username='$username'"; mysql_query($sql) or die (mysql_error()."<p>$sql</p>"); header("Location: mainview.php?show=d3buyskills"); echo "<META HTTP-EQUIV=\"Refresh\"CONTENT=\"0; URL=mainview.php?show=d3buyskills\">"; exit(); } break; } case 'bash': $skillbonus = mt_rand(1,5); // db config include('includes/db_config.php'); // Select data from database $sql = "SELECT * FROM $tbl_name WHERE username='$username'"; $result = mysql_query($sql); // Put info into array Hopefully while($row = mysql_fetch_assoc($result)) { // player config include('includes/player_config.php'); // check for money if they dont have it let them know else go with transaction if($row['onhand'] < '475000'){ header("Location: mainview.php?show=warnmoney"); exit(); } else{ // Update database $sql="UPDATE $tbl_name SET onhand = onhand - 475000, skill2_name = replace(skill2_name,'skill2_name','Bash'), skill2_bonus = $skillbonus WHERE username='$username'"; mysql_query($sql) or die (mysql_error()."<p>$sql</p>"); //header("Location: mainview.php?show=d3buyskills"); echo "<META HTTP-EQUIV=\"Refresh\"CONTENT=\"0; URL=mainview.php?show=d3buyskills\">"; exit(); } break; } case 'coldstun': $skillbonus = mt_rand(1,5); // db config include('includes/db_config.php'); // Select data from database $sql = "SELECT * FROM $tbl_name WHERE username='$username'"; $result = mysql_query($sql); // Put info into array Hopefully while($row = mysql_fetch_assoc($result)) { // player config include('includes/player_config.php'); // check for money if they dont have it let them know else go with transaction if($row['onhand'] < '800000'){ header("Location: mainview.php?show=warnmoney"); exit(); } else{ // Update database $sql="UPDATE $tbl_name SET onhand = onhand - 800000, skill3_name = replace(skill3_name,'$skill3_name','Cold Stun'), skill3_bonus = $skillbonus WHERE username='$username'"; mysql_query($sql) or die (mysql_error()."<p>$sql</p>"); //header("Location: mainview.php?show=d3buyskills"); echo "<META HTTP-EQUIV=\"Refresh\"CONTENT=\"0; URL=mainview.php?show=d3buyskills\">"; exit(); } break; } case 'criticalstrike': $skillbonus = mt_rand(1,5); // db config include('includes/db_config.php'); // Select data from database $sql = "SELECT * FROM $tbl_name WHERE username='$username'"; $result = mysql_query($sql); // Put info into array Hopefully while($row = mysql_fetch_assoc($result)) { // player config include('includes/player_config.php'); // check for money if they dont have it let them know else go with transaction if($row['onhand'] < '900000'){ header("Location: mainview.php?show=warnmoney"); exit(); } else{ // Update database $sql="UPDATE $tbl_name SET onhand = onhand - 900000, skill3_name = replace(skill3_name,'$skill3_name','Critical Strike'), skill3_bonus = $specialbonus WHERE username='$username'"; mysql_query($sql) or die (mysql_error()."<p>$sql</p>"); //header("Location: mainview.php?show=d3buyskills"); echo "<META HTTP-EQUIV=\"Refresh\"CONTENT=\"0; URL=mainview.php?show=d3buyskills\">"; exit(); } break; } // while and switch delimiters do not add anything else below } ?> not sure what the problems is I am trying to get the skill bnames written to the db. so not sure if its a php question or a mysql question. Any help will be appreciated. Thanks
  13. Thanks for all your help I have it now. Learned quite a bit tonight. Kryllster
  14. Ok well that makes more sense but where do I run the function at in the content page or the controller index, and how do I make it run for lack of better wording. ???
  15. I have an entry point to a dungeon room (Im making a game) and Its supposed to take a diamond out of the inventory. Now it was working with a link to the php sctript then using the header location funtion it would take the diamond the send him to the page. I am wanting to just use this over and over agiain as a function. I have like 7 or 8 scripts in different rooms to do this. Here is what my function looks like?? <?php function takeDiamond($arg){ switch ($arg){ case "main1": $takedia = $sql="UPDATE $tbl_name SET diamond = diamond - 1 WHERE username='$username'"; break; } return $takedia; } ?> now in the index.php it just shows the content but I am at a loss how to do it or I mean get it to work??? Stumped again. Thanks. Kryllster
  16. Ok another double post but is this how a normal php header looks like cause Im starting to think Im doing something wrong here. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title><?php echo $title; ?></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="icon" href="/favicon.ico"> <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"> <link rel="stylesheet" type="text/css" href="mystyle.css" media="screen"> <body> <br> <center><img src="images/dm_logo.jpg"></center> <table class="content" width="829px" cellpadding="3" cellspacing="3"> <tr colspan="2"> <!-- *** Navigation Starts Here *** -->
  17. your right I guess if I'm gonna be that complicated I should do that I have used smarty for years as a matter of fact my first script I made or cped were from there and I was thinking of using that but now I'm not sure. I'm working on an array now but I'm not sure about functions and I want to be able to use them just because. Right now I'm using CMSimple but I want to do a roll ur own tyoe thingy. Well if there are any more suggestions ? Id like to figure this out. Thanks all for the replies Kryllster
  18. Ok is there a better to do this besides using a function. I am not able to get everything going from any of the suggestions.
  19. Ok have a lot to work with here thanks for the replies. And btw I wanted to tell Lamez I love ur signature because I was in real life actually attacked by and osterich lol it was not fun. The header_view.php is just a plain html page with the php extension and inside the <title><?php echo $title; ?></title> I am trying to do this with just 1 header I guess its called dynamic or something or other.
  20. for 2 + hours trying to find a solution to my problem. I have taken some code from the internet and I am trying to learn how to write and use functions. My code for the function is like this: <?php function pageTitle($arg) { switch ($arg) { case "main": $title = "Dark Mountain Home"; break; case "music": $title = "My Music"; break; } return $title; } ?> Should be simple I have a basic index.php controller page something like this: <?php include('templates/header_view.php'); include('templates/navigation_view.php'); // check for main if(!isset($_GET['show'])){ $show = "main"; } else{ $show = $_GET['show']; } switch($show) { case 'music': include('templates/music_view.php'); break; case 'main': default: include('templates/main_view.php'); break; } // End include('templates/footer_view.php'); ?> How would I use the function in this code I have tried pageTitle(); below the case switch and pageTitle("My Main Page"); as well. also tried including it in the template file. I am at a loss. Thanks for any help. Kryllster
  21. Ok I'm back had some technical difficulties and had to practically redo the whole game. I am now back to the fight script and ajax, it works kind of it updates the page but, the script just keeps running over and over again and it doesn't just do 1 attack at a time as the script executes too quickly I think. here are the 2 files I'm using: Number 1: attacks_exec.php <?php $player_hp = 30; $mob_hp = 30; // Variables to include in while loop $fight = $_POST['fight']; while($player_hp > 0 && $mob_hp > 0){ // Determine who goes first $first = mt_rand(1,100); // Weapons $player_weapon = mt_rand(1,4); $mob_weapon = mt_rand(1,4); // start fight if($first <= 60){ $mob_hp = $mob_hp - $player_weapon; echo "You attacked with your Weapon causing $player_weapon damage!"; echo "<br>"; echo "The monster has $mob_hp Hitpoints left"; echo "<hr color=\"0000ff\">"; echo "<br>"; } if($mob_hp <= 0){ echo "You have Killed the The Monster with Your Mighty Weapon!! Yeehaa!!"; echo "<br>"; exit(); } if($first > 60){ $player_hp = $player_hp - $mob_weapon; echo "The Monster attacked you and caused $mob_weapon damage!"; echo "<br>"; echo "You have $player_hp Hitpoints left"; echo "<br>"; echo "<hr color=\"#ff0000\">"; echo "<br>"; } if($player_hp <= 0){ echo "You have been killed by the miserable Monster! Eegads!"; echo "<br>"; exit(); } } ?> Number 2: fighttest.php <html> <head> <title>Fight Script Testing - Ajax</title> <script type="text/javascript" src="includes/prototype.js"></script> </head> <body> <h2>The Fight Test</h2> <br> <br> <form action="attacks_exec.php" method="post" <input type="hidden" name="fight"> <input type="submit" value="Fight The Monster"> </form> <div id="attacks"> <script type="text/javascript"> new Ajax.PeriodicalUpdater('attacks', 'attacks_exec.php', { method: 'get', insertion: Insertion.Top, frequency: 1, decay: 2 }); </script> </div> </body> </html> Is this the correct way to do it?? Any pointers? The website you pointed me to is a little vague and is more than I can understand atm. Any reply will be appreciated!!
  22. Thanks for the reply topic solved and something new to add to what I can do with Php!
  23. This is my first time trying to pass parameters in a url here is part of the code and it displays the values in the browser but I cant get them to display in the target page?? /mainview1.php?show=fight_success&gold=1837&diamonds=3&rubies=7 I am trying to print them ie = <?php print($gold); ?> in the target page. Thanks for your time!
  24. I have never had to do this before what has changed I don't understand. I tried another version of the isset but it didn't work but this worked. Thanks for the replies!
  25. I have been looking since I lost all my stuff from hard drive crash I dont understand why this code isnt working any more <?php // Show Header View include('page/header_view.php'); // navigation // Show Header View include('page/navigation_view.php'); //Setup the url var we are looking for to control page display $show = $_GET['show']; switch($show){ case 'johnpeggy': include('page/johnpeggy_view.php'); break; case 'contact': include('page/contact_view.php'); break; case 'downloads': include('page/downloads_view.php'); break; case 'news': include('news/news_view.php'); break; case 'chat': include('page/chat_view.php'); break; case 'main': default: include('page/main_view.php'); break; } include('page/footer_view.php'); ?> I get this error :Notice: Undefined index: show in C:\Apache2\htdocs\index.php on line 10 I just don't understand, today has not been my day!! Thanks
×
×
  • 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.