Jump to content

DavidAM

Staff Alumni
  • Posts

    1,984
  • Joined

  • Days Won

    10

Everything posted by DavidAM

  1. Gees, I'm an idiot! divID.replace(/[0-1]*$/, '') That should be 0-9 (zero through nine) not 0-1. And the * should probably be a + (* means zero or more, + means one or more). Sorry about that.
  2. Yeah, that's me; always doing things the hard way. I just killed that job a few minutes ago (it was at 455 minutes).
  3. Ahh, yeah that would do it. While you are debugging this problem, you might put a die() just before the header -- or comment out the header() since you have an exit() right after it. Then you can see any messages that are output during the POST.
  4. This code is doing the insert if ANY of them have #mudder in them. You need to NOT add the tweet to the $db_values string unless you want to keep it. $index = 0; foreach ($timeline as $tweet) { if (strpos($tweet[0], '#mudder') !== false) { // ONLY KEEP IT IF WE WANT IT if ($index > 4) $db_values .= "('" . htmlentities($tweet[0], ENT_QUOTES, 'UTF-8') . "','" . $tweet[1] . "'," . $user['ID'] . "),"; } // END IF #mudder $index++; } By the way, you really should not use htmlentities() on the data going into the database. You should store it raw (with proper escaping -- mysql_real_escape_string). Use htmlentities when you output it in an HTML document.
  5. That statement should have output something like: Array ( [username] => DavidAM ) It should show up in the browser if this is a standard webpage. Try the "View Source" feature of your browser to see if it is there. If this is AJAX or a CRON job, then it may be elsewhere. At the very least, you should have gotten: Array ( ). If that did not happen, then you never got to that line of code.
  6. That first semi-colon (after "Hi") should be a . (dot), for concatenation.
  7. try using printf('<PRE>%s</PRE>',htmlspecialchars(print_r($user_data,true))); right after the call to user_data(). This should show you the content of that array, so you can see if the data is indeed there. I don't see the email address in that copy of the email you posted either (unless you removed it for the post). Of course, the email column name is not in the call to user_data(), so that column is not being SELECTed or returned. Turn on error reporting so you can see any messages: error_reporting(E_ALL); ini_set('display_errors', true);
  8. If you want someone to write code for you, you need to post in the freelance section and be prepared to pay for it. If you have tried and are having problems, post your code and state your problems. We are here to help you figure it out, but not many people here are going to do it for you You do realize that that is 10,000,000,000 (BILLION) individual strings? I got bored, and I took a swing at this for fun. My development server is an old i386 box. For 5 digit numbers -- just to generate them into an array, no printing, no database insert, no file write -- it took 3 minutes to produce the 100,000 values and took up 13 Megabytes of memory. At 6-digits, PHP ran out of memory to hold them. So, I took the array out and started a run for 10-digits. It has been running for 4 hours now, still not done. I'm sure there is a more efficient way to write it. But it is really just one recursive function, so ... What are you going to do with the 10 BILLION names of ... uh, numbers when you get them?
  9. It's difficult to see why. But I can see that you are not checking your database interaction. Statements like $data = mysql_fetch_assoc(mysql_query($query)); are not considered best practices. $res = mysql_query($query); if ($res === false) { // The query failed. In production do something intelligent // in development: die(sprintf('%s: %s<BR>%s<BR>', __FUNCTION__, $query, mysql_error())); } $data = mysql_fetch_assoc($res); if ($data === false) { die(sprintf('%s: mysql_fetch_assoc() failed', __FUNCTION__)); } return $data; Yes, it is more code. But it is much easier to read, (especially when you come back to change it later) and now the code will tell you what problem it might be having. Also, I don't know what your "sanitze()" function does, but you are calling it multiple times on the same data. If that function includes mysql_real_escape_string(), then this could cause problems. You should only escape the data JUST BEFORE putting it in the query -- and you "escape" it differently JUST BEFORE putting on a web page.
  10. Echo mysql_error when $result is FALSE. It will print the error from the database server. BTW: You need to sanitize ALL user input. See mysql_real_escape_string You never checked to see if the form was actually posted. If someone goes to data.php in the browser, it will (attempt to) insert a row of empty values into the database. Turn on error reporting, so you can see any PHP errors (warnings, etc) The mysql extension has been deprecated. You should switch to mysqli (or PDO) for any new development.
  11. In the first case, you echo the value of $i before it is incremented, so you echo 0, then 2, then 4, then 6, then 8. In the second case you echo the value of $i after it is incremented, so you echo 1, then 3, then 5, then 7, then 9. In both cases, since you are incrementing the control variable ($i) inside the loop (in the echo statement), the loop skips numbers (it is also being incremented in the for statement -- at the end of the loop body). Since you did not echo any punctuation, it appears to echo a single large number. The first loop is functionally equivalent to: for ($i = 0; $i < 10; $i++) { /* Loop Body */ // First pass $i == 0 here // Second pass $i == 2 here echo $i; $i++; // First Pass: $i == 1 // Second Pass: $i == 3 } /* End of the loop body -- increment $i First Pass: $i == 2 Second Pass: $i == 4 if ($i < 10) Go back to first line in loop body */ This is not unique to PHP. Any language that supports for loops and pre-/post- increments will produce the same result.
  12. Have a look at the $_SERVER super-global array. There are a couple of entries there that can tell you if the user requested through HTTP or HTTPS. Then build your domain variable appropriately.
  13. Since establishment_id in establishment_attribute is a Foreign Key to establishments, you should define an index on it. CREATE TABLE IF NOT EXISTS `establishment_attribute` ( `establishment_attribute_id` int(16) NOT NULL AUTO_INCREMENT, `establishment_id` int(16) NOT NULL DEFAULT '0', `attribute_id` int(16) NOT NULL DEFAULT '0', PRIMARY KEY (`establishment_attribute_id`), INDEX(establishment_id) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=180559 ; You should probably do this with all of your other foreign key columns as well. If you define the foreign key constraint in the CREATE TABLE statement, it has been my experience that mySql will create the index (automatically) even if the engine does not support foreign keys. CREATE TABLE IF NOT EXISTS `establishment_attribute` ( `establishment_attribute_id` int(16) NOT NULL AUTO_INCREMENT, `establishment_id` int(16) NOT NULL DEFAULT '0', `attribute_id` int(16) NOT NULL DEFAULT '0', PRIMARY KEY (`establishment_attribute_id`), FOREIGN KEY (establishment_id) REFERENCES establishments(establishment_id) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=180559 ;
  14. We are not here to "DO IT FOR YOU"! If you are having problems, post the relevant code and a detail description of the problem, we will be glad to help. On the other hand, if you just want someone to "DO IT", you need to post in the Freelance forum and be prepared to pay someone.
  15. Why are you crypting a crypt of a crypt? This is NOT more secure and, in fact, increases the chances of a collision.
  16. THIS form uses BBCode not HTML for the user entry. The BBCode is converted to the allowed HTML on display. Also, strip_tags will allow you to leave specific HTML tags intact.
  17. Sounds like the replace may not be working (or you left the "2" off the Anchor's ID). I don't do a lot of JS so the expression might not be write. Try an alert(DivID); right after this line divID = '#' + divID.replace(/[0-1]*$/, ''); to see if it is working as expected (should show the DIV's ID).
  18. I usually just use what's now built-in to Firefox. But then, I don't do a lot of JS. In reference to passing the DIV ID. You could set the Anchor ID to whatever the DIV ID is adding a trailing sequence number. Then something like this might work: <SCRIPT> $(document).ready(function() { $("A.reload").click(function(e) { e.preventDefault(); // The DIV ID is the A ID without the trailing sequence number divID = $(this).attr('id'); divID = '#' + divID.replace(/[0-1]*$/, ''); loadToDiv($(this).attr("href"), divID); return false; }); }); function loadToDiv(psUrl, psDivSelect) { $.get(psUrl, function(data) { $(psDivSelect).html(data); }); } </SCRIPT> <A href="" class="reload Cats" id="reloadCats1">ABC</A> <A href="" class="reload Cats" id="reloadCats2">DEF</A> <A href="" class="reload Cats" id="reloadCats3">GHI</A> <DIV id="reloadCats"></DIV> <A href="" class="reload Dogs" id="reloadDogs1">ABC</A> <A href="" class="reload Dogs" id="reloadDogs2">DEF</A> <A href="" class="reload Dogs" id="reloadDogs3">GHI</A> <DIV id="reloadDogs"></DIV> * Not tested Then you could style all of the .reload links exactly the same using CSS.
  19. It's a typo in the function definition. I forgot to close the parenthesis on the .get() function call. Man I really hate anonymous functions. function loadToDiv(psUrl, psDivSelect) { $.get(psUrl, function(data) { $(psDivSelect).html(data); } ); } [edit] If you watch the Conole, JavaScript should have reported an error when it loaded that script.
  20. Your image is not to scale. And if I remember by geometry correctly, X is specified first and represents the horizontal axis; Y is second and represents the vertical axis. The MIN(X) then represents the left side of the box. The top of that box is at MAX(Y) and the bottom of the box is at MIN(Y). MAX(X) represents the right side of the box, with the same top and bottom. You have to take MIN(X) independent of the Y values, same with MAX(X) and the same with Y (with respect to X).
  21. That means you can try adding the "Sender: " header to the email you are sending and see if it does what you want. I have never tried it. You should be able to set it to a full email address (with display name, I think), just as you do the "From: " header. I don't know what "points" this might get from Spam filters. But I suspect that as long as the email address belongs to the sending server, you should be OK. If it is what I think it is, it is simply telling the user that the email came FROM the named person who authorized the "via" person/agent to send the email for them. Kinda like me telling my brother - "Go in the house right now ... mom said to"
  22. That may be a reaction to the "Sender:" header in the email. From RFC2822 (http://www.faqs.org/rfcs/rfc2822.html): Where ever it is coming from, it is the mail client that is deciding to show it there, with the "via". Other mail clients may show it differently, or not show it at all.
  23. For the enclosing rectangle, it would be: min(X), min(Y) min(X), max(Y) max(X), max(Y) max(X), min(Y)
  24. akphidelt2007 is correct. You need to read the response again. if the same as writing: $action = 0; if ($action) A single equal-sign is assignment. To do a comparison, you have to use two equal-signs (or three for "exactly the same") You are using single equal-signs in several IF tests, including the first $dialog test which is assigning 1 to that variable. Then you retrieve the value from $_POST, which makes it 2. So, yeah, it is equal to 1 and equal to 2, but at slightly different times in the script.
  25. So you are saying that if you run SELECT COUNT(`user_id`) FROM `users` WHERE `email` = 'justin7410@email.com' in myphpadmin it returns a count of 1 (one). But the function I posted above prints that query, and says "Query Says Count is 0"? I can't see how this could happen. Copy-and-Paste the function code as it is now (be sure to use [ code ] tags). Also Copy-and-Paste about five or ten lines around where you are calling that function. There has to be a logical explanation. Oh, those other two queries. I was saying to run them in the SQL console (myphpadmin). With the pipe-character concatenated on either side of the email address. That way if the data was inserted incorrectly you might spot the 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.