Jump to content
xisto Community

Custergrant

Members
  • Content Count

    20
  • Joined

  • Last visited

2 Followers

About Custergrant

  • Rank
    Newbie [Level 1]
  1. Hey guys! I've been conducting some research over the last couple of years and have come to a phase that I need to put up an online instructory course. It's hardly a website, but it'll consist of a text box where users are to write a sentence provided to them and while they type, as the keys are pressed, corresponding .wav files will play. Much like a keyboarding class, a set of sentences and sounds have already been pre-made to specifications...I've been told that I need to do this in Flash, but I don't know any whatsoever. It's a very simple project with all of the raw material made, I just need someone who can put these together, a simple key-action command. Would anyone be willing to do this? I'd gladly put you in the research.
  2. Well, if you know where to look, you can get any of those for either free or a very low cost. I've pondered free energy all of my life and have always been really into it. I really don't have a favorite for an alternative, like most people you talk to do ("yah, fuel cells will never happen"..."solar is way too inefficient"..etc..,etc..). I'm more into the inventive spirit of it.It's really just a matter of doing it. I know I'm currently working on a research prototype that I'm building using laminated solar cells put onto a parabolic dish (like the old satellite dishes). These PV (photovoltaic) cells turn light and UV light into electricity. The reflected light and infrared (heat) get focused onto a focal point where a hybrid Stirling engine and thermal fuel cell sit, which in short, is like your car engine, but just one piston in a closed cycle where the hot air is by itself. This little contraption alone gets like 74% efficiency, which is the highest of the solars. There's energy all around us, but the problem that we have is that we must direct it in some form in order to gain from it, such as in the case of heat (easier to understand). I live just a few minutes from a huge dam and it works well too. Just a matter of how you use it.EDIT: Someone mentioned using energy from our minds....actually, in terms of joules and other units, our minds really don't generate that much energy...it's more small and many type of arrangement. Not taking the resistance of the skin into matter, humans generate a very small charge, and another way to think of it is in calories. If you were to eat someone's brain (I know, I know), you might get a max of 1000 kilocalories out of it, while a lot, that's all it has grown since its creation (like a tree). A tree might generate a lot of sugar from photosynthesis per day, but when you look in retrospect, it takes a long time for that sugar to be put into the cell growth and grow a tree (takes trees a long time to grow). If that made any sense, then I'll be surprised.
  3. I thought that would work too, but I had already tried it and nothing. I still get the extra rows. It is completely boggling my mind as to why this is happening. I've printed both arrays and they're handling just fine, but I can't understand where these 1's are coming from.
  4. Sorry for the double post. I got the problem above fixed, finally, and it's working just smashingly. I used the join below to fix it: $sql = ("SELECT * FROM user_resources JOIN resources ON user_resources.resource_id = resources.ID WHERE user_resources.user_id = $userid ");$result = mysql_query($sql) or die(mysql_error()); And then simply fetched an assoc array on it and printed the corresponding data that I wanted. Now that was for my resources table, but I've moved onto a couple more tables, and I'm having a problem with my buildings. I coded it perfectly I thought, and when I load the page, it says the data it should, but it has even more now. I'm creating a table with the building name and the amount of that type of building. And right now, in my test account, I just have one building. So it should be just "1 Papermill", which I get, but then I get additional columns with just ones in it... And I don't understand. I just now put an additional condition for the selection for where the building name cannot be null, but I'm not sure why it is doing this. //Begin Buildings Table$ubuildings = ("SELECT * FROM user_buildings WHERE user_id = $userid AND building_id != NULL ");$resultb = mysql_query( $ubuildings ) or die(mysql_error());$infob = mysql_fetch_assoc( $resultb );$buildingid = $infob['building_id'];$buildings = ("SELECT * FROM buildings WHERE building_id = $buildingid ");$resultc = mysql_query( $buildings ) or die(mysql_error());echo ("<center><h1 style='font-size:150%'>Buildings</h1><table></center>"); while($infoc = mysql_fetch_assoc( $resultc )){ echo "<tr>"; echo "<td>".$infob['amount'] . " ".$infoc['name'] . " </td> "; } echo "</font>";echo "</table>";
  5. I need help on a join, I think I have it mostly done, but I know my syntax isn't right. First off, to give you an idea, I have two tables, plus my session variables. I'm first selecting from the table: user_resources where the user_id = that of the $_SESSION's, and in user_resources, there are three fields, user_id, resource_id, and amount, and I wish to print all of this. But the hitch to it is, resource_id is an integer. In another table called resources, are the fields id and name. The resource_id = resources.id, and I want to print the name associated with that id... So this is the current code that I have now (I've tried thousands of combinations it seems like): //Begin Resources Table$query = mysql_query("SELECT * FROM user_resources, resources WHERE ". $_SESSION['userid'] ." = user_resources.user_id user_resources JOIN resources ON user_resources.id = resources.id") or die(mysql_error()); echo("<br><br><br><center><b>Resources</b><table border='1' bordercolor='black'>");while($info = mysql_fetch_assoc( $query )) { echo "<tr>"; echo "<th>Name:</th> <td>".$info['amount'] . "</td> "; echo "<th>Amount:</th> <td>".$info['name'] . " </td>"; } echo "</font>";echo "</table>"; As you can see, all I wish to show is the amount of resources by its name. But I'm not sure how to get all of that in one query. As a review on the tables: user_resource.user_id = $_SESSION['userid'] user_resource.resource_id = resource.id And then I want the name and amount from user_resources. I know, not hte best list in the world, but it gives a good idea of what I need. If anyone could help me out on this code snippet, it would be very much appreciated. I've spent over 3 hours on this so far and about to lose it if I can't figure this out.
  6. Okay, I've modified the session.php that you've sent to fit my site, and I can successfully login to my members page. But, I came across another issue and I'm not exactly sure how to approach it, I have a good idea, but thought it would be good to check with you guys (still a hair confused with sessions ). I had a couple friends of mine login using my test account to make sure that the page was displaying properly in different browsers and one of my friends just copied and pasted the url to the members page and was able to view the page just fine, but had a warning about the session.php and it's function. Anyways, what I could make out of it, was that as long as you had the session started on your computer, you could just get right in, and that the same account could be logged in by multiple computers (there were 3 of us at the same time under the same account). So I need to write a piece of code to limit the number of users able to login to one account to 1 and then, if they should exit the page, it logs them out... Here is the session.php that I modified: <?PHP//include in all files to check session and loginsession_start();require("configure.php");//check session statusif($_SESSION['logged'] != "1"){//bad session, kill itsession_destroy();} else { // SESSION GATE//check login details against table$user = $_SESSION['username'];$pass = $_SESSION['password'];//connect $link = mysql_connect($dbhost, $dbuser, $dbpass) or die('Could not connect: ' . mysql_error($link));//select databasemysql_select_db($dbname, $link) or die(mysql_error($link));//check details in the DB$result = mysql_query("SELECT * FROM users WHERE username='$user' AND password='$pass'",$link) or die (mysql_error());$row = mysql_fetch_array($result,MYSQL_ASSOC);//check details from session and DBif($user == $row['name'] && $pass == $row['pass'] && $row['userlevel'] == 1){ //if user is correct then login must be true $_SESSION['logged'] = "1";}else{ //if user is not correct send error message to main page $_SESSION['error'] = "1"; $_SESSION['message'] = "Sorry there was an error with your login details, please <a href=login.php>try again</a>";};}; // SESSION GATE ELSE//if we get this far then they are logged in and can see the page below! Yay!?> And all that I've been putting on my members page at the very top is require <?php ('session.php'); ?>
  7. Hey guys, I'm currently trying to count a number of rows in a table and then echo it out as the number of players in my game. I've checked the SQL sites and I'm following proper syntax and everything. But when I view the page, I get 'Resource id #11', and not 3 like it should be... Below is the code: <?php//connectionrequire ("../session.php");require ("../configure.php");mysql_connect ("$dbhost", "$dbuser", "$dbpass")or die("Could not connect: ".mysql_error());mysql_select_db("$dbname") or die(mysql_error());$query = mysql_query("SELECT COUNT(userid) FROM users") or die(mysql_error()); echo("<center><h1>Welcome ".$_SESSION['username']."</h1></center><br><table><tr><td>Number of Players</td><td><td>$query</td></tr><tr><td>Game Hour</td></tr></table>");?> Maybe I should fetch an array, but the $query code should be executing, and I believe it is, because I'm getting the resource id, but it's not in the format it should be. Any of you have suggestions?
  8. Os,I just started learning PHP and SQL to make my online game, but I would suggest using SQL, just because it's actually a rather simple language in my opinion and is great for storing information. But it really depends on what you're using it for I guess.
  9. Okay, I completely forgot about the session.php you sent me and was spending half a day trying to come up with my own gate. Great, I think this form will work, although, why do you have the $link in so many times? You've already connected to the database it appears, but I guess it'll work. But you're saying I need to define the $_SESSION['logged'] = "1";$_SESSION['username'] = $username;$_SESSION['password'] = $password; in my login.php? So then in the future members pages, it can call of those variables?
  10. Okay, well, I'm using a subdomain here, so can I still use that account on the link below you gave me?Otherwise, I can just transfer everything to my hotmail account, which isn't too bad, I suppose.
  11. Hey guys,I love how I have sendmail and my own email account here, but I don't know how to access them. When I created my account, I put in my home email address because that's supposed to be there. But instead of having my users email me at my home email account in my contact form, I would like to have them email me here at Xisto. I went into my Email Management and saw Add/Remove Email and created one called Custergrant@custopoly.trap17.com...and it created correctly and all. But if I have users email at this, how do I read it? Do I click Read Webmail? And how do we get accounts at this SquirrelMail and Horde? I'm very confused about this, so if anyonce can help, it'd be greatly appreciated.
  12. Sorry for the double post.. Chris, I just redid my buildings table and I'm going to try to explain the 'useless' ID field that I was talking about on MSN. First, I agreed that I just need one table for buildings, so I just kept the buildings table with the fields of id, building_id, name, cost_type, cost_restype, and cost_amount. I thought about just making a field for cost type, cost amount, input type, input amount, and so on, but it would really cause some duplication problems, and the cost_type system really makes it easier, because you can simply give it a number (0, 1, or 2) and that defines cost, input, or output. So my create table code looked like this: CREATE TABLE buildings( id INT AUTO_INCREMENT PRIMARY KEY, building_id INT, name VARCHAR(255) cost_type INT(1), cost_restype INT, cost_amount INT); Notice the first field of id, it's auto_inc and also the primary key, and it's also a completely useless field in terms of data, but it's the key to making these types of tables fit together. Anyways, I'll explain its role after I explain the actual data insertion: -- Iron Mine, Cost, 500 Lumber 1000 Stone 200 Coin, Produces 25 IronINSERT INTO buildings (building_id, name, cost_type, cost_restype, cost_amount) VALUES ('7', 'Iron Mine', '0', '8', '500');INSERT INTO buildings (building_id, cost_type, cost_restype, cost_amount) VALUES ('7', '0', '24', '200');INSERT INTO buildings (building_id, cost_type, cost_restype, cost_amount) VALUES ('7', '0', '2', '1000');INSERT INTO buildings (building_id, cost_type, cost_restype, cost_amount) VALUES ('7', '2', '7', '25'); That's a typical insertion command for one of my buildings. I have the comment with the name and statistics just for quick reference on my part. So on the first line, I'm inserting the building_id, name, and so forth. The building_id for this building is '7', which is consistent throughout this. I inserted the name, and a 0 for the cost, and an 8 for a resource type (Lumber) and an amount, 500. Now I can move onto the 1000 Stone, and instead of having to add extra fields or face duplication error, I just make another row, and it won't duplicate because the field 'id' is the primary key and it's on auto_inc, so I can simply put in the building_id to match it back up to it's proper building and keep on inserting the data for that table. And I've actually used this 'useless id' field in A LOT of my tables, because there is usually more than one line of data for the stuff I'm putting data in for, and instead of making these huge complex tables, just make some extra rows and it's all there. All you have to do is select the data where the 'real' id = whatever. I'm not sure if most people do this when they make MySQL tables, but I was pretty well new to it and this really made a lot of sense to me and makes it much easier to store data. But Chris, is this a better layout for the buildings?
  13. Okay, thanks! I'll try this out and modify it to fit my site. But I notice the 'logged'...where do I define that at in my login.php?
  14. Okay, I just got all my site stuff transferred over to Xisto, so I'm ready to resume coding. I'm currently working on my members' pages, and wish to use the PHP Session tags and include it in a function so that on every page, I just include the function to check and see if that user is still logged in and is allowed to view that page.Somebody told me I need to use the isset( blah blah blah and check to see if they were logged in from the login page (not sure how to do that), then query the $_SESSION['username] so I can check the 'userlevel' to check if that person is permitted to be there, but I'm not sure how to do that all inside of a function...
  15. Hey, thanks for the reply, I'm probably going to contact you here in a minute. For the sake of making this post more readable, I capitalized all of my fields and tables, they're all lower-case and plural at the moment. :DI hear you completely on the buildings and cost tables. The big problem is, it would cause duplicate entries, because one building may cost 100 Stone, 100 Lumber, and 100 Coin, unless I make an extra ID field with auto inc and then just make sure every row that includes those cost links up to its proper building_id...Okay, so you think I should keep user_resources and user_buildings seperated and not make just one table for every user...and I hear you on the modification part, but I really can't see any modifications at the moment, else, it would have to update the building's input and output...which would require even more work.
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.