Jump to content

WebStyles

Members
  • Posts

    1,216
  • Joined

  • Last visited

Everything posted by WebStyles

  1. the format in mysql is not the same as you're using. convert it to date("Y-m-d H:i:s"); before inserting.
  2. This has obviously no impact, and as long as you remember your own logic everything will always work, but I just thought I would mention that when using Booleans (value 1 or 0), the "normal" logic is that 0 is false, closed, inactive, no, negative, etc... and 1 is true, open, active, yes, positive, ... You seem to be using the inverse: 1 for closed, 0 for open.
  3. you could just do a random thing: (untested, off the top of my head) $words = explode(",",$var); // assume this array holds your words $sizes = array(10,13,16); // font sizes you want foreach($words as $word){ $size = rand(0,sizeof($sizes)); // randomly choose a size echo '<font size="'.$sizes[$size].'">'.$word.'</font>'; }
  4. wanna share the code that's on the page sending the emails?
  5. I totally agree! Start to do the *proper* thing now and it will save you a lot of pain in the future.
  6. try my paypal, I bet it will work, but I only accept very large amounts!
  7. sounds weird. should have nothing to do with sending the emails. Sure you dont have other code executing? comment out the two lines that send the emails and try again. if you still lose your cookies, it's not the emails. otherwise post your code here so we can have a look.
  8. you can also use a little flash movie to do that. Bu yeah, js is the way to go for a live countdown if you don't want to include flash.
  9. just found a typo in my last code. (last 3 lines) where it reads: if(($start+$itemsPerPage) < sizeof($_SESSION['fileContens'])){ echo '<a href="'.$_SERVER['PHP_SELF'].'?start='.($start+$itemsPerPage).'">next></a>'; } $_SESSION['fileContens'] should be $_SESSION['fileContents'] (contents was misspelled) this code I gave you should read your file, 20 lines at a time, and also create links to go to previous and next page (if there are no more typos)
  10. try this (untested, may contain a few typos) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <html> <head> <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type" /> <meta name="author" content="FilmZilla"> <meta name="publisher" content="FilmZilla"> <meta name="copyright" content="FilmZilla"> <style type="text/css"> @import url(styles.css); </style> <title>FilmZilla</title> </head> <body> <div id="header">FilmZilla</div> <div id="bar_nav"> <ul> <a href="#">Home</a> <a href="Donate.html">Donate</a> </ul> </div> <div id="content_left"> <h1>Newest Films</h1> Planet 51 <BR> Scream 4 <BR> Xmen First Class </div> <!-- this is where the film links are ################################################## --> <div id="content"><h1>Films</h1> <?php $basefolder = opendir('/films/'); while (($folder = readdir( $basefolder)) !== false){ if (is_dir($folder)){ $subfolder = opendir('/films/'.$folder); while (($file = readdir( $subfolder)) !== false){ echo $folder . '/'. $file.'<br>'; echo '<a href="/films/'.$folder.'/'.$file.'">'.str_replace(".avi","",$file).'</a><br />'; } closedir( $subfolder ); } } closedir( $basefolder ); ?> <!--this is where the film links end ################################################## --> </div> <div id="bar_bottom2"><marquee>Films are all DVDRIP. Please donate. Do not take credit for these movies!</marquee></div> <div id="bar_bottom">© 2011 | Copyright © FileZilla</a></div> <!--[if IE]></div><![endif]--> <div style="text-align: center; font-size: 0.75em;">Copyright© FilmZilla</a>.</div></body> <link rel="shortcut icon" href="icon.ico"> <link rel="icon" type="image/gif" href="icon.png"> </html>
  11. you need something just a little more complex than that. That script you provided reads file names based on a given directory, but it seems you have a movie directory, and then each movie is contained within it's own folder. you need to test each folder with is_dir or something.
  12. ok... a few things to consider: file will do the same as file_get_contents + explode (reads file directly into an array) when doing things this way, you're reading the entire file every time, and only displaying 20 lines at a time. A bit of a waste of resources, though nothing serious. Depending on the size of the file, you could just read it into a $_SESSION variable (so you only read it once and it will be available on every page) or you should consider a database if you're expecting large amounts of data. this example uses a session, so I'm assuming the file will have less that 1000 lines (?) (just typed this off the top of my head, it's untested so there might be a typo or two) <?php // start session session_start(); // load file into session if it does not exist: if(!isset($_SESSION['fileContents'])){ $_SESSION['fileContents'] = file('filename.txt'); } // define start $start = isset($_GET['start']) ? $_GET['start'] : 0; // choose number of records per page $itemsPerPage = 20; // show items for($i=$start;$i<=($start+$itemsPerPage);$i++){ echo $_SESSION['fileContents'][$i].'<br />'; } // show next & previous buttons: if($start > 0){ echo '<a href="'.$_SERVER['PHP_SELF'].'?start='.($start-$itemsPerPage).'"><prev</a> '; } if(($start+$itemsPerPage) < sizeof($_SESSION['fileContens'])){ echo '<a href="'.$_SERVER['PHP_SELF'].'?start='.($start+$itemsPerPage).'">next></a>'; } ?>
  13. well no. Something like the example I posted. Your original question was that you wanted to skip anything with and ID bellow 20.. right? Tell me exactly what your final goal is. (reading a file and then displaying 20 lines at a time?)
  14. man, I can think of 200 names you could give that variable, none of which is $date... why not sort the array by key ($date), and use a for loop with the range of numbers you want? (you're not extracting anything from the array, so I don't really understand what your final goal is though.) $count = 20; $startNumber = 21; for($i=$startNumber;$i<=($startNumber+$count;$i++){ echo 'blablabla'; }
  15. what exactly is in the variable $date? I'm assuming it's not a *real* date. Just a number?
  16. I tested here and it works just fine.
  17. then check your typing, there's no way you spelled it correctly if you're getting that result.
  18. man, you didn't look too far... php.net: http://www.php.net/manual/en/language.operators.precedence.php
  19. please post whatever errors you're getting.
  20. can you do a dump of your table in .sql format so I can set it up here?
  21. I know nothing about chinese encoding, I just thought it would be fun to try....
  22. I sort of re-wrote your code, created a function to handle mysql connection, and put functions nice and tidy at top of page. However, I cannot test this code because I don't have the database here. try this: <?php // functions function con(){ $c = mysql_connect("localhost", "user", "pass") or die('Could not connect: ' . mysql_error()); mysql_select_db("dev", $con) or die(mysql_error()); return $c; } function doSite($DBSite) { $mydir = $_SERVER['DOCUMENT_ROOT'] . "/filedepot"; $dir = opendir($mydir); $con = con(); $getfilename = mysql_query("select distinct `filename` from `search_test` where `site`='$DBSite'",$con) or die(mysql_error()); $result = '<table><tr><td>Results.</td></tr>'; while ($row = mysql_fetch_array($getfilename)){ $result .= '<tr><td><a href="' . basename($mydir) . '/' . $row['filename'] . '" target="_blank">' . $row['filename'] . '</a></td></tr>'; } @mysql_close($con); $result .= '</table>'; return $result; } function doFileSearch($DBFilename) { $mydir = $_SERVER['DOCUMENT_ROOT'] . "/filedepot"; $dir = opendir($mydir); $con = con(); $getfilename = mysql_query("select `filename` from `search_test` where `filename`='$DBFilename'",$con) or die(mysql_error()); $result = '<table><tr><td>Results.</td></tr>'; while ($row = mysql_fetch_array($getfilename)) { $result .= '<tr><td><a href="' . basename($mydir) . '/' . $row['filename'] . '" target="_blank">' . $row['filename'] . '</a></td></tr>'; } @mysql_close($con); $result .= '</table>'; } ?> <HTML> <head><title>SEARCH TOOL - PROTOTYPE</title></head> <body><h1>SEARCH TOOL - PROTOTYPE</h1> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <fieldset> <legend>Filename (one item)</legend><select name="DBFilename" id="DBFilename" size="1"> <?php $con = con(); $result = mysql_query("select distinct `filename` from `search_test` order by `filename`",$con); while ($row = mysql_fetch_array($result)){ echo '<option value="'.$row['filename'].'">'.$row['filename'].'</option>'; } @mysql_close($con); ?> </select></fieldset> <fieldset> <legend>Site (one item)</legend><select name="DBSite" id="DBSite" size="1"> <?php $con = con(); $result = mysql_query("select distinct `site` from `search_test` order by `site`",$con); while ($row = mysql_fetch_array($result)){ echo '<option value="'.$row['site'].'">'.$row['site'].'</option>'; } @mysql_close($con); ?> </select></fieldset> <input type="submit" name="submit" value="submit" > <input type="button" value="Reset Form" onClick="this.form.reset();return false;" /> </form><br /><br /> <?php if (isset($_POST['submit'])){ if (!empty($_POST['DBFilename'])){ echo doFileSearch($_POST['DBFilename']); } echo '<br /><br />'; if(!empty($_POST['DBSite'])){ echo doSite($_POST['DBSite']); } } ?> </body></html> turn on errors, 'cause there's bound to be a typo somewhere in there, as it is all untested
  23. can you post the list of fields you have in table `search_test` please ?
  24. oh dear... in database `blogs`, table: `dons_posts`, id nr. 6, I added chinese characters to field `post_content`... didn't go well for me.
  25. Are you sure about this??? select filename from search_test where filename='".$DBFilename."' you're selecting filename where filename equals the filename you already have. Kind of redundant.
×
×
  • 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.