Jump to content

ManiacDan

Staff Alumni
  • Posts

    2,604
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by ManiacDan

  1. What...what are you wanting these items to be? As far as I can tell, json_object will be an object that just contains the string "data". This matches your output (but not what you say you want). json_array will be an array of all the twitter posts you're fetching from somwhere. This, again, matches your output. You probably want... function get140Sentiment ( $tweets ) { $item_type = "data"; $data = array('data' => array()); foreach ( $tweets as $tweet ) { $data['data'][] = array('text'=> $tweet->tweet_text); } $json_object = json_encode ( $data, JSON_FORCE_OBJECT); $json_array = json_encode( $data ); var_dump($json_object, $json_array); }
  2. Checkboxes need to be checked in order to pass information. You shouldn't use checkboxes for this anyway though, the session is more correct for passing data between page loads.
  3. Take out the "or die". It's causing your page to...die.
  4. print_r($_POST, 1) would show nothing...unless you put it inside the rest of the statement like you were asked to do. Why not able to solve the issue is because you're not giving us any information. Copy and paste the command you were given. Show the output. It absolutely 100% will always print something. Show us that something.
  5. Someone asked you to print_r post.
  6. You need to pay someone to do this. Because you don't know how, any solution you come up with could be circumvented by anyone with higher skill than you. If you use file_get_contents(), you'd have to either use eval() (which is wrong) or force your clients to turn on allow_url_fopen and require() a remote file (which is not only wrong, but a serious security flaw). Even so, I could just as easily pull that file down by hand and replace your security code with a local version. The only true way to protect your PHP code is to not give it to anyone. Have this demo or whatever run on your server, don't distribute the code.
  7. Yeah, I guess so. Plus, from the filenames it looks like an old school file explorer application. It would be more trouble than it's worth to rewrite it.
  8. PHP is not a compiled language, it is interpreted. The source code is always available. There are expensive products like ioncube which attempt to obfuscate the code so something like this is possible, but it's not possible to simply push a button somewhere and "lock" your source code. As an aside: I would never buy a product which relies on your server being up in order to work.
  9. number_format does what you want, but it puts a 0 before the decimal. If you wish to remove it, you should wrap your decimals() function AROUND the number_format function. Functions in programming languages are called inside-out, the innermost ones are resolved first.
  10. ...what didn't work about it? Number_format is exactly what you want.
  11. Steve, you should try out EclipsePDT. It's free, and it's a real IDE.
  12. You have bugs in this code that would have thrown errors 12 years ago had you turned error-reporting on. Put this at the top of your script: error_reporting(E_ALL); Then start from the top and fix every warning and error. You also have blocks in here which are unnecessary, like your switch to determine the month of the year. wren_functions.php probably has more problems. You should also tell strangers what "bombs out" means, since we're not sitting next to you able to actually read the errors that you can see.
  13. You shouldn't be using frames in the first place.
  14. Christian is right. You're also using a lot of buzzwords that make no sense. PHP scripts are not applets. There's no such thing as a "data bounds." And you need to read up on how PHP handles comparisons between data types
  15. The "lightswitch" in the top left of the rich text editor turns it off permanently, but also disables the CODE and PHP buttons. However, since the editor doesn't seem to be chrome compatible, it's better than leaving it on. As for the quicklink to the filter, you can bookmark this link, which is the direct link to "show only items I participated in which are unread." The filters show up in the URL when you refresh.
  16. Unfortunately, these solutions won't work because my girlfriend's birthday is TODAY, but her birthdate is not within 3 days of today, it was 20 years ago. You need to combine the date_format functions and the str_to_date function to change their birthdates from the year of their birth to this year, something like: WHERE STR_TO_DATE(CONCAT_WS('-', DATE_FORMAT(NOW(), '%Y'), DATE_FORMAT(birthdate, '%M'), DATE_FORMAT(birthdate, '%D')) BETWEEN DATE_SUB(NOW(), INTERVAL 3 DAY) AND DATE_SUB(NOW(), INTERVAL 3 DAY) Might not be correct, it's been a while since I actually wrote a query, but you get the idea.
  17. Right, this code proves nothing other than you still say something which most of us think is impossible. Barand is right, this data is already escaped by something. Though that has no bearing on implode()
  18. Better yet, post code that proves this is happening, along with the output.
  19. 1) Don't use md5, it's insecure, even with a salt (especially with a 5-character salt). Use at least sha1, but there's a password thread in the forums about how to do it properly. 2) mysql_ functions are deprecated, you should use the mysqli_ equivalent, or PDO 3) You should be using the boolean values for true and false, not the word "true" (though your other return is an actual error message).
  20. Because...like I already said, the mysql_real_escape_string is being run before the function is called (that's how programming languages work, from the inside out). Since your function incorrectly establishes a database connection inside of itself, the m_r_e_s is being called before the connection is established, which throws an error. And the solution, like I already said, is to establish a database connection FIRST. If you have 400 queries on your page you'll be establishing 400 database connections, which is 399 too many. You also assign the connection to $Conn without ever using $Conn.
  21. Oh I'm quite sure. Symfony has the base class, the peer class, the query class, and an override class for each of those (since it deletes and rewrites the parent classes every time you regenerate your data model from the yml file). To find an object in the DB, you instantiate a new instance of the Query class (which extends the baseQuery). The Query class uses values from the Peer class to determine table names and restrictions (which are usually inherited from the basePeer class), then returns an instance of the main class (extending baseMain). There's actually SEVEN classes per table, since foreign keys are stored in the tableMap class...which I assume can be extended, but I've never seen that. It's really...really ridiculous.
  22. If you just recently learned how to program, do not accept credit card payments. You are nowhere near good enough to do it properly, and the code you write will most likely be illegal. You won't need an SSL certificate if you use paypal or google checkout. SEO is a completely separate question, and there are plenty of articles on it. Question 3 is...unfinished.
  23. To clarify: If your MySqlSelect function establishes a database connection (it shouldn't, that's wrong), that will happen AFTER your call to mysql_real_escape_string, which requires a pre-existing database connection. Establish the connection before you build the query, or used PDO and prepared statements.
  24. It just annoys me that there's a facebook plugin but they don't support composite foreign keys. Get data modeling right before you start doing extra crap. There's also a LOT of file bloat. Every database table is represented by SIX PHP classes, many of them empty. In order to add a custom setter to a file, you have to open at least 3 more so you make sure you're hitting all the right functions. And forget about trying to load symfony in something like Zend which will try to scan the project file for autocomplete information, there's too many objects. The fact that it loads every translation file on the entire site every time you load anything bothers me too. The overhead is ridiculous, nothing is compartmentalized. Each "bundle" is not necessarily self-contained, everything is in the global scope to the symfony app. In contrast to this, everything is heavily namespaced, so you need to import a dozen classes before you can do anything useful in a controller, but other things like translations and template files are automatically global with no importing necessary. Silly.
  25. A friend of mine just asked me about learning Symfony2, so I'll c/p what I said to him: My favorite framework is closed source, but I did enjoy https://github.com/gmr/framewerk when I worked with it.
×
×
  • 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.