Jump to content

DirtySnipe

Members
  • Posts

    69
  • Joined

  • Last visited

    Never

Everything posted by DirtySnipe

  1. Nail on the head. Thanks for that. I had installed a new webserver and forgot about the short tags. thanks again.
  2. I have a php file which contains a html form. Within the html form are multiple drop down boxes which are supposed to pull information from a mysql database. What im also trying to do is get it to show a default entry from the database. <select style="width:100px" name="person_involved"> <?php mysql_connect("localhost", "username", "password") or die("Connection Failed"); mysql_select_db("mydatabase") or die("Connection Failed"); $sql = "SELECT * FROM hesk_location ORDER BY name ASC"; $result = hesk_dbQuery($sql); while ($row=hesk_dbFetchAssoc($result)) { $sel = $row['isDefault'] == true ? "selected='selected'" : ""; ?> <option <?=$sel?> value="<?=$row['name']?>"><?=$row['name']?></option> <?php } ?> </select> but for some reason it only displays Value=""> not the values from the database.. can anyone help me out here?
  3. Is that not a hint ive been trying to convert the old file???
  4. Im stuck on the following part. the old modified part it goes as follows:- Line 789 there is an sql select you can see the modification by the ref JM in the comment. I cannot see how to add these modifications in the new file.
  5. I have a customized old version of MRBS 1.x.x which added equipment to the booking system. When you click on an item and submit the booking it would email the it department with the booking information and the required equipment they selected. They have upgraded the script to now include this and fix alot of bugs. But they didn't include the email notification part. Can anyone help to convert my modified mail function to the newer version? I have attached the files into a zip. Thanks in advance [attachment deleted by admin]
  6. Why don't you just take a look at this php / mysql search engine script. Look into the code to figure out how they did it and make your own from there. http://www.sphider.eu/
  7. I think i fixed it myself function privacy_form($idnum) { global $ct, $tbclr_1, $tbclr_2, $tbclr_3, $tbclr_4, $fntclr_1, $emltp, $emllogin, $msg2, $indx_url ; $fields_val=get_edit_info($idnum); $message= " <script type='text/javascript'> /*********************************************** * Email Validation script- © Dynamic Drive (www.dynamicdrive.com) * This notice must stay intact for legal use. * Visit http://www.dynamicdrive.com/ for full source code ***********************************************/ var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i function checkmail(e){ var returnval=emailfilter.test(e.value) if (returnval==false){ alert('Please enter a valid email address.') e.select() } return returnval } </script> <center> <table width='600' border=0 cellspacing=1 cellpadding=0> <tr><td> <a href='{$indx_url}ct=$ct&md=details&id=$idnum'> ".$msg2['ID_f']."".$fields_val['idnum']."<b> ".$fields_val['title']."</b> </a></font> </td></tr></table> <p class='pst1'> <table width='600' class='frmtb1' border=0 cellspacing=1 cellpadding=0> <tr><td> <font class='frmcp'> ".$msg2['Send_Privacy_Message']." </font> <table width='100%' border=0 cellspacing=1 cellpadding=0> <tr><td class='frmtb2'> <form action='{$indx_url}ct=$ct&md=send_mail' method='post'> <input type='hidden' name='idnum' value='$idnum'> <input type='hidden' name='emltp' value='$emltp'> <input type='hidden' name='emllogin' value='$emllogin'> <p class='pst1'><center> <table> <tr> <td align='right' > <font class='frmft1'> ".$msg2['Your_e_mail_f'].": </font> </td><td> <input type='text' name='pm_email' size='40' class=formst></td></tr><tr> <td align='right'> <font class='frmft1'> ".$msg2['Subject_p'].": </font> </td><td> <input type='text' name='pm_subject' size='40' class=formst value='Re: ".$fields_val['title']."'></td></tr><tr> <td align='right'> <font class='frmft1'> ".$msg2['Message_p'].": </font> </td><td> <textarea rows='8' cols='40' name='pm_message' class=formst></textarea> </td></tr> </table> <p class='pst1'> "; $message=$message." <input type='submit' value='".$msg2['Send_p']."' onClick='return checkmail(this.form.pm_email)' class=formst STYLE='FONT-WEIGHT: bold;'> </form> </center> </td></tr></TABLE> </td></tr></TABLE> </center> "; output_message($message); return; }
  8. Im trying to insert email validation to the following code but no matter what I try it does not work. Please help. email validation code <script type="text/javascript"> /*********************************************** * Email Validation script- © Dynamic Drive (www.dynamicdrive.com) * This notice must stay intact for legal use. * Visit http://www.dynamicdrive.com/ for full source code ***********************************************/ var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i function checkmail(e){ var returnval=emailfilter.test(e.value) if (returnval==false){ alert("Please enter a valid email address.") e.select() } return returnval } </script> <form> <input name="myemail" type="text" style="width: 270px"> <input type="submit" onClick="return checkmail(this.form.myemail)" value="Submit" /> </form> php form code function privacy_form($idnum) { global $ct, $tbclr_1, $tbclr_2, $tbclr_3, $tbclr_4, $fntclr_1, $emltp, $emllogin, $msg2, $indx_url ; $fields_val=get_edit_info($idnum); $message= " <center> <table width='600' border=0 cellspacing=1 cellpadding=0> <tr><td> <a href='{$indx_url}ct=$ct&md=details&id=$idnum'> ".$msg2['ID_f']."".$fields_val['idnum']."<b> ".$fields_val['title']."</b> </a></font> </td></tr></table> <p class='pst1'> <table width='600' class='frmtb1' border=0 cellspacing=1 cellpadding=0> <tr><td> <font class='frmcp'> ".$msg2['Send_Privacy_Message']." </font> <table width='100%' border=0 cellspacing=1 cellpadding=0> <tr><td class='frmtb2'> <form action='{$indx_url}ct=$ct&md=send_mail' method='post'> <input type='hidden' name='idnum' value='$idnum'> <input type='hidden' name='emltp' value='$emltp'> <input type='hidden' name='emllogin' value='$emllogin'> <p class='pst1'><center> <table> <tr> <td align='right' > <font class='frmft1'> ".$msg2['Your_e_mail_f'].": </font> </td><td> <input type='text' name='pm_email' size='40' class=formst></td></tr><tr> <td align='right'> <font class='frmft1'> ".$msg2['Subject_p'].": </font> </td><td> <input type='text' name='pm_subject' size='40' class=formst value='Re: ".$fields_val['title']."'></td></tr><tr> <td align='right'> <font class='frmft1'> ".$msg2['Message_p'].": </font> </td><td> <textarea rows='8' cols='40' name='pm_message' class=formst></textarea> </td></tr> </table> <p class='pst1'> "; $message=$message." <input type='submit' value='".$msg2['Send_p']."' class=formst STYLE='FONT-WEIGHT: bold;'> </form> </center> </td></tr></TABLE> </td></tr></TABLE> </center> "; output_message($message); return; }
  9. Is it possible to display Mon, Tue, Wed and so on instead of day1, day2, day3?
  10. myrddinwylt what can I say. You are a star...
  11. I can hook you up with a temp account to login to the system and a temp ftp.
  12. intense.. sounds like trouble. how much would it cost if i were to say could you rewrite it?
  13. here is the code from table class. <?php class table { // Variable declarations private $html; // The container for the html private $bgc; // Array with row colors private $bgi; // Index used to alternate the bgc array private $current_row; // Current row counter private $current_col; // Current col counter private $columns; // Total number of columns. private $rowIsOpen; // bool to mem if a row is open. private $alternating; // If we use alteranting row colors. private $hasContent; // Set to true when the first row has been completed. private $width; // Width. // Constructator!!1 public function __construct($cols, $alt = false, $width = "%%WIDTH%%", $align = false) { // The $cols (columns) must be a positive integer greater of equal one. if ($cols <= 0) { makeNotice("Invalid column count given to constructor", "error", "Internal Error"); } // Default values for new tables. $this->bgc = array ( "#333344", "#444455" ); // Array of background colors $this->bgi = 1; // Index used in conjunction with above array. $this->current_col = 0; // Counts the current columns in the current row $this->current_row = 0; // Counts the number of rows $this->alternating = $alt; // True if we use alternating colors. $this->columns = $cols; // Defines the max number of columns. $this->html = "<table " . $align . $width . " cellpadding=\"2\" cellspacing=\"0\">"; // Open up the table. } public function addRow($bgcolor = false, $valign = false) { // Close current row, if applicable. $this->closeRow(); if (!$bgcolor) { $bgcolor = $this->bgc[$this->bgi]; $this->bgi = 1 - $this->bgi; } if ($valign) { $valign = "valign=\"" . $valign . "\""; } // Do we want alternating table colors? if ($this->alternating) { $this->html .= "<tr bgcolor=\"" . $bgcolor . "\" $valign>"; } else { $this->html .= "<tr>"; } // Reset the column count (new row) $this->current_col = 0; // Reset the column counter. $this->rowIsOpen = true; // Mark the table as open. $this->current_row++; // Increase row count. } private function closeRow() { if ($this->rowIsOpen) { // Do we have an open row? if ($this->current_col != $this->columns) { // Is the row filled? $BT = nl2br(print_r($this, true) . "<br>" . print_r(debug_backtrace(), true)); makeNotice("Current row not finished feeding yet!<br><br>" . $BT, "error", "Internal Error"); } else { // Its opened and filled. Close the row, and mark it as closed, too. $this->html .= "</tr>"; // Close row. $this->rowIsOpen = false; // Mark row as closed. } } } public function hasContent() { return ($this->hasContent); } public function addHeader($text) { $this->addRow("#222233"); $cols = $this->columns; $this->addCol("$text", array ( "bold" => true, "colspan" => $cols )); } public function addHeaderCentered($text) { $this->addRow("#222233"); $cols = $this->columns; $this->addCol("$text", array ( "bold" => true, "colspan" => $cols, "align" => "center" )); } public function addCol($cont, $modes) { // Do we have an open row? if (!$this->rowIsOpen) { makeNotice("Row not opened.", "error", "Internal Error"); } // Do we have a valid modes array? if (isset ($modes) && is_array($modes)) { // set the colspanning right. if ($modes[colspan]) { $colspan = $modes[colspan]; } else { $colspan = 1; } // rowspanning! if ($modes[rowspan]) { $rowspan = $modes[rowspan]; } else { $rowspan = 1; } // Bold ? if ($modes[bold]) { $bold = "<b>"; $bold_end = "</b>"; } // Width ? if ($modes[width]) { $width = $modes[width]; } // Align? if (isset ($modes[align])) { $align = "align=\"" . $modes[align] . "\""; } // Valign? if (isset ($modes[valign])) { $valign = "valign=\"" . $modes[valign] . "\""; } // Color? if (isset ($modes[bgcolor])) { $bgcolor = "bgcolor=\"" . $modes[bgcolor] . "\""; } } else { // Default Values go here (if no array set) $colspan = 1; } // Are we over-doing it? if ($this->current_col + $colspan > $this->columns) { debug($this); makeNotice("Too many columns requested.", "error", "Internal Error"); } // Add the content. $this->html .= "<td rowspan=\"" . $rowspan . "\" colspan=\"" . $colspan . "\" $bgcolor width=\"$width\" $align $valign>" . $bold . $cont . $bold_end . "</td>"; $this->current_col = $this->current_col + $colspan; $this->hasContent = true; } public function flush() { // Close and opened rows, if any. $this->closeRow(); // Finnish up. $this->html .= "</table>"; return ($this->html); } } ?>
  14. This is a screen dump of what this function displays atm. This is what i mean there is no current day it just displays a one day schedule. A 24 hour block of time. I need to change it to a 168 hour block of time displayed like mon 0-1 1-2 and so on tues 0-1 1-2 wed 0-1 1-2 for a 7 day week. There are other things in there aswell like user stuff that relates to other code but that is not really needed here for what i want to do. I just want to change this from a single day to a full week.
  15. I have a bit of code for a 1 day availability. Not the best but it works. It is now in much need to an alteration. I need to modify it to a 7 day availability. Can anyone help. <?php function onlineTime() { // We need funky globals! global $DB; global $MySelf; global $TIMEMARK; /* * The change form. */ $MySetting = $DB->query("SELECT * FROM onlinetime WHERE userid='" . $MySelf->getID() . "'"); $MySetting = $MySetting->numRows(); if ($MySetting == 0 || $_GET[edit]) { $setTable = new table(3, true); $setTable->addHeader(">> Set your online time"); // Fetch el grande saved array. Ole! $myOnlineTime = $DB->getAssoc("SELECT * FROM onlinetime WHERE userid='" . $MySelf->getID() . "' LIMIT 1"); $myOnlineTime = $myOnlineTime[$MySelf->getID()]; // Loop through the hours. $j = 0; for ($i = 0; $i <= 23; $i++) { // Add a new row every 3rd time we are here, startign with first. if ($j == 0) { $setTable->addRow(); $j = 3; } // 01-02, 02-03.. etc $p = str_pad($i, 2, "0", STR_PAD_LEFT) . "-" . str_pad(($i +1), 2, "0", STR_PAD_LEFT); // Wow this is ugly. Pre-select all values that are stored in the db. $ppdv0 = "<option value=\"0\">0</option>"; $ppdv1 = "<option value=\"1\">1</option>"; $ppdv2 = "<option value=\"2\">2</option>"; $ppdv3 = "<option value=\"3\">3</option>"; $column = "h" . str_pad($i, 2, "0", STR_PAD_LEFT); switch ($myOnlineTime[$column]) { case ("0") : $ppdv0 = "<option selected value=\"0\">0</option>"; break; case ("01") : $ppdv1 = "<option selected value=\"1\">1</option>"; break; case ("2") : $ppdv2 = "<option selected value=\"2\">2</option>"; break; case ("3") : $ppdv3 = "<option selected value=\"3\">3</option>"; break; } $ppd = $ppdv0 . $ppdv1 . $ppdv2 . $ppdv3; $s = "<select name=\"$i\">"; $setTable->addCol($p . $s . $ppd . "</select>"); // Substract one. $j--; } // explain: $setTable->addRow(); $setTable->addCol("Code 0: You cant play at all. (sleep, work)", array ( "colspan" => 3 )); $setTable->addRow(); $setTable->addCol("Code 1: You could, but normaly wouldnt, except for extreme cases.", array ( "colspan" => 3 )); $setTable->addRow(); $setTable->addCol("Code 2: You can easily be online, but normaly are not.", array ( "colspan" => 3 )); $setTable->addRow(); $setTable->addCol("Code 3: Your preffered online time.", array ( "colspan" => 3 )); $submitbutton = "<input type=\"hidden\" name=\"check\" value=\"true\">" . "<input type=\"hidden\" value=\"modonlinetime\" name=\"action\">" . "<input type=\"submit\" value=\"Update your OnlineTime\" name=\"submit\">"; $setTable->addHeaderCentered("All times are EvE time!"); $setTable->addHeaderCentered($submitbutton); $form .= "<form action=\"index.php\" method=\"POST\">"; $form .= $setTable->flush(); $form .= "</form>"; } else { $editLink = "<br>[<a href=\"index.php?action=onlinetime&edit=true\">Edit your times</a>]"; } $page = "<h2>Online Time</h2>" . $form; /* * Okay pheew. That was the table to set your own time. Now lets create * a table to show everyones online time. */ $onlineTime = new table(25, true); $onlineTime->addHeader(">> Online Time of your corporation"); $onlineTime->addRow("#060622"); $onlineTime->addCol("Member"); $onlineTime->addCol("00"); $onlineTime->addCol("01"); $onlineTime->addCol("02"); $onlineTime->addCol("03"); $onlineTime->addCol("04"); $onlineTime->addCol("05"); $onlineTime->addCol("06"); $onlineTime->addCol("07"); $onlineTime->addCol("08"); $onlineTime->addCol("09"); $onlineTime->addCol("10"); $onlineTime->addCol("11"); $onlineTime->addCol("12"); $onlineTime->addCol("13"); $onlineTime->addCol("14"); $onlineTime->addCol("15"); $onlineTime->addCol("16"); $onlineTime->addCol("17"); $onlineTime->addCol("18"); $onlineTime->addCol("19"); $onlineTime->addCol("20"); $onlineTime->addCol("21"); $onlineTime->addCol("22"); $onlineTime->addCol("23"); // Ask the oracle. $cutOff =$TIMEMARK - 2592000; // 30 days. $OT = $DB->getCol("select distinct id from users where canLogin='1' and lastlogin >= '$cutOff' AND deleted='0'"); // Pilots names are not store in the onlinetable. So we have to translate. foreach ($OT as $pilotID) { $pilots[] = idToUsername($pilotID); } // Anyone published his online time yet? if (count($pilots) >= 1) { $haveOnlineTime = true; } // Sort the pilots by name. asort($pilots); // Create a row for each pilot. foreach ($pilots as $pilot) { // Get the pilots online times. $id = usernameToID($pilot); $ot = $DB->query("SELECT * FROM onlinetime WHERE userid='" . $id . "'"); // break off here if the user has not publishes his online time yet. if ($ot->numRows() == 0) { continue; } $ot = $ot->fetchRow(); $onlineTime->addRow(); // Pilot name $onlineTime->addCol(ucfirst($pilot)); // And go through each hour, creating a nice coloured box. for ($i = 0; $i <= 23; $i++) { $column = "h" . str_pad($i, 2, "0", STR_PAD_LEFT); // #222733 | #4f646e | #c2c957 | #e6f137 switch ($ot[$column]) { case ("0") : $onlineTime->addCol(" ", array ( "bgcolor" => "#222733" )); break; case ("01") : $onlineTime->addCol(" ", array ( "bgcolor" => "#4f646e" )); break; case ("2") : $onlineTime->addCol(" ", array ( "bgcolor" => "#c2c957" )); break; case ("3") : $onlineTime->addCol(" ", array ( "bgcolor" => "#e6f137" )); break; } } } // Return the hard labor. /* Return the Online Table, or, If no one published his online time yet, * print a message saying just that. */ if ($haveOnlineTime) { // We have at least one person who sent in his times. return ($page . $onlineTime->flush() . $editLink); } else { // Noone ever sent in his times. return ($page . "<b>Noone sent in his/her onlinetimes yet. But you can be the first! </b><br>" . $editLink); } } ?>
  16. Im trying to switch number output to the jquery 1.2 progress bar but cannot figure it out. I currently use the following as the output :- <? printf('%d', $percentage * 100); ?> This displays the output as follows :- 00 How can i get jquery to work instead of just showing plain numbers? The code goes on about using an upload form which I dont want to use. here is a link to progress bar http://t.wits.sg/tag/progressbar/
  17. ahhh bliss Thank you soo much. You have been a great help.
×
×
  • 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.