PHP - Removing Something Specific From An Array?
Hey guys.
How do you remove a specific element from an array? Lets say I have a string like this: $list = "guy,girl,boy,man,woman,lady"; Then I use explode to break it up into an array by commas: $listArray = explode(",",$list); Now $listArray contains everything. Now if I wanted to delete something specific from that array, how would I do that? So for example, I want to delete "man" out of the array. How do I do that without know its key? Similar TutorialsHi all, I have an array of data. I am looping through this data to generate a CSV file. However, if there are commas in any of the elements then this will throw out the structure of the CSV file. My question is, how do I loop through the array before I use it to strip out any commas and replace with a space? Thanks for your help. I have the following array structu Code: [Select] [0] => Array ( [id] => Array ( [$t] => http://www.google.com/mate/ ) [updated] => Array ( [$t] => 2011-08-31T11:43:05.942Z ) [category] => Array ( [0] => Array ( [scheme] => http://schemas.google.com/g/ [term] => http://schemas.google.com/contact/ ) ) [title] => Array ( [type] => text [$t] => Name ) [link] => Array ( [0] => Array ( [rel] => http://schemas.google.com/contacts/2008/rel#edit-photo [type] => image/* [href] => https://www.google.com/mate/feeds/photos/media/ ) [1] => Array ( [rel] => self [type] => application/atom+xml [href] => https://www.google.com/mate/feeds/contacts ) [2] => Array ( [rel] => edit [type] => application/atom+xml [href] => https://www.google.com/mate/feeds/ ) ) [gd$email] => Array ( [0] => Array ( [rel] => http://schemas.google.com/g/2005#other [address] => email_address@gmail.com [primary] => true ) ) ) I am tried to display name and email address. I am using following method, can anyone tell me is there any better way? Thank u 4u help. NAME $name=( $emp_det[0]['title'][t]); $email =( $emp_det[0]['gdemail'][0][address]); I used DOM to parse data from html, then I made the data go into an array. the array now looks like Array([0]->street[1]->city, st, zip[2]->phone[3]->fax) and it is quite a long array. The problem is that when there is no fax number on the html, it doesnt show the fax on the array, so when I am trying to loop through this in a table it is throwing off my cells. Is there a way to delete all entries in an array that include Fax:* ? Is there a way to exclude all nodes that have Fax* using DOM? My current DOM looks like... Code: [Select] $address = $xpath->query('//td[@id="addressText"]'); So Im building this little link scraper. The problem I am having is when it outputs the links that are in the array its got duplicate elements. I'm trying to erase the dupes and only show unique values. I've tryed array_unique() with out success as well as in_array(). Any help would be appreciated! //PAGE WE ARE GETTING LINKS ON $diags = str_get_html(getDiagramLinks($html)); //GET THE DIAGRAM LINKS TO PAGES INTO ARRAY foreach($diags->find('a') as $f) { $diagLinks[] = $f->href; } //iterate through the array for($i=0; $i<sizeof($diagLinks); $i++) { //ignore if blank element if(trim($diagLinks[$i]) !== ' ') { echo $diagLinks[$i]. '<br>'; } } The Output: Code: [Select] /partsearch/model.aspx?diagram_id=110375 /partsearch/model.aspx?diagram_id=110375 /partsearch/model.aspx?diagram_id=110376 /partsearch/model.aspx?diagram_id=110376 /partsearch/model.aspx?diagram_id=110377 /partsearch/model.aspx?diagram_id=110377 /partsearch/model.aspx?diagram_id=110378 /partsearch/model.aspx?diagram_id=110378 /partsearch/model.aspx?diagram_id=110379 /partsearch/model.aspx?diagram_id=110379 /partsearch/model.aspx?diagram_id=110380 /partsearch/model.aspx?diagram_id=110380 Hello, I have two arrays: $questions, which has 'question_id' as one of its keys and $assignment_questions which is a subset of $questions, pulled off my database. Using php, I'd like to construct a 3rd array which takes my $questions array and removes from it any question that has a question_id which can be found in both $questions and $assignment_questions, in addition to the other values associated with a particular question_id. For example, $questions has: question_id, solution, author (and other keys). Is there any way to check if a particular key matches and then zap out all of the corresponding fields (solution, author, etc.)? Thanks! Hello I'm trying to remove null ou 0 values from my array but i can't get it to work properly This is my array
Array ( [0] => Array ( [0] => 2020-09-21 [1] => 3 ) [1] => Array ( [0] => 2020-09-23 [1] => 2 ) [2] => Array ( [0] => 2020-09-28 [1] => 3 ) [3] => Array ( [0] => 2020-09-30 [1] => 2 ) [4] => Array ( [0] => 2020-10-07 [1] => 2 ) [5] => Array ( [0] => 2020-10-12 [1] => 3 ) [6] => Array ( [0] => 2020-10-14 [1] => 2 ) [7] => Array ( [0] => 2020-10-19 [1] => 3 ) [8] => Array ( [0] => 2020-10-21 [1] => 2 ) [9] => Array ( [0] => 2020-10-26 [1] => 3 ) [10] => Array ( [0] => 2020-10-28 [1] => 2 ) [11] => Array ( [0] => 2020-11-02 [1] => 3 ) [12] => Array ( [0] => 2020-11-04 [1] => 2 ) [13] => Array ( [0] => 2020-11-09 [1] => 3 ) [14] => Array ( [0] => 2020-11-11 [1] => 2 ) [15] => Array ( [0] => 2020-11-16 [1] => 3 ) [16] => Array ( [0] => 2020-11-18 [1] => 2 ) [17] => Array ( [0] => 2020-11-23 [1] => 3 ) [18] => Array ( [0] => 2020-11-25 [1] => 2 ) [19] => Array ( [0] => 2020-11-30 [1] => 3 ) [20] => Array ( [0] => 2020-12-02 [1] => 2 ) [21] => Array ( [0] => 2020-12-07 [1] => 3 ) [22] => Array ( [0] => 2020-12-09 [1] => 2 ) [23] => Array ( [0] => 2020-12-14 [1] => 3 ) [24] => Array ( [0] => 2020-12-16 [1] => 2 ) [25] => Array ( [0] => 2021-01-04 [1] => 3 ) [26] => Array ( [0] => 2021-01-06 [1] => 2 ) [27] => Array ( [0] => 2021-01-11 [1] => 3 ) [28] => Array ( [0] => 2021-01-13 [1] => 2 ) [29] => Array ( [0] => 2021-01-18 [1] => 3 ) [30] => Array ( [0] => 2021-01-20 [1] => 2 ) [31] => Array ( [0] => 2021-01-25 [1] => 3 ) [32] => Array ( [0] => 2021-01-27 [1] => 2 ) [33] => Array ( [0] => 2021-02-01 [1] => 3 ) [34] => Array ( [0] => 2021-02-03 [1] => 2 ) [35] => Array ( [0] => 2021-02-08 [1] => 3 ) [36] => Array ( [0] => 2021-02-10 [1] => 2 ) [37] => Array ( [0] => 2021-02-17 [1] => 2 ) [38] => Array ( [0] => 2021-02-22 [1] => 3 ) [39] => Array ( [0] => 2021-02-24 [1] => 2 ) [40] => Array ( [0] => 2021-03-01 [1] => 3 ) [41] => Array ( [0] => 2021-03-03 [1] => 2 ) [42] => Array ( [0] => 2021-03-08 [1] => 3 ) [43] => Array ( [0] => 2021-03-10 [1] => 2 ) [44] => Array ( [0] => 2021-03-15 [1] => 3 ) [45] => Array ( [0] => 2021-03-17 [1] => 2 ) [46] => Array ( [0] => 2021-03-22 [1] => 3 ) [47] => Array ( [0] => 2021-03-24 [1] => 2 ) [48] => Array ( [0] => 2021-04-05 [1] => 3 ) [49] => Array ( [0] => 2021-04-07 [1] => 2 ) [50] => Array ( [0] => 2021-04-12 [1] => 3 ) [51] => Array ( [0] => 2021-04-14 [1] => 2 ) [52] => Array ( [0] => 2021-04-19 [1] => 3 ) [53] => Array ( [0] => 2021-04-21 [1] => 2 ) [54] => Array ( [0] => 2021-04-26 [1] => 3 ) [55] => Array ( [0] => 2021-04-28 [1] => 2 ) [56] => Array ( [0] => 2021-05-03 [1] => 3 ) [57] => Array ( [0] => 2021-05-05 [1] => 2 ) [58] => Array ( [0] => 2021-05-10 [1] => 3 ) [59] => Array ( [0] => 2021-05-12 [1] => 0 ) [60] => Array ( [0] => 2021-05-17 [1] => 3 ) [61] => Array ( [0] => 2021-05-19 [1] => 0 ) [62] => Array ( [0] => 2021-05-24 [1] => 3 ) [63] => Array ( [0] => 2021-05-26 [1] => 0 ) [64] => Array ( [0] => 2021-05-31 [1] => 3 ) [65] => Array ( [0] => 2021-06-02 [1] => 0 ) [66] => Array ( [0] => 2021-06-07 [1] => 3 ) [67] => Array ( [0] => 2021-06-09 [1] => 0 ) [68] => Array ( [0] => 2021-06-14 [1] => 1 ) [69] => Array ( [0] => 2021-06-16 [1] => 0 ) [70] => Array ( [0] => 2021-06-21 [1] => 0 ) [71] => Array ( [0] => 2021-06-23 [1] => 0 ) [72] => Array ( [0] => 2021-06-28 [1] => 0 ) [73] => Array ( [0] => 2021-06-30 [1] => 0 ) ) And i'm using this code to remove but no success print_r(array_values(array_filter($cronograma)));
Any help please
Thanks I dont even know where to begin doing this. I am supposed to remove duplicate entries in this 2 dimensional array but I just can't find any answers anywhere. Code: [Select] <?php /* In the following two dimensional array (an array of arrays) you will notice that there are several duplicate entries (David and Patricia). 1) Write a basic function which will go through $input and remove the duplicate entries. A "duplicate" is an entry which has the same FirstName and LastName as another entry. Ignore the other fields. Call your function "dedupe1". It should return a two-dimensional array without these duplicates 2) Using your dedupe1 function, write one called dedupe2 which will detect empty DOB's and DOB's of '00/00/0000'. When an empty or zeroed DOB is detected, your code should use the entry with a complete DOB (if available). Like dedupe1 your code should return a two-dimensional array without duplicates. If you use the provided $input function, all of the returned entries should have a complete DOB listed. */ $input = array( array( 'FirstName' => 'Daniel', 'LastName' => 'Anderson', 'Phone' => '614-123-4568', 'Address' => '123 Main St', 'SSN' => '001-01-0001', 'DOB' => '01/11/1922' ), array( 'FirstName' => 'Aaron', 'LastName' => 'Williams', 'Phone' => '937-321-3993', 'Address' => '933 N Park St', 'SSN' => '992-23-1192', 'DOB' => '04/21/1965' ), array( 'FirstName' => 'David', 'LastName' => 'Taylor', 'Phone' => '223-293-9921', 'Address' => '123 Main St', 'SSN' => '003-19-2992', 'DOB' => '12/14/1995' ), array( 'FirstName' => 'Patricia', 'LastName' => 'Anderson', 'Phone' => '614-123-4568', 'Address' => '123 Main St', 'SSN' => '123-32-3123', 'DOB' => '00/00/0000' ), array( 'FirstName' => 'David', 'LastName' => 'Taylor', 'Phone' => '223-293-9921', 'Address' => '123 Main St', 'SSN' => '003-19-2992', 'DOB' => '' ), array( 'FirstName' => 'Patricia', 'LastName' => 'Anderson', 'Phone' => '614-123-4568', 'Address' => '123 Main St', 'SSN' => '123-32-3123', 'DOB' => '02/22/1957' ), ); // Get results from dedupe1 and print them $result1 = dedupe1($input); var_dump($result1); // Get results from dedupe2 and print them $result2 = dedupe2($input); var_dump($result2); print_r($input);//just to see the information in the web page function dedupe1($in_array) { // your code here } function dedupe2($in_array) { // your code here } ?> Hi I have a multi-dimension session array as per the below: $_SESSION['myarray'][][] If for example there are several elements stored in the array: $_SESSION['myarray'][0][0] = "aaa"; $_SESSION['myarray'][0][1] = "111"; $_SESSION['myarray'][1][0] = "bbb"; $_SESSION['myarray'][1][1] = "222"; $_SESSION['myarray'][2][0] = "ccc"; $_SESSION['myarray'][2][1] = "333"; $_SESSION['myarray'][2][0] = "ddd"; $_SESSION['myarray'][2][1] = "444"; How can i remove one of the above and shunt the other elements up? I have tried using the unset command but this seems to essentailly nullify the desired values where as what i would like to do is remove them completly from the array and then shorten the total number of records stored in the array. Thanks for taking the time to read this. Well, In my DB i have user items as follows: Code: [Select] 13,12,11,9,27,15,16,22,21,23,24,26,29,30,31,32,33 Each ID is a user item that has been imploded to be sent to the DB. Well, I', trying to take them out of the DB now, and I'm having a small problem turning them back into integers. Here's what I've done. Code: [Select] $items = explode(",", $row['user_item_id']);So I get: Code: [Select] 0 => string '13' (length=2) 1 => string '12' (length=2) 2 => string '11' (length=2) 3 => string '9' (length=1) 4 => string '27' (length=2) 5 => string '15' (length=2) 6 => string '16' (length=2) 7 => string '22' (length=2) 8 => string '21' (length=2) 9 => string '23' (length=2) 10 => string '24' (length=2) 11 => string '26' (length=2) 12 => string '29' (length=2) 13 => string '30' (length=2) 14 => string '31' (length=2) 15 => string '32' (length=2) 16 => string '33' (length=2) Then I do this: Code: [Select] foreach($items as $item){ var_dump($item); $sql = 'SELECT * FROM `MYTABLE` WHERE item_tab = '.$tab_id.' AND item_id = '.$item.' AND item_pose =0'; } and get this: Code: [Select] string '13' (length=2) string '12' (length=2) string '11' (length=2) string '9' (length=1) string '27' (length=2) string '15' (length=2) string '16' (length=2) string '22' (length=2) string '21' (length=2) string '23' (length=2) string '24' (length=2) string '26' (length=2) string '29' (length=2) string '30' (length=2) string '31' (length=2) string '32' (length=2) string '33' (length=2) Now, this works how I want it to except, I want a integer value not a string. What would be the best way to approach this? Hello all, I have a rather large array and I need to list it's contents in an alphabetical list. The array is built like this: $array['query']['row']['0']['title'] = 'Bob'; $array['query']['row']['1']['title'] = 'Andy'; $array['query']['row']['2']['title'] = 'Tom'; I need to sort it so it is in alphabetical order based on the title. Is there an easy way to do this? <?php class CsvToArray { /* global $file; $file = '../Datafeeds/baseball_all.csv'; */ public function data() { $file = '../Datafeeds/baseball_all.csv'; $fileName = fopen($file,'r+'); $all_rows = array(); $header = fgetcsv($fileName); while ($row = fgetcsv($fileName)) { $games[] = array_combine($header, $row); } //print_r($games); print_r($games[64]["Home Team"]); } } $game = new CsvToArray(); $game->data(); ?> csv: https://anonymousfiles.io/vSubWgPY/ How can I get specific array values outside a class or function? About to try "File put contents" I think. That should work right? So I thought the last couple times. Or what would you suggest?. Overwritten previous attempts to share =[
Next up is seeing if I can change $file to $var to change it from other locations. Should be easy I reckon. Edited April 19 by MinzerHi all, I would like to ask you if somebody could have a better idea to build this function. The current one is working, but I feel this built a bit in an amateur manner. Feel free to add your ideas so we can learn more about PHP and how to deal with arrays.
I have an array: $arrayVideoSpecs = Array( Array( 'aspect' => '4:3', 'density' => '442368', 'resolution' => '768x576' ), Array( 'aspect' => '4:3', 'density' => '307200', 'resolution' => '640x480' ), Array( 'aspect' => '16:9', 'density' => '2073600', 'resolution' => '1920x1080' ), Array( 'aspect' => '16:9', 'density' => '121600', 'resolution' => '1280x720' ) );
and I want an array as output grouped by video aspect ratio where the key is the pixel density and the value is the video resolution, namely like that for aspect ratio 16:9 ... Array ( [2073600] => 1920x1080 [121600] => 1280x720 )
Then I coded this function which is working but seems amateur ... function groupAndExtractByAspect($array, $groupBy, $aspect, $density, $resolution) { $groupByAspect = Array(); foreach ($array as $value) { $groupByAspect[$value[$aspect]][] = Array($value[$density], $value[$resolution]); } $arrayClean = Array(); foreach ($groupByAspect as $key => $value) { if ($key == $groupBy) { $arrayClean[$key] = $value; } } foreach ($arrayClean as $aspectGroup) { $arrayOutput = Array(); for ($i = 0; $i <= count($aspectGroup); $i++) { $densityIsValid = false; $resolutionIsValid = false; if (!empty($arrayClean[$groupBy][$i][0])) { $density = $arrayClean[$groupBy][$i][0]; $densityIsValid = true; } if (!empty($arrayClean[$groupBy][$i][1])) { $resolution = $arrayClean[$groupBy][$i][1]; $resolutionIsValid = true; } if (($densityIsValid === true) && ($resolutionIsValid === true)) { $arrayOutput[$density] = $resolution; } } } return $arrayOutput; }
The usage is as follow ... $showArray = groupAndExtractByAspect($arrayVideoSpecs, '16:9', 'aspect', 'density', 'resolution'); echo '<pre>'; print_r($showArray); echo '</pre>';
Thank you very much for your ideas! Mapg Hello, i retrieve an array from the database that looks something like this: $var=a:1:{s:2:"cc";a:1:{i:22;s:11:"TESTING";}}; I need to retrieve the number corresponding to the character i: and print it(11 in the first case). For example , If, $var=a:1:{s:2:"cc";a:1:{i:15;s:11:"TESTING";}}; I would need to print 15. $var=a:1:{s:2:"cc";a:1:{i:3;s:11:"TESTING";}}; I would need to print 3. Thanks in advance. Hi guys, I am getting data from a json source: ``` $jsondata = file_get_contents($url);$response = json_decode($jsondata, true) echo "<pre>"; print_r(array_keys($response));; echo "</pre>"; ``` and this returns: ``` Array ( [0] => jsonapi [1] => data [2] => links ) ``` I want to extract data from specific key in the data array (eg 'title'): ``` [data] => Array ( [0] => Array ( [type] => recipes [id] => d6cd7643-6e44-4d26-9ed9-9da7196cef12 [attributes] => Array ( [internalId] => 7 [isPublished] => 1 [title] => Deep mediterranean quiche [createdAt] => 2019-05-07T13:34:27+0200 [updatedAt] => 2019-05-07T13:34:27+0200 [isPromoted] => 1 [path] => /recipes/deep-mediterranean-quiche [cookingTime] => 30 [difficulty] => medium [ingredients] => Array ( [0] => For the pastry: [1] => 280g plain flour [2] => 140g butter [3] => Cold water [4] => For the filling: [5] => 1 onion [6] => 2 garlic cloves [7] => Half a courgette [8] => 450ml soya milk [9] => 500g grated parmesan [10] => 2 eggs [11] => 200g sun dried tomatoes [12] => 100g feta ) [numberOfservings] => 8 [preparationTime] => 40 [instructions] => ``` How do I loop through the data array and select just the 'title' and 'difficulty' for example? Edited May 12, 2019 by ludo1960I am using session variables to keep track of what is in a shopping cart. I can add the items to the cart quite easily enough. But my problem is that I can't delete a specific item in the cart. Below is a summary of what the array looks like $Item1=array("ProdID"=>"Hat","Color"=>"Not Needed","Size"=>5); $Item4=array("ProdID"=>"Shirt","Color"=>"Green","Size"=>"L"); $Item2=array("ProdID"=>"Pants","Color"=>"Not Needed","Size"=>"32x32"); $Item3=array("ProdID"=>"Socks","Color"=>"Not Needed","Size"=>"Not Needed"); $NumItems=4; $TestArray=array("NumItems"=>$NumItems,1=>$Item1,2=>$Item2,3=>$Item3,4=>$Item4); However when I attempt to delete any of the top level elements (1,2,3,4,NumItems), I either end up deleting only the last element (4) or somehow taking out 2 of them. I know that this must be an easy fix but I've looked at it for so long that I can't seem to figure out what the problem is. below is the code that I use to delete the Item from the array Code: [Select] $ItemNum=$_GET['item']; if ($ItemNum=="All"){ $ItemNum=$_GET['item']; if ($ItemNum=="All"){ unset($TestArray); unset($TestArray['NumItems']); unset($_SESSION['OrderTotal']); //header("Location:Cart.php?act=view"); } else{ $TestArray['NumItems']=$TestArray['NumItems']-1; if($TestArray['NumItems']<1) { unset($_SESSION['OrderTotal']); unset($TestArray); unset($TestArray['NumItems']); } else { unset($TestArray[$ItemNum]); } Can anyone take a look at this and point me in the correct direction? What I am after is to delete any element of the top array and keep the rest. I need to find out how many times the "mac" key show is in an array. Code: [Select] Array ( [serial] => Robert [added] => Peter [mac] => 1232091823 [mac] => 7538572375 [mac] =>943820348239804 [place] =>home ) Hey all. another quick question. here is the output of my 2D array: Code: [Select] array(2) { ["folder.jpg"]=> array(2) { ["valid"]=> bool(true) ["error"]=> bool(false) } ["file.mp3"]=> array(2) { ["valid"]=> bool(true) ["error"]=> bool(false) } } how can i foreach my way into getting an iterator that points to the folder.jpg and file.mp3? as is now, i have something that looks like this: foreach($arr as $val){ var_dump($val) } the var_dump of $val is an *array*. Thanks for your help! I use the Wholesale Suite Premium Prices plugin with WooCommerce. I have 6 specific wholesale roles out of 15 that I wish to hide two specific shipping methods from being selected for the 6 exceptions. I'm just trying this on my staging server at this time using a code snippet example that I found and modified for my specific conditions. Would the following work for this purpose? /* Hide specific shipping methods for specific wholesale roles */ add_filter( 'woocommerce_package_rates', function( $shipping_rates ) { // User role and shipping method ID to hide for the user role $role_shipping_method_arr = array( 'ws_silvia_silver' => array( 'Silvia Premium Standard Shipping (Tracking Service)'), 'ws_silvia_silver_pst_exempt' => array( 'Silvia Premium Standard Shipping (Tracking Service)'), 'ws_silvia_silver_tax_exempt' => array( 'Silvia Premium Standard Shipping (Tracking Service)'), 'ws_silvia_silver' => array( 'Silvia Union Standard Shipping (Tracking Service)'), 'ws_silvia_silver_pst_exempt' => array( 'Silvia Union Standard Shipping (Tracking Service)'), 'ws_silvia_silver_tax_exempt' => array( 'Silvia Union Standard Shipping (Tracking Service)'), 'ws_silvia_gold' => array( 'Silvia Premium Standard Shipping (Tracking Service)'), 'ws_silvia_gold_pst_exempt' => array( 'Silvia Premium Standard Shipping (Tracking Service)'), 'ws_silvia_gold_tax_exempt' => array( 'Silvia Premium Standard Shipping (Tracking Service)'), 'ws_silvia_gold' => array( 'Silvia Union Standard Shipping (Tracking Service)'), 'ws_silvia_gold_pst_exempt' => array( 'Silvia Union Standard Shipping (Tracking Service)'), 'ws_silvia_gold_tax_exempt' => array( 'Silvia Union Standard Shipping (Tracking Service)'), ); // Getting the current user role $curr_user = wp_get_current_user(); $curr_user_data = get_userdata($current_user->ID); // Wholesale Suite Roles if (isset($current_user) && class_exists('WWP_Wholesale_Roles')) { $wwp_wholesale_roles = WWP_Wholesale_Roles::getInstance(); $wwp_wholesale_role = $wwp_wholesale_roles->getUserWholesaleRole(); // Loop through the user role and shipping method pair foreach( $role_shipping_method_arr as $role => $shipping_methods_to_hide ) { // Check if defined role exist in current user role or not if( in_array( $role, $current_user->roles) ) { // Loop through all the shipping rates foreach( $shipping_rates as $shipping_method_key => $shipping_method ) { $shipping_id = $shipping_method->get_id(); // Unset the shipping method if found if( in_array( $shipping_id, $shipping_methods_to_hide) ) { unset($shipping_rates[$shipping_method_key]); } } } } } return $shipping_rates; }); Any insights as to how to accomplish this would be greatly appreciated. Lyse Hey guys, im using UNIX time and trying to figure out how to remove the leading 0 when it shows the hour. "07:06 am" to make it read "7:06 am" manual says i need to use %i with strftime. So I guess Im suppose to be removing the zero before the date format? which is why strftime isnt working after the date function. Or is there a way to do this in the date function. $time = 1327493219; date_default_timezone_set('UTC'); $user_offset = date('h:i a M/d', $time); echo "<td>". strftime("%l",$user_offset) ."</td>"; Hy guys I try to rebuild a PTC site The thing is when the member is click on the ad, they get money after x sec. I have the code, and the question is how i can remove the top frame, but i would like to keep the money part. So when they open a link its will looks a normal link no frame no timer but they still get the monye after x second. Can i do this?? The code is he <? session_start(); /********************************************************************************************************************************************** ScriptBux Version 2.50 beta This Script has been created and coded by Gabrola and edited by hassan ahmady. If you find any bugs in the script report at support@thealternatif.info or contact hassan ahmady. Copywrite ScriptBux 2008; Please make donations if you use this sript for commercial use to My paypal account "bisnis-usd@plasa.com" ************************************************************************************************************************************************/ require('config.php'); global $c; require('data.php'); global $config; require('funciones.php'); $adse=securedata($_GET["ad"]); if(isset($_GET['example'])) { die("<body bgcolor='#FFFFFF'></body>"); } if(!$_GET['ad']) { die("<b>Error</b> - You need the advertisement ID."); } if(!isset($_COOKIE["usNick"]) && !isset($_COOKIE["usPass"])) { $sqlz = "SELECT * FROM ads WHERE ad_id='$adse'"; $resultz = mysql_query($sqlz); $myrowz = mysql_fetch_array($resultz); if(!$loggedin) { $numero=$myrowz["outside"]; $sqlex = "UPDATE ads SET outside=outside +'1' WHERE ad_id='$adse'"; $resultex = mysql_query($sqlex); } } $checkad = mysql_query("SELECT * FROM ads WHERE ad_id='$adse'"); $ad_exist = mysql_num_rows($checkad); if ($ad_exist<1) { echo "You can only click an ad once every 24 hours."; exit(); } $ad = mysql_fetch_array($checkad); ?> <html> <head> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Expires" content="-1"> <title><?=$config["title"]?></title> <script> <?php if ($r["account"]=="premium") { ?> var x = <?=$config['pro_click'] + 1; ?>; <?php } else { ?> var x = <?=$config['free_click'] + 1; ?>; <?php } ?> var y = 1; function startClock() { if (x !== 'Done') { x = x-y; document.frm.clock.value = x; setTimeout("startClock()", 1000); } if (x == 0) { x = 'Done'; document.frm.clock.value = x; var code = "<?php if($loggedin==1) { $site_code = md5(time().sha1(microtime())); } else { $site_code = "Not Login"; } $_SESSION["adcode"] = $site_code; print($site_code); ?>"; var ad= "<?=$_GET['ad']?>"; success.location.href="success.php?ad="+ad+"&code="+code+"&verify=1"; } } </script> </head> <body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0" onLoad="startClock()"> <form name="frm"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tbody> <tr> <td class="maintopright" style=" background:url(images/adloading.gif) no-repeat 150px;border-bottom: 2px solid rgb(51, 51, 51); font-family: Verdana; font-size: 13px;" width="50%"> <div class="maintopright"> <img src="images/top_small.jpg" align="middle" /> <input name="clock" size="3" readonly="readonly" style="border: medium none ; padding: 0pt; font-size: 25pt; font-family: Verdana; vertical-align: top;" type="text"> <iframe name="success" src="view.php?example" border="0" framespacing="0" marginheight="0" marginwidth="0" vspace="0" hspace="0" style="vertical-align: top;" frameborder="0" height="48" scrolling="no" width="48"></iframe> </div> </td> <td style="border-bottom: 2px solid rgb(51, 51, 51); font-family: Verdana; font-size: 13px; " align="left" valign="middle" width="50%"> <strong>Please take the time to visit the sponsor below.<br> Show your website below for only <a href="index.php?option=advertise" target="_blank">$<?=$rowz1["price"]?></a> per 100 views!</strong> </td> </tr> </tbody> </table> <iframe src="<?=$ad["ad_url"]?>" border="0" framspacing="0" marginheight="0" marginwidth="0" vspace="0" hspace="0" frameborder="0" height="100%" scrolling="yes" width="100%"></iframe> </form> </body> </html> |