premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
Just to rub it in, I pwnt you Maq.
-
Two things I am seeing, the first is smart quotes in the default fields. Not sure if this is the problem. The second is an int(20). From what I recall, 11 is the max int size. I do not know if that would cause the error or not, but if you need it to be 20 slots, use BIGINT. http://dev.mysql.com/doc/refman/5.0/en/integer-types.html Do that and change those smart quotes and it should work: CREATE TABLE IF NOT EXISTS `users` ( `id` int(11) NOT NULL auto_increment, `username` varchar(32) NOT NULL, `password` varchar(32) NOT NULL, `online` bigint NOT NULL default '0', `email` varchar(100) NOT NULL, `active` tinyint(1) NOT NULL default '0', `rtime` bigint NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; See how that goes.
-
Hard to say without the actual cronjob setup or any code. If the cron is something like: lynx --dump "http://yoursite.com/phppage.php" It should work, if it is not preceded with the http, that would be a problem. The other potential issue, is if the site is using session / cookies, lynx may be asking for permission for those cookies. You may be better off with wget or curl for the processing in that case.
-
Write up a contract that states the design is not to be used elsewhere and if it is found to be in use elsewhere that he agrees of a $10,000 fine per instance it is used, get it noterized on his end, have him fax or scan it in with signature and all should be well. But given that, all he would really have to do is make a few minor changes to the code, but it may hold up in court if you decide to pursue it that way.
-
I would agree with Josh on most points. But the commenting part on variables etc. I do have issues with, but as he stated that in the real world, you do what your boss tells you, and if you never got the clarification from him, that is your mistake, never the bosses. As far as how I comment, I tend to lapse in the middle of code and more or less do the comments the PHPDoc style. Having a clear path of what the function should do, and where it should go is a great way to start it. From my professors in College, they always told me that you should not have to comment "common sense" code, but more or less tricky code. I got marked down for over commenting, and after they clarified that, I never got mark downs for that again. So if you take another Programming class, ask that question the first day, "What are your coding guidelines?" and ask if you can have a print out of their guidelines. In that way you will be covered for something like this as long as you follow it. If they say they do not have any, ask for that in writing too, the best way not to get screwed over is having it in writing one way or the other. I would get that from him, if possible, and bring up the argument that "if there is no clear route for me to follow, how can I follow it?" argument.
-
if(document.getElementById('yes').checked==true) { document.getElementById('cliente_isclientOf').disabled=false; document.getElementById('cliente_isdistributor').disabled=false; }
-
Seems like your MySQL server is offline. That or the MySQL connection is never made in your code.
-
How do I make an array global to use in multiple functions?
premiso replied to simboski19's topic in PHP Coding Help
I don't think I would have pointed it out otherwise, but who knows. Give it a shot. -
How do I make an array global to use in multiple functions?
premiso replied to simboski19's topic in PHP Coding Help
You can use the $_GLOBALS $_GLOBALS['yourarray'] = array('test'); function myFunc() { $array = $_GLOBALS['yourarray']; } There are better ways to do it, however, such as passing it as a parameter: $array = array('test'); myFunc($array); function myFunc($array) { print_r($array); } But there you have it. -
It really depends on the router, but yea, most routers have that capability. Given it came with his ADSL, I just assumed that it would be something basic, unique to the company and very limited on what you can do with it.
-
A switch does not care about the DHCP at all. It just acts as a splitter, as long as it is truly a switch and not a router. You just plug in the connection from the wall into the switch then plug in both laptops to the switch as well and it will work fine. If you have a router, go buy a switch and it should work.
-
I would say trying is just wasting your time. Perhaps a better way of doing it is available. Mind explaining what the security_code does and why you do not want people to be able to copy it?
-
<form name="form1" method="post" action=""><SELECT NAME="person"> <OPTION VALUE=0>Choose <?=$options?> </SELECT> <input type="submit" value="Submit" name="submit" /> </form>
-
I do not know many people who would be willing to help unless you have consent of the owner of leagueoflegends.com.
-
Not really what I was getting at, they can have a small footprint, but most of the time you are cloning the whole repository of a framework and tend to have all those files. You can remove them, but most people don't. More or less what I was getting at.
-
You should turn on ad-blocker and it won't show up anymore
-
How large is "larger"? Take a look at: set_time_limit, if it is your server side php doing it, that should solve it.
-
A framework provides streamlined code, in most cases, for common functions etc. So you don't have to "re-invent" the wheel so to speak and have modules type systems to make it easily plugin. Like for instance, Zend Framework has a Doctrine library that is already built to integrate it with Doctrine, so you just have to include that library class for it to work. It also has validation library, mail library, form library, etc. And yes, it is basically including the libraries that you want to use, and it more or less can streamline it. Once you learn a framework they are dead useful, but they are not for every project, as frameworks tend to be heavy,
-
Oh gotcha, check out wordwrap.
-
It all depends on the project, and your preference. A framework can be good with multiple developers as the documentation and consistency with coding, etc can be a benefit. Especially with opensource software, as anyone can look up on it. With your framework, you would have to take the time to document it, and although you know it well, no one else would, and if you decided to give up on a project that has a bit of people on it, they would be at a loss for the most part. If it was using a framework that is known, well people could easily look up items online in their forums etc for more information about it. There are other reasons, but it is more or less down to your personal decision and perhaps the client you are working for.
-
<?php echo nl2br($contribution_description); ?> nl2br is what you are looking for.
-
the m tag is used for referencing php functions. Put either code or php around your top section.
-
The modified code: if($_POST["stripHTML"] == 'true'){ $messageBody = strip_tags($messageBody); $messageBody = myStripSlashes($messageBody); } function myStripSlashes($data) { if (get_magic_quotes_gpc()) return stripslashes($data); return $data; } As far as subsequent form submissions, no that is not what I am saying at all. What I am saying is that if someone upgrades your server to PHP 5.2 > magic_quotes is turned off by default. And as such your stripslashes, still stripslashes (unless you add the check in like my function does) on the data. So say you had something like: The message is bob / sally are the culprits With magic quotes on that turns into: The message is bob // sally are the culprits as it escapes any characters that could break the database / cause injection (but it is better to use the database's escaping function which is why magic_quotes is depreciated). Now say in a year, the server gets upgraded and magic_quotes is no longer an available option (since it is depreciated) your code now takes the original message (with the single slash) and removes the slashes which becomes: The message is bob sally are the culprits Which is not a desired effect. So adding in the check to see if magic_quotes are on, and only striping slashes from the data if it is on, will avoid this potential issue later down the line. This has nothing to do with the send mail or subsequent requests. It is strictly a PHP issue. Read up on magic_quotes and stripslashes to get a better understanding what each does. That is why there is a manual, so you can read and understand, not just randomly guess what is going on.
-
Just be cautious with the stripslashes as if magic_quotes gets disabled, it will cause slashes to be removed that should not be. You should implement a get_magic_quotes_gpc check first, if that is true, run the stripslashes, if it is false don't run it. Can even be added to a function to make it easier: function myStripSlashes($data) { if (get_magic_quotes_gpc()) return stripslashes($data); return $data; } Would be suitable and not break the code incase of a change in the php.ini file later down the line.