Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. Or use DirectoryIterator http://www.php.net/manual/en/directoryiterator.construct.php
  2. I pushed your code through a beautifier to make it readable again. So that people who want to help at least now can.. I also removed most duplication. if (isset($_POST['pc'])) { $con = mysql_connect("localhost", "root", "mypassword") or die("Could not connect: " . mysql_error()); $to = "myemail@mydomain.co.za"; $subject = "New Change Request - Reference Number $_POST[reference]_$_POST[lname]"; if ($_POST["pc"] == "Desktop" && $_POST["access_card"] == "Access Card" && $_POST["organogram"] == "%" || $_POST["pc"] == "Laptop" && $_POST["access_card"] == "Access Card" && $_POST["organogram"] == "%" || $_POST["champ_portal"] == "Champ Portal" && $_POST["access_card"] == "Access Card" && $_POST["organogram"] == "%" || $_POST["email"] == "E-Mail" && $_POST["access_card"] == "Access Card" && $_POST["organogram"] == "%" || $_POST["phone"] == "Hard Phone" && $_POST["access_card"] == "Access Card" && $_POST["organogram"] == "%" || $_POST["phone"] == "Soft Phone" && $_POST["access_card"] == "Access Card" && $_POST["organogram"] == "%" || $_POST["lan"] == "LAN" && $_POST["access_card"] == "Access Card" && $_POST["organogram"] == "%" || $_POST["g_drive"] == "G:" && $_POST["access_card"] == "Access Card" && $_POST["organogram"] == "%" || $_POST["h_drive"] == "H:" && $_POST["access_card"] == "Access Card" && $_POST["organogram"] == "%" || $_POST["distribution"] == "Yes" && $_POST["access_card"] == "Access Card" && $_POST["organogram"] == "%") { $message = "Action Required"; } else if ($_POST["pc"] == "Desktop" && $_POST["access_card"] == "Access Card" || $_POST["pc"] == "Laptop" && $_POST["access_card"] == "Access Card" || $_POST["champ_portal"] == "Champ Portal" && $_POST["access_card"] == "Access Card" || $_POST["email"] == "E-Mail" && $_POST["access_card"] == "Access Card" || $_POST["phone"] == "Hard Phone" && $_POST["access_card"] == "Access Card" || $_POST["phone"] == "Soft Phone" && $_POST["access_card"] == "Access Card" || $_POST["lan"] == "LAN" && $_POST["access_card"] == "Access Card" || $_POST["g_drive"] == "G:" && $_POST["access_card"] == "Access Card" || $_POST["h_drive"] == "H:" && $_POST["access_card"] == "Access Card" || $_POST["distribution"] == "Yes" && $_POST["access_card"] == "Access Card") { $message = "Action Required"; } else if ($_POST["pc"] == "Desktop" && $_POST["organogram"] == "%" || $_POST["pc"] == "Laptop" && $_POST["organogram"] == "%" || $_POST["champ_portal"] == "Champ Portal" && $_POST["organogram"] == "%" || $_POST["email"] == "E-Mail" && $_POST["organogram"] == "%" || $_POST["phone"] == "Hard Phone" && $_POST["organogram"] == "%" || $_POST["phone"] == "Soft Phone" && $_POST["organogram"] == "%" || $_POST["lan"] == "LAN" && $_POST["organogram"] == "%" || $_POST["g_drive"] == "G:" && $_POST["organogram"] == "%" || $_POST["h_drive"] == "H:" && $_POST["organogram"] == "%" || $_POST["distribution"] == "Yes" && $_POST["organogram"] == "%") { $message = "Action Required"; } else if ($_POST["pc"] == "Desktop" || $_POST["pc"] == "Laptop" || $_POST["champ_portal"] == "Champ Portal" || $_POST["email"] == "E-Mail" || $_POST["phone"] == "Hard Phone" || $_POST["phone"] == "Soft Phone" || $_POST["lan"] == "LAN" || $_POST["g_drive"] == "G:" || $_POST["h_drive"] == "H:" || $_POST["distribution"] == "Yes") { $message = "IT Action Required"; } else if ($_POST["access_card"] == "Access Card") { $message = "Forensics Action Required"; } else if ($_POST["organogram"] == "%") { $message = "Organogram Action Required"; } if ($_POST["pc"] == "Desktop" && $_POST["organogram"] == "%" || $_POST["pc"] == "Laptop" && $_POST["organogram"] == "%" || $_POST["champ_portal"] == "Champ Portal" && $_POST["organogram"] == "%" || $_POST["email"] == "E-Mail" && $_POST["organogram"] == "" || $_POST["phone"] == "Hard Phone" && $_POST["organogram"] == "%" || $_POST["phone"] == "Soft Phone" && $_POST["organogram"] == "%" || $_POST["lan"] == "LAN" && $_POST["organogram"] == "%" || $_POST["g_drive"] == "G:" && $_POST["organogram"] == "%" || $_POST["h_drive"] == "H:" && $_POST["organogram"] == "%" || $_POST["distribution"] == "Yes" && $_POST["organogram"] == "%") { $message = "Action Required"; } $message = " New Churn Request - $_POST[churn_type]. " . $message . " A Churn request has been logged for $_POST[fname] $_POST[lname]. Please log onto the churn management system via the link http://10.249.135.30 and action the request accordingly. "; }
  3. http://pulsecms.com/ http://www.couchcms.com/ http://cms.pagelime.com
  4. The PEAR packages are unfortunately written like that. To get rid of the strict error messages alter error_reporting to error_reporting(E_ALL & ~(E_STRICT | E_NOTICE));
  5. Pretty much like everyone seems to know everything about the law. Until they are in a courtroom...
  6. I concur. You want to be able to focus as much on your application as possible instead of writing what has been done so many times before you (DB class, Auth class, bootstrap code). I don't know if Drupal is a good choice for you, you will have to make that up for yourself. Drupal is a full-stack framework, meaning it gives you the house, you just have to pick/move in the furniture. It also means you might not like where it has put certain walls.. Personally I don't like imposed walls, I also don't like doing things how someone else envisioned them (big picture I mean). Which is why in most cases you will find me writing apps using a set of loosely coupled components*. I can still focus on my app, but I will also have to spend a little time focusing on bootstrap code. (*) You can find examples of loosely coupled components doing a specific task on these pages: http://symfony.com/components http://pear.php.net/ http://framework.zend.com/ http://github.com/languages/php -- every repo here is a good source
  7. Let's just assume for a moment the referer would ALWAYS be available. You can not use it to authenticate users on your website, doing so will compromise your website by design. If xyz.com does not support OAuth then you can't use authenticated users on xyz.com to be also authenticated on abc.com. And trying to use anything else then OAuth (or something like it) will result in compromising your website.
  8. Are you running the latest version of Wordpress? If not, upgrade! What specifically did you ask him to code for you? If this is related to Wordpress core functionality then I doubt the programmer would have to use/write new functions and thus the memory leaks come from existing functions. Which would be resolved when upgrading Wordpress. Have you contacted the programmer who wrote this for you? Can you, in any way, show us the code he has written for you? We may be able to spot the serious problems or tell you which code may be causing the memory leak. If these are many files then include them in a zip file.
  9. I would have to actually check. I switch so many times between color themes I lost count.. Even sometimes in one editing session (CTRL+~ to switch themes in PhpStorm). I use PhpStorm like Kevin and their color themes... SUCK ! And they don't allow me to color certain keywords different, so I also regularly switch editors too (netbeans, PDT, notepad++, ace, sublime text 2, ..). But since I use it at work and it has all the features I need/want.. and there is no other editor like it, I always end up back with PhpStorm. But I would switch in a flash for another editor that has all the features I need AND allows me to color certain keywords differently.
  10. No mod with an auto-format option? Since most code here is indented with a random number between 1 and 8 spaces for each line.. (I intended to say something else, but I should be nice.) Just look at the indentation of the code here: http://forums.phpfreaks.com/index.php?topic=362257.msg1713875#msg1713875 Then compare that to: http://forums.phpfreaks.com/index.php?topic=362257.msg1713894#msg1713894 I used an online PHP formatter for that.
  11. http://codebirth.com/index.php?topic=82.0 looks good. Does not copy line numbers when selecting, does not format though... Based on Geshi, mod can be found at http://custom.simplemachines.org/mods/index.php?mod=3070 (updated 11 jan '12). Would be cool if it included a toolbar so you also could copy-to-clipboard. Not many possibilities though: http://custom.simplemachines.org/mods/index.php?action=search;basic_search=syntax+highlighting The only other one in that list is (has no line numbers): http://custom.simplemachines.org/mods/index.php?mod=2925 And the 3rd is only when editing themes... Would it be hard to let a 3rd party plugin handle tags?
  12. Is the double case really necessary? case ($str_item === '"' || $str_item === "'") && !$indoublequotes:
  13. This is possibly done better and faster without regex. Regex would require you to regex twice. Once for everything between " and once for everything that is not between ".
  14. I found two posts that requested this from 2008 and some posted a few possible solutions, but they are from 2008 http://forums.phpfreaks.com/index.php?topic=215609.msg985474 http://forums.phpfreaks.com/index.php?topic=230395.msg1067248 Since there are a lot more options now for code highlighting could this be considered again? Personally I would like to see a code highlighter that also format's the inputted text since most people here who post code tend to write evertything against the border. EDIT: What's up with the editor injecting automagically?
  15. This should tell you what the error is: <?php // DATABASE CONNECTION require("/config.php"); // LEAD DETAILS PAGE - PAGE ID function leaddetailspgid() { global $mysqli; $stmt = $mysqli->prepare("SELECT ID,date,firstname,lastname,spousefirst,spouselast,primarybday,spousebday,phonecell,phonehome,phoneoffice,spousecell,phoneother,email,emailspouse,emailother,emailspouseother,address,suite,city,state,zipcode,addressother,suiteother,cityother,stateother,zipcodeother,agentassigned,contacttype,status,contactsource,timing,password,subscribesearches,subscribedrips FROM contacts"); $stmt->bind_result($ID, $date, $firstname, $lastname, $spousefirst, $spouselast, $primarybday, $spousebday, $phonecell, $phonehome, $phoneoffice, $spousecell, $phoneother, $email, $emailspouse, $emailother, $emailspouseother, $address, $suite, $city, $state, $zipcode, $addressother, $suiteother, $cityother, $stateother, $zipcodeother, $agentassigned, $contacttype, $status, $contactsource, $timing, $password, $subscribesearches, $subscribedrips); $stmt->execute(); $stmt->fetch(); $space = (!empty($firstname) && !empty($lastname)) ? ' ' : ''; $name = $firstname . $space . $lastname; $name .= (!empty($spousefirst)) ? " & {$spousefirst}" : ''; $name .= (!empty($spouselast)) ? " {$spouselast}" : ''; $cell = (!empty($phonecell)) ? " {$phonecell} (cell)" : ''; $home = (!empty($phonehome)) ? " {$phonehome} (home)" : ''; $email = (!empty($email)) ? " {$email} (email)" : ''; $pbday = date("F jS", strtotime($primarybday)); $sbday = date("F jS", strtotime($spousebday)); echo ' <ul id="secondary"> <li class="pageid">DETAILS:</a></li> <li class="pageid">' . $name . '</li> <li class="pageid">' . $home . '</li> <li class="pageid">' . $cell . '</li> <li class="pageid">' . $email . '</li> </ul>'; $stmt->close(); $mysqli->close(); } // LEAD DETAILS PAGE - DETAILS function leaddeatails() { global $mysqli; $stmt = $mysqli->prepare("SELECT ID,date,firstname,lastname,spousefirst,spouselast,primarybday,spousebday,phonecell,phonehome,phoneoffice,spousecell,phoneother,email,emailspouse,emailother,emailspouseother,address,suite,city,state,zipcode,addressother,suiteother,cityother,stateother,zipcodeother,agentassigned,contacttype,status,contactsource,timing,password,subscribesearches,subscribedrips FROM contacts"); if ($stmt === false) { echo 'SQL ERROR: ', $mysqli->error; exit; } $stmt->bind_result($ID, $date, $firstname, $lastname, $spousefirst, $spouselast, $primarybday, $spousebday, $phonecell, $phonehome, $phoneoffice, $spousecell, $phoneother, $email, $emailspouse, $emailother, $emailspouseother, $address, $suite, $city, $state, $zipcode, $addressother, $suiteother, $cityother, $stateother, $zipcodeother, $agentassigned, $contacttype, $status, $contactsource, $timing, $password, $subscribesearches, $subscribedrips); $stmt->execute(); $stmt->fetch(); echo ' <table class="view-detail" id="view-detail"> <tbody> <tr> <td colspan="2"><h2>Details</h2></td> </tr> <tr> <td>Partner: </td><td>' . $spousefirst . ' ' . $spouselast . '</td> </tr> <tr> <td>Cell: </td><td>' . $phonecell . '</td> </tr> <tr> <td>Partner Cell: </td><td>' . $spousecell . '</td> </tr> <tr> <td>Home: </td><td>' . $phonehome . '</td> </tr> <tr> <td>Office: </td><td>' . $phoneoffice . '</td> </tr> <tr> <td>Email: </td><td>' . $email . '</td> </tr> <tr> <td>Partner Email: </td><td>' . $emailspouse . '</td> </tr> <tr> <td>Password: </td><td>' . $password . '</td> </tr> <tr> <td>Other Email: </td><td>' . $emailother . '</td> </tr> <tr> <td colspan="2"><h2>Mailing Address</h2></td> </tr> <tr> <td>Address: </td><td>' . $address . ' Suite: ' . $suite . '</td> </tr> <tr> <td>City: </td><td>' . $city . '</td> </tr> <tr> <td>State: </td><td>' . $state . '</td> </tr> <tr> <td>Zip Code: </td><td>' . $zipcode . '</td> </tr> <tr> <td colspan="2"><h2>Investment Property</h2></td> </tr> <tr> <td>Address: </td><td>' . $addressother . ' Suite: ' . $suiteother . '</td> </tr> <tr> <td>City: </td><td>' . $cityother . '</td> </tr> <tr> <td>State: </td><td>' . $stateother . '</td> </tr> <tr> <td>Zip Code: </td><td>' . $zipcodeother . '</td> </tr> <tr> <td colspan="2"><h2>Birthdays</h2></td> </tr> <tr> <td>Birthday: </td><td>' . $pbday . '</td> </tr> <tr> <td>Partner Birthday: </td><td>' . $sbday . '</td> </tr> <tr> <td colspan="2"><h2>Other Details</h2></td> </tr> <tr> <td>Agent: </td><td>' . $agentassigned . '</td> </tr> <tr> <td>Type: </td><td>' . $contacttype . '</td> </tr> <tr> <td>Status: </td><td>' . $status . '</td> </tr> <tr> <td>Groups: </td><td>Groups Checkboxes Go Here!</td> </tr> <tr> <td colspan="2"><h2>Subscriptions</h2></td> <tr> <td>Searches: </td><td>' . $subscribesearches . '</td> </tr> <tr> <td>Email Drips: </td><td>' . $subscribedrips . '</td> </tr> </tbody> </table>'; $stmt->close(); $mysqli->close(); }
  16. RESTful means you use HTTP verbs GET/POST/DELETE. So Is both restful. Even foo.php?bar=bat is restful.
  17. There is a difference between using a simple Image object to display a model (that said without a vector image it will always go blurry), and using an actual model renderer like THREE with WebGL to display it in 3D. A quick search on Google revealed: http://forums.bukkit.org/threads/web-html5-skin-viewer.4428/ Where you can download the code to view your model in 3D. EDIT: going through the code revealed it assumes register_globals = On ! 0h n03s !!
  18. Thank you for your detailed explanation. I have no experience with lambda-calculus. Bookmarked your code example on the Y combinator. Shouldn't this also be added to that Wikipedia page? LOL. I know what kind of face I'd be getting if I said that to my colleagues because I named all my functions y($x) x($y).
  19. That is not specific to your client. That is how every businessman thinks: cut costs wherever possible while maintaining the same level of quality. It's probably because you allow this kind of pressure from the client (do it faster!) get the better of you and rack up bugs faster than a rotting body. Trust me, I've been there cutting corners everywhere I could to meet an impossible deadline and still be fixing bugs while the client was on his way to celebrate the release of his software... Get out of it before it puts you out! If they do not hire you afterwards because of the potential cost, it's at least that: cost, not the blame of possible incompetence, not implying you are here, which is devastating for your career. That said, it are though times, which is probably why you get no repeat business.
  20. Well I think it all depends. If the code is properly written and somewhat documented. Analyzing first, is a good approach (if this is the case, see below the --). However what are the chances, right? I have edited quite a few legacy systems, some of which you could not tell the difference between if the code was obfuscated first and then checked in, or just written like that. When you have to deal with a system where the typical variable name does not exceed one alphabet character, and function names describe their functionality as well as a 3-year old describes their toys. I highly recommend you code first, ask questions later. Followed by at least a few days of intensive testing, be sure to involve as many people as possible, and fix the bugs that apply to your code, put any other bugs you find in their bug tracking software (if they have that sort of thing). -- In a good case scenario there are some things you must do before you can even consider starting implementation. Fix bugs! If there are already multiple open bugs for the part of the system you are going to be editing, then it goes without saying that whatever you are going to do is going to make it worse. Probably what has been happening to you. If they apply unit-testing, your job is even easier to squash bugs! Done fixing bugs? But still not too comfortable? Refactor! Some functions body you will be using exceeds your screen height? Good candidate for refactoring! Break it up into smaller functions (literally copy-pasting parts of the parent function into the smaller function and resolving any missing local variables). If they apply unit-testing, again your job will be much easier. By now you will feel as if you wrote the damn thing.
  21. I think a perfect script should have a better variable naming convention I don't know what this does though: $ff = function($f) { return $f($f); }; // PHP doesn't allow function call chaining return $ff( function ($g) use ($f) { return $f(function() use ($g) { return call_user_func_array($g($g), func_get_args()); }); } ); My guess would go to currying of some sort?
  22. Something like this? $validator = $model->getValidator(); if (!$validator->isValid()) { $this->display(array('messages' => $validator->getMessages())); }
  23. They realized PHP only implements half of Java's OO functionalities..
×
×
  • 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.