-
Posts
4,704 -
Joined
-
Last visited
-
Days Won
179
Everything posted by kicken
-
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!
-
Correct syntax to use variable inside as argument of $_POST[ ]
kicken replied to wahidku's topic in PHP Coding Help
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. -
Using MYSQL Left Join to Order by Results of a SubQuery
kicken replied to ShoeLace1291's topic in PHP Coding Help
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. -
Correct setup of Apache, etc/hosts and DNS on Ubuntu server
kicken replied to UbuntuJon's topic in Apache HTTP Server
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. -
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.
- 13 replies
-
- validation
- form
-
(and 2 more)
Tagged with:
-
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.
- 13 replies
-
- validation
- form
-
(and 2 more)
Tagged with:
-
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.
-
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.
-
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.
-
The proper format is RewriteRule, one word, no space.
-
(Bug) Mangled pagination in New Content page
kicken replied to requinix's topic in PHPFreaks.com Website Feedback
Seems to be unfixed, Happening on the [sOLVED] Exam Results script. Please help me .......... thread: -
Designing a PHP script/functionality with future and safety in mind
kicken replied to Ortix's topic in PHP Coding Help
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. -
use strpos to find the location of the =. It's location would be equal to the count of things before it.
-
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 |.
-
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.
- 4 replies
-
- robots.txt
- codeigniter
-
(and 1 more)
Tagged with:
-
installing rar package
kicken replied to gdfhghjdfghgfhf's topic in PHP Installation and Configuration
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. -
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?
- 4 replies
-
- robots.txt
- codeigniter
-
(and 1 more)
Tagged with:
-
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.
-
There are various libraries out there for PDF generation. FPDF and TCPDF are two common ones.
-
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.
-
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.
-
How to send mail via command "HELO" "MAIL FROM"?
kicken replied to alkogolic's topic in PHP Coding Help
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. -
This code is incorrect. What you want to pass to dirname is the constant __FILE__, not the string "_FILE_". $path = dirname(__FILE__);
-
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
-
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 }