Jump to content

br0ken

Members
  • Posts

    421
  • Joined

  • Last visited

    Never

Everything posted by br0ken

  1. Thanks kickstart, I think that's what I'm looking for!
  2. I have a table of addresses. In this table there are two fields, dtCreated and dtModified. dtCreated stores a timestamp of the when the address was first input into the database and dtModified stores a timestamp of the last time it was updated or accessed. There are other fields in the table but these aren't relevant to my problem. Basically, I want to retrieve all addresses and order them with the ones accessed recently at the top. Is there a way to order the query by the two fields at the same time? These two queries DO NOT produce what I want: SELECT * FROM tblAddress ORDER BY dtModified DESC, dtCreated DESC SELECT * FROM tblAddress ORDER BY dtCreated DESC, dtModified DESC Can any one help?
  3. I just did a quick Google search and found these tutorials that look promising: http://uk.php.net/session/ http://www.tizag.com/phpT/phpsessions.php http://www.phpf1.com/tutorial/php-sessions.html http://www.codewalkers.com/c/a/Miscellaneous/Using-Sessions-in-PHP/
  4. That's not a problem. This board has helped me in a lot in the past so the least I can do is help others. I've tried to find more good MySQL tutorials but couldn't find that many. Here are a few I've found though: http://www.webmonkey.com/tutorial/PHP_and_MySQL_Tutorial_-_Lesson_3 http://www.devshed.com/c/a/MySQL/Beginning-MySQL-Tutorial/3/ Also, there is a program called phpMyAdmin which allows the user to create and edit tables using a GUI. While in the long term it's much better to actually learn SQL, using phpMyAdmin provides a quick and easy way to get a database up and running. Here is the link if you want to check it out: http://www.phpmyadmin.net/home_page/index.php
  5. It could be that you've included that file twice. When you only want a file included once try using include_once("Filename.php"); Change your include commands to include_once where ever you include that file and see if that helps.
  6. There are many out there but after a quick Google search this one seem like the best: http://www.w3schools.com/PHP/php_mysql_intro.asp Go through each page clicking 'Next' at the bottom to progress to the next page. Also, the PHP MySQL section will provide an indepth explanation of all MySQL functions available in PHP. http://php.net/mysql
  7. While I wouldn't design my database like that, you certainly could do. To measure activity have a function like the one below on each page you want to measure. function recordHit($page) { // Connect to db code here // Clean database input $page = mysql_real_escape_string($page); // Update the database $res = @mysql_query("UPDATE tblPages SET hits = (hits + 1) WHERE name = '$page'"); // Close DB code here return ($res); } This code is a simplified version of what you want and will need to be expanded on but it should get you going.
  8. You could store your XML files outside of your http directory?
  9. It should be noted that using the Browser and IP address as a secure login method can be insecure. Both of these items can be faked, but also, some people use shared IP's (AOL users) which means they would not be able to access your system. Using session_regenerate_id() often is a good practise. If someone does get hold of a users session id, by the time they use it, it would have changed and become invalid. Using SSL, especially when login information is being sent is vital to any secure system.
  10. Change the input type from checkbox to 'radio'. Each input box should have the same name but each should have a different value. For example, if you name the 3 input boxes to 'test' and give them the values, 1, 2, 3 respectively, when you use $_GET['test'], either 1, 2 or 3 will be returned. This isn't a PHP issue but I hope it makes sense anyway.
  11. Use file_get_contents($url) to get the HTML of the website in question. Then loop through that content looking for <a tags. Each time you find an anchor tag, use substr() and strpos() to extract the link. Do this for all links adding each one into an array. Once you've done this, go through each link checking to see whether it is from the domain you're looking for. You can use the parse_url() function to do this or you can use a combination of strpos() and substr() If you need more information on the functions given above please see these links: http://uk2.php.net/substr http://uk.php.net/strpos http://uk2.php.net/function.file-get-contents http://uk3.php.net/function.parse-url
  12. You have this code: header('Location: $page'); But you actually need: header("Location: $page"); When using single speech marks, variables are not parsed and are treated as a string.
  13. First you'll need a database. You'll need one table for your pages, another for ratings and maybe another for users. Each time a user rates a page, you'll need to update your database to show this. You'll then need a PHP page that requests the pages from the database in the order of most popular or highest rating. You can then use PHP to list these in some way.
  14. You'll find people help you a lot more if your code is indented correctly and all of your braces line up. While I don't know what your problem is without seeing some sample data, I've added a two echo commands in so that you can see the value in find and the value it is being compared against ($ss5). Run this code and see the values printed and maybe that will shed some light on your problem. $find = strip_tags($find); $find = trim($find); $find = strtoupper($find); $data = mysql_query("SELECT * FROM profiles"); while ($ss1 = mysql_fetch_array( $data )) { $ss3=$ss1['keywords']; $ss4=(explode(",",$ss3)); for ($x=0; $x<count($ss4); $x++) { $ss5=strip_tags($ss4[$x]); $ss5=trim($ss4[$x]); $ss5=strtoupper($ss4[$x]); echo $find."<br>"; echo $ss5."<br><br>"; if ($find==$ss5) { $profile=$ss1['name']; $pro_lvl=$ss1['prolvl']; $query=("insert into search(profile,pro_lvl,id) values ('$profile','$pro_lvl','$id')"); $result = mysql_query($query); } } }
  15. Just to update everyone on my progress... I found some code that a few people claim works so I tried this. The code was based on the code presented on the following site: http://elouai.com/force-download.php Here is my actual code: <?php set_time_limit(0); ini_set('memory_limit', '64M'); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private", false); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=\"".basename($link)."\""); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".$fsize); readfile($link); ?> This code makes the download run for slightly longer but still no more than 10% of the file size. The download pauses for a long time and then eventually produces the following error: I hope this new information can help someone figure out an answer for me! Thanks in advance! PS. The file I'm trying to download is 57mb
  16. One more thing, which of my methods above is the correct way to force a file download? Should I send it as a audio/mpeg or octet stream or are either ways viable ways of achieving my goal?
  17. Yes, I've set the PHP time limit to 0 and set PHP's memory limit to 64M. I don't think this is the issue anyway as I don't get any errors indicating this. I don't know if this is important but I've noticed Firefox only ever downloads about 1mb where as IE7 downloads just over 2mb. Here is my download link if that would help: http://www.reflex-nutrition.com/reflex_radio_mp3.php?mp3id=1&mp3=48077226a1571e1f961fd2117e90c017&emailid=145&email=cf1f337fd6616d3a4789c56a74667899
  18. I've tried several combinations of header values, all of which fail. The download will download for a small amount of time but will eventually just stop. The download appears to be still downloading as it doesn't say 'download failed' but the progress bar stops going up. Here are two variations of my headers: header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Type: audio/mpeg"); header("Content-Disposition: attachment; filename=\"".basename($link)."\""); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".$fsize); echo $buff; AND header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); header("Content-Disposition: attachment; filename=\"".basename($link)."\""); header("Content-Length: ".$fsize); echo $buff; It should be noted that I've tried this on IE7 And Firefox 3 and get the same result for both.
  19. To do I just divide the the amount of bits by 8 to get the octet version?
  20. Are you passing the $sql variable into mysql_query first? Paste all of your code please but it should read something like: $sql = "SELECT * FROM Journal WHERE type = News Article LEFT JOIN JournalImages ON Journal.image_id = JournalImages.image_id ORDER BY Journal.created DESC"; $result = mysql_query($sql); while($row = mysql_fetch_assoc($result)) { // Do something here }
  21. I posted before about my system. It delivers an MP3 over HTTP. I was advised to include a content-length header to stop the connection timing out. I've done this but this has had no effect. I've read the following document: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13 This says that the Content-Length field must be written in octets. Currently I use the filesize function on the actual mp3 to get the value for Content-Length. Should this be converted to octets in order for this to work?
  22. You need single speech marks around News Article. $sql = "SELECT * FROM Journal WHERE type = 'News Article' LEFT JOIN JournalImages ON Journal.image_id = JournalImages.image_id ORDER BY Journal.created DESC";
  23. Returning content makes your function much more portal which will make your software much more flexible. If your problem has been solved can you click the topic solved button at the bottom of this thread?
  24. The distinct query applies to all of the fields selected so even though all of the rows contain the same 'request_uri', they will have different 'id' and 'sent_or_not_sent' values which will make the rows different and therefore distinct.
  25. <?php $r = 6; // Rows $c = 5; // Columns for($i = 0; $i < $r; $i++) for($j = 0; $j < $c; $j++) $buff[$i][$j] = 0; ?> I haven't tested this code but that should do the trick.
×
×
  • 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.