Jump to content

avatar.alex

Members
  • Posts

    156
  • Joined

  • Last visited

    Never

Everything posted by avatar.alex

  1. I got this software up and running it just is having one problem. Whenever I log in I get this: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/www/twilightfor.freehostia.com/x/examples/protect.php on line 15 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/www/twilightfor.freehostia.com/x/examples/protect.php on line 23 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/www/twilightfor.freehostia.com/x/examples/protect.php on line 33 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/www/twilightfor.freehostia.com/x/examples/protect.php on line 37 I go to protect.php: (I looked at the code and everything seems correct) <?php session_start (); // --------------------------------THE VARIABLES---------------------------------- // @include ("config.php"); // ----------------------------------THE CODE ------------------------------------ // function clearance ($user_value, $pass_value, $level_value, $userlevel_value, $table_value, $column1, $column2, $path) { // Function to see if user can login $check = mysql_query ("SELECT $userlevel_value FROM $table_value WHERE username='$user_value' AND password='$pass_value'"); // Query to see if user exists $verify = mysql_num_rows ($check); if ($verify == 0) { // Check if passwords are hashed with MD5 $md5 = md5 ($pass_value); $check = mysql_query ("SELECT $userlevel_value FROM $table_value WHERE username='$user_value' AND password='$md5'"); // Query to see if user exists $verify = mysql_num_rows ($check); } if ($verify == 0) { // Check if passwords are hashed with SHA1 $sha1 = sha1 ($pass_value); $check = mysql_query ("SELECT $userlevel_value FROM $table_value WHERE username='$user_value' AND password='$sha1'"); // Query to see if user exists $verify = mysql_num_rows ($check); } $get = mysql_fetch_array ($check); if (count ($level_value) != 0) { // If the allow array contains userlevels if (in_array ($get[$userlevel_value], $level_value) && $verify > 0) { // Search allow to see if userlevels match $_SESSION['username'] = $user_value; // Register sessions $_SESSION['password'] = sha1 ($pass_value); // sha1 password for extra security $_SESSION['userlevel'] = $get[$userlevel_value]; } } else { if ($verify == 0) { // If attempt fails then redirect to login page $_SESSION = array(); $error = "Sorry but your login details were incorrect"; @include ("login.php"); exit; } if ($verify > 0) { // If attempt is good then register the user $_SESSION['username'] = $user_value; $_SESSION['password'] = sha1 ($pass_value); } } } function protect ($level_value, $password_value, $userlevel_value, $table_value, $column1, $path) { // Function to keep pages secure if (!isset ($_SESSION['username'])) { // If session doesn't exist then get user to login if (isset ($_POST['username']) && isset ($_POST['password'])) { $error = "Sorry but your login details were incorrect"; } $_SESSION = array(); @include ("login.php"); exit; } else { // If user is logged in check to see if session is valid and that they have the required userlevel $check = mysql_query ("SELECT $password_value, $userlevel_value FROM $table_value WHERE $column1='$_SESSION[username]'"); // Query to see if user exists $verify = mysql_num_rows ($check); $get = mysql_fetch_array ($check); if ($verify == 0) { $_SESSION = array(); $error = "Sorry but your login details were incorrect"; @include ("login.php"); exit; } if ($verify > 0 && count ($level_value) != 0) { if (!in_array ($get[$userlevel_value], $level_value)) { // Check to see if the users userlevel allows them to view the page $error = "Sorry but your login details were incorrect"; @include ("login.php"); exit; // Ensure no other data is sent } } } } if (isset ($_POST['username']) && isset ($_POST['password'])) { // If user submits login information then validate it clearance ($_POST['username'], $_POST['password'], $allow, $userlevel, $table, $username, $password, $path); } protect ($allow, $password, $userlevel, $table, $username, $path); mysql_close ($link); // Close the database connection for security reasons // -----------------------------------THE END ------------------------------------ // ?>
  2. oh ok thanks so much I get it now ill look it all up k!!!
  3. Im looking it up and I cant find any <? CRON CODE ?> Type scripts
  4. Whats it called when I want something to happen every hour like. Every hour something happens?
  5. do you think that you could help me pull that map system from the game cus you have more EXP with the script?
  6. k thanks!!! ill look into all that ill show you guys when im done!!
  7. i know its not simple but couldn't I just do something like make a table and put x,y cordites in the table along wit map number and so if they land on 3,4 I can make it so its like header("location:map.php?id=".$mapnum.); and it sends them to map 2 or something Pluse i dont have ads in my game...?
  8. OK so in the code where would I look to see what to change?
  9. Ive searched and I couldn't find anything like this ok...well one of my game developers have created a type of explore system...but its written in javascript and PHP so its hard for me to tweak it...but I need something that moves around like this http://www.bbgamezone.com/map/ but if I have a house or something be able to enter it...some how? IDK...but everythings good just entering the houses, shops, shrines w/e it may be i would like to know how to do this? Heres the topic http://community.bbgamezone.com/index.php/topic,1000.0.html for more detail...but if anyone already knows a source out there that is similar to this feel free to share with me!! thanks
  10. Ok wat I want to do is show info in rows and columns for my game but i dont know how to get it all displayed correctly cus how im calling the items like if I call item one it shows up like this: <table> <tr> <td>Item 1</td> <td>Item 1</td> <td>Item 1</td> <td>Item 1</td> </tr> </table> I want it to show up like this in a table. FYI im using mouseover div box for the items!!
  11. Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''players' ADD 'jobcount' INT(11) default '3'' at line 1 IDK wats going on?
  12. I searched for it and it didn't show up the results I wanted... For my site I want my site to send a text message when ever someone gets a private message...how would I do that.
  13. IDK why this isn't correct but can someone help me with this ALTER TABLE 'players' ADD 'jobcount' INT(11) default (3); IDK I want to add a jabcount to the players table but it wont let me?
  14. Hello im am trying to add something to my game and I got stuck. I am trying to get it so When I push Get Item it will generate a item that is between 1-5 gold randomly....but i got this far in my quest to do so...could someone point me in the right direction!!! if ($_POST['getitem']) { $query = $db->execute("select `id`, `name`, `price` from `blueprint_items` where `id`=?", array($_GET['id']));
  15. i did and thats not the errors trying to say! Having it explained to me helps me I can also learn by going through the code!!! Thanks!
  16. no lol im still lookin up stuff and tryin to fix it!!!
  17. I found wat i did. I didn't make a login table i changed it to users. I changed the error
  18. The Login.php file works fine thanks so much!!!! Ok thanks now a new problem...i though everything works it turns out the members page has an error I DON'T KNOW HOW!!! But it does: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, support@freehostia.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. -------------------------------------------------------------------------------- Apache/1.3.33 Server at avatar-alex.freehostia.com Port 80 <? // members page session_start(); //Database Information $dbhost = "mysql2.freehostia.com"; $dbname = "alealb52_login"; $dbuser = "alealb52_login"; $dbpass = "****"; //Connect to database mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error()); mysql_select_db($dbname) or die(mysql_error()); $query="SELECT * FROM users "; $result=mysql_query($query); $num = mysql_num_rows ($result); if ($num > 0 ) { $i=0; while ($i < $num) { $username = mysql_result($result,$i,"category"); if (!$username) { print "Please login below!"; include 'login.html'; } else if ($username == "admin") { echo "I can edit members here, right!<br >"; } else { print"<html>"; print"<head>"; print"<title>MEMBERS ONLY</title>"; print"</head>"; print"<body>"; print"Your Members Page...."; print"</body>"; print"</html>"; } } } ?> P.S. Sorry about all the troble I am still learning how to use PHP an MySQL sorry
  19. Ok I pretty much have this system done I just need some help with this part. It all works except for when I login. The registration work fine!!! The problem is on line 20 Parse error: parse error, unexpected T_STRING in /home/www/avatar-alex.freehostia.com/login.php on line 20 <?php //Database Information $dbhost = "mysql2.freehostia.com"; $dbname = "alealb52_login"; $dbuser = "alealb52_login"; $dbpass = "****"; //Connect to database mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error()); mysql_select_db($dbname) or die(mysql_error()); session_start(); $username = $_POST[‘username’]; $password = md5($_POST[‘password’]); $query = “Select * from users where username=’$username’ and password=’$password’ ”; $result = mysql_query($query); if (mysql_num_rows($result) != 1) { $error = “Bad Login”; include “login.html”; } else { $_SESSION[‘username’] = “$username”; include “memberspage.php”; } ?>
  20. Oh no lol you have me misunderstood im sorry. I don't want some one to write the code for me and thats it. I kinda want help writing the code, in a way this would belong in the Freelance forum could someone please move this topic there. Thanks
  21. Hello I am in the process of creating or changing this user login system to a user management system. I would like to have the users in 3 levels of access: 1=member 2=mod 3=admin I would like it so when they register they automatically go in the database as a member, but I would like a seperate registration page to like admins register?? This is the registration page. I would like it to be so when a momber registers it has them register as a member. <?PHP //Database Information $dbhost = "localhost"; $dbname = "your database name"; $dbuser = "username"; $dbpass = "yourpass"; //Connect to database mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error()); mysql_select_db($dbname) or die(mysql_error()); $name = $_POST['name']; $email = $_POST['email']; $username = $_POST['username']; $password = md5($_POST['password']); // lets check to see if the username already exists $checkuser = mysql_query("SELECT username FROM users WHERE username='$username'"); $username_exist = mysql_num_rows($checkuser); if($username_exist > 0){ echo "I'm sorry but the username you specified has already been taken. Please pick another one."; unset($username); include 'register.html'; exit(); } // lf no errors present with the username // use a query to insert the data into the database. $query = "INSERT INTO users (name, email, username, password) VALUES('$name', '$email', '$username', '$password')"; mysql_query($query) or die(mysql_error()); mysql_close(); echo "You have successfully Registered"; // mail user their information $yoursite = ‘killako.freehostia.com.com’; $webmaster = ‘avatar.alex’; $youremail = ‘avatar.alex@yahoo.com’; $subject = "You have successfully registered at $yoursite..."; $message = "Dear $name, you are now registered at our web site. To login, simply go to our web page and enter in the following details in the login form: Username: $username Password: $password Please print this information out and store it for future reference. Thanks, $webmaster"; mail($email, $subject, $message, "From: $yoursite <$youremail>\nX-Mailer:PHP/" . phpversion()); echo "Your information has been mailed to your email address."; ?> This is part of the code that tells you if your logged in then you can view the page if ( empty( $username ) ) { print "Please login below!"; include 'login.html'; } else { echo "Admins Only"; } if ($username=3)){ echo "Edit members here"; } ?> The if ($username=3)){ echo "Edit members here"; } at the end I added if I get the system to work thats what I would what the user managment system to look like I would like to store the PHP user level code in the connect.php with the connection to the database. This is the table delow how would I add the userlvl in it? or would I make a new table because there are 3 user levels CREATE TABLE users ( userid int(25) NOT NULL auto_increment, name varchar(25) NOT NULL default '', email varchar(255) NOT NULL default '', username varchar(25) NOT NULL default '', password varchar(255) NOT NULL default '', PRIMARY KEY (userid), UNIQUE KEY username (username) ) TYP E=MyISAM COMMENT='Members';
  22. Why wont this table be created??? CREATE TABLE `app` ( `id` int(6) NOT NULL auto_increment, `email` varchar(255) NOT NULL default '', `name` varchar(255) NOT NULL default '', `scripting` varchar(255) NOT NULL default '', `scriptingskills` varchar(255) NOT NULL default ", `mapping` text NOT NULL default '', `mappingskills` varchar(255) NOT NULL default '', `website` varchar(255) NOT NULL default '', `message` varchar(255) NOT NULL default '', PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`) )
  23. well it doesn't show up as any errors( it send me to the thank you page) but it won't send the email to my yahoo.com email my other feedback form did this also could I divide it up like this: <? $email = $_REQUEST['email'] ; $name = $_REQUEST['name'] ; $mappingskill = $_REQUEST['mappingskill'] ; $mapping = $_REQUEST['mapping'] ; $scripting = $_REQUEST['scripting'] ; $scriptingskill = $_REQUEST['scriptingskill'] ; $message = $_REQUEST['message'] ; mail( "adalbrecht67@aim.com", "Develop App - $name", "$message", "--------------", "$scriptingskill", "--------------", "$scripting", "--------------", "$mapping", "--------------", "$mappingskill"", "--------------", ""From: $email" ); header( "Location: /index.php?id=thankyou" ); ?>
  24. is there a reason why it never sends emails to a yahoo.com email account
×
×
  • 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.