Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. The execute should come first. You have nothing to 'get' until you run it.
  2. Also - re-read your code. You escape a couple of fields and then hash the un-escaped one. You also go to the trouble of grabbing the post values before you check to even see if there are any values. Kinda backwards, no? Also - try to add some error checking on your actions. Check the connection results. Check the prepare result. Then do your query. IMHO - something doesn't seem right here. I've not used mysqli (PDO) but as I read the manual this is the order of things: build query prepare query stmt bind params to stmt execute the stmt get_result loop thru the results obtained from get_result using fetch_array/fetch_assoc You do the get_result before the execute AND you don't assign the get_result to anything. Read the manual and see if you agree with my impression.
  3. // in php mode here "<li class='Answer$QID-$Value' id='$QID'><a href=# id='somecriteria' onclick='getAnswer()'>$QA</a></li>"; This is untested. The class in the li may be what you want to put into the id of the <a>. Your onclick event will call the js code that will extract the question and answer values from this.
  4. You could still use my idea about anchor tags to tell the user to 'click the best answer'. JS attached to anchor tags. Each anchor tag having an id perhaps that holds the Q# and the answer code/value that your js then retrieves and breaks down
  5. None of your code samples make sense, nor your supposed working code. Whatever do you mean by "I have been successful in getting the output in a pure php file"? What is a pure php file? A file that has nothing but php code in it and no html? And how do you know this thing works?
  6. You talk about ceasing the usage of radio buttons to make selections but then you talk about (and show) a list item. How do you expect to get the user to recognize that a list element is a 'selection' and how do you expect to retain that knowledge? Or do you want the javascript to be triggered when focus (?) is obtained on each list item and do something then? Me? I would use css-styled anchor tags inside the list items with no href attribute and just a js call attached to an event on the anchor. But you would also have to have some indicator to show what the user has already selected, no? And how about removing the selection when the user changes his/her mind? Personally radio buttons make much more sense to the user.
  7. As suggested, read the manual on using the mail() function. YOu are missing the headers.
  8. Perhaps you want to pose these questions to Ebay tech support to see what they changed.
  9. You have a table to store users who sign up to become referrers. When you decide that they have reached a certain level you post that value to their "referrer" record. And so on. I assume that you rate them at a certain level for all people that they refer or for all products that they can be referring. If not, you have to create a referrer record for each user for each category (not level) of referral they make in the same fashion. Obviously the referrers must login before referring someone. Periodically you go through your table (monthly?) and look for referrals made since the last-paid date on the record and report out (or store) the referrer's name/id and the amount to be paid this time and post that record with the current date as the last-paid date. You might also save the total amount earned over time. Am I close? Does this make sense?
  10. At the least you need a space after WHERE
  11. Error text? Is this an error message from your script or is it perhaps an error message from PHP? Show us the message.
  12. The way to avoid a problem with headers is to practice good code organization in your scripts. Do your output from one place, after you have processed thru all your logic. That way if your logic wants to send you somewhere else it can do so, since you will not have output anything at that point. Fix those errors!
  13. Do you have php error checking enabled to be sure your script is free of errors? As for testing the result of the mail call - I find that it pretty much always comes back true even if the mail is never sent. As for the headers showing up in the message - you probably did not format the mail call correctly. Try building the message body from all those parts outside of the call and then just pass in 4 vars to the call: $to, $subject, $msg, $hdrs.
  14. You admit that you know nothing about coding and yet you have done something that is supposed to satisfy CLIENTS already? Rather bold of you! Would you take your car to a self-proclaimed auto mechanic who tells you that it is his first day trying to fix cars? Or a would you go to a doctor who is in his first day of med school? What do you think learning how to program computers is all about?
  15. As I read the manual for this function I sense that it doesn't work on multi-dimensional arrays. Why you get a consistent order while trying to do so I do not know, but I think you have to use a custom sorting function. See remarks for assort in the manual.
  16. Not sure what your code sample is telling me but here is how I would do it, if I had to: - you have a login/user table that holds the user id and the encrypted password. - add to this a datetime field for when a first attempt to login happens - add also a counter for attempts made - grab the user id and password from the user - encrypt the password and then query the login/user table for the record that matches the userid - if you get a record for the id then check the password for a match - if you don't match the password or the record is not found issue a message to the user and setup the input form for them again. if the record exists for the user then update the record with the number of attempts (add 1) and if the datetime has not been set or is outside 48 hrs old, set the current date/time in there. When the attempts reach 5 and the datetime is within 24 hours then reject the logon. - if the record is found and the password matches, then the user is logged in - delete the datetime value and the attempts in the table. Hope this makes sense. Play with it and you'll figure it out. As I said I just made this up and have never done this, but this should work. Of course there are others out there who may find fault with it. BTW - what do you need remote_addr for? You're not trying to limit the attempts to just one ip are you? A guy could try 5 times from one pc and then move to another device and start over, no?
  17. I have no idea. It's your code, isn't it? Then you should understand it. And if it's not your code, then you should try to understand it.
  18. What does a statement containing just a single php var actually do? Isolate your problem area and show us what you are trying
  19. Rather silly of you to post all that code and expect us to make sense of it. You hardly comment it at all. It's all a string of code with no clear breakdown of functions that accomplish things for you. Add a few go-to's and you've got what we used to call 'spaghetti code'. How about doing some work and isolating the part that you need the help with? AND - if this is a wordpress thing, why haven't you posted it in the CMS forum? PS - what is that second line supposed to be doing for you?
  20. Show us your code and THEN we can help
  21. Horning in on requinex's very helpful reply I offer this in case she doesn't respond soon: foreach($xml->gms->g as $games) { echo "Matchup:".$games['htn']," ",$games['hs']," vaersus ",$games['vtn']]," ",$games['vs']," on ",$games['d']," at ",$games['t'],"<br>"; }
  22. I'm guessing that you didn't write this code and don't understand that is going on in it. Until you take the time and make the effort to learn what is going on here, you will never advance beyond your perceived level. It's pretty simple. When you do an insert query you specify in it what fields are to be posted/inserted and what values are to be put into each of those fields. So if you want to update 10 fields you need to provide 10 values. Looking at your sql statement as I said you have different numbers there. Fix it. Then when you have the query written correctly, carefully look at which of those values that you want to use substitute parameters for (the ? ones) and provide all of their values in the bind_param call. This will "join" those php values to the ? parts of the query, to put it simply. One could have just written the query without the ? and put the actual php vars in there instead, but that leads to sql injection problems and that is why you have a prepared query here. (Which is good!) You simply have to do the same kind of thing that you did above in fixing the query - align the stuff in the bind_param with the ? in the query statement. For every ? you have to supply a value for it in the bind_param. Also - add a check of these steps to be sure they are working. If you look up the functions in the manual you will see that you will get a value of False if something goes wrong. So after the prepare call add this: if (!$stmt) { echo "Problem doing Prepare"; exit(); } When you do the bind_param call do it like this: if (!$stmt->bind_param(.....)) { echo "Problem binding params"); exit(); } That's the best I'm going to do for you here. The fixes are so simple that my doing them will NOT help you. I've tried to explain what is going on and tell you what you have to do. Now you have to do it in order to learn and improve your knowledge for your next effort. Good luck. Talk later.
  23. This is the code you posted: $stmt = $mysqli->prepare("INSERT INTO ".$db_table_prefix."users (user_name,password,email,activation_token,last_activation_request,lost_password_request, active,title,sign_up_stamp,last_sign_in_stamp) VALUES (?,?,?,?,?,'".time()."','0',?,'New Member','".time()."','0')"); $stmt->bind_param("ssssi", $this->username, $secure_pass, $this->clean_email, $this->activation_token, $this->user_active); Your query has 10 fields to be inserted but 11 values. That alone is a problem. Then your bind has only 5 values being bound to that query, yet the query is expecting 6. You need to balance all of this out. Have at it!
  24. The line with the error is binding 5 parms to your query, which you didn't show us. I went thru your class code and found the 131 line and then found that the query has 6 ? chars in it, meaning you have to supply 6 values to the bind-param call. Supply the missing parm in your bind call. PS - it's always a good idea to CHECK the results of things to be sure they worked. If you had wrapped the bind call in an if statement you would have detected this problem.
×
×
  • 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.