Jump to content

BoarderLine

Members
  • Posts

    140
  • Joined

  • Last visited

    Never

Everything posted by BoarderLine

  1. Hi. Can someone please point me in the right direction with this. I have the following tables:- table: options | id | sta | fin |valID| |-----|----- |----- |------| | 3 | 984 | 984 | 1 | | 7 | 165 | 685 | 1 | | 5 | 233 | 876 | 1 | table: values | id | col | |-----| -------| | 1 | harry | I am using the following query to attempt to get a joined result set against the key (id), and the MIN(fin) ROW. SELECT values.col, options.id, options.sta, MIN(options.fin) AS fin FROM values JOIN options ON options.valID = values.id GROUP BY options.valID, options.fin ORDER BY col I would like this to result: | col | id | sta | fin | | ----- |----|----- |----- | |harry| 7 | 165 | 685 | However I get the result: | col | id | sta | fin | | ----- |----|----- |----- | |harry| 5 | 233 | 685 | How can obtain the result values for the entire row which contains MIN(fin). Hope this makes sense to someone? Many Thanks.
  2. Hi again. Here is tutorial on file upload and how to use the $_FILES array. http://www.tizag.com/phpT/fileupload.php
  3. Ok. You have options for how to go about this, but probably the best for you would be: Assuming if a Teacher is logged in, they will have some form of userID eg. $_SESSION['userID']. When you create your upload form for the Teachers, have it something like this: <form method="post" enctype="multipart/form-data" action="upload.php"> <label for="lesson">LESSON NAME: <input type="text" name="lesson" id="lesson" /></label><br/> <label for="pdf">LESSON NAME: <input type="file" name="pdf" id="pdf" /></label><br/> <input type="submit" name="submit" value="UPLOAD" /> </form> Now in your upload script (upload.php) you should upload the file into a directory, but at the same time do a mysql insert into a table against the userID of the teacher along with the file name (not the file just the files name), the lesson title. To get the file name use php $_FILES function, the teachers userID should be something like $_SESSION['userID'], and the LESSON NAME $_POST['lesson']. Now you have the .pdf's uploaded into a directory and the lesson information against a teachers userID and lesson title in the db. You can now retrieve from the db a record set of lessons from individual teachers and populate the students list of lessons with the lesson titles as the labels and the file_names as the values. Now when the student selects the lesson from the menu, collect the file name on the form action page as $_POST (like you say), and display it like this on the page. <iframe height='1200' width='100%' src='/path/to/folder/<?php echo $_POST['filename_inputs_name']; ?>'></iframe> And you should be close to what you want.
  4. Is the student selecting the lesson they want from menu of some kind? Can you post the form you are using for for the students selection?
  5. This is perhaps not your php at all. Make sure your domains DNS records are correct.
  6. Might need more info to help on that one. Are you inserting the file name into the db against the users ID on file upload? What sort of user input are you referring to?
  7. What error are getting? Here's a break down of code: $imgDir = "path_to_upload_folder"; -- obvious if(($files = @scandir($imgDir)) && (count($files) > 2)) -- scans the folder where the file is kept and if there are more than 3 items the folder is not empty (3 because it accounts for the . and .. that are present in folders) and the following curly braces are read if($handle = opendir($imgDir)) -- opens the folder so the files can be used while($file = readdir($handle)) -- process the following code for each file that is present in the folder clearstatcache(); -- clear the information that php has cached about the file if(is_file($imgDir.'/'.$file)) -- if the file is present echo "<iframe height='1200' width='100%' src='".$imgDir."/".$file."'></iframe>"; -- open the file in an iframe } closedir($handle); -- close the directory that was opened
  8. You would probably be best to upload the file to a folder on the server. You can open the pdf in a browser by using an <iframe> tag. Use something like this to retrieve it: <?php $imgDir = "path_to_upload_folder"; if(($files = @scandir($imgDir)) && (count($files) > 2)) { if($handle = opendir($imgDir)) { while($file = readdir($handle)) { clearstatcache(); if(is_file($imgDir.'/'.$file)) echo "<iframe height='1200' width='100%' src='".$imgDir."/".$file."'></iframe>"; } closedir($handle); } ?> Hope this helps. Good luck.
  9. And obviously this way the WITH ROLLUP was not needed.
  10. Ta mate. Saved me. Cheers
  11. Thanks silkfire, The problem is I am looping through the data set in a list but need the total sum of 'counter' for the whole data set before the result list is populated. I am trying to avoid doing this in two queries to reduce processing time.
  12. And sorry forgot the essentials: MySQL 4.1.47
  13. I can get the result I need with:- SELECT COUNT(IF(a.field='1',1,NULL)) AS number, b.name FROM b LEFT JOIN a ON a.id = b.id GROUP BY b.name WITH ROLLUP Which results:- henry 6 fred 7 harry 9 terry 0 NULL 22 I can then get the ROLLUP value by using mysql_data_seek() however this makes the rest of the dataset unusable later on the page. I think I may have to move this now to the php forum, unless anyone can share a work around?? Thanks.
  14. Of course, sorry. What I meant to put as example query was this: SELECT COUNT(IF(a.field='1',1,NULL)) AS number, b.name FROM b LEFT JOIN a ON a.id = b.id example result: henry 6 fred 7 harry 9 terry 0
  15. Hi. Is it possible to get the total sum of all count values returned in a query (not total rows of the query but the total sum of a count), but have it returned as a separate variable within the query?. If by using the following query: SELECT COUNT(a.field) AS number FROM a WHERE a.field='1' it returns: 6 7 9 Is it possible to somehow place a variable within the query that will give the value: 22 from the above example?
  16. Thanks Steve, []#telnet mydomain 443 Trying ###.#.###.###... telnet: connect to address ###.#.###.###: Connection refused I created a self signed certificate and changed the details in ssl.conf. []#service httpd restart Stopping httpd: [ OK ] Starting httpd: Apache/2.2.15 mod_ssl/2.2.15 (Pass Phrase Dialog) Some of your private key files are encrypted for security reasons. In order to read them you have to provide the pass phrase. Server mydomain:443 (RSA) Enter pass phrase: OK: Pass Phrase Dialog successful. [ OK ] []#telnet mydomain 443 Trying ###.#.###.###... telnet: connect to address ###.#.###.###: Connection refused
  17. OK i have US$50 via paypal for anyone that can point me to a fix on this.
  18. Argghh. Handshake works so this would suggest SSL cert,key,chain are communicating and setup correct yes? I still receive Results:SSL Connection Failed! from GoDaddy's install tool and when I try and connect to https://atmydomain I get a 'This webpage is not available' message with Error 118 (net::ERR_CONNECTION_TIMED_OUT): The operation timed out. However there seems to be no major errors in the logs??? If someone has any ideas/comments/even abuse, please please suggest.
  19. Correction: Debug command above []#openssl s_client -connect localhost:443 -state -debug
  20. After the openssl debug command above ssl_error_log.conf reads: [Thu Apr 28 16:51:45 2011] [debug] ssl_engine_kernel.c(1870): OpenSSL: Handshake: done [Thu Apr 28 16:51:45 2011] [info] Connection: Client IP: 127.0.0.1, Protocol: TLSv1, Cipher: DHE-RSA-AES256-SHA (256/256 bits) [Thu Apr 28 16:53:45 2011] [debug] ssl_engine_io.c(1893): OpenSSL: I/O error, 5 bytes expected to read on BIO#7fdaa8f92250 [mem: 7fdaa8faa0c3] [Thu Apr 28 16:53:45 2011] [info] [client 127.0.0.1] (70007)The timeout specified has expired: SSL input filter read failed. [Thu Apr 28 16:53:45 2011] [debug] ssl_engine_kernel.c(1884): OpenSSL: Write: SSL negotiation finished successfully Looks like OpenSSL I/O error accuring then times out!
  21. In my .conf I did have a NameVirtualHost *:443 which I commented out restarted apache but still no love. A good debug command I found in the mod_ssl documentation: []#openssl s_client -connect locahost:443 -state -debug However the output was huge. Some meaning things I could see here were:- No client certificate CA names sent SSL handshake has read 5548 bytes and written 311 bytes New, TLSv1/SSLv3, Cipher is DHE-RSA-AES256-SHA Server public key is 2048 bit Secure Renegotiation IS supported Compression: zlib compression Expansion: zlib compression --bla --bla lists SESSION-ID and Master-Key OK and then -- SSL3 alert read:warning:close notify closed
  22. To start the ssl_module I added LoadModule ssl_module modules/mod_ssl.so and restarted apache, however this returns '[warn] module ssl_module is already loaded, skipping' on startup. So the module is loaded! Back to SSL.conf....... I will look into named virtual host being the problem here........ This is kinda good it's like a troubleshooting log to myself :-)
  23. Sorry SSL error log in original post should read: [Thu Apr 28 14:19:58 2011] [info] Loading certificate & private key of SSL-aware server [Thu Apr 28 14:19:58 2011] [debug] ssl_engine_pphrase.c(470): unencrypted RSA private key - pass phrase not required [Thu Apr 28 14:19:58 2011] [info] Configuring server for SSL protocol [Thu Apr 28 14:19:58 2011] [debug] ssl_engine_init.c(415): Creating new SSL context (protocols: SSLv3, TLSv1) [Thu Apr 28 14:19:58 2011] [debug] ssl_engine_init.c(611): Configuring permitted SSL ciphers [ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW] [Thu Apr 28 14:19:58 2011] [debug] ssl_engine_init.c(695): Configuring server certificate chain (3 CA certificates) [Thu Apr 28 14:19:58 2011] [debug] ssl_engine_init.c(370): Configuring TLS extension handling [Thu Apr 28 14:19:58 2011] [debug] ssl_engine_init.c(742): Configuring RSA server certificate [Thu Apr 28 14:19:58 2011] [debug] ssl_engine_init.c(781): Configuring RSA server private key [Thu Apr 28 14:25:27 2011] [info] Loading certificate & private key of SSL-aware server [Thu Apr 28 14:25:27 2011] [debug] ssl_engine_pphrase.c(470): unencrypted RSA private key - pass phrase not required [Thu Apr 28 14:25:27 2011] [info] Configuring server for SSL protocol [Thu Apr 28 14:25:27 2011] [debug] ssl_engine_init.c(415): Creating new SSL context (protocols: SSLv3, TLSv1) [Thu Apr 28 14:25:27 2011] [debug] ssl_engine_init.c(611): Configuring permitted SSL ciphers [ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW] [Thu Apr 28 14:25:27 2011] [debug] ssl_engine_init.c(695): Configuring server certificate chain (3 CA certificates) [Thu Apr 28 14:25:27 2011] [debug] ssl_engine_init.c(370): Configuring TLS extension handling [Thu Apr 28 14:25:27 2011] [debug] ssl_engine_init.c(742): Configuring RSA server certificate [Thu Apr 28 14:25:27 2011] [debug] ssl_engine_init.c(781): Configuring RSA server private key [Thu Apr 28 14:25:27 2011] [info] Loading certificate & private key of SSL-aware server [Thu Apr 28 14:25:27 2011] [debug] ssl_engine_pphrase.c(470): unencrypted RSA private key - pass phrase not required [Thu Apr 28 14:25:27 2011] [info] Configuring server for SSL protocol [Thu Apr 28 14:25:27 2011] [debug] ssl_engine_init.c(415): Creating new SSL context (protocols: SSLv3, TLSv1) [Thu Apr 28 14:25:27 2011] [debug] ssl_engine_init.c(611): Configuring permitted SSL ciphers [ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW] [Thu Apr 28 14:25:27 2011] [debug] ssl_engine_init.c(695): Configuring server certificate chain (3 CA certificates) [Thu Apr 28 14:25:27 2011] [debug] ssl_engine_init.c(370): Configuring TLS extension handling [Thu Apr 28 14:25:27 2011] [debug] ssl_engine_init.c(742): Configuring RSA server certificate [Thu Apr 28 14:25:27 2011] [debug] ssl_engine_init.c(781): Configuring RSA server private key
  24. Additional information:- nmap -sS localhost Starting Nmap 5.21 ( http://nmap.org ) at 2011-04-28 13:25 Nmap scan report for localhost (127.0.0.1) Host is up (0.000011s latency). rDNS record for 127.0.0.1: localhost.localdomain Not shown: 992 closed ports PORT STATE SERVICE 21/tcp open ftp 25/tcp open smtp 53/tcp open domain 80/tcp open http 110/tcp open pop3 143/tcp open imap 443/tcp open https 3306/tcp open mysql Nmap done: 1 IP address (1 host up) scanned in 0.09 seconds But it seems SSL module may not be present in apache:- # httpd -l Compiled in modules: core.c prefork.c http_core.c mod_so.c looking in to it...
×
×
  • 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.