Jump to content

kicken

Gurus
  • Posts

    4,704
  • Joined

  • Last visited

  • Days Won

    179

Everything posted by kicken

  1. 1) Put a rating area next to each post w/ numbers 1-10 and a submit button. 2) When the user submits, shove their selected rating into a table somewhere 3) ??? 4) Find the average rating use a SELECT w/ the AVG function 5) Profit!
  2. To answer your actual question however, the proper syntax would be: $_POST[$serial_number]You do not put quotes around the variable, you only do that for strings used as keys.
  3. Your date_posted columns in both the forum_messages and forum_threads tables need to be a DATETIME or TIMESTAMP type, not TEXT. Once you've fixed that issue, you just need to have your sub-query return the thread id, and MAX(date_posted) in order to get the newest post, then order by that in the outer query. Also, you don't want to LIMIT the sub-query as that would cause it to return only a single row, not a single row per thread which is what you need SELECT t.board_id, t.thread_id FROM forum_threads AS t LEFT JOIN ( SELECT m.thread_id, MAX(m.date_posted) as lastPost FROM forum_messages AS m GROUP BY m.thread_id ) AS q ON t.thread_id = q.thread_id WHERE t.board_id = $ID ORDER BY q.lastPost DESC LIMIT $X,$Y Make sure you have an index on forum_messages(thread_id,date_posted). Then the sub-query will run nearly instantly.
  4. ServerAlias only means that apache will recognize that server name as also belonging to the given vhost. You still need a DNS entry so that clients can resolve that domain to the proper IP address. You can do this either with a separate A entry or a CNAME record. Adding the domain to the hosts file is not strictly necessary so long as it exists in DNS.
  5. Not really, what happens is you end up creating a property on the global object, which is different from variables technically. It "works" but is poor practice and frowned upon (like globals in php). var somevar = 'blah'; console.log(window.somevar) //undefined because somevar is a variable, not a property function x(){ somevar = 'blah'; } x(); console.log(window.somevar); //'blah' because somevar was created as a property.
  6. Not really, JS has the same rule. The difference is in JS variables defined outside of a function, exist within it. Not that it really matters in a thread about PHP. function x(){ var y=100; } x(); console.log(y); //y does not exist here.
  7. That doesn't really make much sense. In order to get the file to the server, you have to upload it. Whether you do that as a single large file or 20 small files doesn't really make much difference. Splitting it and doing it separate would actually increase the overall upload size due to http overhead.
  8. Do you have a copy of the AxSerial.ComPort component installed? Near as I can tell from some googling, it is something you'd have to purchase from ActiveXperts. If you don't have it, or want to try something else, give the PHPSerial class a try.
  9. Remove the or die() stuff after your query string. That is something you would use on the line where you run the query using mysql_query, not when you define the query text. Since you are checking mysql_query with an if statement though, you do not need it at all.
  10. The proper format is RewriteRule, one word, no space.
  11. Seems to be unfixed, Happening on the [sOLVED] Exam Results script. Please help me .......... thread:
  12. Either that, or just accept the fact that it is going to be a lax security setup. Unless you are doing something like allowing a user to store their credit-card info and automatically charge things, I don't really see that much of a problem with making an email address the only requirement for login at the kiosk. You could just set it up to allow a new scan but nothing else unless they login with the password also. The two most likely scenarios of someone entering an email which is not their own are going to be 1) They are sharing a friends account. This will happen whether you require a password or not. Or 2) They typo their email and it just happens to match some other user's email. While possible, this is probably unlikely to happen. Even if it did, I see no real harm in it. Without knowing all the requirements the client wants, the direction I would go is probably a two-option approach: 1) Login with email only: A user can place a new order or attach a scan to an existing order. Any other access is not allowed 2) Login with email + password: A user has full account access and can do things like view order history, access personal information, place an order using save payment info, etc.
  13. use strpos to find the location of the =. It's location would be equal to the count of things before it.
  14. Simple, $var=str_replace('||', '|', $var);Replace two || with a single |. You could do it in a loop if necessary. Or use a regex to replace any number of | with a single |.
  15. A bad crawler is going to flat out ignore your robots.txt file and crawl your site anyway. The only thing a robots.txt file is good for is to indicate to a good crawler which paths you would prefer it not crawl.
  16. There should be something in the output of phpinfo showing it installed. You may need to edit the php.ini file to load the extension.
  17. Basically if google finds links to your site, it will still index the URLs, just not any of the pages contents. So based on the URL or text used within the pages that link to you, google still matched your URL and included it in the result, but because of your robots.txt google doesn't have any of the page's content in order to provide a good description of the site. According to google, to completely prevent the site from appearing in search results at all you need to use the noindex meta or http header: Note that the above is specific to google. Other search engines may handle things differently. Is there any particular reason why you wish to block your entire site from being crawled by search engines?
  18. My best guess is that they are using some kind of frames setup to hide their real domain behind some other domain and they don't want people to be able to find the real domain by viewing the source of the page. Not really possible since the frame would have it listed in it's src="" attribute but they probably don't know about that or something. Sounds to me like someone who just doesn't know how things work decided such a thing was a good idea when in reality it doesn't really matter.
  19. There are various libraries out there for PDF generation. FPDF and TCPDF are two common ones.
  20. I'd guess it means exactly what it says, you need to make sure the scripts never output the domain name. On a simple level, this would mean you can't use any absolute URI's in things like links or image sources, everything should be relative. I'm not really sure what such a request has to do with security, but that is something you'd have to ask the client about.
  21. You do not quote table and column names. Remove your quotes around UserId and user. The same applies to your other query. Also, the reason for the error is because the query is failing, due to the above issues. You should be doing some error checking to ensure the query is successful rather than just blindly passing $total into mysql_result. The PHP manual for mysql_query has plenty of examples of error checking.
  22. neither hotmail.com nor outlook.com are the hosts you should be trying to connect to if you want to send mail to an @hotmail or @outlook address. Not going to say which are the proper addresses, if you want to be spamming people you can figure out how to do it yourself.
  23. This code is incorrect. What you want to pass to dirname is the constant __FILE__, not the string "_FILE_". $path = dirname(__FILE__);
  24. That sounds like the case, yes. You can verify by creating a file called phpinfo.php that contains the code: <?php phpinfo(); ?> When you load that file in the browser it will show you a bunch of information about how PHP is configured, including what version you are using at the top. Make the change and load that file, see if it says you are using 5.4
  25. That code does not create any array. It just overwrites $class each time. If you want $class to be an array of all the returned class values you'd use: $class[] = $Row['class']; Then, to see if $destno exists in that array: if (in_array($destno, $class)){ //It exists } else { //Could not be found }
×
×
  • 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.