Jump to content

poizn

Members
  • Posts

    30
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

poizn's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi all Over the past few days i'v been creating a page with some tabs on. As you click on the tab, the content should update. Seems simple enough, but one of the tabs has an area map on. Again all seems simple, but it doesn't work in IE (it works in FF) I have created the page below to demonstrate what im trying to do. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <script type="text/javascript"> function add_event(obj , event_type , func) { if(obj.addEventListener) { obj.addEventListener(event_type , func , false); return true; } else if(obj.attachEvent) { var r = obj.attachEvent("on" + event_type , func); return r; } else { return false; } } function africa_toggle() { alert('1'); } function loader() { var map_img = document.createElement("img"); map_img.src = "world_map.jpg"; map_img.id = "search_map"; map_img.alt = "World Map"; map_img.border = "0"; // next line doesnt work if I use the above notation... so I had to use setAttribute map_img.setAttribute("usemap" , "#search_map_map"); var map_tag = document.createElement("map"); map_tag.name = "search_map_map"; map_tag.id = "search_map_map"; var area = document.createElement("area"); area.id = "africa"; area.shape = "poly"; area.coords = "208,171,220,169,227,162,230,156,230,149,238,142,238,134,236,130,239,122,251,110,252,100,245,102,239,98,232,87,226,77,222,72,215,71,210,72,202,69,197,63,185,66,179,67,174,70,172,75,165,79,164,85,165,91,164,96,167,103,174,112,178,109,181,112,188,108,194,110,197,112,198,115,197,118,200,126,203,128,204,134,203,139,201,143,204,152,206,160,208,163"; area.href = "africa.php"; add_event(area , "mouseover" , africa_toggle); map_tag.appendChild(area); document.getElementById("body").appendChild(map_img); document.getElementById("body").appendChild(map_tag); } add_event(window , "load" , loader); </script> </head> <body id="body"> </body> </html> Basically it should, on page load, create an img tag, create a map tag, and then create an area tag, and insert it all into the body tag. Can anyone help? Thank in advance Cheers
  2. Hi all I have 2 question's. Recently I have started trying to impliment stored procedures in our application, but am having a little trouble learning everything. My first question is can a stored procedure return more than one record. In other words, if I had a stored procedure, that fetched all the records from a table, could I get all the records returned from the stored procedure? DELIMITER $$ DROP PROCEDURE IF EXISTS `test`.`p2` $$ CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`(OUT user_ids INTEGER(10)) BEGIN SELECT DISTINCT user_id INTO user_ids FROM users; END $$ DELIMITER ; Lets assume this is my simple stored procedure, I call it like so CALL p2(@var); And get the following error message "Error 1172: Result consisted of more than one row" Can anyone help? My second question isn't really a stored procedures question, but more of a query related question. Lets assume I have a users table, with a user_id column. I then have a user_group table, with a user_id, and group_id column. Given that a group can be any size (ie there can be multiple records in the user_group table for a given group) how can I check if a group exists, given the user_id's? And if the group does exist, return the group_id? Can any one help? Thanks in advance
  3. Awesome i'm glad you understand Thanks for your suggestions, ill keep them in mind. Probably not going to impliment that right now, but something I could do in the future. Thanks very much
  4. I think the only way to do this is to set a cookie. I'v been researching, just about the same thing and it looks like the only way to uniquely identify a PC (in PHP) is via a cookie.
  5. You should read up on SQL injection and other php security related topics http://www.ilovejackdaniels.com/php/writing-secure-php/ http://ocliteracy.com/techtips/sql-injection.html Or just google SQL injections Cheers
  6. To answer HAN question define("SESSION_TIMEOUT_MINS" , 5); $session_path = ini_get("session.save_path"); if(($pos = strpos($session_path , ";")) !== FALSE) $session_path = substr($session_path , $pos + 1); $session_path .= "/{your app name or what ever folder you want to put it in}"; if(!file_exists($session_path)) mkdir($session_path , 0774); ini_set("session.save_path" , $session_path); ini_set("session.gc_probability" , 100); ini_set("session.gc_maxlifetime" , (SESSION_TIMEOUT_MINS * 60)); // seconds ini_set("session.cookie_lifetime" , 0); ini_set("session.cache_limiter" , "nocache"); ini_set("session.cache_limiter" , "private"); ini_set("session.cache_expire" , SESSION_TIMEOUT_MINS); // minutes This should destroy the session after 5 minutes of inactivity Or every time there is some activity on one of your scripts (you could have some code to write the current time, in the same place as you session start), you could store the time and check it against the current time. Ie when the guy logs in get current time, and every time you open a page (and start the session) get the old stored time, check that it isnt more than 5 minutes ago (or how ever long your timeout is). If it isnt store the new time, but if it is, destroy the session. Thanks for your help redarrow, and thanks for your points of view. I agree with what you have to say, but I dont think you fully understand what our site does, what the login are for etc.. I agree with you point But only in certain situations, our situation not being one of them. Let me explain the way our site works (maybe you will get a better feel for what im trying to do). Our site is similar to myspace, where a user / company can create a login and create their own mini page on our site. There's plenty more to the site than that, but I cant really give that info away. In the case of a company, one person may have some details while another may have some other details needed by our site, so giving more than one person in the client company, the user name and password may very well happen (we not going to do this, this will be managed by the client) (I hope this helps you understand) So the reason we want to stop two people from logging into the same account is to stop Dave from HR, who has to enter the address of the company. He see's that the phone number is not yet filled in (but Steve has been assigned to do this, and is trying to log in at the same time) and so tries to fill it in, while Steve is doing it at the same time. Like you said storing the slient IP wont solve my problem because many people on one lan will have the same IP, but they shouldnt have the same computer name. I think two pc's on a lan can have the same name, but its the closest thing i'v got to being unuique (and in most cases, most PC's on the same network have a different computer name)
  7. The reason that its handy to not allow more than one person to log on to an account, is so that two users dont edit the same data at the same time, or enter the same data at the same time. Some parts of our site allow users to enter rates and various other things like that, so to make sure two employes dont enter the same rates to their pages (have any of you ever worked with people before, especially in a big company, ever had the situation where people dont listen and duplicate work etc...), we trying to only allow one perons to log on at once. Its not as crazy as people think, iv seen other sites that do similar things... The best solution that I can come up with is, when a user logs on, store the 1) session id - session_id() 2) the current time - time() 3) clients remote id - $_SERVER["REMOTE_ADDR"] 4) clients computer name - $_ENV["COMPUTERNAME"] This way if another user logs in, ill know that they not the orignal user and be able to give them a message that the other user is logged in etc., by using the session id and time (simple) But if a user closes their brower window, and tries to log on again, ill be able to check and see if its the same computer, and warn the user that the other session will be destroyed This still doens solve the problem of somebody closing their browser and then other people wont be able to log in (until the time expires) So maybe a higher user could then log that person out I hope that made sense, and I hope it helps someone out Cheers
  8. Hi all Sorry if some of you have already seen this, but no one could help me on Friday, so im posting my question again, hoping that some fresh eyes will see it and help me out... I am creating a site that has a session based log in. Pretty simple stuff, but the bosses have asked if we can make it so that only 1 person can log into an account at once (ie if someone logs in with a specific acocunt, lock the account and dont let any one else log in) I'v been fiddleing around with session, and various session variables etc. and the only part that I cant figure, is if the user logs in, and closes the browser window, how do I know that the user has logged out. Does anyone have any suggestion, clues or help for me? If you would like a more detailed description of how im handleing my sesssions etc. please just ask. Thanks
  9. Hmmm it could very well be that function. Try this maybe, comment out the line that calls this function (generatePassword) This way you would know, if the function is causing the script to hang
  10. So which line is actually hanging? ../../ "should" work Is it maybe that the script, that you trying to include, doesnt exist? What is the actualt error you get?
  11. Whats is forking you script and how do you do that?
  12. Silly question maybe, but have you checked if $_POST["save_file"] and $_POST["savecontent"] have the correct values in them? (sorry if i'm asking a really dumb question)
  13. Cool thanks for the help, but I had pretty much come to the same conclusion. If a user closes their window, they arent going to be able to log in again, until the session has timed out... (big bummer) I also thought of using a session variable, to store the time (well the last activity on the account) and you pretty much get the same thing, if the user closes the window... (blah blah) If you talking about using the actual session on the server, you can try this define("SESSION_TIMEOUT_MINS" , 5); $session_path = ini_get("session.save_path"); if(($pos = strpos($session_path , ";")) !== FALSE) $session_path = substr($session_path , $pos + 1); $session_path .= "/b"; if(!file_exists($session_path)) mkdir($session_path , 0774); ini_set("session.save_path" , $session_path); ini_set("session.gc_probability" , 100); ini_set("session.gc_maxlifetime" , (SESSION_TIMEOUT_MINS * 60)); // seconds ini_set("session.cookie_lifetime" , 0); ini_set("session.cache_limiter" , "nocache"); ini_set("session.cache_limiter" , "private"); ini_set("session.cache_expire" , SESSION_TIMEOUT_MINS); // minutes Pretty much does the same thing (it time the session out after a certain time of inactivity), but same thing, if the user closes the window... blah blah blah Thanks again for your suggestion. Has anyone else got any ides? Please help, these sessions are driving me crazy O_o
×
×
  • 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.