sKunKbad
Members-
Posts
1,832 -
Joined
-
Last visited
-
Days Won
3
Everything posted by sKunKbad
-
What kind of router are you using? Are you using controllers? I guess I don't see why the rewrite rules are a good choice for doing what you are doing.
-
I believe you need to echo your response, not return it. Also, your Ajax should probably declare a data type, and add result to the call to console.log.
-
How about: $newpost = str_replace("<p>", "<div contenteditable=\"true\"><p data-contenteditable >", $post);
-
I think if you're serious about the framework, you're going to need to at least get it to alpha or beta, and at least put up some sort of documentation so people can have an idea of why they would want to use it. I browsed the files, and it didn't look like you had almost anything. I want to ask you a some questions. 1) What inspired you to start this framework? 2) What frameworks have you used? 3) What frameworks do you feel you have mastered? 4) Why would somebody be interested in your framework vs the others?
-
The .htaccess file is just another text file. You would modify it with standard PHP file editing. Take a look at the documentation on php.net.
-
I'd say there's room to improve there. For instance, if you can detect that somebody is hitting your login form beyond a reasonable number of attempts, you should block them at the server level. If they just exceeded X number of login attempts, you can lock them out for 10 or 20 minutes, but locking somebody out doesn't mean that they won't keep hammering on your login. Another thing I'd do is put the session ID in the database, then match it on requests after login. On logout delete the session ID. You might do the same for session expiration.
-
Maybe you should propose a repository? What keeps you from working locally, an IT department? It must be damn tedious to not work on a local box. I hope you're getting paid by the hour.
-
GC doesn't always run, that's why there is a probability. Try setting probability higher. I think you are playing with the wrong setting though. I don't use symfony, but you should probably be setting a session expire time, not the GC.
-
codeigniter - layout manager - function not loading array
sKunKbad replied to ricky spires's topic in Frameworks
Your add includes method is adding to file_includes, but it should be includes! because that's the name of your class member. -
Barand, thanks for the link. I watched the first 8 videos, and having never heard of such things, found it very interesting. I only stopped watching because I had to go to bed, but plan on watching the rest of the videos today.
-
How to manage databases with groups of somewhat related items
sKunKbad replied to CrimpJiggler's topic in MySQL Help
I think I would have separate tables for plants, compounds, etc, and then have a cross referencing table. So for instance if you have plant #1, and it is related to compound #12, you would have a reference in the cross reference table: a_type = plant a_id = 1 b_type = compound b_id = 12 You would end up with multiple rows if plant #1 had a few compounds, but this would make it easy to do cross references because if you query the cross reference table you can see that plant 1 is related to compound 12 ( or compound 12 is related to plant 1 ). Maybe somebody else has a better idea, but your original proposed solution seems like it is messy to me. -
I'm using the current version of MySQL. I'm working on the planning stages for a proprietary e-commerce section of my website, and would like cart (basket) data to be stored in the database. The site visitor would be given a cookie that would reference the cart_id. I was thinking to serialize the cart data in a text field. Before I put too much time into this approach, I'd like to ask for input from phpfreaks members. Here is the carts table: CREATE TABLE IF NOT EXISTS `carts` ( `cart_id` varchar(40) NOT NULL COMMENT 'matches identifier in cookie', `user_id` int(10) unsigned DEFAULT NULL, `cart_data` text NOT NULL COMMENT 'serialized data', `created_at` datetime DEFAULT CURRENT_TIMESTAMP, `modified_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`cart_id`), FOREIGN KEY (`user_id`) REFERENCES `users`(`user_id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; You will probably see that the user_id column is set to NULL by default. The idea would be that a site visitor may not be logged in while shopping, but the user_id could be applied once they do log in. I guess my main concern would be the serialization of the cart data. This would usually just include a simple array of product IDs, quantities, options, etc.
-
Which frameworks would you recommend to start with
sKunKbad replied to CrimpJiggler's topic in Frameworks
You're probably going to find that you will eventually try most of the popular frameworks. I normally do this on holidays or when I'm bored. I find that there are some things to love and hate about most frameworks. That said, I think you are going to find that a lot of people want you to code their way, so they will say try framework foo or framework bar. You just need to do some investigation and start using the one that feels the best to you. -
If you want to get rid of records that have not been activated, then just use a DELETE query, like this: DELETE FROM the_table WHERE activated IS NULL You could of course customize that as needed, but whatever this prune feature is, you don't need it.
-
Pimple container -vs- defined constant for SITEPATH etc...
sKunKbad replied to Firemankurt's topic in PHP Coding Help
When you define a constant it is global in scope, so keep that in mind. The container is only accessible when you pass it or call it, but constants are available everywhere. Aside from those points, I would just say to do what feels more organized for you application. -
I use Pimple in my own custom framework. It's awesome, and I don't need anything else. I looked at Auryn, and it just looked overly complicated, or perhaps the documentation was just poorly written. (Maybe a little of both.) As I was reading, I noticed that the author of Auryn certainly likes to tell people how to code, and while in general there's nothing wrong with that, it was almost offensive, and a condescending tone to be sure.
-
Errors when PHP creates MySQL stored procedure on new server
sKunKbad replied to sKunKbad's topic in Applications
No, but the business paid for it, and I liked it after checking out the trial version. I don't know about MySQL workbench, but SQLyog's schema sync is pretty awesome. That alone was worth the price. Oh, and I got 50% off because they are running a special until the end of the year. I got the Ultimate version plus an extra year of upgrades/updates for $134 USD. -
Errors when PHP creates MySQL stored procedure on new server
sKunKbad replied to sKunKbad's topic in Applications
I learned the real reason for the odd behavior. It has to do with cpanel, the MySQL user used by PHP, and the MySQL user used by phpMyAdmin (which is the cpanel account user). If you search for "MySQL Definer", and how this effects stored procedures, then you will see that stored procedures have special privileges. The privileges are based on the Definer, which is a combination of the user name and the domain or IP that the user created the procedure with. Since the cpanel user name isn't the same as the user name used by PHP to create the procedure, the cpanel user will have no access to the procedure, which includes viewing, altering, or exporting. The reason why there is this restriction is that the procedures are stored in the MySQL `proc` table, and MySQL creates a special privilege on-the-fly when the procedure is created. The MySQL user only have access to this procedure because of the Definer. It seems to me that this is kind of a pain in the ass. I don't really understand why the stored procedure can't be attached to the actual database, but perhaps procedures need to be able to query on multiple databases. Anyways, that's the real answer. To get around this issue, I have to tunnel in as the original user via SSH. So I bought SQLyog, which makes this super simple. -
Errors when PHP creates MySQL stored procedure on new server
sKunKbad replied to sKunKbad's topic in Applications
Yes, I can execute the CALL statement through the SQL tab, but when I go to view/edit the stored procedure, even through phpMyAdmin's ROUTINES table, the definition and params are empty. If I CREATE the stored procedure in the SQL tab, then I can view/edit it, but that sort of defeats the purpose of the PHP installer. Another thing that isn't very nice is that the stored procedures don't show up in an SQL export. Something is definitely wrong. -
Errors when PHP creates MySQL stored procedure on new server
sKunKbad replied to sKunKbad's topic in Applications
It would appear that this is a bug in phpMyAdmin, which is what I've been using to check the stored procedure after it is installed. After running your code, the CALL to greeting() does display the time, however the stored procedure appears blank inside phpMyAdmin. I appreciate your time. I guess I'm off to the phpMyAdmin forum to figure out what is going on. Thanks again. -
Errors when PHP creates MySQL stored procedure on new server
sKunKbad replied to sKunKbad's topic in Applications
I'm not trying to CALL the procedure, only CREATE it. There is no such statement when CALL and CREATE would be used at the same time, according to the link you provided. I've got some ideas of other things to try, but it is strange that this code has been working until we moved to the new server. -
Errors when PHP creates MySQL stored procedure on new server
sKunKbad posted a topic in Applications
I've got a script that allows us to setup our database, add some testing data, and install some stored procedures. This script worked on the last couple of servers we were on. It's kind of important to not force a real human to install the stored procedures, because experience shows that confusion regarding the install can happen. Details of new database server: Server: Localhost via UNIX socket Server type: MySQL Server version: 5.1.52-cll - MySQL Community Server (GPL) Protocol version: 10 Details of new server: cpsrvd 11.40.1.7 Database client version: libmysql - 5.0.96 PHP extension: mysqli PHP version 5.4.22 <?php // Fake stored procedure $sql = ' DROP PROCEDURE IF EXISTS fake_stored_procedure; CREATE PROCEDURE `fake_stored_procedure`(x float,y float, z int) BEGIN // ... bunch of sql ... END '; $this->mysqli->multi_query( $sql ); do { $this->mysqli->next_result(); } while( $this->mysqli->more_results() ); if( $this->mysqli->errno ) { die( $this->mysqli->error ); } When going to phpMyAdmin after an install, the stored procedures have been created, but the definition and parameters are missing, as well as the definer. If I install the stored procedures manually through phpMyAdmin, then everything appears normal. It seems like a PHP issue, but I get no errors during the installation. Any advice or help is appreciated. -
Convert a cURL cookie into a valid Opera cookie?
sKunKbad replied to ionicle's topic in PHP Coding Help
Have you tried using setcookie ? I don't think you are going to find a way to do it automatically, but whatever data is in the cURL cookie, just pass it along to setcookie. -
I want to make a good impression to my client - Need Help!
sKunKbad replied to markjans's topic in Website Critique
If you want to be impressive, you have to code impressive. For starters, you should consider responsive web design. Google it if you don't know what that is. -
Maybe a temp uploads table is needed, or a field in the current table that allows for serialized data to represent what is uploaded. There are lots of security issues for uploads, so I recommend checking out how some popular frameworks are handling them.