Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. This will give you the offset of the first space following the 300th character: $offset = strpos($string, ' ', 300); If there are no spaces then this will result in "false", so you must check for that value. If it's not false, then you can use that number in substr()
  2. Dirt_diver, can you add this line to the top of your script: ini_set('display_errors', 1); That may give you some useful information.
  3. Sorry I forgot to explain - the reason it times out is that your script runs "forever". So I suspect that your loop there never terminates, and just keeps on looping until the 30 second limit kills it.
  4. if( $sDisplayArticle != " " ){ $i=1; while( $sDisplayArticle != " " ){ $iMaxCharacters = $iMaxCharacters+$i; //line 82 $sArticle = $sTinyMCEData; $sDisplayArticle = substr( $sArticle,$iMaxCharacters,1 ); } } Is it possible that $sDisplayArticle never becomes equal to " " ? Try temporarily replacing this loop with a debug statement that prints out each $sDisplayArticle so you can verify that the values are what you expect.
  5. In what way does it not work? Is the user registered but no text is displayed?
  6. Here is one option <?php $get_achs = mysql_query("SELECT gameid FROM achievements WHERE achname = 'Secret' GROUP BY gameid ORDER BY gameid") or die(mysql_error()); ?> Or in one query to fetch the game names directly.: <?php $get_achs = mysql_query("SELECT v.gamename, v.gameid FROM achievements a JOIN videogames v USING (gameid) WHERE a.achname = 'Secret' GROUP BY v.gamename, v.gameid ORDER BY v.gameid") or die(mysql_error()); ?> All untested unfortunately .. I do not have a mysql installation to test with.
  7. I'm sure you can tell from one of the $_SERVER variables. Are you familiar with phpinfo() ? Run a script like this: <?php echo phpinfo(); ?> That will show you what variables are available that might tell you if the connection is secure or not.
  8. Both $records and $records[0] are arrays. But $records is an array that lists rows of data from the database, whereas $records[0] (and [1], [2], etc) are arrays that list data in a single row. So count($records[0]) is always 3, same for the others. But count($records) will give you the number of results. In the first var_dump above, the number of items happens to be exactly the same as the number of items in each result. But in the second var_dump, there is one result, and that result contains 3 items. Counting the number of items ($records) will give you 1, but counting the number of data items in a result ($records[0]) will give you 3.
  9. Did you use /usr/lib/php/library/Zend/Loader.php when you checked to see if the file was there? I just want to rule out the simple explanations first If the file really is there, the next thing I would try is putting a file directly in /usr/lib/php/library and including that. Next step would be adding the new include path onto the existing include path instead of replacing it altogether. Maybe that will help for some reason.
  10. Ah I think I got it. Try counting $records instead of $records[0] to set $numrec
  11. You said that /usr/lib/php/Zend/Loader.php is present, but you are adding /usr/lib/php/library to your include path.
  12. Can you add this code after setting $records: var_dump($records); And show us what it displays.
  13. There's a few things you could try 1. Detect in php if you are on a non-login non-checkout page and using https. If yes, issue a 302 redirect to the non-secure version of that page 2. Generate the links in php, ensuring that links to pages that should not be encrypted are http, and vice versa.
  14. The variables are called $_REQUEST['Email'] (for example), rather than just $Email. Try this (with a similar change for the other lines): if($_REQUEST['Email']=='') {print "You have not entered a email, please go back and try again. ";$validForm = false;}
  15. There's a fundamental problem in that the code must be decrypted on the customer's machine. So it's a question of how well you can obfuscate the process, rather than making it impossible for the customer to access unencrypted code. Distributing compiled code (in the way that Xcache and APC store compiled code) will go some way to obfuscating. That means the customer has to reverse engineer the code to get source without variable names, and possible with incorrect structure as well (due to optimizations or ambiguous object code). Then if you're serious you can have code which decrypts code which decrypts the real program. That's the kind of thing programmers would do on the old Apple II and similar PCs to stop people copying their games. Rarely will people have the knowledge and time to go through two layers, only to find that they get compiled code that they have to decompile. Then you can go extreme and write your own self-modifying assembly code to decrypt the program .. that will drive people crazy Even when they view that code, they can't see what it really does until they run it (or simulate running it). These are all obfuscation ideas, because that's what you need here, rather than foolproof encryption. keeB, you're making the assumption that your clients know what's best for them
  16. The approach I would use there is to add some debugging output. Instead of this: return rawurlencode(json_encode($input)); this: print "Original: $input\n"; $json_enc = json_encode($input); print "Encoded to $json_enc\n"; $urlencoded = rawurlencode($json_enc); print "URL encoded to $urlencoded\n"; return $urlencoded; Then you can see at what stage it goes wrong, and fix it. In the code in the original post, json_decode() returns nothing for all of my test cases, because the output of json_encode() on a string does not result in valid json.
  17. What's wrong with serialize() and unserialize()? Are you encoding binary data or php structures? What other functions will work depends on what you need from your functions. What I mean by json_encode() and json_decode() not being symmetrical is that json_decode(json_encode($x)) is not always $x. I am pretty sure that they are NEVER equal when the input to json_encode() is a simple string.
  18. Are you expecting json_encode() and json_decode() to be symmetrical? They're not ..
  19. Well you can use extract() .. and it can make your code neater. GateGuardian, it's easier (for me) if you post your code and then I can suggest modifications.
  20. Does your script do what you want it to do? It looks fine at a glance. Though you should escape your input like this: $search = $_POST['search']; $search = '%' . $search . '%'; $search = mysql_real_escape_string($search); $sql = "SELECT * FROM stylists WHERE firstname like '" . $search . "';"; Otherwise people will be able to control your database with sql injection.
  21. This should do it: $order_totals = array(); while($row_total = mysql_fetch_array($result_total)) { $order_id = $row_total['order_id']; $item_id = $row_total['item_id']; $item_qty = $row_total['item_qty']; $item_price = $row_total['item_price']; $order_totals[$order_id] += $item_qty * $item_price; $total_item_price += $item_qty * $item_price; // This is the line that adds all totals } Then $order_totals will be an array with the totals for each order, indexed by order_id.
  22. Can you give some more background? An example would help a lot.
  23. Does the images directory exist? Did you call it "image" instead of "images"? How about moving the uploaded file to another directory, does that work?
  24. Well that's weird. Nothing has changed from the flash side? If PHP is displaying all that stuff, then that's what php is receiveing in the form. Try this to confirm: print_r($_REQUEST); Is the HTML in there?
  25. Could it be a newline issue? Can you run a sniffer to detect the exact traffic going over the network? If it gives a different response it must be getting different data from your script.
×
×
  • 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.