Jump to content

GingerRobot

Staff Alumni
  • Posts

    4,082
  • Joined

  • Last visited

Everything posted by GingerRobot

  1. That rather depends on how you want to allow access. You could store all uploaded files outside of the web directory, to make them inaccessible to others. You could then create a database of the uploaded files with the user who has permission to access them, and use a php file to get the file that someone wants, but would only get the file if the correct user is logged in/the correct password is supplied. An alternative would be to create new folders for each user and use a .htaccess file to authenticate the user.
  2. [quote author=Azu link=topic=105646.msg689505#msg689505 date=1189032590] ANYWAYS, a crime is a crime. Trying to say that there is a crime that is worse then it is pretty stupid. [/quote] That is actually one of the most rediculous things i've heard in my life! Of course some crimes are worse than others! I guarantee that all of us "break the law" in some small way almost every day! To take just an example that spings to mind immediately; pick up a couple of books you have near you and check the copyright. Most [i]specificially[/i] say you cannot even lend a book to someone. When was the last time you lent a book? Im sure you have at some point. Shock horror! You broke the law! Get off your high horse. *Steps down from soap box* Edit: Thought i should add, im not necessarily saying that it is OK to use someone elses internet - more commenting on assertion that a crime is a crime.
  3. As already said, we cannot possibly know how this function works. We can only guess. I've no idea what the $id variable is for. Perhaps that is the variable containing the day of the month.
  4. Well i for one am completely unsure of what you are asking. Your post appears to be a complete mess to me. First off, you should try using the tags(without the spaces) around your php code, so we can actually what is the code. Second, an actual question would be nice. The only thing i can think that you [i]might[/i] be asking is about getting your results into multiple columns. If so, check this link: http://www.phpfreaks.com/forums/index.php/topic,95426.0.html If not, try and make what you are asking a bit clearer.
  5. No, you can't do that with php. You're only option would be to have php echo some javascript to change the other frame.
  6. 1.) The syntax of your regular expression is for use with ereg() Try: $u_regex = "^[A-Za-z0-9_]{6,20}$"; // If username has between 6 and 20 word characters if (ereg($u_regex, $user)) {... Notice i modified your expression slightly. You'll need the ^ to make sure the match is for the entire string. With your previous expression, someone could have put any characters at the beginning of the string, so long as the last 6-20 where alphanumeric or underscores. 2.) Again, the manual is your friend: www.php.net/array_key_exists The function requires two parameters, the first being the key you are looking for, the second being the array in which you are searching.
  7. Try: <?php fwrite($file, $time."\n"); ?> GuiltyGear: <br /> is an HTML tag to create a new line on a webpage. It is differant from the newline character (\n) needed in this case.
  8. Well, given what you've done so far, you're only real option is: <?php if(isset($error1) || isset($error2)|| ...){ //errors } ?> However, your code would be neater and more maintainable if you were to stick your errors into an an array. You could then check the number of elements in the array to see if there are any errors.
  9. Well, im not too sure about the differences in the formatting, however, to get the pieces of the string you need, you could do: <?php $str = '/YYYY-MM-DDT00:00:00.000/'; list($date,$time) = explode('T',$str); $date = substr($date,1); $time = substr($time,0,strlen($time)-1); echo $date.'<br />'; echo $time; ?>
  10. You could also use the glob() function $links = glob('*.*');
  11. I could be wrong, since i personally hate regex, but shouldn't your pattern be: if (preg_match('/Average Rate[^0-9]*([0-9.]+)/i', $data, $regs)){ Noting the . rather than the ,
  12. As i said, the function i posted doesn't already do what you're trying to do. I was basically pointing you in the right direction as far as a recursive function is concerned(your function needs to call itself to allow you to search through an undefined level of subdirectories) You'll need to modify it. How you modify it rather depends on how you want it to work. You could simply set it up to echo something when it finds the file. That would be the easiest modification, though perhaps least useful. I would personally alter what the function returns; i woud have it return true on a match, and false with no match (if you take this method, you'll need to add an if statement to test the result of the function where it is called by itself)
  13. Here's an example of how it might work: <script type="text/javascript"> function showall(id,text){ document.getElementById(id).innerHTML=text } function showshort(id,text){ document.getElementById(id).innerHTML=text } </script> <span id="test" onmouseover="showall(this.id,'the full text')" onmouseout="showshort(this.id,'the full...')">the full...</span> However, that would simply make everything wider. I guess what you're really after is some sort of tooptip to appear above the text. I know there are lots of these that you can find on the web. I suggest you google.
  14. If you want someone to do this for you, i suggest you try the freelance forum. This forum is to help you with the things that you are attempting to do. If you do want some help, then take a look at the following bit of code: <?php function no_of_files($start_dir,$sub_dir=FALSE){ $no_of_files=0; if($sub_dir === false){ $handler = opendir($start_dir); }else{ $start_dir = $start_dir.$sub_dir; $handler = opendir($start_dir); } while(false !== ($file = readdir($handler))){ if($file != '.' && $file != '..'){ if(is_dir($start_dir.'\\'.$file)){//if this is a directory, recall the function with the subdirectory defined $dir_name = '\\'.$file; echo $dir_name.'<br />'; $no_of_files += no_of_files($start_dir,$dir_name); }else{//is a file, so increase our counter //here is where you would check to see if the file is the one you are looking for $no_of_files++; } } } return $no_of_files; } echo no_of_files('C:\Documents and Settings\Ben\My Documents\My Music'); ?> That was a function i wrote to count the number of files in a given folder and all its subfolders. It wouldn't be too hard to modify the function to accept a 3rd parameter - the file you are searching for. It would then be a case of adding in a test to see if the file currently being looked at in the loop is the one you are after.
  15. Try using: $shortTrack = strlen($trackname) > 10 ? substr($trackname,0,."...": $trackname; However, you're going to need to be echoing some javascript along with this too if you want to allow people to hover over the text to show the whole lot.
  16. Well, without any code or database structure, its going to be hard to help you. However, if i assume that you have a field in your table(which im going to assume is called properties) called 'type', then its a relatively simply case of modifying your query to something along the lines of: $sql = "SELECT * FROM properties WHERE type='rentals'"; $result = mysql_query($sql) or die(mysql_error());
  17. Haha. I think it probably is an imaginary solution! Im imagining that i understand it all perfectly
  18. Whoops. Though it was 7 in the morning -thats my excuse anyway As for current goal, i think i've satisfied my original motivation for posting, which was that i'd noticed that php couldn't deal with negative bases and fractional powers. I've largely just been trying to understand, from a mathematical point of view, how/why it works/doesn't work. I think ill mark this as solved now, although im sure im going to continue my searches on the internet. And thanks everyone, for all your help.
  19. Well, your for loop doesn't make sense. You can't have two conditions within your for loop. I assume that by "does not work" you mean you end up with a blank page? Or do you actually get the error message? Either way, it would be helpful to be a bit more descriptive of the problem. Anyways, i would suggest constructing your for loop as something like: <?php for($k=0;$k<=count($readfile_sort)-2;$k++{ $k2 = $k+1; //rest of your code here } ?> That should be ok if the only matches you want to find are those where the 1st tab delimited value in file 1 is the same as the 3rd tab delimited value in file 2 and are on the same line within their respective files. If thats not what you're after, you'll need to explain a bit more fully with what you are trying to achieve.
  20. Sorry, yes you're right. I put the fraction with the wrong letter. However, you agreeing that (x^(1/b))^a is the same as (x^a)^(a/b) ? In which case, i think im back where i started. Also, whilst you say the rules don't hold for b=0, that is simply due to the fact that x/0 is undefined - however you manipulate the expression, at some point you must divide by b, making the calculation impossible.
  21. While i know nothing of your troubles with windows authentication etc, i do know that your summing up is a bit vague! What do you actually mean? Can you never stay logged in? Or does it allow you to view pages which require a login without having previously logged in? If its the first, then there are potentially lots of causes. It could be your PHP setup. Also, if you are creating your session variables using the $_SESSION or $HTTP_SESSION_VARS arrays, then you should not use session_is_registered (www.php.net/session_is_registered) Can we have a bit more detail?
  22. Indeed. Read my last post - the solution is there.
  23. Well, if the window was opened with javascript, you can close that window with javascript. http://www.google.co.uk/search?hl=en&q=javascript+close+window+delay&meta=
  24. Well, presumably all of the code you posted is in a loop similar to: while($row=mysql_fetch_assoc($result)){ //your code here } You should only place the echoing of the rows of the table inside the while loop. This is, afterall, the piece of code you want repeated. Overall, it would look something like: <?php $sql = "SELECT * FROM `yourtable`"; $result = mysql_query($sql); $num = mysql_num_rows($result); echo '<table><tr><td>Column1</td><td>Column2</td></tr>'; if($num > 0){ while($row = mysql_fetch_assoc($result)){ echo '<tr><td>'.$row['field1'].'</td><td>'.$row['field2'].'</td></tr>'; } }else{ echo '<tr><td colspan="2">No results found!</td></tr>'; } echo '</table>'; ?> This is just a rough example. You will, of course, need to modify this to work with your existing script.
×
×
  • 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.