Jump to content

Jiraiya

Members
  • Posts

    206
  • Joined

  • Last visited

    Never

Everything posted by Jiraiya

  1. k thanks, Yesideez. but i really just need to get this script working is there any possible way of getting it fixed quick and easy?
  2. how do i reset the cookies to do what i need? i have very little knowlege with this and only have a few pages i think that actually use the cookies
  3. yea i have a cookie created for when the user logs in would it help to see that script too?
  4. you mean i have to start my game over from the beginning? is there another way i could create this battle script without having to start all over again?? oh is this what you wanted to see for the cookie?? echo "3"; $UserSQuery = mysql_query("SELECT * FROM `users` WHERE username='$username'"); $UserS = mysql_fetch_array($UserSQuery); $NPCSQuery = mysql_query("SELECT * FROM `npc` WHERE npcname='$NPC'"); $NPCS = mysql_fetch_array($NPCSQuery); setcookie('NPC', $NPC, 2400); setcookie('health', $UserS['health'], 2400); setcookie('skill', $UserS['skill'], 2400); setcookie('NPCH', $NPCS['health'], 2400); } ?>
  5. i think the cookie should have the players data and the npcs data i would think i could be wrong
  6. when i click attack the number 3 appears
  7. when you click attack it should run the script that does the fighting when you press run it should bring you to the travel page
  8. here is the url were this script should running http://narutotalesofthesannin.com/Attack.php here is the entire code for the page <?php mysql_connect("localhostl", "username", "password") or die(mysql_error()); mysql_select_db("members") or die(mysql_error()); session_start(); if(!isset($_GET['NPC'])) { echo "You have not selected a NPC to fight! Please select one from below <br><br>"; $NPCS = mysql_query("SELECT * FROM `npc`"); while($Show = mysql_fetch_array($NPCS)) { echo "<a href=\"Attack.php?NPC=" . $Show['npcname'] . "\">" . $Show['npcname'] . "</a><br>"; } exit(); } $NPC = mysql_escape_string($_GET['NPC']); echo "<a href=\"Attack?NPC=" . $NPC . "&Action=Attack\">Attack</a><br> <a href=\"Attack?NPC=" . $NPC . "&Action=Run\">Run</a><br>"; $username = $_COOKIE['ID_my_site']; if(isset($_COOKIE['NPC'])) { $UserS = mysql_query("SELECT * FROM `users` WHERE username='$username'"); $UserS = mysql_fetch_array($UserS); $UserH = $_COOKIE['health']; $UserA = $UserS['skill']; $UserA *= .1; $NPCS = mysql_query("SELECT * FROM `npc` WHERE npcname='$NPC'"); $NPCS = mysql_fetch_array($NPCS); $NPCH = $_COOKIE['NPCH']; $NPCA = $NPCS['dmg']; $NPCA *= .1; $NPCX = $NPCS['skillgained']; $NPCH -= $UserA; if($NPCH <= 0) { echo "You win and have gained " . $NPCX . " skill"; $UserA = $UserS['skill'] + $NPCX; mysql_query("UPDATE `users` SET skill='$UserA' WHERE username='$username'"); unset($_COOKIE['NPC']); exit(); } setcookie('NPCH', $NPCH, 2400); $UserH -= $NPCA; if($UserH <= 0) { echo "You have lost"; $UserA = $UserA * .95; mysql_query("UPDATE `users` SET skill='$UserA' WHERE username='$username'"); unset($_COOKIE['NPC']); exit(); } setcookie('health', $UserH, 2400); } else { $UserS = mysql_query("SELECT * FROM `users` WHERE username='$username'"); $UserS = mysql_fetch_array($UserS); $NPCS = mysql_query("SELECT * FROM `npc` WHERE npcname='$NPC'"); $NPCS = mysql_fetch_array($NPCS); setcookie('NPC', $NPC, 2400); setcookie('health', $UserS['health'], 2400); setcookie('skill', $UserS['skill'], 2400); setcookie('NPCH', $NPCS['health'], 2400); } ?> </body> </html>
  9. here is the code i had that sorta worked before it might be easier to fix from this point on i hope <?php session_start(); if(!isset($_GET['NPC'])) { echo "You have not selected a NPC to fight! Please select one from below <br><br>"; $NPCS = mysql_query("SELECT * FROM `npc`"); while($Show = mysql_fetch_array($NPCS)) { echo "<a href=\"Attack.php?NPC=" . $Show['npcname'] . "\">" . $Show['npcname'] . "</a><br>"; } exit(); } $NPC = mysql_escape_string($_GET['NPC']); echo "<a href=\"Attack?NPC=" . $NPC . "&Action=Attack\">Attack</a><br> <a href=\"Attack?NPC=" . $NPC . "&Action=Run\">Run</a><br>"; $username = $_COOKIE['ID_my_site']; if(isset($_COOKIE['NPC'])) { $UserS = mysql_query("SELECT * FROM `users` WHERE username='$username'"); $UserS = mysql_fetch_array($UserS); $UserH = $_COOKIE['health']; $UserA = $UserS['skill']; $UserA *= .1; $NPCS = mysql_query("SELECT * FROM `npc` WHERE npcname='$NPC'"); $NPCS = mysql_fetch_array($NPCS); $NPCH = $_COOKIE['NPCH']; $NPCA = $NPCS['dmg']; $NPCA *= .1; $NPCX = $NPCS['skillgained']; $NPCH -= $UserA; if($NPCH <= 0) { echo "You win and have gained " . $NPCX . " skill"; $UserA = $UserS['skill'] + $NPCX; mysql_query("UPDATE `users` SET skill='$UserA' WHERE username='$username'"); unset($_COOKIE['NPC']); exit(); } setcookie('NPCH', $NPCH, 2400); $UserH -= $NPCA; if($UserH <= 0) { echo "You have lost"; $UserA = $UserA * .95; mysql_query("UPDATE `users` SET skill='$UserA' WHERE username='$username'"); unset($_COOKIE['NPC']); exit(); } setcookie('health', $UserH, 2400); } else { $UserS = mysql_query("SELECT * FROM `users` WHERE username='$username'"); $UserS = mysql_fetch_array($UserS); $NPCS = mysql_query("SELECT * FROM `npc` WHERE npcname='$NPC'"); $NPCS = mysql_fetch_array($NPCS); setcookie('NPC', $NPC, 2400); setcookie('health', $UserS['health'], 2400); setcookie('skill', $UserS['skill'], 2400); setcookie('NPCH', $NPCS['health'], 2400); } ?>
  10. the code that was suggested above just made my page bland
  11. what do you mean by that? please explain it
  12. I think it might be set as a cookie im not sure about it im kinda new to using php
  13. the script is supposed to take player data player health "A" and skill "B" and then subtract 10% of "B" from "C" which is computer controlled enemy and then take 10% of "D" which is computer controlled enemy skill and subtract that from "A" until either "A" or "C" reaches zero and if "A" reaches zero then 5% of "B" is supposed to be taken away from "B" and if "C" reaches zero then "B" is supposed to gain a preset number to the total of "B". im not sure whats wrong with it all i know is that i keeps telling me that i havent picked a npc to fight
  14. when i run it it says you havent picked a npc to fight even when i do pick one
  15. its supposed to be a player vs computer controlled fighting like and a reward system all built into one script
  16. im not sure whats wrong with this script its supposed to be a fighting script and i had it kinda working before but im not sure whats wrong with it session_start(); if(!isset($_GET['NPC'])) { echo "You have not selected a NPC to fight! Please select one from below <br><br>"; $NPCS = mysql_query("SELECT * FROM `npc`"); while($Show = mysql_fetch_array($NPCS)) { echo "<a href=\"Attack.php? Action=Attack" . $Show['npcname'] . "\">" . $Show['npcname'] . "</a><br>"; } exit(); } $NPC = mysql_escape_string($_GET['NPC']); echo "<a href=\"Attack?NPC=" . $NPC . "&Action=Attack\">Attack</a><br> <a href=\"Attack?NPC=" . $NPC . "&Action=Run\">Run</a><br>"; $username = $_COOKIE['ID_my_site']; if(isset($_COOKIE['NPC'])) { $UserS = mysql_query("SELECT * FROM `users` WHERE username='$username'"); $UserS = mysql_fetch_array($UserS); $UserH = $_COOKIE['health']; $UserA = $UserS['skill']; $UserA *= .1; $NPCS = mysql_query("SELECT * FROM `npc` WHERE npcname='$NPC'"); $NPCS = mysql_fetch_array($NPCS); $NPCH = $_COOKIE['NPCH']; $NPCA = $NPCS['dmg']; $NPCA *= .1; $NPCX = $NPCS['skillgained']; $NPCH -= $UserA; if($NPCH <= 0) { echo "You win and have gained " . $NPCX . " skill"; $UserA = $UserS['skill'] + $NPCX; mysql_query("UPDATE `users` SET skill='$UserA' WHERE username='$username'"); unset($_COOKIE['NPC']); exit(); } setcookie('NPCH', $NPCH, 2400); $UserH -= $NPCA; if($UserH <= 0) { echo "You have lost"; $UserA = $UserA * .95; mysql_query("UPDATE `users` SET skill='$UserA' WHERE username='$username'"); unset($_COOKIE['NPC']); exit(); } setcookie('health', $UserH, 2400); } else { $UserS = mysql_query("SELECT * FROM `users` WHERE username='$username'"); $UserS = mysql_fetch_array($UserS); $NPCS = mysql_query("SELECT * FROM `npc` WHERE npcname='$NPC'"); $NPCS = mysql_fetch_array($NPCS); setcookie('NPC', $NPC, 2400); setcookie('health', $UserS['health'], 2400); setcookie('skill', $UserS['skill'], 2400); setcookie('NPCH', $NPCS['health'], 2400); } ?> </body> </html>
  17. i have a script to that i want to count all the users from a table and display the total number of people in that group for example: Group A: 3 Group B: 6 Group C: 20 Group D: 204 something like that there is the script im not sure if its right <?php // Make a MySQL Connection $query = "SELECT village, COUNT(user) FROM members GROUP BY village"; $result = mysql_query($query) or die(mysql_error()); // Print out result while($row = mysql_fetch_array($result)){ echo "There are ". $row['COUNT(user)'] ." ". $row['village'] ." items."; echo "<br />"; } \ // generate and execute query $query = "SELECT * FROM townranks ORDER BY sk DESC"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); // if records present if (mysql_num_rows($result) > 0) { // iterate through resultset // print article titles while($row = mysql_fetch_object($result)) { ?> <tr> <td><?php echo $row->townname; ?></td> <td><?php echo $row->hp; ?></td> <td><?php echo $row->sk; ?></td> <td><?php echo $row->kage; ?></td> <td><?php echo $row->people; ?></td> </tr> <?php } } // if no records present // display message else { ?> <p>No press releases currently available</p> <?php } // close database connection mysql_close($connection); ?> </table> <center><H3><li><a href="http://narutotalesofthesannin.com/player.php">To Your Profile</a></li> </body> </html>
  18. <table border="1"> <tr> <th>Villag</th> <th>Health</th> <th>Skill</th> <th>Current Hokage</th> </tr> <?php // includes $host = "localhost"; $user = "username"; $pass = "password"; $db = "databasename"; // open database connection $connection = mysql_connect(localhost, username, password) or die ("Unable to connect!"); // select database mysql_select_db(members) or die ("Unable to select database!"); // generate and execute query $query = "SELECT * FROM townranks ORDER BY skill DESC"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); // if records present if (mysql_num_rows($result) > 0) { // iterate through resultset // print article titles while($row = mysql_fetch_object($result)) { ?> <tr> <td><?php echo $row->townname; ?></td> <td><?php echo $row->hp; ?></td> <td><?php echo $row->sk; ?></td> <td><?php echo $row->kage; ?></td> </tr> <?php } } // if no records present // display message else { ?> <p>No data available</p> <?php } // close database connection mysql_close($connection); ?> </table>
  19. im really confused about about how to display a picture that a logged in user has submitted onto there profile. I have it set up were it will upload the picture to a folder, but i dont understand how im supposed to display that picture if it isnt a variable data in a table??
  20. i dont have any idea how to display images and for what code do you need please be a little specific because i am a noob kinda
  21. ok i have fixed it so it uploads pics, know my question is how to display one picture that a user uploads and then have it display on the users profile?
  22. yea i can connect to my database, im having trouble editing the code so it only allows one picture to be uploaded and not three and im also having trouble figureing out were im supposed to store it. am I supposed to store it in a sub directory? because i created one called "uploads"
  23. whats this? include("dbinfo.php");
  24. so far its working pretty good. but how do i tell it were to store the profile pictures? should i try and store it on a mysql database??? or what?
  25. so far i got this script, and im not really sure were to go from here, i already had googled for tutorials on this and they didnt help much. <form enctype="multipart/form-data" action="uploader.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Upload a profile picture: <input name="uploaded pic" type="file" /><br /> <input type="submit" value="Upload File" /> </form> </body> </html>
×
×
  • 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.