Jump to content

ChemicalBliss

Members
  • Posts

    719
  • Joined

  • Last visited

    Never

Everything posted by ChemicalBliss

  1. change $os .= $i; to $os[] = $i; and you got yourself a winner.
  2. In your display i cannot see where locationid form variable exists. you are just echoing it out. Also, foreach() expects it's first parameter ($_POST['locationid'] in your case) to be an array. Which a single id is clearly not (unless you put it inside an array). If you have multiple locationid's and updating multiple forms at once, you will have to iterate each form element for ex; HTML: <form> <input name="locationid[0]"> <input name="location_name[0]"> <input name="location_date1[0]"> <input name="location_date2[0]"> --- second form <input name="locationid[1]"> <input name="location_name[1]"> <input name="location_date1[1]"> <input name="location_date2[1]"> --- etc... PHP: <?php if( isset( $_POST['locationid'] ) && count( $_POST['locationid'] ) >= 1){ foreach( $_POST['locationid'] as $formId => $locationId ){ $thisForm = array( "id" => $locationId, "name" => $_POST['location_name'][$formId], "date1" => $_POST['location_date1'][$formId], "date2" => $_POST['location_date2'][$formId] ); // input validation etc // then update database using new values gained. } } ?>
  3. If you havn't already I would get used to using the php manual, it's real quick and easy to find what you need. In this case, the parameters of the function setcookie: http://php.net/setcookie Just drop the last two parameters until you understand exactly why your using them .
  4. I agree with your statements that this could be misrepresented as a "Teach Me" topic. All I can say is know who your dealing with, search my posts if you want to know how often I ask for help . (Not often). But this isn't about asking for help a such, more to the effort of getting a better understanding of advanced concepts such as OOD. As stated, I am currently learning OOP for php and certain things I'm not too sure of I might ask for some clarification, whereas I can offer what I already know about OOP, and the extensive knowledge of general programming in PHP This is a two-way thing here, help each other as you stated . PHP Groups yes, that is a good idea and I have used IRC chats before but it seems much like on forums, non-personal, sometimes the other person just doesn't care. And it's next to impossible to get a good relationship going with people that constantly help others. Having a personal friend(s) you can contact is much more personal, you get the friendship that forms from getting to know each other and what each other knows.
  5. Thanks for the input . It has already proved quite useful, although my time is limited, I haven't been "harassed" at all from the few people I have already added and we have helped each other already. (and it was fast!). So it's working out great at the moment and hope to gain more php buddies . Will keep watching this thread if anyone would still like a coding buddy.
  6. Ohh it can . I'm using it as we speak . Apache 2.4.1 PHP5.4.0 (release) xDebug 2.2 Dev NetBeans 7.2 Dev
  7. Even xdebug? Since he hasn't compiled 2.2 yet..
  8. @the little guy Don't mean to be rude but this thread is for people looking for general talk and idea sharing. I suggest you ask in the freelance forum if you want coding help with your current projects. If you want to talk about ideas and concepts drop me a shout. Thanks
  9. If you want to use xDebug with php 5.4.0 - I have compiled the windows dll myself (with only 1 issue: max_exec_time isn't modified so have to modify in php.ini - nothing major). Or I can outline steps to compile xdebug yourself. (fairly lengthy, from tools download to using the dll in netbeans can take up to an hour depending on network speed.)
  10. Don't mean to bump Just wanted to say I've had a couple of bites . It's good to have friends that program like you that you can contact quickly (learn and teach a lot all at the same time ). But, More is merrier so if anyone else is willing to Talk/Learn/Program/Teach or otherwise communicate about PHP, drop me a message and Ill give you my skype/email. Cheers guys .
  11. Don't remove any code if your not sure what it does, or if you do, pout it back if it doesn't do what you expected. change timeclock.php from: if (($display_current_users == "yes") && ($display_office == "all") && ($display_group == "all")) { $current_users_date = strtotime(date($datefmt)); $calc = 86400; $a = $current_users_date + $calc - @$tzo; $b = $current_users_date - @$tzo; $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.* from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ((".$db_prefix."info.timestamp < '".$a."') and (".$db_prefix."info.timestamp >= '".$b."')) and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin' order by `$sortcolumn` $sortdirection"; $result = mysql_query($query); } elseif (($display_current_users == "yes") && ($display_office != "all") && ($display_group == "all")) { $current_users_date = strtotime(date($datefmt)); $calc = 86400; $a = $current_users_date + $calc - @$tzo; $b = $current_users_date - @$tzo; $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.* from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."' and ((".$db_prefix."info.timestamp < '".$a."') and (".$db_prefix."info.timestamp >= '".$b."')) and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin' order by `$sortcolumn` $sortdirection"; $result = mysql_query($query); } elseif (($display_current_users == "yes") && ($display_office == "all") && ($display_group != "all")) { $current_users_date = strtotime(date($datefmt)); $calc = 86400; $a = $current_users_date + $calc - @$tzo; $b = $current_users_date - @$tzo; $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.* from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.groups = '".$display_group."' and ((".$db_prefix."info.timestamp < '".$a."') and (".$db_prefix."info.timestamp >= '".$b."')) and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin' order by `$sortcolumn` $sortdirection"; $result = mysql_query($query); } elseif (($display_current_users == "yes") && ($display_office != "all") && ($display_group != "all")) { $current_users_date = strtotime(date($datefmt)); $calc = 86400; $a = $current_users_date + $calc - @$tzo; $b = $current_users_date - @$tzo; $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.* from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."' and ".$db_prefix."employees.groups = '".$display_group."' and ((".$db_prefix."info.timestamp < '".$a."') and (".$db_prefix."info.timestamp >= '".$b."')) and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin' order by `$sortcolumn` $sortdirection"; $result = mysql_query($query); } elseif (($display_current_users == "no") && ($display_office == "all") && ($display_group == "all")) { $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.* from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin' order by `$sortcolumn` $sortdirection"; $result = mysql_query($query); } elseif (($display_current_users == "no") && ($display_office != "all") && ($display_group == "all")) { $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.* from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."' and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin' order by `$sortcolumn` $sortdirection"; $result = mysql_query($query); } elseif (($display_current_users == "no") && ($display_office == "all") && ($display_group != "all")) { $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.* from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.groups = '".$display_group."' and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin' order by `$sortcolumn` $sortdirection"; $result = mysql_query($query); } elseif (($display_current_users == "no") && ($display_office != "all") && ($display_group != "all")) { $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.* from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."' and ".$db_prefix."employees.groups = '".$display_group."' and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin' order by `$sortcolumn` $sortdirection"; $result = mysql_query($query); } to: if (($display_current_users == "yes") && ($display_office == "all") && ($display_group == "all")) { $current_users_date = strtotime(date($datefmt)); $calc = 86400; $a = $current_users_date + $calc - @$tzo; $b = $current_users_date - @$tzo; $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.* from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ((".$db_prefix."info.timestamp < '".$a."') and (".$db_prefix."info.timestamp >= '".$b."')) and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin' order by `$sortcolumn` $sortdirection"; } elseif (($display_current_users == "yes") && ($display_office != "all") && ($display_group == "all")) { $current_users_date = strtotime(date($datefmt)); $calc = 86400; $a = $current_users_date + $calc - @$tzo; $b = $current_users_date - @$tzo; $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.* from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."' and ((".$db_prefix."info.timestamp < '".$a."') and (".$db_prefix."info.timestamp >= '".$b."')) and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin' order by `$sortcolumn` $sortdirection"; } elseif (($display_current_users == "yes") && ($display_office == "all") && ($display_group != "all")) { $current_users_date = strtotime(date($datefmt)); $calc = 86400; $a = $current_users_date + $calc - @$tzo; $b = $current_users_date - @$tzo; $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.* from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.groups = '".$display_group."' and ((".$db_prefix."info.timestamp < '".$a."') and (".$db_prefix."info.timestamp >= '".$b."')) and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin' order by `$sortcolumn` $sortdirection"; } elseif (($display_current_users == "yes") && ($display_office != "all") && ($display_group != "all")) { $current_users_date = strtotime(date($datefmt)); $calc = 86400; $a = $current_users_date + $calc - @$tzo; $b = $current_users_date - @$tzo; $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.* from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."' and ".$db_prefix."employees.groups = '".$display_group."' and ((".$db_prefix."info.timestamp < '".$a."') and (".$db_prefix."info.timestamp >= '".$b."')) and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin' order by `$sortcolumn` $sortdirection"; } elseif (($display_current_users == "no") && ($display_office == "all") && ($display_group == "all")) { $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.* from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin' order by `$sortcolumn` $sortdirection"; } elseif (($display_current_users == "no") && ($display_office != "all") && ($display_group == "all")) { $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.* from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."' and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin' order by `$sortcolumn` $sortdirection"; } elseif (($display_current_users == "no") && ($display_office == "all") && ($display_group != "all")) { $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.* from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.groups = '".$display_group."' and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin' order by `$sortcolumn` $sortdirection"; } elseif (($display_current_users == "no") && ($display_office != "all") && ($display_group != "all")) { $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.* from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."' and ".$db_prefix."employees.groups = '".$display_group."' and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin' order by `$sortcolumn` $sortdirection"; } $result = mysql_query($query) or die("<h1>MYSQL QUERY ERROR</h1>\n<b>Query:</b> ".$query."\n<br/><br/>\n".mysql_error()); Basically, "Not a valid mysql result resource" means a query failed somewhere (if the code is supposed to work). Make sure you testing this with all errors and notices turned on. especially if your converting old code. Tell us what it says. Good luck.
  12. To be honest I'm surprised a server admin helped you that far. I'm guessing it's a free host, most admins just don't care/have time to help on those free hosts. (they don't get paid ). Even if it's a paid host I would imagine they would not "support" third party scripts like SMF. Although I'm surprised SMF themselves have not given you any hints on their forums. Basically, you need to learn regex. You need to learn how regex works in PHP, the preg_match/preg_replace(_all) etc if you want to do this yourself. This can take a while to learn. But if you really want to learn PHP I would stick at it until you do it, generally, it is an easy fix. Two options; 1. Modify the existing regex matcher. 2. Create a new (separate or inline) regex matcher to parse the smilies the original matcher missed. They would generally both take as much effort, 1- having to keep the functionality of the original matcher and 2- not breaking the functionality of he original matcher. Give us the output that I explained in my previous post and the whole method code (you've provided a snippet that's hard to measure) (function name(){ all code }), from the function name to the last curly brace (not the last curly brace in the file, just for that method - match them up). Good luck.
  13. I thought I would share the fact that I finally compiled it! Basically you compile as a PECL extension (duh) - Not the way xdebug documentation suggests. I now have apache 2.4.1/PHP5.4.0 and Xdebug (2.2) running with netbeans perfectly (ok 1 problem..). Only problem I think is from xdebug: Max Execution Time is exceeded when debugging, just set max_execution_time in php.ini to 0 or a higher number (not sure if the web service you use will timeout also, most have 300 sec limits). Thanks again
  14. UPDATE: So I followed "https://wiki.php.net/internals/windows/stepbystepbuild" to the letter. All successful. Then I try o compile the xdebug extension separately as required. Steps: 1. Unpack xdebug (c:\xdebug) 2. run phpize (from inside xdebug - success) 3. run configure --with-xdebug ! Failure ! Here is the console output: c:\php-sdk\php54a\vc9\x86\php540rc8-xyz>cd c:\xdebug c:\xdebug>C:\php-sdk\php54a\vc9\x86\php540rc8-xyz\Release_TS\php-5.4.0RC8-devel- VC9-x86\phpize.bat Rebuilding configure.js C:\php-sdk\php54a\vc9\x86\php540rc8-xyz\Release_TS\php-5.4.0RC8-devel-VC9-x86 module ... Now run 'configure --help' c:\xdebug>configure --with-xdebug Saving configure options to config.nice.bat Checking for cl.exe ... <in default path> Detected compiler MSVC9 (Visual C++ 2008) Detected 32-bit compiler Checking for link.exe ... C:\Program Files\Microsoft Visual Studio 9.0\VC\Bin Checking for nmake.exe ... <in default path> Checking for lib.exe ... <in default path> Checking for bison.exe ... <in default path> Checking for re2c.exe ... <in default path> Detected re2c version 0.13.5 Checking for zip.exe ... <in default path> Checking for lemon.exe ... <not found> Checking for mc.exe ... C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin Checking for mt.exe ... C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin Build dir: Release_TS PHP Core: php5ts.dll and php5ts.lib Enabling extension C:\xdebug [shared] c:\xdebug\configure.js(1254, 3) Microsoft JScript runtime error: 'PHP_PGI' is un defined c:\xdebug>nmake Microsoft (R) Program Maintenance Utility Version 9.00.30729.01 Copyright (C) Microsoft Corporation. All rights reserved. NMAKE : fatal error U1064: MAKEFILE not found and no target specified Stop. Note: During the configure process: I checked the JS file and that constant sure enough is not mentioned apart from 2 lines that try to read it. Along with 'PHP_PGO'. It is though, the same routines that are in the original configure.js for compiling PHP itself, which runs perfectly well without any changes. I am baffled as to why I am stuck at this point. Perhaps something is not being included as it should be.. ? Thanks for any input you may have regarding this .
  15. Hi guys, I need to compile xDebug from the Master Git Repository for PHP 5.4.0RC8 for Windows x86. I can find next to no information for loading this project into a VC9 IDE, and then compiling the result. The source comes with a makefile batch program but does not contain the mak files themselves. Any help would be greatly appreciated! Thanks PS: xDebug Source - https://github.com/derickr/xdebug PHP5.4.0RC8 Binary/Source: http://windows.php.net/qa/ using Visual Studio 2010. And nMake 1.5. (Windows 7) Tried; http://blog.slickedit.com/2007/09/creating-a-php-5-extension-with-visual-c-2005/ then tried running the makefile with nmake to find .mak files missing. UPDATE: Just caught this link: http://bugs.xdebug.org/view.php?id=730 Seems someone knows how to do it . Will review this case and see if I can get it to build.
  16. Ignace you understand me! lol, thanks for the offer it is much appreciated, although a PM is similar to posting a topic . Need something a little more... practical . Thanks again . - I'm surprised that more people havn't come forward, I would of killed for a PHP Partner/buddy to learn with when I was learning more advanced topics. Guess everyone is busy on the forums .
  17. Hi thanks very much for the advice. I find the killerphp and jream videos on yt very helpful. These static tutorials are great, but when coding it is better to have a friend you can get specific advice that's related to your code or design ideas. IRC just doesn't have the personal touch, when you know someone even a little you get to understand their concepts and ideas easier. Just lookin for a 'PHP Buddy' . Or Buddies ofc. Thanks again.
  18. The reason the emoticons are not parsed is because of the way SMF looks for strings to replace as img tags. It uses a PCRE Regular Expression. Basically it is like a very mini language, seemingly very simple but can be very complex. Learning regex on it's own can take weeks if not longer. I would post this question in the Regular Expressions Sub-Forum of PHP Help. or continue with the help of your admin friend; In PHP, debugging this way is very common for a wide range of common problems. He's telling you to echo and print_r two variables. He wants to know what is in these variables at the point in code that they are used (I would assume). To do this in PHP, all you need to do is make a new line just above where they are "used" (not updated/created), if you are this new to php this will be very difficult to grasp. In this case I would put this new line below the line he told you to remove the "\s" from. eg; $smileyPregSearch = '~(?<=[>:\?\.\s' . $non_breaking_space . '[\]()*\\\;]|^)(' . implode('|', $searchParts) . ')(?=[^[:alpha:]0-9]|$)~e' . ($context['utf8'] ? 'u' : ''); echo $smileyPregSearch; print_r($smileyPregReplacements); exit(); Generally you want an exit(); after your debug output, this is so it is easier to find the output in the browser. also, make sure you view the output in the "source code" of the browser page. Good luck.
  19. Want to learn OOP? Currently Learning OOP but finding it difficult? I'm looking for anyone who is starting out with OOP to bounce ideas with, I've been a member here for a while now helping people out (and learning ofc ), but now I need more one to one conversation to turbo charge my ideas. Basically if you want to learn PHP OOP/OOD, or are currently learning it, or think a PHP Buddy to bounce ideas off and get help etc with would be helpful to you, then please drop a line. I think anyone who wants to learn OOP would appreciate something like this as certain mis-conceptions can be caught before they become habits or bad practices. Also having a hard time understanding certain concepts, you can get a different view of the concept and get a better idea of it as a whole. Thanks for taking a look .
  20. You might want to try something like this: http://www.ozhiker.com/electronics/pjmt/index.html
  21. Check your memory_limit in your php.ini. If it's a hosted server, then you might not be able to change it, especially if it's a free host. Impose a maximum filesize and make them do the bulk of the resizing, even paint can resize images (albeit bad quality), but many free apps can do it easily. If you really want that functionality you will need to use ini_set: ini_set("memory_limit", "30M"); // Should be, I would say, 10% larger than the max file size you want users to upload. You can use ini_get to see what the memory limit is atm, i am guessing yours is at 8MB echo(ini_get("memory_limit")); You can also use HTACCESS files or edit the php.ini directly but i highly discourage this as it will use memory that it probably wont need 99% of the time.
  22. Ok this is a "Recursive Function". You design your loop so that everytime it is called it does the same thing, for every element or any data its acting on. Ideally, at the end, you get the modified data you wanted, in a single variable, but something this is not exactly what you want. You should never really need that "parent instance" check, so I would reccomend you post the appropriate code needed to know what your trying to do. Anyway your requested solution would be to: Set a GLOBAL VARIABLE (Before you run you loop) (this can be a CLASS PROPERTY if the method your talking about is in a class.). The first thing the loop does is check if the GLOBAL VARIABLE has a certain value. If it has TRUE (for example), it is the first run, therefor, change it to FALSE, and run the "first loop" code. Otherwise, run the "recursive loop" code. GLOBAL $firstrun = TRUE; function test($x){ // So the loop actually ends.. if($x >= 100){ break; } // if($firstrun == TRUE){ echo "FIRST RUN $x<br />"; $x++; return test($x); }else{ echo "NEXT RUN $x<br />"; $x++; return test($x); } } echo(" <br /> Last Run: ".test(1);
  23. Sleeper is correct, and also spotted something i missed on my "scan" . - Make sure you count your quotes and braces through the string properly, ie, it would be counted as such: nothing 1 brace (we MUST find a right brace now) 1 dbl quote + brace (we MUST find another double quote BEFORE we find another brace now) 1 dbl quote + 2 braces (now we MUST find a right brace BEFORE another double quote) 1 dbl quote + brace (We found a right brace so we forget about those pair of braces) 1 dbl quote + 2 braces 1 brace (note, we lost the dbl quotes too early, also note, we dont go any further, ie, we dont lose this brace to get "nothing" again, so we need to add another right brace.) Just wondering if you actually coded this ? Anyway, the Regex (Regular Expression) that you need to change to I will explain: Regex uses certain symbols/characters in the pattern to determine what to look out for and sometimes what to do when it does find something. #[^A-Za-z0-9]#i Your Regex Basically states this: "Find one character from anwhere in the SUBJECT where it is NOT ( ^ ) any of these character ranges... (a-z0-9)" Also the "i" at the ends basically means you dont need to A-Za-z, you just need a-z as "i" turns the character matches as case-insensitive. Basically the opposite of what you want. You want something like: "From the Start of the string( ^ ) to the End of the string ( $ ), Match Any of these character ranges (a-z0-9) that have a a length of between 3 and 16 ( {3,16})" #^[a-z0-9]{3,16}$#i <?php // Test Strings $test1 = "some user name"; // 14 chars OK. SPACE characters make it INVALID $test2 = "someusernamethathastoomanycharacters"; // all Valid except too many characters $test3 = "somevaliduser"; // A valid username in every way # ORIGINAL REGEX // Test 1 var_dump(preg_match("#[^A-Za-z0-9]#i", $test1)); // VALID (Spaces make it valid) echo("<br />"); // Test 2 var_dump(preg_match("#[^A-Za-z0-9]#i", $test2)); // INVALID (Doesn't contain matching characters) echo("<br />"); // Test 3 var_dump(preg_match("#[^A-Za-z0-9]#i", $test3)); // INVALID (Doesn't contain matching characters) echo("<br />"); # TARGET REGEX // Test 4 var_dump(preg_match("#^[a-z0-9]{3,16}$#i", $test1)); // INVALID (Contains invalid space) echo("<br />"); // Test 5 var_dump(preg_match("#^[a-z0-9]{3,16}$#i", $test2)); // INVALID (Too Long) echo("<br />"); // Test 6 var_dump(preg_match("#^[a-z0-9]{3,16}$#i", $test3)); // VALID Pattern Matches the WHOLE string ?>
  24. A) Not the reason, but all your preg_match functions are completely vulnerable to nijection as they only check for the "first character" and only if its one character long, it does not validate the length, or any other characters past the first character. B) You have an error in your SQL syntax, check the braces... To fix your preg_match add a $ symbol to denote END OF SUBJECT at the end of your pattern before the ending delimeter. To fix your sql query add the missing closing brace.
  25. You have solved your own problem in your post. just change the url in the action attribute of the form tag element to what you need.
×
×
  • 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.