Jump to content
Larry Ullman's Book Forums

rob

Members
  • Posts

    143
  • Joined

  • Last visited

  • Days Won

    16

Everything posted by rob

  1. Have you looked at the source code for that page to confirm it's being set correctly? You should dump the contents of the information sent by paypal to your ipn script into a text file. This will enable you to see which conditions are met and whether your ipn script gets to the part where the sql query should be executed. If it does then you'll have to go through the standard sql debugging to see where the error is.
  2. The path to mysql.inc.php is incorrect and index.php can't include it. You need to double check the location and path to the mysql.inc.php file. Also, I'd recommend you post code/error messages as text and not as images, it's much easier for people to check that way.
  3. In your script you're testing a mysqli object ($connection) to NULL; from the manual: OO syntax only: If a connection fails an object is still returned. To check if the connection failed then use either the mysqli_connect_error() function or the mysqli->connect_error property as in the preceding examples. http://www.php.net/manual/en/mysqli.construct.php
  4. Have you got session_start() in the php code for your index page?
  5. Try it with ./mysql in the bin directory. You probably did, but make sure mamp is running.
  6. I've been testing code against the RCs of PHP 5.4 for about a month and realised that the official stable version was released in the last 24 hours. Liking it a lot: especially the short array syntax, built in server and traits. Nice to see register globals and magic quotes gone too. Can't believe how tedious writing array in 5.3 has already become. Anyway, I thought I'd just post this up just in case anyone had missed it: http://php.net/releases/5_4_0.php
  7. Ok, it's been a while since I used mysqli, unless I have to work with legacy code, I pretty much stick to PDO these days. Re-reading the php manual, if you use prepared statements for SELECT queries you need to bind the results, so my question was nonsensical; apologies for misleading. If I had to achieve what you're doing and I had the option, I would probably avoid a prepared statement and go with: $query = "SELECT… "; if ($result = mysqli_query($mysqli, $query)) { while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { $myarray[] = $row; } mysqli_free_result($result); } Just remember to filter and sanitize your search terms if you go down that route. Might be worth reading through the user comments on the php manual for a possible solution using prepared statements other than the one you already have.
  8. Non persistant database connections are closed automatically at the end of script execution. If you're pre-populating a form with data from a database, and a user submits that form, these are 2 script executions and therefore 2 separate connections to the database. You could close the connection manually after both your SELECT and UPDATE queries - I've assumed the form posts data back to the same script and the UPDATE query won't be called unless the script tests true for form submission. mysqli_free_result frees up memory used by the result of your query. General rule is use mysqli_free_result after executing queries and mysqli_close when you know you no longer require a database connection for the rest of the current script execution. I think it's good practice to use both, can also make code easier to review for you and others.
  9. while(mysqli_stmt_fetch($stmt)) { $myarray[] = array($col1, $col2)); } $myarray will automatically assign the index numbers, you don't need to. Is there a reason you're using bound results? If not, simply assign returned $rows to $myarray. while($row = mysqli_fetch_row($result)) { $myarray[] = $row; }
  10. Sounds like it could be an issue with the HTML markup, have you inspected the markup? Anything else would just be guessing, since there's so little code.
  11. Assign the page specific content to a variable and check to see if the variable is set within the included file: $foo = 'content to include here'; include 'header.php'; In header/footer include file if(isset($foo)) { echo $foo; } Using if() and isset() makes $foo optional, so you can just set content when you need to.
  12. No, sorry. On the basis that you've already stated support said they had no idea what the problem was and it's not your server, I would follow Larry's advice and use cURL.
  13. Echo out the sql query and run it through the mysql client /phpmyadmin or other. Alternatively, remove the @ signs, check your php display_errors and error_reporting settings and use mysqli_error.
  14. Under Registered Stream Socket Transports , ssl isn't listed, looks like it's not setup. Also, your original syntax for hostname was correct ssl://www.paypal.com don't include https.
  15. No worries, Wanted to test this for myself, for anyone who was interested in a working example for locally stored video above the root directory for protection: Downloaded latest JW player from http://www.longtailv.../jw-flv-player/ Created a page with the following code: (include player.swf in same directory your viewer page) <script type='text/javascript' src='jwplayer.js'></script> <div id='mediaspace'>This text will be replaced</div> <script type='text/javascript'> jwplayer('mediaspace').setup({ 'flashplayer': 'player.swf', 'file': 'proxy.php', 'controlbar': 'bottom', 'provider': 'video', 'width': '470', 'height': '320' }); </script> Created a directory above the document root called video (I know original); remember to check directory perms. Found the absolute path to video directory Created a proxy script called proxy.php (place in same directory as viewer page), with the following: <?php $file = "[ABSOLUTE_PATH_TO_VIDEO_DIR]" . 'video.mp4'; header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: no-store, must-revalidate"); header("Content-Type: video/mp4"); header('Content-Length: ' . filesize($file)); readfile($file); Obviously change ABSOLUTE_PATH_TO_VIDEO_DIR to whatever that is on your development/production server. To play different video files pass the page with the player embedded a $_GET variable and then just send this to the proxy.php script: proxy.php?video=your_get_var Append to the end of $file instead of video.mp4 in the above example. JW player also offers a setup wizard at http://www.longtailv...er-setup-wizard which shows an option for a playlist, which may be a better way of doing it, but I've run out of time to check. NB: JW player does offer HTML5 video with fallback to flash, but this was about protecting content so I haven't bothered with it. This is just a quick proof of concept, I haven't included any validation in the proxy script; however, should be a good starting point for anyone who's interested.
  16. Yeah this is the big stumbling block for html5 video. You could store the files outside the document root and access them through a proxy script and run them through a flash player (JW player is pretty easy to use). I think some sites do this with javascript, but it's not an area I'm familiar with. Alternatively, store the assets on Amazon S3 and set up bucket permissions to only allow linking from the server ip address the sports club website is hosted on. Then run it through a flash player on the website. You might also want to take a look at Amazon CDN which offers streaming. JW player has Amazon CloudFront support built in, but I've never used it. Truth is though, if someone wants to copy your content, there's no way to prevent it; there are freely available tools for download that will rip flash/music/anything. There are probably more options available which may suit your requirements better, I'll be interested to see what others have used/suggest.
  17. You would use array_walk_recursive() - instead of array_map() - on $_POST, that way trimming all your form submitted values.
  18. That's a warning (non-fatal error) therefore script execution isn't stopped, personally I wouldn't ignore it. Take a look at array_walk_recursive() on the php website.
  19. media will be an array within the $_POST array; to access the values you need to use the method you would for a multimensional array $_POST['media'][0]. Alternatively, you could assign $_POST['media'] to a variable and then access the media values using $array[0].
  20. You could use radio buttons or a select list and have the user specify what kind of search it is.
  21. Build up the <img> src value by using the information from the database that you used to rename the file with: echo '<img src=" .../' . $row['username'] . '/' . $row['id'] . $row['username'] . '.jpg">'; I've had to guess at what you've called database fields, but should give you the idea.
  22. mime is returned by getimagesize, it's value changes depending on the file type being uploaded. In a nutshell mime type is what kind of file it is, i.e. jpeg, png, pdf etc.
  23. In addition to Jonathon's comments, I don't think it's great to hide any product unless you're discontinuing it. Amazon allow you to purchase even if the item is not in stock - I'm sure I've done this with two of Larry's new books in the past, they had order early discounted prices. On a recent ecommerce project, I had item pages without stock state "Stock on order" with both a form to enter a contact email address(to be notified when stock was in) and the addition of thumbnail images/links for similar products in stock.
×
×
  • Create New...