Jump to content

sasori

Members
  • Posts

    332
  • Joined

  • Last visited

Everything posted by sasori

  1. so how to convert this oracle timestamp, without using any oracle function, just pure php fucntions to manipulate this oracle timestamp? like e.g 12-JAN-13 12.00.00.000000000 AM if i do echo date('F d,Y',strtotime($oracleTimeStamp)); it produces January 01,1970 and if i do echo strtotime($oracleTimeStamp); it produces nothing at all what's the proper way without using any oracle function at all, just pure php to manipulate this oracle timestamp?
  2. <PAGE_NAME> = can be one of “midlet”, “wap”, “ajax”, “touch” <ITEM_ID> = numerical entry <GIF_NAME> = arbitrary string, url <SENDER_ID> = numerical entry <RECEIVER_ID> = a numerical entry /gift.php?view=&gift_id=&sender_id=&receiver_id=RECEIVER_ID> what's the correct mod_rewrite rewrite rule to handle the request from the URL above, if the additional query string parameters must be forwarded as well?
  3. hi , how to get the prime numbers of the positive integer input and print them? here's what i have at the moment function getPrime($num){ if((int)$num == $num && (int)$num > 0){ for($i = 2; $i < $num; $i++){ for($j = 2; $j < $i; $j++){ if($i % 2 == 1){ echo $i.'<br />'; } } } } } displayPrime(10); the ouput should be 2,3,5,7 but the output apparently, is 3 5 5 5 7 7 7 7 7 9 9 9 9 9 9 9 how to solve this?
  4. this is the important thing i learned from ya It's always useful in these problems to break things down into individual queries. thanks for the reminder
  5. hi, i was given this situation SQL Test: Imagine you have a User table for a twitter-like web application that looks like this: Username, Status Update, Date Updated (eg. Ann123, "Hi, I am at Startbucks!", 01/26/12 10:00:01). Write a query that selects only the latest status update for each user. and so I created my own dummy table to test what I thought would be the answer CREATE TABLE USER( id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, username VARCHAR(50), `status` VARCHAR(50), `dateupdated` DATETIME ) ENGINE = INNODB; then I ended up with this query SELECT user.`username`, latest.status AS latest_status , user.`dateupdated` FROM USER LEFT JOIN USER AS latest ON user.`id` = latest.id ORDER BY dateupdated but it seem like it's still wrong, since I used an ID as primary key, the username can be repeated and the question scenario should only give the unique latest update for each user, "I think" ...any suggestions how to fix this problem ?
  6. ok guys, I ended up with my own function //from the class file public function displayItemViewed(){ $image = ''; $catid = ''; foreach(array_keys($_SESSION['viewed']) as $item){ $image = $this->getProductImage($item); $catid = $this->getCatByProductID($item); if(count($_SESSION['viewed']) <= 5){ echo '<li> <a alt="'.$item.'" title ="'.$catid["ProductName"].'"href="catalog-details.php?prod_id='.$item.'&cat_id='.$catid["ProductCatID"].'"><img src="module/newmodule/products/'.$image['ImageLocation'].'"></a> </li>'; } else { array_shift($_SESSION['viewed']); reset($_SESSION['viewed']); } } } //inside the you also viewed items box <ul> <?=$myCart->displayItemViewed();?> </ul> //from the product details page from where I set the session $productid = $_GET['prod_id']; if(isset($productid)){ $_SESSION["viewed"][$productid] = true; } now my problem is, whenever i run everything...my function seem to display a 0 key?, when it shouldn't that's why there are some instances where my "you also viewed items" has 1 item missing in the set of five , how to fix this ?
  7. ok, if that's the case, what if the person viewed alot of items? , i think it's uncool to paginate the data in the small box, what to do next ? or there's a better way?
  8. am currently building the cart system of a product, now there is this part wherein, the non-logged-in OR logged-in user should also be able to see the items that he/she viewed, how to do that?., am not asking for code snippets , just give me some ideas/hints/strategies/tips that may help me get the big picture on how to do this thing and proceed coding.
  9. pfft, nevermind this thread.. I found the bug..the field name of the products table is small caps...geez..
  10. it didn't helped, I did it like this <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" <?php if(empty($_SESSION['cart']) && !isset($_SESSION['cart'])){echo "onsubmit=\"return false;\"";}?>>
  11. Hi, is there something wrong with my code ? <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" <?php if(empty($_SESSION['cart'])){echo "onsubmit=\"return false;\"";} ?>> <input type="hidden" name="cmd" value="_cart" /> <input type="hidden" name="upload" value="1" /> <input type="hidden" name="business" value="<?=$ppemail['email']?>" /> <?php $i = 1; foreach($_SESSION['cart'] as $id => $qty): $product = $myCart->getProduct($id); ?> <input type="hidden" name="item_name_<?php echo $i; ?>" value="<?php echo $product['ProductName']; ?>"> <input type="hidden" name="item_number_<?php echo $i; ?>" value="<?php echo $product['ProductID']; ?>"> <input type="hidden" name="amount_<?php echo $i; ?>" value="<?php echo $product['ProductOverridePrice']; ?>"> <input type="hidden" name="quantity_<?php echo $i; ?>" value="<?php echo $qty; ?>"> <?php $i++; endforeach; ?> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="lc" value="US"> <input type="hidden" name="rm" value="2"> <input type="hidden" name="shipping_1" value="<?php echo $shipping; ?>"> <input type="hidden" name="return" value="<?php echo $the_class->settings[0]['DomainName'];?>shopping-cart-details.php"> <input type="hidden" name="cancel_return" value="<?php echo $the_class->settings[0]['DomainName'];?>"> <input type="hidden" name="notify_url" value="<?php echo $the_class->settings[0]['DomainName'];?>classes/paypal.php"> <input type="image" src="images/continue-btn.png" name="pay now" value="pay" /> while cart is not empty, I tested it locally and it worked fine.. but when I tested it on a live server, sandbox says, your cart is empty, even if it's not empty at all.. any ideas why is this happening ? :'(
  12. Hi, how to determine which country the IP is coming from ? like e.g when a visitor came to a site, I can log the ip using $_SERVER['REMOTE_ADDR'] , but that's all a combination of numbers, if let's say I want to log only the IP address coming from the US,AU,UK, or any other country that I want specifically, how to do that?
  13. ^ thanks.. but, is paypal sandbox always like that?, am coding on my local, and when i do a transaction using the sandbox, sometimes i get an array, sometimes, it's empty..why is that?..is it just me or it's with the sandbox itself ?
  14. Hi, I have this $_POST array coming from a paypal transaction Array ( [address_city] => San Jose [address_country] => United States [address_country_code] => US [address_name] => Test User [address_state] => CA [address_status] => confirmed [address_street] => 1 Main St [address_zip] => 95131 [business] => test1_biz@gmail.com [charset] => windows-1252 [custom] => [first_name] => Test [item_name1] => Product Name 1 [item_name2] => Product Name 6 [item_name3] => Product Name 8 [item_number1] => 1 [item_number2] => 6 [item_number3] => 8 [last_name] => User [mc_currency] => USD [mc_fee] => 0.82 [mc_gross] => 18.00 [mc_gross_1] => 14.00 [mc_gross_2] => 2.00 [mc_gross_3] => 2.00 [mc_handling] => 0.00 [mc_handling1] => 0.00 [mc_handling2] => 0.00 [mc_handling3] => 0.00 [mc_shipping] => 11.00 [mc_shipping1] => 11.00 [mc_shipping2] => 0.00 [mc_shipping3] => 0.00 [notify_version] => 3.4 [num_cart_items] => 3 [payer_email] => test_biz@gmail.com [payer_id] => TRCLJTHLNCJ7Q [payer_status] => verified [payment_date] => 22:52:56 Jan 27, 2012 PST [payment_fee] => 0.82 [payment_gross] => 18.00 [payment_status] => Completed [payment_type] => instant [protection_eligibility] => Eligible [quantity1] => 1 [quantity2] => 1 [quantity3] => 1 [receiver_email] => test_biz@gmail.com [receiver_id] => 74PV23B8KSK84 [residence_country] => US [tax] => 0.00 [tax1] => 0.00 [tax2] => 0.00 [tax3] => 0.00 [test_ipn] => 1 [transaction_subject] => Shopping CartProduct Name 1Product Name 6Product Name 8 [txn_id] => 7BS85664SB906284D [txn_type] => cart [verify_sign] => AJ2IuqHp8G0lIxhedAqrwRQbv8fVA4-Gum9e7DMZmEWIFrljEwFCJDfP ) 1 as you can see, there are key value pairs like this, [items_name1] => Product Name 1 [items_name2] => Product Name 2 [items_name3] => Product Name 3 those keys aren't constant, I mean, it came from a shopping cart, so the item name depends on how many items were placed in the shopping cart to be purchased.. now my question is, How to loop to that post array, and get only the item_names plus their corresponding values ?, because I need them and save in a db table
  15. Hi, I was asked to create a plug and play shopping cart module for 3 different web sites written from scratch using PHP how/what strategy to do to approach this thing?, the module should be used in any of those portals regardless of their web design. what am currently thinking is, 1 ) create a class that has functions that calls the "add to cart" button 2 ) this add to cart button will detect which site it is being used and it'll display the correct add to cart button graphics. 3 ) add some functions that will fetch the input number of quantity from each product item and their prices 4 ) add some functions that will display the total amount of the things inside the cart 5 ) use native PHP session to store the shopping cart total quantity + total amount of the items inside it. Please tell me your point of view or your strategies in attacking this problem.. maybe I'll find a nice solution from one of you guys. Thanks in advance
  16. Hi, here's my problem let's say I gave an end user a url such as e.g http://www.test.com/index.php?user=asdf1234 and I did the same thing to different end users with unique $_GET['user'] value each . my question is, how to track the URLs ?, i mean, how will i know if those urls were clicked and how to count the clicks made ? some possible scenarios could be - the url is pasted and send via email - the url is embeded as a link in some portals
  17. the 3 sample urls that i gave aren't meant to be connected to the app that i created, they were meant to be distributed to people, manually, like let's say i'm the owner of the app that was build, then I input email addresses, if i want to send something to one of the email addresses, I'll get the e.g proposal.test.com/seo and append the key to this url and send it to email.
  18. ok let me explain how the system works the app that i created is at e.g proposals.test.com/admin/ - this app is solely made for one person only, because he wanted to input email addresses of people manually by himself - this app currently allows him to login as admin and input email addresses, once an email address was input and the form was submitted, a random generated key is also saved together with that email address. now, those URL that I mentioned at my first post, how will I approach the access of those pages? how to check if user did has an existing and matching key from the database ? because each unknown end user can just type in the url to the browser bar e.g proposals.test.com/seo/blahblah <-- what if blahblah doesn't exist in db? he'll be able to see the page.. so what to do now?
  19. Hi, I was asked to create an app, wherein, the user may enter the email addresses of people manually, and it auto generates a random key. now this key will be used access such pages e.g proposal.test.com/ppc proposal.test.com/seo proposal.test.com/design so using the key for example => Sa22asdf it should appear like this proposal.test.com/ppc/Sa22asdf proposal.test.com/seo/Sa22asdf proposal.test.com/design/Sa22asdf without the unique key generated during the input of email address, the URL mentioned shouldn't be accessed by anyone.. now my question is, how to approach this thing in PHP ? I have done the input for email address and generation of random keys., but i don't know yet what to do or how to do the securing of pages using those keys ?
  20. I see, php5.3 namespaces..thanks for the extra tips
  21. I already explained that the other devs they have are cool and better than me and they can learn the framework that I use in a short period of time.. but , you know, am not the boss so I lost the debate battle
  22. because a 3rd party module made up of spaghetti and some oop coding style will be integrated in the system and i think it'll cause a huge impact in most of my code or if not, i will have to tweak the third party stuff to fin in the framework that i use..that's why they asked me to re-write everything without a framework..they worry about having a limitation of hiring someone who doesn't know the framework that i use..
  23. Hello, I built a system using a framework called Yii, now I was asked to re-write everything from scratch without a framework. I don't know how to do a system architecture, I'm used to do coding rightaway controllers,models with the help of an existing php framework w/o minding system design/folder structures., can you guys give me some tips how to do such? or a templating engine such as smarty can do the job for me ? Thanks in advance.
  24. Help, here's the situation, 1) get the countries(not sure if those are countries or state of africa), artist name, title of video, year, youtube links. - via this page , and clicking the african music button http://www.africanmusic24.com/ I can scrape the name of countries. now, if you i will click e.g "benin" from the bottom listings, and got redirected to this page, http://www.africatv24.com/music_video/benin how will i tell the script to 1) grab the links of each artists such as e.g "Afafa", then once grabbed, go to http://www.africatv24.com/afafa_ if by viewing the view source of http://www.africatv24.com/music_video/benin doesn't contain the url of each of the artists listed at the bottom of that page. Ok, now on this page, http://www.africatv24.com/afafa_ if I clicked the e.g "Love you(2008)" link to a video, I'l get redirect to this page http://www.africatv24.com/afafa_?video_feed=6870 at that page above, all I can get/scrape via php is the title, but no year and also, how will I tell the script to go to that page and scrape the title if from this page below http://www.africatv24.com/afafa_ I can't even scrape any links or url that goes to that video_feed=6870 what should I do ? how to approach this scraping for this thing ?, because the view source seems encrypted and well crafted. :'(
  25. Hi, am using Codeigniter My app goes like this, 1) user selects a topic from a dropdown 2) user is able to type some text/questions inside a text area under that dropdown 3) user clicks paypal checkout button and pay for asking a question question is, how will i save the id of the selected topic and the typed question if my submit button is calling paypal's processing stuff and not my own ci controller action thing ? here's the code of the submit/checkout button of paypal <form action=https://sandbox.paypal.com/cgi-bin/webscr method=post> <input type=hidden name=cmd value=_cart> <input type=hidden name=business value="test@gmail.com"> <input type=hidden name=item_name value="test"> <input type=hidden name=item_number value="1"> <input type=hidden name=amount value="<?php foreach($query3->result() as $row){echo $row->price; } ?>"> <input type=hidden name=quantity value="1" disabled="disabled"> <input type=hidden name=currency_code value="USD"> <input type="hidden" name="return" value="http://your-website.com/after-payment-page.html" / > <input type=image id="checkout" src="https://www.paypal.com/images/x-click-but6.gif" Border="0" name=submit><br> <input type=hidden name=add value=1></form>
×
×
  • 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.