Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. that warning is your browser itself giving you that warning - on your own computer (client side).  if there is a solution to getting rid of that warning, it's with a client side language like javascript.
  2. $row is an array of your data, with the field names as array elements.  extracting $row will create variables having the same name as your field names. do this loop to see what is actually being retrieved, and then you will see what variables are being extracted. foreach ($row as $key => $val) {   echo "key: $key  value: $val <br>"; } the "key" is the variable names that extract should build.
  3. [code] $_SESSION['basket'] = array(); $_SESSION['kurv'][0][0] = 5; $_SESSION['kurv'][0][1] = 3; $_SESSION['kurv'][1][0] = 1; $_SESSION['kurv'][2][3] = 25; echo count($_SESSION['kurv']) ; [/code]
  4. <input type = 'text' maxlength = '10'> this limits the number of characters to 10.  p.s. - moving to html forum. please ask questions in the proper forum k thx.
  5. a) why do you want it in 2 pages? b) the above code assumes register globals is set to ON. in the form, use value='{$_POST['email']}'  instead of $email. c) if you really want to do it in 2 pages, you're going to have to   1) make a cookie (user dependant)   2) start a session (best option)   3) store the information in a db or flatfile (not really convenient) to make a session: at the beginning of both of your scripts, put session_start(); this must be before anything else (except your <?php tag) then in your form, use $_SESSION['email'] as the input value for the email in your processing script, set $_SESSION['email'] = $_POST['email'] if there is an error, kick them back to the form with a header or something. 
  6. smaller project i'd like to eventually start: making a really really good search engine with 5 million options. larger project i'd like to eventually start: somehow making a 3d model of the internet. Not necessarily of every website out there, but maybe websites retrieved from a search, or something.  Or maybe of the whole damn thing after all.  I've always dreamed of surfing the internet in 3d.  Gotta love those sci-fi books :)
  7. okay so add a timestamp field to your table, associated with the user, and then have your script check the timestamp. if it is not old enough, then give the user an error message instead of executing the normal script.
  8. yes, yes you can.  but, if  your script is generating variable names in your form, and then you are using the foreach or extract methods to change them from $_POST['blah'] to $blah.. i have to ask you why you wish to do this?  you don't know your variable names, so you won't be able to access them later.  The only reason why generating variable names is really useful is for keeping them in an array for easy looping in the first place.  In which case, there's really no point in doing this.  well anyways, good lucks.
  9. is the user somehow logged in or can i randomly surf to this page and keep hitting reload?
  10. as in, never ever again, or just within a certain amount of time?
  11. try global $epts; $epts = mysql_result($result,0,'ep'); also, unless you passed $result as an argument ot the function, you're going to have to declare it as a global too.
  12. if you are not planning on logging anything special, then you can just cut your code in half, using $_REQUEST['id'], as suggested above. It will check the post and get, as it is an array of both.    since your error messages look the same and there seems to be no logging code or anything, then just use request.
  13. your $_POST is an array of all of the posted variables. the foreach loop does this: for each array element in the $_POST array, assign the element name to $key and it's corresponding value to $value.  Then (for each one of these $key/$value pairs), make new variable that is named the same as the array element ($key).  so for example, let's say you have a posted variable called number1 that holds the value '1' so that code will in essence do this: // $_POST['number1'] exists, cuz it was posted foreach ($_POST as $key => $value) {   $number1 = 1; } an alternative method is to use the [url=http://us2.php.net/extract]extract[/url] function: extract ($_POST); it pretty much does the same thing as the foreach loop, but there are extra arguments you can use, as far as overwriting pre-existing variable names, adding on prefixes, etc.. (refer to the linkie above)
  14. this forum is for helping you debug your own code.  If you are looking for someone to write some code for you, please make a thread in the freelance forum (read the rules first). If you are looking for a prefab script, please make use of www.google.com.
  15. okay, so yeah i know that the admin have a whole bunch of stuff on their plate, so put this request down at the very bottom of the pile, under category "I'm so bored and I have nothing better to do:" How about inserting an echo or something to display right above or below (in red) the subject input field when you start a new thread, something like "Please use a descriptive subject, not OMG  HELP ME PLZ!!!" or something. Cuz seriously, apparently people don't bother reading the FAQ or else they have no common sense or there's an active underground movement against making appropriate subjects or something.
  16. on all of your mysql functions, you need to attach [code=php:0] or die(mysql_error()); [/code] to the end of it. it may give you a helpful clue as to what is wrong. example: [code=php:0] $mysql=mysql_query("SELECT * FROM users WHERE username='$username'") or die(mysql_error()); [/code] also, it helps to seperate the query string from the query function, for debugging.  That way, you can echo out what is actually being queried. For instance, perhaps you are connecting just fine, but your variables used in the query are not holding what they should be holding. example: [code=php:0] $sql = "SELECT * FROM users WHERE username='$username'"; echo "query string: $sql <br>"; $mysql = mysql_query($sql) or die(mysql_error()); [/code]
  17. you are overwriting the $row from the first while loop, with the 2nd while loop edit: ^^ the $sql overwrite is okay.  the main one is only needed one time, in order to get the results. the result source is then used in the outer while loop.  So it doesn't matter that it is over-written inside that loop.  It's the $row he is over-writing.  the outer loop is based on $row, but he starts his inner loop using the same variable name. the inner loop loops through the over-written $row and then breaks back to the outer loop, which then becomes false, because it checks $row, which the inner loop already incremented the pointer to the end of it.  you need to use a different variable name for your inner loop, instead of $row. editedit: okay actually, yes, you need to use a diff var besides $sql, as well. i just noticed that you did not seperate the query string from the query function. so yes, you need to use some different var than $sql, but you also need to do the same for $row
  18. require payment upfront. Or installment payments at certain pre-defined milestones. Doesn't eliminate the risk, but helps in reducing it.
  19. if you want to include the ability to change the user's password from your cp, don't even bother having a "current password" field that is populated.  what's the point? it's md5 encrypted.  Instead, have 2 fields, one for "change password" and "change password confirmation" (2nd field optional at your discretion, if you feel that it is necessary for you. if not, then don't make a 2nd field).  Don't auto-populate the field.  When you process the form, check to see if this "change password" variable exists, and just concactonate the extra field assignment to your sql string if it does. if not, leave it as is, password not touched.
  20. i think the thread you were referring to was the dude who based his includes on a switch with a GET variable.  The solution was to have a predefined array of what was deemed an acceptable value in the variable, and to check the variable against the array, and only include stuff afterwards. That is, if it's "that thread" I think you're talking about.
  21. how about...changing the target email to your own email.
  22. well, yeah, at face value, with what you've shown, that'd be my guess too.
  23. you need to use a different argument variable in your something() function. passing the data with the same name as your object will overwrite your object. or the object will overwrite the argument when you declare it, actually.  also, you need to declare your $error object as a global variable to be used within the scope of your something() function. working code: [code] <?php class error {   var $message;   function display() {       echo $this->message;   } } class somefeature {   var $something;   function something($errormsg) {       global $error; $error->message = $errormsg;   } } $error = new error; $somefeature = new somefeature; $somefeature->something(errortest); $error->display(); ?> [/code]
  24. try onclick='document.forms[{document.load_face_$row[id]}].submit();' or possibly without the { } i haven't quite worked out the whole {} part but i think in some browsers you can't just use the form.formname you have to use document.forms[formname] or document.getelementbyid[formname] (with id='formname' in your form tags)
  25. okay to expand on that, let's look at this example: [code]$a = 'foo'; $b =& $a; echo $a; // output: foo echo $b; // output: foo [/code] okay at face value, it assigns the value of $a to $b. But what is really happening here is that you are assigning the reference pointer of $a to $b.  At this given point in time, they are both holding the value 'foo'. Now let's look expand this example: [code]$a = 'foo'; $b =& $a; echo $a; // output: foo echo $b; // output: foo $a = 'bar'; echo $a; // output: bar echo $b; // output: bar $b = 'foobar'; echo $a; // output: foobar echo $b; // output: foobar [/code] same thing as before, at first.  but now when we assign 'bar' to $a, notice how echoing $a and $b both echo 'bar', instead of $b echoing 'foo'.  it is because the initial =& assigns the same memory location reference to both variables.  And again, if i were to go and assign 'foobar' to $b, you will see that they both now echo 'foobar' both variables point to the same memory location.  changing one effectively changes the other, because the other one points to the same place, which you changed with the other. 
×
×
  • 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.