Jump to content

mikhl

Members
  • Posts

    80
  • Joined

  • Last visited

Everything posted by mikhl

  1. mikhl

    Phpmyadmin

    I also remember being told in database lectures that a tuple is a row
  2. Sorry if I caused any confusion with the saving the users Id in a cookie. This was just an idea I had and I was wondering what others thought about it. In retrospect, I would have used the username; it makes much more sense. To clear anything up, the cookie was being used to auto fill part of the lov in form. A way to. And it feel to the use like they are verifying their credentials, rather than actually logging in again. However, I am unsure at to if I will be implementing this approach into my website. Maybe it is taking a step too far for something that should be quite simple.
  3. I was thinking something along the lines of: when the user logs in a cookie containing the users id. When a page is loaded it will be checked to see if the session exists, if not, it is checked to see if the user id cookie exists, if so a request will be made for the user to log back in.
  4. I would also highly reccomend xyph's suggestions. This will be much easier in the long term. Your database will be more managable and user friendly.
  5. Hello, When using sessions to give registered users acess to their content. What length of time do you think is a good length of time for a session to expire. Taking into account the user should be able to ask the session to never expire. If a users session does expire, what do you think is the best thing to do? Is it best to navigate them to the login page, or would it be better to prompt them with some sort of message popup saying something along the lines of "your session has expired, please enter your password to log back in, or click here to log in as someone else".
  6. What might be a good idea is to concatenate a number of the users details you have stored in the database, such as their birthday, email address, name, and maybe a preset string from you, then hash this. This will create a unique hash for the user. Send the user an email containing a link like: www.yoururl.com/reset_password?key=hashedvalue When the user clicks this or pasted it into the web bar a script will validate the hashed value and allow the user to select a new password or create a new one for them. This method means you don't have to store anything in the database. However, you cannot set an expiry date for this.
  7. I think Kicken has the best idea about creating a hash value in a cookie and storing it in your database obviously this method has its flaws. People can clear their cookies and vote again. You could have the voting feature disabled cookies are not enabled. Another method would be to have the user enter their email address to vote. This would also enable to sort out your non-logged in users. Though entering and email address also poses disadvantages. Namely deterring users, fake email addresses, people with numerous accounts.
  8. I cannot think of anything that would fix it, if your href pointer is correct. If all else fails use the URL. To make sure of things I like to start at the HTML file and manually navigate to the CSS file in the window. This will verify the file path for you. You could also try navigating to the CSS file from the forums directory using the command line. This will show you the exact file path to use. Hope this gets resolved
  9. You could write a simple JavaScript function to do this for you. function setState(element, state) { var elem = document.gelElementById(element): elem.style.display(state); In HTML: <input type="checkbox" value="yes" name="name" onchange="setState('elementID', 'block');" /> You would replace none with inline or block to set the element to display. The CSS display attribute of each element will have to be set to none. This code is not tested and may not be 100% complete
  10. Try: img{ border:0; } To get rid of the image borders
  11. Hmm. Am I right in thinking you are storing the friend IDs all in the same value, deprecated by commas. I don't think that this is the best method to store friends. The only way I can think, without redesigning the database, would be to (as you said) retrieve the list of friend IDs from the database and append the new one to the end. When deleting a friend you could cycle thought each ID in the string and place them in an array. Look for the value of the ID to be removed within the array, remove it. Then insert the newly amended array back into the database.
  12. Is the forums and assets directories in the same directory. I know it's a silly question, but I thought it worth checking.
  13. I aim to impress. Auto correct can only help!!
  14. Hello people, I self thought myself some PHP as an extended project at school and then did some more PHP (as well as HTML, CSS, JS, and Flash) as a part of my degree at uni. I created my account here to aid my studies a couple of years ago and I am now back out of my own interest. I have since had a growth in interest in web development. Mostly back-end, though I like some front-end. I was hoping to hear other people's stories as to how they got into web development, and what they are doing now.
  15. Can cookies be forged to gain access to someones account details, or is this not something to worry about.
  16. Hey Steve. What do you store in the cookies to verify the users identity. I was just wondering what cookies you store to authenticate the iser. So I can compare it with what I am thinking of, and find out if my ideas are good or not. Thanks for the reply!!
  17. Have you thought of setting its visibility to none so it wouldn't show but would still be there to be submitted. You could modify this with a simple JS function.
  18. Give each questions radio buttons the same name value, e.g. "q1", these are then grouped together as one input Then in the PHP just retrieve that input and check it against an array of list of variables containing the correct answers. $answer = $_POST['q1']; if($answer == $q1_answer){ $score += 1; } Hope this helps. Sorry if there is something wrong with the code. Done this on my phone
  19. When creating a login feature is it best to create it using sessions or is it feasible to use cookies. What are the disadvantages of doing it each way. And is it secure it create the login feature with cookies in the first place. Thanks
  20. I agree with downah. Are we gona get a sneaky view of this legend of a CV. Oh and congratulations!!
  21. Hey, thanks for the answers. Some things I am going to brush up on and ensure I can fully utilise and understand. Silkfire, if you can come up with some more I would be very greatful.
  22. Hi, I'm just wondering what I should know in PHP to be classed of a good PHP coder. I am wanting to compile a list so I can check off what I know and figure out what I still need to learn. Thanks
  23. Hello! I have some JS that affects the elements of a select box. When the user selectes which type of customer they are a select box automatically fills with the payment types available to them. This works in Forefox. However, if the user was using Internet Explorer they would see an empty select box instead of one filled out with the payment types. To make this work I am using the innerHTML of the select box. if you are interested, my JS code is below: This function also affects the visibility of some elements on the web page. However, this works well. function terms(chkBox, termsText){ var form = document.getElementById('orderForm'); var chk = document.getElementById(chkBox); var text = document.getElementById(termsText); //if the checkbox is checked on change if(chk.checked == true){ text.style.color = '#000000'; text.style.fontWeight = 'normal'; document.getElementById('sub1').disabled = false; } else { //if it is unchecked text.style.color = '#FF0000'; text.style.fontWeight = 'bold'; document.getElementById('sub1').disabled = true; } } function changeCustType() { var form = document.getElementById('orderForm'); var custType = form.customerType.value; var subType = form.subType; //default setting of subType var temp = '<option value="">Choose a Type</option>'; //the fields to affect var retArea = document.getElementById('retCustDetails'); var trdArea = document.getElementById('tradeCustDetails'); //change the customer type if(custType == 'ret'){ //make fields visible retArea.style.visibility = 'visible'; //make fields hidden trdArea.style.visibility = 'hidden'; //loop through sub array apd place values in correct places for(i = 0;i < subListArray[1].length; i++){ //retrieves substrings for value and detail aspect of option tag var val = subListArray[1][i].substring(0,2); var det = subListArray[1][i].substring(3); temp += '<option value="' + val + '">' + det + '</option>'; }//end forloop } else if(custType == 'trd'){ //make fields hidden retArea.style.visibility = 'hidden'; //make fields visible trdArea.style.visibility = 'visible'; for(i = 0;i < subListArray[2].length; i++){ var val = subListArray[2][i].substring(0,2); var det = subListArray[2][i].substring(3); temp += '<option value="' + val + '">' + det + '</option>'; }//end forloop } subType.innerHTML = temp; }
  24. Hi. I have some XML that is allways formatted like the snippet below. i am trying to parse it with a JS function but I am having no success what so ever. <?xml version="1.0" encoding="ISO-8859-1" ?> <root> <offer> <bookTitle>Book Title</bookTitle> <catDesc>Category</catDesc> <bookPrice>£29.99</bookPrice> </offer> </root> The JS I have to do this so far is below and I dont think it works very well at all. I seem to be able to get the first element (the title of the book) with the .firstChild function. But I cant access the others. I was also trying something with .nextSibling but having no luck there either. function displayXML( data ){ var root = data.documentElement; // get root element var nElements = root.childNodes.length; var retval = ""; alert(nElements); var offer = root.childNodes; nOfferElems = offer.length; alert(nOfferElems); for(var j = 0; j < nElements; j++){ if(root.childNodes[j].hasChildNodes()){ for ( var n = 0; n < nOfferElems; n++) { if (offer[j].childNodes[n].hasChildNodes()) { var node = offer[j].childNodes[n]; retval += node.firstChild.nodeValue; for(var i = 0; i < nOfferElems; i++){ alert('test - ' + (i+1)); alert('nodeType: ' + node.childNodes[i].nodeType); if(node.childNodes[i].nodeType != 4){ alert('node test - ' + (i+1)); alert(node.childNodes[i].nodeValue); //node = node.nextSibling; } } retval += "<br />\n"; } }//end for }//end if }//end for // the id of the element on the receiving html page // where the output will be displayed document.getElementById('special2').innerHTML = retval; }
  25. Hello, I have a script I would like to have run at a certain time every day instead of running when accessed by a user. I have heard of cron. Is this the best way to do this or is there another way. The script will check a database and send an email to certain people depending on the data held for particular users. I will be using a Linux server, probably with 123-reg.co.uk to host the site. Thanks, Michael
×
×
  • 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.