Jump to content

convinceme

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

convinceme's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. ok ahmm no its not about pagination... i know how to do that its just that how to figure out the nearest 10. using LIMIT would paginate it.. but the starting point is the problem.. if the last id is 24 how to make sure the limit starts from 20 thats my point... i want it to be dynamic if that makes any sense
  2. I am not quite sure its more related to maths or php anyway Problem: I want to show the last post in a mysql table. And i am displaying them with a limit of 10, i.e. 10 results per page. Now i have a problem figuring it out what would be the starting point of the results display in this case. I know it sounds confusing so let me give a few examples to illustrate my point. Example 1: Last Id = 15. So now we want to display with a limit starting from 10 Example 2: And if the last id = 22 we want to display with a limit starting from 20 because remember we want to show 10 results on each page. The problem is to figure out which was the last '10' starting point, which in example 1 would be 10 and in example 2 be 20.
  3. i needed some help with ['quote'] system Currently I am using following code to replace the tags $string = str_replace("[Quote]", "<table bgcolor=#000000><tr><td>",$string); $string = str_replace("[/Quote]", "</font></td></tr></table>",$string); The problem with this is that in case there is no at the end, the <table> wont end which means it would distort the whole page. Is there a way to ensure that is there in the $string or if its not than just close the table where the string ends. using explode to check if the word exists in the string could be one possible option maybe havent tried it though it think should work.. is there any other?
  4. I have been trying to display the result from the textarea on seperate lines for e.g if i enter a b c in the text area it should display the same rather than what it is doing write now "a b c" Can someone please help me with this? <?php $action = $_REQUEST['action']; if ($action == submit) { print str_replace("\n", "", $_POST['testt']); } echo "<form method=post action=?action=submit>"; echo "<textarea name=testt></textarea>"; echo "<input type=submit name=test value=test></form>" ?> I even tried looking in the search area and found this link but that doesn't help either: http://www.phpfreaks.com/forums/index.php/topic,92732.msg542113.html#msg542113
  5. function strtrim($str, $maxlen=500, $elli=NULL, $maxoverflow=180) { global $CONF; if (strlen($str) > $maxlen) { if ($CONF["BODY_TRIM_METHOD_STRLEN"]) { return substr($str, 0, $maxlen); } $output = NULL; $body = explode(" ", $str); $body_count = count($body); $i=0; do { $output .= $body[$i]." "; $thisLen = strlen($output); $cycle = ($thisLen < $maxlen && $i < $body_count-1 && ($thisLen+strlen($body[$i+1])) < $maxlen+$maxoverflow?true:false); $i++; } while ($cycle); return $output.$elli."..."; } else return $str.$elli; } When i use the above chunk of code i end up getting the following value being displayed Now how to get rid of this "<span style" part... I want it to just display the text apart from these tags. The data in the mysql database for which the output being generated is There are so many tags because i wrote it in Microsoft Word 2007 and pasted it in the the textbox which has richedit enabled (wysiwyg script). Can someone please tell me an easy way to get rid of that "<span" part, as you might see the tags in the starting of the data aren't displayed!
  6. Hey i was successful in embedding the mediaplayer but i was wondering if there was anyway to create a snapshot on the fly as in not making user upload a snapshot of that video to be displayed but create one as using currentPosition param or something your help in this regard would be highly appretiated
  7. ahmm while downloading a big file i get this error connection from the server was reset using set_time_limit(0); while(!feof($file)) { echo fread($fp, 1024 * 40 * 8); flush(); sleep(1); } how to prevent this error... help in this regard would be highly appretiated
  8. i want to restrict simultaneous downloads per ip.. for that what i tried was 1) Check for ip in the database if it doesnt exist add it in the database... 2) Send headers to force download 3) if end of file remove the ip from the database whats missing is when the user clicks on the cancel button when the popup window popups with the options of "OPEN" "SAVE" "CANCEL" (bcoz of force download using headers) the ip remains in the database for ever and doesnt get removed...so how to check if the user clicked on cancel secondly if the user cancelled during the download process how to remove it now from the database help in this regard would be highly appretiated... thanks in advance
  9. wel what you can do is in your user authentication database create a column for level in which you can give people a specific user level which determines their priority and whenever user is logged in you check for his/her user level. i hope this helps the example below is just to give u a lil picture of how to query ur mysql database [code] $sql = "SELECT password,level from users where username='$user'"; $query = mysql_query($sql); $numrows = mysql_num_rows($query); if ($numrows > 0) { $row = mysql_fetch_array($query); $u_passwd = $row['password']; $u_level = $row['level']; if ($password == $u_passwd) {   if ($u_level == "1") { echo "Hello User"; } if ($u_level == "2") { echo "Hello Teacher"; } if ($u_level == "3")  { echo "Hello HOD"; } } } [/code] u_passwd = password stored in database u_level = value of level stored in database as 1,2,3 this can be anything you want though password = password you have typed in the form user = username you have typed in the form I hope that helps
  10. Thats how i rem always entering data into a mysql table but now suddenlyit doesnt appear to work :S thats real weird.... SQL-query: [code] CREATE TABLE cities (   id int(11) NOT NULL auto_increment,   city_name varchar(50) NOT NULL default '',   latitude varchar(15) NOT NULL default '',   longitude varchar(15) NOT NULL default '',   population int(11) NOT NULL default '0',   country_code char(2) NOT NULL default '',   PRIMARY KEY  (id) ) TYPE=MyISAM AUTO_INCREMENT=1; INSERT INTO `cities` ( `id` , `city_name` , `latitude` , `longitude` , `population` , `country_code` ) VALUES ( '', 'Sherbrooke', '45 23 59.00', '-71 46 11.00', 125000, 'ca' ) [/code] [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] Mysql Error: #1264 - Out of range value adjusted for column 'id' at row 1 [/quote] can someone please tell me what went wrong there :S
  11. well i went through the php.net manual on session and what i could figure out was something below [code]ini_set('session.referer_check','.$filepathdoh.'); session_start(); if (!isset($_SESSION['count'])) { $_SESSION['count']=0; } else { $_SESSION['count']++; } if ($_SESSION['count'] > 0) { echo $_SESSION['count']; echo"Download Limit Reached $filepathdoh"; } else { echo "Download is about to begin";}[/code] $filepathdoh is the name of the file to be downloaded this file is forced to download using headers so what went wrong was that if the page with the link to the popup window which forces to download the file was kept open it wont unset session even if the download was complete...unless i had closed that main window and went through the process again Page "A" has the link to the popup window which forces download [popup window = Page "B"] .. now once when the file is downloaded it should unset the session id probabbly cost of that session.referer_check but tht doesnt happen. Even if i close Page "B" which has the above code. I have to close Page "A" inorder to have sucess. How to solve this issue
  12. i would highly appretiate if u could pm me that thingy of urs if u can post it here :)
  13. oh ok i get it now :) hehe thanks.. and btw can you through some light on simultaneous download thingy... as i have lot of queries about that which i have posted earlier.. and let me post them again for your convinence *If i store that ip and data and time of the user who is downloading a certain file from my website... nd remove it after certain time.. than that would be hard coding... some people have better download speed as compared to others... so that wont work... what i want is to restrict simulatenous downloads per ip .... and this thing doesnt really make sense to me* Thanks in advance
  14. ok ahmm i get that but my point is ... different people have different download speed one person takes 1 min to download same thing while the other might take an hour... now the thing is we want to limit simultaneous downloads which means he shouldnt be allowed to download unless the previous is complete.. and what you said , as in what i understood, was set a specific time after which they can download which is a hard coding rite? so could you kindly put some light on this issue :) [b]txmedic03[/b] i highly appretiate your idea i have tried implementing that but there is a little problem with it.. i couldnt figure out how people use download.php?sid=129 for example... i had to give in the song name the folder name in order to make it work so it looked somehing like that download.php?name=putyourlightson&folder=santana ... now using header as soon as its clicked a popup window opens and file download prompts but the problem is... i am using andromeda one can figure out the directory which it is in if they use just a little of their brain.. what would you say about this? :)
  15. [qoute] I'd also have another script that runs on that page that reduces their download count after a certain period of time, or provide some way to earn points towards more downloads or something. [/quote] if you could send me that would be great... i mean if its ok with you [convinceme_@hotmail.com] Ahh i get it... but i had a lil confusion with this concept... though doesnt make sense why i have confusion but still let me ask so i can clear it :D *sorry if it sounds irritating:D* i get it once the download starts i store the ip and time... but now how do i remove it from the database once the download is complete :O as in how do i know that the last download being done by the user has completed... i dont want to restrict no. of downloads/per ip as in allow him 1 download for one day or one week... i want to restrict simultaneous downloads *I think thats because i wasnt clear while asking that question.. maybe i didnt mention simultaneous due to which there was some confusion (A) sorry for that* and thanks guys for that prompt reply :)
×
×
  • 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.