Jump to content

hitman6003

Members
  • Posts

    1,807
  • Joined

  • Last visited

Everything posted by hitman6003

  1. There are several major CMSs...a simple google search will reveal them. I'd start by looking at: Drupal [a href=\"http://www.drupal.org\" target=\"_blank\"]http://www.drupal.org[/a] Mambo [a href=\"http://www.mamboserver.com\" target=\"_blank\"]http://www.mamboserver.com[/a] and Mambo's cousin Joomla [a href=\"http://www.joomla.org\" target=\"_blank\"]http://www.joomla.org[/a] If you want more detailed information about them, you're better off asking their users as they will be more knowledgeable.
  2. [!--quoteo(post=354892:date=Mar 14 2006, 09:25 AM:name=bran)--][div class=\'quotetop\']QUOTE(bran @ Mar 14 2006, 09:25 AM) [snapback]354892[/snapback][/div][div class=\'quotemain\'][!--quotec--] I basically have 3 parts to my code. The first part selects the file to be played and prints the name of the clip. The second part generates an iframe and plays the sound in it. The last part should be the delay before it loops back to part one. [/quote] Have your page refresh after a certain amount of time...then it will begin the process again, and you won't have to worry about max execution time. Use the meta refresh and set it for a second longer than your music file and have it refresh back to itself.
  3. You can also use the sleep function: [a href=\"http://www.php.net/sleep\" target=\"_blank\"]http://www.php.net/sleep[/a] Keep in mind that unless you have altered the php.ini file to extend execution time, it is limited to 30 seconds.
  4. This should get you most of the way...be sure to remove the space between f functions and the rest of their names in the script below...the forum code doesn't like it for some reason. [code]/*     the person's url should be along the lines of:     http://yourserver.com/counterpage.php?name=1.1.1.1     where 1.1.1.1 is the ip of the person that you are recording the count for     conversely you could change that to be whatever you want. */ //First, get the person's ip address... $ip = $_SERVER['REMOTE_ADDR']; //Then read your file into an array: $file = file($_GET['name'] . ".txt"); //Then use in_array to see if it's in there: if (in_array($ip, $file)) {     //if it's in the array, then that person has already been counted.     echo "Your ip has already been counted.  The current count is: " . count($file);      } else {  //otherwise, add them, and count them:     array_push($file, $ip);     echo "Your ip has been recorded.  The current count is: " . count($file);          //now write the file back to itself     $open = f open("ipsforperson.txt", 'w');     f write($open, implode("\n",$file));     f close($open);      }[/code] This will automatically create a new file for each new $_GET['name'] that is passed to it. You can add in additional code to check to make sure it already exists. There's lots of other things you can add to it as well.
  5. This is not a service. If you would like help learning how to do something using php, then please ask.
  6. Yes, it's called normalization, specifically, third normal form. Do a google search for it. The over all gist of it is to have a seperate table that stores the values, which those values are presented to the user...so the user can only select the ones that you have presented to them, which elminates them making mistakes. Aside from normalizing your db, there is no good way of doing what you want "automatically".
  7. Here's a calender I did a while back...hope it helps: [code]<?php $months = array('January' => 1,                 'February' => 2,                 'March' => 3,                 'April' => 4,                 'May' => 5,                 'June' => 6,                 'July' => 7,                 'August' => 8,                 'September' => 9,                 'October' => 10,                 'November' => 11,                 'December' => 12             );              $days = array(    'Sunday' => 0,                 'Monday' => 1,                 'Tuesday' => 2,                 'Wednesday' => 3,                 'Thursday' => 4,                 'Friday' => 5,                 'Saturday' => 6, ); //month to display calender for $m = $_GET['m']; if ($m == "") {     $m = mktime(NULL, NULL, NULL, date('m'), 1, date('Y')); } //echo date('Y-m-d H:i:s', $m); $month = date("m", $m); $year = date("Y", $m); $prevmonth = mktime(NULL, NULL, NULL, $month-1, 1, $year); $prevyear = mktime(NULL, NULL, NULL, $month, 1, $year-1); $nextmonth = mktime(NULL, NULL, NULL, $month+1, 1, $year); $nextyear = mktime(NULL, NULL, NULL, $month, 1, $year+1); //determine the starting day for the first //$fd = mktime(NULL, NULL, NULL, $m, 1, $y); $firstday = date('l', $m); $daysinmonth = date('t', $m); $startday = $days[$firstday]; $day = 1; $today = mktime(NULL, NULL, NULL, date('m'), date('d'), date('Y')); $thismonth = date('m'); //echo date("Y-m-d", '1130821200'); function dayhtml($day) {     global $today, $month, $year, $conn;     $blah = mktime(NULL, NULL, NULL, $month, $day, $year);     //$disp = '<a href="daydetail.php?m=' . mktime(NULL, NULL, NULL, $month, $day, $year) . '">' . $day . '</a>  ';     $disp = $day;     if ($blah == $today) {         return '<td width="14%" style="background-color: #66CCDD;" onmouseover="this.style.backgroundColor=\'#66AACC\';" onmouseout="this.style.backgroundColor=\'#66CCDD\';">' . $disp . '<br>' . $inner . '</td>';     } else {         return '<td width="14%" onmouseover="this.style.backgroundColor=\'#66AACC\';" onmouseout="this.style.backgroundColor=\'white\';">' . $disp . '<br>' . $inner . '</td>';     } } function emptyday() {     return '<td width="14%">&nbsp;</td>'; } $firstweek = ""; for ($i = 0; $i < $startday; $i++) {     $firstweek .= emptyday(); } for ($i = $startday; $i <= 6; $i++) {     $firstweek .= dayhtml($day);     $day++; } $secondweek = ""; for ($i = 0; $i <= 6; $i++) {     if ($day <= $daysinmonth) {         $secondweek .= dayhtml($day);     } else {         $secondweek .= emptyday();     }     $day++; } $thirdweek = ""; for ($i = 0; $i <= 6; $i++) {     if ($day <= $daysinmonth) {         $thirdweek .= dayhtml($day);     } else {         $thirdweek .= emptyday();     }     $day++; } $fourthweek = ""; for ($i = 0; $i <= 6; $i++) {     if ($day <= $daysinmonth) {         $fourthweek .= dayhtml($day);     } else {         $fourthweek .= emptyday();     }     $day++; } $fifthweek = ""; if ($day <= $daysinmonth) {     $fifthweek = "<tr valign=\"top\" height=\"100\">";     for ($i = 0; $i <= 6; $i++) {         if ($day <= $daysinmonth) {             $fifthweek .= dayhtml($day);         } else {             $fifthweek .= emptyday();         }         $day++;     }     $fifthweek .= "</tr>"; } $sixthweek = ""; if ($day <= $daysinmonth) {     $sixthweek = "<tr valign=\"top\" height=\"100\">";     for ($i = 0; $i <= 6; $i++) {         if ($day <= $daysinmonth) {             $sixthweek .= dayhtml($day);         } else {             $sixthweek .= emptyday();         }         $day++;     }     $sixthweek .= "</tr>"; } ?> <html> <head> </head> <body> <style> td {     border: 1px solid lightblue;     font-size: .6em; } </style> <table border="0"  cellspacing="2" cellpadding="2" width="100%" style="border: 1px solid lightblue">     <tr>         <th align="left"><a href="<?php echo $_SERVER['PHP_SELF']; ?>?m=<?php echo $prevmonth ?>" alt="Previous Month"><</a> <a href="<?php echo $_SERVER['PHP_SELF']; ?>?m=<?php echo $prevyear ?>" alt="Previous Year"><<</a></th>         <th colspan="5" align="center" id="ignore"><h2><?php echo date('F', $m); ?> <?php echo date('Y', $m); ?></h2></th>         <th align="right"><a href="<?php echo $_SERVER['PHP_SELF']; ?>?m=<?php echo $nextyear ?>" alt="Next Year">>></a> <a href="<?php echo $_SERVER['PHP_SELF']; ?>?m=<?php echo $nextmonth ?>" alt="Next Month">></a></th>     </tr>     <tr>         <th>Sunday</th>         <th>Monday</th>         <th>Tuesday</th>         <th>Wednesday</th>         <th>Thursday</th>         <th>Friday</th>         <th>Saturday</th>     </tr>     <tr height="100" valign="top" >         <?php echo $firstweek; ?>     </tr>     <tr height="100" valign="top" >         <?php echo $secondweek; ?>     </tr>     <tr height="100" valign="top" >         <?php echo $thirdweek; ?>     </tr>     <tr height="100" valign="top" >         <?php echo $fourthweek; ?>     </tr>     <?php echo $fifthweek; ?>     <?php echo $sixthweek; ?> </table> </body> </html>[/code]
  8. Inside your form use this: [code]<input type="button" value="clicky" onclick="javascript: window.location.href='someotherpage.php'">[/code]
  9. Try this: [code]$filename = "path/to/file.txt"; $file = file($filename); $file = array_reverse($file);[/code]
  10. Well, I don't see anything in your code that would cause a problem, so I would say to echo out your query to verify that it's correct, and also echo out the password that you have in the db and the md5'd password that is being passed into the function to compare them visually.
  11. Use the substr function: [code] $start = 5; $end = 9; $str = "the quick brown fox jumps over the lazy dog"; echo $str . "<br />"; echo substr($str, $start, ($end - $start));[/code]
  12. According to the error, the variable $categories, is not an array. If you are creating that array from a mysql query, then it probably is your query.
  13. [a href=\"http://www.phpfreaks.com/tutorials/40/0.php\" target=\"_blank\"]http://www.phpfreaks.com/tutorials/40/0.php[/a] A google search for "php login" will yeild literally millions of others.
  14. That string is a representation of an array. It's obtained by using the function serialize (http://www.php.net/serialize) on an array. In order to return it to it's original form, which is a very usable array, you will want to use unserialize (http://www.php.net/unserialize). From there, you can loop through it and produce a table, or select out only certain elements for a table, or what ever you want to do with it.
  15. Well, to start, please edit your post and remove that incredibly long string from it so that we dont' have to scroll a mile to the right to view your post. Use serialize to change your string back into an array, then you can display it back however you want.
  16. You have to put the part of the code that calls the parse functions into a function itself, then call it and have it return your html... [code] <?php $color1 = "#252D8B"; $color2 = "#2B34A1"; $row_count = 0; /*  PHP RSS Reader v1.1     By Richard James Kendall     Bugs to richard@richardjameskendall.com     Free to use, please acknowledge me          Place the URL of an RSS feed in the $file variable.               The $rss_channel array will be filled with data from the feed,        every RSS feed is different by by and large it should contain:               Array {            [TITLE] = feed title            [DESCRIPTION] = feed description            [LINK] = link to their website                       [IMAGE] = Array {                        [URL] = url of image                        [DESCRIPTION] = alt text of image                    }                       [ITEMS] = Array {                        [0] = Array {                                [TITLE] = item title                                [DESCRIPTION] = item description                                [LINK = a link to the story                            }                        .                        .                        .                    }        }               By default it retrives the Reuters Oddly Enough RSS feed. The data is put into the array        structure so you can format the information as you see fit. */ set_time_limit(0); $rss_channel = array(); $currently_writing = ""; $main = ""; $item_counter = 0; function startElement($parser, $name, $attrs) {        global $rss_channel, $currently_writing, $main;        switch($name) {            case "RSS":            case "RDF:RDF":            case "ITEMS":                $currently_writing = "";                break;            case "CHANNEL":                $main = "CHANNEL";                break;            case "IMAGE":                $main = "IMAGE";                $rss_channel["IMAGE"] = array();                break;            case "ITEM":                $main = "ITEMS";                break;            default:                $currently_writing = $name;                break;        } } function endElement($parser, $name) {        global $rss_channel, $currently_writing, $item_counter;        $currently_writing = "";        if ($name == "ITEM") {            $item_counter++;        } } function characterData($parser, $data) {     global $rss_channel, $currently_writing, $main, $item_counter;     if ($currently_writing != "") {         switch($main) {             case "CHANNEL":                 if (isset($rss_channel[$currently_writing])) {                     $rss_channel[$currently_writing] .= $data;                 } else {                     $rss_channel[$currently_writing] = $data;                 }                 break;             case "IMAGE":                 if (isset($rss_channel[$main][$currently_writing])) {                     $rss_channel[$main][$currently_writing] .= $data;                 } else {                     $rss_channel[$main][$currently_writing] = $data;                 }                 break;             case "ITEMS":                 if (isset($rss_channel[$main][$item_counter][$currently_writing])) {                     $rss_channel[$main][$item_counter][$currently_writing] .= $data;                 } else {                     //print ("rss_channel[$main][$item_counter][$currently_writing] = $data<br>");                     $rss_channel[$main][$item_counter][$currently_writing] = $data;                 }                 break;         }     } } function getrsshtml($feedurl) {     global $rss_channel;     global $currently_writing;     global $main;     global $item_counter;          $rss_channel = array();     $currently_writing = "";     $main = "";     $item_counter = 0;     $file = $feedurl;     $xml_parser = xml_parser_create();     xml_set_element_handler($xml_parser, "startElement", "endElement");     xml_set_character_data_handler($xml_parser, "characterData");     if (!($fp = f open($file, "r"))) {         return "could not open XML input";     }          while ($data = fread($fp, 4096)) {         if (!xml_parse($xml_parser, $data, feof($fp))) {             return (sprintf("XML error: %s at line %d",                         xml_error_string(xml_get_error_code($xml_parser)),                         xml_get_current_line_number($xml_parser)));         }     }     xml_parser_free($xml_parser);          $html = "<table align='left' width='150' border='1' cellpadding='0' cellspacing='0' bordercolor='#252D8B' bgcolor='#252D8B'>";     $html .= "<tr><td bgcolor='#252D8B'><i>$rss_channel[DESCRIPTION]</i></td></tr>";          if (isset($rss_channel["ITEMS"])) {         if (count($rss_channel["ITEMS"]) > 0) {             for($i = 0;$i < count($rss_channel["ITEMS"]);$i++) {             $row_color = ($row_count % 2) ? $color1 : $color2;                 $html .= "<tr><td width=\"100%\" bgcolor='$row_color'><a href=\"" . $rss_channel["ITEMS"][$i]["LINK"] . "\" target=\"_blank\">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</a>";                 $html .= "</td></tr>";                 $row_count++;             }         } else {             $html .= "<b>There are no articles in this feed.</b>";         }     }          $html .= "</table>";          return $html; } echo getrsshtml("http://rss.cnn.com/rss/cnn_topstories.rss"); echo getrsshtml("http://rss.cnn.com/rss/cnn_tech.rss"); [/code] You can use 1000000000 rss feeds with that and never have a problem.
  17. You pretty much wrote it yourself, you might want to check the manual on if statements... [code] <?php if (permission("products","read") == TRUE) {   echo '<script src="menu.js"></script><script menumaker src="menu_.js"></script>'; } [/code]
  18. I think: [code]$tempuser = ${"user$a"};[/code] will work.
  19. [code]mail($to, $subject, $msg, $headers, "-f someuser@somedomain.com");[/code] Essentially, it forces the header to look like it's coming from that person.
  20. [!--quoteo(post=354321:date=Mar 12 2006, 05:20 PM:name=keeB)--][div class=\'quotetop\']QUOTE(keeB @ Mar 12 2006, 05:20 PM) [snapback]354321[/snapback][/div][div class=\'quotemain\'][!--quotec--] I like how it says 'No. I won't write it for you' in your signature, and yet you just wrote the guys code for him!!! [/quote] Yeah, it depends on what it is and my mood. If it's something that I've explained a thousand times then I'm less prone to posting it again. Part of it also has to do with whether I find it entertaining or not...if it's something that I haven't tried doing before, but might at some point in the future consider doing, then I'll write it to see if I can, and at that point I may as well post the code. And I didn't write the php...just the js. If it's for an intranet, then he should be able to control js being enabled or not...especially if it's something for "the man" to keep track of his people...they'll make it happen if they want it bad enough.
  21. Post the code that you use to determine the userid and the code that you use to save the uploaded file...please don't post your entire script...we only need the relevant parts.
  22. [code] <script type="text/javascript">     var start;     var type;          function startbreak() {         if (document.getElementById('btype').selectedIndex > 0) {             var x = document.getElementById('btype');             type = x.options[x.selectedIndex].value;             var d = new Date();             start = d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds();             document.getElementById('end').disabled = false;         } else {             alert("You must select a break type");         }     }          function endbreak() {         var d = new Date();         //uncomment this line to redirect the page to store the values.  You can         //also use php on that page to determine the amount of time they spent on break         //window.location.href = "pagetostoretimes.php?breaktype=" + type + "&starttime=" + start + "&endtime=" + d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds();         alert("Start Time: " + start + "\nEnd Time: " + d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds() + "\nType: " + type);     }      </script> <form method="post">     <select name="break" id="btype">         <option></option>         <option value="smoke">Smoking</option>         <option value="bathroom">Bathroom</option>         <option value="screwing-off">Coffee</option>     </select>     <br />     <input type="button" value="Start Break" onclick="javascript: startbreak()" />&nbsp;&nbsp;<input type="button" value="End break" id="end" onclick="javascript: endbreak();" disabled /> </form>[/code]
  23. You could use a procedure, however I would use a trigger... [a href=\"http://dev.mysql.com/doc/refman/5.1/en/triggers.html\" target=\"_blank\"]http://dev.mysql.com/doc/refman/5.1/en/triggers.html[/a]
  24. Save your self some work and just use one of the open source forum's available...phpBB is a good one, takes about 45 seconds to install, and is pretty user friendly. [a href=\"http://www.phpbb.com\" target=\"_blank\"]http://www.phpbb.com[/a] I know there's others out there however. I realize that you said you don't need individual forums and all, but if your doing this for work, then trust me, once your users/employers start using it, they will want to add more features. Why not start with more than the minimum.
  25. There has to be something different about that particular page if you are using that same script from your other pages. The only other thing I can offer is a link or two: [a href=\"http://www.tech-recipes.com/mysql_tips762.html\" target=\"_blank\"]http://www.tech-recipes.com/mysql_tips762.html[/a] [a href=\"http://www.modwest.com/help/kb6-220.html\" target=\"_blank\"]http://www.modwest.com/help/kb6-220.html[/a] But I don't know if it will help or not.
×
×
  • 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.