Jump to content

kicken

Gurus
  • Posts

    4,704
  • Joined

  • Last visited

  • Days Won

    179

Everything posted by kicken

  1. Store the files in a folder outside of the web root and require the user to access them via a gateway script (ie, download.php or whatever). You can either pass an ID (my preferred) or a filename to the download script so that it knows which file to server and then just have it set appropriate headers and send the file contents. Depending on your requirements you can count # of downloads, times of downloads, success/failure status, etc this way. You could make the URL look pretty using some URL rewriting if desired (ie link to /downloads/setup.exe and rewrite it on the server to /download.php?file=setup.exe)
  2. See the numbers in parenthesis right after the word string? That is the length of the string. Your first string is 157 characters long, while your second is only 3 characters long. Obviously they do not match each other. Your first string likely contains a lot of spaces padding it's value. You can use trim to remove these spaces.
  3. At a place I worked a few years ago me and some coworkers would go out to lunch fairly often. Sometimes if we had a particularly stressful/hectic morning we'd hop over to the British pub and some of them would have a beer. I'm not a drinker myself so I just stuck with the soda but they enjoyed doing it to kinda of relax a bit before going back to face the rest of the day's issues. I'm certainly not against someone having a beer or two at lunch and coming back to work, just don't go get plastered or something lol. Regarding standing desk stuff. I've never tried one but I have worked standing up occasionally. When we bought our new house about two years ago I would sometimes work out of it before we got furniture so it was either sit on the floor or stand at the kitchen counter. The counter was generally much nicer. It was a bit low for me though so I did get a back ache after a while from being slightly bent over. If I had something at a more appropriate height I could probably get use it to/enjoy it. As it is now I do tend to sit a lot, but I also try and make it a point to get up and walk around for a bit at least once an hour, if not more. I've read a few different articles over the years about the problems with long term sitting.
  4. It sounds like you'd just get the raw binary data so all you'd do is read in that data from wherever you need to and then write it out to a file (using file_put_contents for example). If it's a web service I'm guessing you'd get the data either as a $_POST variable, $_FILES upload, or $HTTP_RAW_POST_DATA.
  5. You're returning to early. Inside your foreach loop you want to concatenate each of the parts together to build a string, then return the string at the end of the function. Right now you will only see the largest segment because you return right away after generating it.
  6. You'll want to find the difference between the current date and the posting date, in seconds. The easiest way to do that is to convert them to a unix timestamp and just subtract the two. You can use the UNIX_TIMESTAMP function in your MySQL query, or PHP's strtotime() to convert a date to a unix timestamp. After that you just convert the # of seconds into your textual string. There are lots of implementations of functions for this if you search google, or you can try writing your own.
  7. VLC is my player of choice. It'll play just about anything from nearly any source. You can also use it to stream, convert files, capture inputs, etc.
  8. = is an assignment, meaning you are assigning '-1' to $x and '1' to $y. If you want to test the value of $x against '-1' to see if they are equal, you need to use == (two equal signs)
  9. Working (in chrome at least) example: http://jsfiddle.net/YNHXM/
  10. That's not an issue. You just have to escape the HTML properly. Eg: <div data-tip="<h1>Some title</h1><p>This is the tooltip "content"</p>">Something</div> Like I said though, if you want to keep them separate, use an array: <script type="text/javascript"> var tooltipStrings = [ "Search items and recipes in the database", "Roster Configuration Panel", "Add a new guild and synchronize<br \/>the memberlist with Blizzard\'s Armory", "Image screenshot database" ]; </script> Then set the index # as the data attribute, eg <div data-tip="2">blah</div> And finally to get the string you'd do: var tipIndex=$(this).attr('data-tip'); var tipText = tooltipStrings[tipIndex]; Using eval is about the worst possible thing you could do.
  11. Not really no. It'll be like the window.close thing. Any action which would cause you to essentially "leave the page" (ie, closing the window, re-direct, document.open, etc) should be treated as a final action because it will at some point cause the scripting engine to be killed.
  12. Hiding the URL isn't going to stop anyone from taking the images if they want to take them.
  13. If you're going to store the tips separately like that, then use an array, not just sequentially numbered variables. However, why don't you just store the tooltip text directly in the data attribute (or the title attribute) and not even bother with the array: //<div data-tip="Search items and recipes in the database">blah blah</div> function simple_tooltip(target_items, style){ $(target_items).each(function(i){ var tipText = $(this).attr('data-tip'); var tipDiv = $("<div>"); tipDiv.appendTo(document.body).html(tipText); } } Completely untested, but something like that.
  14. It is probably just a race-condition where the window.close starts IE's cleanup procedures to close the page but leaves the script running. IE gets in another statement or two of code before the cleanup process kills the scripting engine. Regardless of if it works or not in other browsers, what your attempting to do is fundamentally wrong. What you should be doing is either 1) Load the URL to regenerate the PDF by assigning it to window.location, and after the PDF generation is done have it do a header redirect to the PDF viewing page that your currently trying to open -or- 2) Run the PDF generation process by loading that URL with XMLHttpRequest and wait for message that is has completed. Once complete, load the PDF viewing page. At no point should you be trying to close and re-open a window.
  15. This SQL query could replace your loop to find the next available customer number. It will select the highest existing customer number for the given initials and add one to it. If nobody with the given initials has been added yet it will return 1. This small bit could be made into a method. SELECT COALESCE(MAX(CONVERT(INT, SUBSTRING(Code, 3, LEN(Code)))), 1) FROM Customers WHERE Code LIKE 'JB%' private function getNextCustomerNumber($initials){ $res=mssql_query("SELECT COALESCE(MAX(CONVERT(INT, SUBSTRING(Code, 3, LEN(Code)))), 1) FROM Customers WHERE Code LIKE '{$initials}%'"); $row=mssql_fetch_array($res, MSSQL_NUM); return sprintf("%s%04d", $initials, $row[0]); } That would accept the initials as input (ie, 'JB') and return as output your customer # string, (ie 'JB0025'). The only problem with the query is it assumes two-letter initials. Your for loop to generate $initials is written in such a way that is it may be possible to have more than two letters as the initials. You could either modify the query to allow for additional letters, or modify the loop to limit it to two letters.
  16. It sounds like GoDaddy has the register_globals directive enabled (which is a BAD thing) and you're relying on that. You should fix your scripts to not rely on this setting. In this particular case that means using the $_FILES superglobal to access your file upload details: if (empty($_FILES['userfile'])) $errorArray['Image File'] = "Browse and select a GIF/JPEG Image File to upload!"; elseif (!($_FILES['userfile']['type'] =="image/pjpeg" OR $_FILES['userfile']['type']=="image/gif")) $errorArray['Uploaded Image'] = "Your uploaded file must be either JPG or GIF only!"; elseif (!doesuserfile_nameEventBannerExist($_FILES['userfile']['name'])) $errorArray['Uploaded Image'] = "Filename already Exists, Rename and Upload again!";
  17. Echo your query out with var_dump($result) before you run it to make sure it is valid. Try running it manually in something like PHPMyAdmin or mysql console and check for errors.
  18. That condition does not make any sense. You need to know if the selected time frame overlaps with any existing time frame. In order to do that you need to check that none of the stored start or end times occur between the entered start and end time frame. WHERE date='2012-9-19' AND ( starttime BETWEEN '16:30' AND '17:30' OR endtime BETWEEN '16:30' AND '17:30' ) If 0 rows match that condition then the time frame is ok. Otherwise you have a conflict.
  19. Indeed lol. The tap here isn't so great. We have two of em actually, there is another in the kitchen by the coffee pot. When I'm extra-thirsty I tend to just bring one in here rather than keep walking back to the kitchen. Had to stick an inline filter on the water line to the fridge for the ice maker too otherwise the ice tastes horrible.
  20. I'm a very messy person, so mine is usually covered in papers, bottles, etc lol. Once in a while I get in a mood to clean it all up then it looks nice for a few days. This is as of a few minutes ago. The desk is from Ikea. Spent a while at various stores trying to find something. Never really found one that I really liked but this one was decent. The way it curves in the back i would have lost a bit of space between it and the wall corner so I built a little shelf to go back there. I stick my router, modem, and coordless phone base back there out of the way.
  21. Your entry for Server Path is wrong. It needs to be the location of your document root. I am guessing this is going to be /srv/disk11/1151584/www/qatesting.atwebpages.com but you could upload a script with <?php var_dump($_SERVER['DOCUMENT_ROOT']);?> in it to check.
  22. Welcome! Keep the PHP manual handy and make sure you at least skim through it a time or two to get an idea of what is there. If you get stuck on any particular problem make a thread over in the PHP Coding help forum, someone can probably help you out. Make sure you provide your code you tried (inside [code][/code] tags) and describe what your trying to do vs what is actually happening (including any error messages, in full, not just "it doesn't work" or similar).
  23. The path it is referencing in the include is trying to find the file from the root directory, which is wrong. This could be due either to a problem with the code or a problem with something you entered during the install process. We can't really say with the info given. Did it ask you at all during the installation process to enter a path to a file or directory?
  24. How strings work String concatenation INSERT syntax Read each of those manual pages, then try writing your code again.
  25. You should be using the SQLSRV extension for php rather than the mssql extension. mssql is old and no longer supported. Setup the SQLSRV extension try it. If there are still problems post back.
×
×
  • 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.