Jump to content

jaylow

Members
  • Posts

    59
  • Joined

  • Last visited

Everything posted by jaylow

  1. in a separate table, like this.: <div><table></table><table></table><table></table><table></table><table></table><div> every table is set up like the one in my first post code the div has the id="chat_txt"
  2. Thank you, I am now able to hide all the tables in the chat box, i just need to figure out how to select only the ones from the user(s) i would like to hide.
  3. Hi, i am playing a game and there is a user in chat that bothers me and other players a lot but he does not break any game rule... i was wondering if there is a way i could block or mute his text with a JavaScript if so, does anyone have a tutorial on how to code something like this? the chat have no ID but every chat message is put out like this. <table border="0" padding="0" cellspacing="0" width="100%"> <tbody> <tr> <td width="90" class="chat"> <div id="202525"></div> 2015-08-24 06:06:00 </td> <td style=""> <a href="javascript:newmsg('The Martyr','')" style="">The Martyr:</a> " so I starting to give up" </td> </tr> </tbody></table> and it looks like this in chat: 2015-08-24 06:06:00 The Martyr: so I starting to give up i was thinking i could use the user name 'The Martyr' in some way to block that user i would love to code something that would just remove the lines from the chat box. and any other line the user typed and will type. i just have no idea where to start. any kind of help would be appreciated thanks
  4. jaylow

    foreign key error

    Hello, i have 2 tables. one is for users to sign up and the other is to make character. i added a foreign key to the character table to link it to the members table not when i sign up it just adds me to the table but when i want to make a character it give me this error i want to link the character_id to the id in the members table, so i know what character belongs to what member.. i get: ERROR:could not able to execute INSERT INTO `character` (charname, ######, gold, xp, accdate) VALUES ('jay', 'male', 100000, 0, now()).Cannot add or update a child row: a foreign key constraint fails (`secure_login`.`character`, CONSTRAINT `character_ibfk_1` FOREIGN KEY (`character_id`) REFERENCES `members` (`id`) ON DELETE CASCADE ON UPDATE CASCADE) Members table: CREATE TABLE IF NOT EXISTS `members` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(30) NOT NULL, `email` varchar(50) NOT NULL, `password` char(128) NOT NULL, `salt` char(128) NOT NULL, `accdate` timestamp NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ; `character` table: CREATE TABLE IF NOT EXISTS `character` ( `id` int(11) NOT NULL AUTO_INCREMENT, `character_id` int(11) NOT NULL, `charname` varchar(30) NOT NULL, `######` tinyint(4) NOT NULL, `gold` int(11) NOT NULL, `xp` int(11) NOT NULL, `accdate` timestamp NOT NULL, PRIMARY KEY (`id`), KEY `character_id` (`character_id`)) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;---- Constraints for table `character`--ALTER TABLE `character` ADD CONSTRAINT `character_ibfk_1` FOREIGN KEY (`character_id`) REFERENCES `members` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; without a foreign key i can update the characters table without any issue i messed around with the tables for the last two hours and just dont know anymore. if i switch the foreign key to my members table the sign up does not go into the members table
  5. That was it! thank you very much!
  6. now i am getting the error: ERROR:could not able to execute INSERT INTO character (charname, ######, gold, xp, accdate) VALUES ('sam', 'male', 100000, 0, now()).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 'character (charname, ######, gold, xp, accdate) VALUES ('sam', 'male', 100000, 0, n' at line 1 making me think the "now()" has a issue. i tried quotation marks around it but did not help $sql = "INSERT INTO character (charname, ######, gold, xp, accdate) VALUES ('$charname', '$######', 100000, 0, now())";
  7. Hello, i am having issues adding info to a database i have a html from where a user should fill in charname and select ###### then press submit. if i do this i get the error ERROR:could not able to execute INSERT INTO character(charname, ######, xp, gold, accdate) VALUES(jay, male, 0, 100000, now()).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 'character(charname, ######, xp, gold, accdate) VALUES(jay, male, 0, 100000, now())' at line 1 <?php include_once 'db_connect.php'; include_once 'psl-config.php'; $error_msg = ""; $now = time(); // check connection if($mysqli === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); } // Escape user inputs for security $charname = mysqli_real_escape_string($mysqli, $_POST['charname']); $###### = mysqli_real_escape_string($mysqli, $_POST['######']); //attempt inser quesry execution $sql = "INSERT INTO character (charname, ######, gold, xp, accdate) VALUES ($charname, $######, 100000, 0, now())"; if(mysqli_query($mysqli, $sql)){ echo "Records added successfully."; } else{ echo " ERROR:could not able to execute $sql." .mysqli_error($mysqli); } // close connection mysqli_close($mysqli); ?> Table CREATE TABLE IF NOT EXISTS `character` ( `id` int(11) NOT NULL AUTO_INCREMENT, `charname` varchar(30) NOT NULL, `######` tinyint(4) NOT NULL, `gold` int(11) NOT NULL, `xp` int(11) NOT NULL, `accdate` timestamp NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; I was wondering if some one could explain me what i do wrong, and or have some tips how to make this better. the idea is to add a check to see in the "charname" is already used. and some other stuff. but first i like to see the info end up in my DB Thanks
  8. I have a session running after someone registers and log into my page and i want to use that session ID How can i use the session id to store new information into a other mysql database and when the same user logs in retrieve it again from that database? I want that the user log into the page and then create a character. I just don't know how to bind it together. I made a new page where you need to create/select Character name, $ex, Race, Home world and a new table called "players" with those 4 in it plus id and User_id how would i code it so that the users session ID from the register page combines with the info he/she filled in the player creation form ? if some one could shove me into the right direction it would make my day This is the session function and log in function. function sec_session_start() { $session_name = 'sessionName'; // Set a custom session name $secure = SECURE; // This stops JavaScript being able to access the session id. $httponly = true; // Forces sessions to only use cookies. if (ini_set('session.use_only_cookies', 1) === FALSE) { header("Location: ../error.php?err=Could not initiate a safe session (ini_set)"); exit(); } // Gets current cookies params. $cookieParams = session_get_cookie_params(); session_set_cookie_params($cookieParams["lifetime"], $cookieParams["path"], $cookieParams["domain"], $secure, $httponly); // Sets the session name to the one set above. session_name($session_name); session_start(); // Start the PHP session session_regenerate_id(); // regenerated the session, delete the old one. } function login($email, $password, $mysqli) { // Using prepared statements means that SQL injection is not possible. if ($stmt = $mysqli->prepare("SELECT id, username, password, salt, accdate FROM members WHERE email = ? LIMIT 1")) { $stmt->bind_param('s', $email); // Bind "$email" to parameter. $stmt->execute(); // Execute the prepared query. $stmt->store_result(); // get variables from result. $stmt->bind_result($user_id, $username, $db_password, $salt, $accdate); $stmt->fetch(); // hash the password with the unique salt. $password = hash('sha512', $password . $salt); if ($stmt->num_rows == 1) { // If the user exists we check if the account is locked // from too many login attempts if (checkbrute($user_id, $mysqli) == true) { // Account is locked // Send an email to user saying their account is locked return false; } else { // Check if the password in the database matches // the password the user submitted. if ($db_password == $password) { // Password is correct! // Get the user-agent string of the user. $user_browser = $_SERVER['HTTP_USER_AGENT']; // XSS protection as we might print this value // everything works! //so i could add more to the table and get the info from here $user_id = preg_replace("/[^0-9]+/", "", $user_id); $_SESSION['user_id'] = $user_id; $_SESSION['email'] = $email; $_SESSION['username'] = $username; $_SESSION['accdate'] = $accdate; // XSS protection as we might print this value $username = preg_replace("/[^a-zA-Z0-9_-]+/", "", $username); $_SESSION['username'] = $username; $_SESSION['login_string'] = hash('sha512', $password . $user_browser); // Login successful. return true; //TEST if Login successful add to email and username from members and add to players table } else { // Password is not correct // We record this attempt in the database $now = time(); $mysqli->query("INSERT INTO login_attempts(user_id, time) VALUES ('$user_id', '$now')"); return false; } } } else { // No user exists. return false; } }}
  9. its not drag and drop its on click move to location. i will have a look into Javascript animation it sounds promising. i was thinking some php should be there, as well and maybe a database, so that other images could be stored on them like a building and stay on that spot.
  10. Hi, i was wondering how to move a image over a 9x9 grid of other images The 9x9 would be 81 images of a size, lets say 32px by 32px The images that moves over them the same size 32x32. The 9x9 would be the background and the image that needs to be moved should stay centered. In what direction should i look, and are there any tutorials on the mather ? i was thinking that if i move the background the image would always stay centered but i dont know i that is a good idea. an exemple would be http://www.pardus.at or http://sylfex.redirectme.net
  11. its for everyone to see the same time, i would be used to show when a planet has a production tick. (to help my faction friends in a game) "when it gets to the end it's not going to be accurate"so javascript slows down afther some time? what do you mean with a "timestamp" a excact time when the time tick is?because those i have, (if i ask around) but for a test any time will do
  12. Hi, i am making a countdown timer that needs to countdown every 7 hours.seti have a time now that i can set to any time. and it counts down. now i want that it counts down ever 7 hours (starting at 14:02 to 21:02 to 4:02 to 11:02 ect)my questions are:1.how do i make it start on a specific time?2. how do i make it so that the timer does not start over everytime you refresh the page, or go to the page? i am pretty new to Javascript and this is the first thing i am "making"here is my code so farits just a countdown timer that counts down 5 seconds and restarts var Timer;var TotalSeconds; function CreateTimer(TimerID, Time) { Timer = document.getElementById(TimerID); TotalSeconds = Time; UpdateTimer() window.setTimeout("Tick()", 1000);}function Tick() { if (TotalSeconds <= 0) { Timer.innerHTML = " Time's up "; window.setTimeout("Tick", 1000); CreateTimer("timer", 5) return; } TotalSeconds -= 1; UpdateTimer() window.setTimeout("Tick()", 1000);}function UpdateTimer() { var Seconds = TotalSeconds; var Days = Math.floor(Seconds / 86400); Seconds -= Days * 86400; var Hours = Math.floor(Seconds / 3600); Seconds -= Hours * (3600); var Minutes = Math.floor(Seconds / 60); Seconds -= Minutes * (60); var TimeStr = ((Days > 0) ? Days + " days " : "") + LeadingZero(Hours) + ":" + LeadingZero(Minutes) + ":" + LeadingZero(Seconds);Timer.innerHTML += " " + TotalSeconds; Timer.innerHTML = TimeStr; }function LeadingZero(Time) { return (Time < 10) ? "0" + Time : + Time;} </script> i put this in the html: <div id="timer" ><script type="text/javascript">window.onload = CreateTimer("timer", 5);</script></div >
  13. its seems that now all is good but one thing..if to <td> are next to iets other and have something in them they overlap...it has something to do with.cresent {position: absolute;background: #540400;}but if i turn that off it messes up even more..would ther be a way to make a 1px width by 90px height space inbetween 2 <td> in a table
  14. ha i got it \ / and the end result is less Css and the same html <td class="cresent"><div class="empthy"> </div><div class="empthy"> </div><div class="empthy"><img src="images/tld.png"></div><br class="clearboth" /><div class="empthy"><img src="images/center_l.png"></div><div class="empthy"> </div><div class="text">Ethernoan</div><div class="empthy"><img src="images/center_r.png"></div><br class="clearboth" /><div class="empthy"><img src="images/drd.png"></div><div class="empthy"> </div><div class="empthy"> </div></td> .empthy{float: left;width: 30px;height:30px;z-index:5;}.clearboth { clear: both; } .text {position: absolute;width:100%;text-align:center;overflow:visible;Z-index:6; .cresent {position: absolute;background: #540400;} Thanks,only took me 3 hours
  15. found outi can do it like this: <td><div class="empthy"> </div><div class="empthy"> </div><div class="empthy"><img src="images/tld.png"></div><br class="clearboth" /><div class="empthy"><img src="images/center_l.png"></div><div class="empthy"> </div><div class="empthy"><img src="images/center_r.png"></div><br class="clearboth" /><div class="empthy"><img src="images/drd.png"></div><div class="empthy"> </div><div class="empthy"> </div></td>---------------# the Css #--------------- .empthy{float: left;width: 30px;height:30px;z-index:5;}.clearboth { clear: both; } but then i have a problem with the text in the centerit will mess up the center as it does not fit. is there a way to force the text to be centered in the <td> and not mess up the other content in it ?
  16. if i remove the <div> around <div id="st_bc"><img class="st_bc" src="images/st.png"></div> and use position:relative; i can move the straigh bottom line on the right place. but that messes up all the other straigh bottom lines... does anyone know a way to make them all work out and stay in the bottom center (and top center) on the <td> with out pushing the left and right images up/down/left/right?i need to add this to every <td> in the code so it should work universalThanks also if i find a way to fix this i will post it here
  17. i am adding images to a table it needs to represent the connections between the sectors on a map (look at code and you understand)i use "float:" for the ones that go left and right and then position them with position:relative top and bottombut then ones that need to go in the top center and bottom center can not use float: so the push everything a bit uphow can i fix this?look at Venious 7.3 (in the red space)you can download the code in the attachment .html and .cssyou probably see i am pretty new to this Edit: i cant seem to upload the connection images that its all about (maybe to small 1kb)so its hard to test it out with out those... css.css index2.html
  18. Site Name: Fleet-fan-siteSite Description: Fan site for a MMO in beta stage called fleetSite Owner/Developer: MeSite Address: Visit My WebsiteExtra Comments:first site i made, use lots of tutorials
×
×
  • Create New...