Jump to content

JustLikeIcarus

Members
  • Posts

    430
  • Joined

  • Last visited

Everything posted by JustLikeIcarus

  1. Try putting this in your code. Replace "thefile" with the name of your file input element. if(array_key_exists('thefile', $_FILES)) { // Handle the uploaded file here }
  2. No you will need to send them a link to reset the password. There are usually a lot of tutorials online on how to best do this.
  3. Yeah its because the md5 function isn't getting executed where it is. Change these lines. $pas=md5($cgi['passone']); updateUser($_SESSION["activationID"], " password='$pas', active='1' ");
  4. Well you will likely run into problems with joins if you use that solution. You are better off running your query for the data then stripping off the limit section and running it again. Then you can use mysql_num_rows on the second result to get the total.
  5. Well you could create a random hash for each song and use it in the link... The more secure method however is a uniquqe random has for each allowed download link. This lets you expire the links, etc...
  6. Ok then you could do a simple preg_replace like this. See if that works. $sql = 'select id, name, age from users'; $sql_count = preg_replace('/^select.+from/i', 'select count(*) from', $sql); echo $sql_count;
  7. Well you would want to use some type pf random hash then store it in the database. Then if the "ticket" var you have in the url exists for that user in the database the link is valid. Here is a way to generate it. $salt = rand(1000000,99999999); $ticket = sha1($user . $salt);
  8. Here maybe these headers will point you in the right direction header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename=$file"); header("Content-Type: application/$mimetype"); header("Content-Transfer-Encoding: binary");
  9. Why don't you just use php's mysql_num_rows on the result of the query? $num_rows = mysql_num_rows($result)
  10. You can fix this by adding display:block; to the link. Just add this to your css. p.newsTextLink a { display:block; }
  11. Well Delete * from $table is not a valid delete statement. It would just be Delete from $table
  12. The query would be something along the lines of... delete from your_table where date_created < date_sub(curdate(), 10 days) This would delete records older than 10 days.
  13. Ideally you should create a session and store its id, login time, expiration, etc... in the database. Then use a cookie which contains the session id. If the session exists in the db and hasn't expired then the user is still logged in. Here is a simple session class which does some of what I am talking about. class SessionDB { private $data=null; private $session_id=null; private $minutes_to_expire=3600; // TIME TO MAINTAIN DATA ON DB public function __construct(){ global $SESSION; if (isset($_COOKIE['session_id'])){ $this->session_id = $_COOKIE['session_id']; } else { $this->session_id = md5(microtime().rand(1,9999999999999999999999999)); // GENERATE A RANDOM ID setcookie('session_id',$this->session_id); $sql = "INSERT INTO `tb_session_db` (`session_id`, `updated_on`) VALUES ('{$this->session_id}', NOW())"; mysql_query($sql); } $sql = "SELECT `value` FROM `tb_session_db` WHERE `session_id`='{$this->session_id}'"; $query = mysql_query($sql); $this->data = unserialize(mysql_result($query, 0, 'value')); $SESSION = $this->data; } private function expire(){ $date_to_delete = date("Y-m-d H:i:s", time()-60*$this->minutes_to_expire); $sql = "DELETE FROM `tb_session_db` WHERE `update_on` <= '$date_to_delete'"; mysql_query($sql); } public function __destruct(){ global $SESSION; $this->data = serialize($SESSION); $sql = "UPDATE `tb_session_db` SET `value`='{$this->data}', `updated_on`=NOW() WHERE `session_id`='{$this->session_id}'"; mysql_query($sql); $this->expire(); } }
  14. Try this tutorial http://css-tricks.com/jquery-php-chat/
  15. Try one of these. I think you want the second one For Monthly Averages Select Month(`date`), avg(`duration`) AS 'Daily Duration' from Table where `date` between '2009-01-01' and '2009-12-31' group by Month(`date`) For Daily averages Select Month(`date`), Day(`date`), avg(`duration`) AS 'Daily Duration' from Table where `date` between '2009-01-01' and '2009-12-31' group by Month(`date`), Day(`date`)
  16. Your "pageloadtest" js function is causing the trouble here. Specifically the below code: if(thisbrowser.indexOf("Firefox") != -1) { var barstyle = document.styleSheets[0].cssRules[12].style; barstyle.width = "1725px"; } else { //windows browser var barstyle = document.styleSheets[0].rules[12].style; barstyle.width = "1725px"; } When you add the h1 css rule it causes .bar to be index 13 but your code still modifies 12 which is then you .itemcell.
  17. Your floating issue is caused by the width set on #PBCons. The width needs to instead be set on the element that contains the floated items.
  18. Switch the padding-top:5px; property with margin-top:5px; in the below code. <div id="searchBar" align="right"> <div style="vertical-align:middle; padding-right:11px; margin-top:5px; padding-top:0px;">
  19. Well one way you could do this is prior to displaying the text as html replace occurances of "\n" with "</br>". In this situation "\n" will be where the user started a new line.
  20. You would want something like this. $grabSkill = $db->query("SELECT DISTINCT user, exp_" . $getSkill . " FROM rscd_experience, rscd_players WHERE rscd_experience.user = rscd_players.user AND rscd_players.highscoreopt = 0 ORDER BY exp_" . $getSkill . " DESC LIMIT " . $db->escape($fixStart) . " , 20");
  21. You need to post the layout of your tables so we can see the relationship between them. Do the tables all have a player id field, etc..?
  22. Try changing your sndReqArg js function to this. function sndReqArg(val) { val = encodeURIComponent(val); var params = 'val='+val; var url = 'testprog1.php'; http.open("POST", 'testprog1.php', true); http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.setRequestHeader("Content-length", params.length); http.setRequestHeader("Connection", "close"); http.onreadystatechange = handleResponse; // function to handle response http.send(params); }
  23. I did some searching and it looks like this is a bug in mySQL that hasn't been resolved. What version are you running? Try the query this way. I know oracle allows subqueries as columns so mySQL should as well. SELECT (SELECT count(`user_id`) FROM `user`) AS total_users, (SELECT count(`product_id`) FROM `product`) AS total_products
  24. From the mysql manual: what error are you getting?
×
×
  • 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.