This isn't a real code problem but more a where and how to start problem.
So I hope you can give me some creative ideas, examples or share your thoughts !
After login in to a website, I can change my product details, this is done by HTTP POST forms.
Because we have over 1000 products I somehow want to customise / easyify.
My idea was, make a PHP form on my own server which submits to the supplier url(s).
However when doing this, it forwards us to the customer login.
If I temper my submitted data in firefox, I see this is because after login a cookie is been set and obvious our system does not have this.
Anyone an idea how to automate this process ? In other words, how can I set this cookie in my php form in order to submit it succesfully.
Or Im I thinking about the wrong solution ?!
You cannot post to another server unless you use cURL or something like that. Maybe I am not understanding your question.
Related
I've set up a product enquiry page so that people can submit questions straight from the product details page.
I'd like to post some variables from the product details page to the enquiry page, but when I use the POST method it does not work (I'm re-directed to a search page). I assume this is a security measure and is being controlled by auth.php (or a file referenced from there).It works fine when I use GET, but i want to avoid the variables in URL.
My page looks like this
Code:
require "./auth.php";
require $xcart_dir."/include/categories.php";
require "products.php";
$smarty->assign("main","productenquiry");
func_display("customer/home.tpl", $smarty);
afaics, it's a restriction posed from your web server administrator..imho, it has nothing to do with auth.php
A friend of mine had a similar issue and after much exercise we came to know upon contacting that the web administrators had done something which was causing the issue and on our request the same was resolved and we were able to use POST method..
So, you may try to contact your web server administrator to resolve the same..
The very first thing you should do is make sure that $_POST actually works.
To do that, create a basic form, then submit it to a php file that contains just <?php var_dump($_POST);. This will show you exactly what is being passed through.
Break the problem into small steps.
I'm looking at a domain registration site that looks like it uses jquery to process users data inputed and to register domains.
What I was wondering is if it's possible for users to be able to fill in data on a form on my website and then when the user is ready to complete payment, be taken to the actually domain registration site where all the data they typed in on my site will be posted to the domain reg site.
So basically, the users fills in a load of info on my site, AND attempts to check for domain availability on my site. Once the users has found the domain they want, they will be redirected over to the actual domain reg site where all their info will be posted.
Now I know if the domain reg site used PHP to process all the stuff, it wouldn't be a problem. But they don't use PHP.
Do you guys reckon this could be possible?
I'm not sure this would be possible in any amount of time that would make it worth it to you. Without knowing any of their back-end code, it's going to be extraordinarily difficult. Edit: I should add that I did look through some of their jQuery code and it looks as though they're using ajax .post() to submit data. Where this data goes and what responses are expected is anyone's guess, though...
That said... there are quite a few domain registrars that offer real APIs to let you do what you want... or even let you go one step further and offer the ability to register domains directly through your website. Sometimes you can set your own price, as well.
Here are links to some of these APIs:
Namecheap: http://developer.namecheap.com/docs/
GoDaddy: http://www.godaddy.com/reseller/domain-reseller-api.aspx
eNom: http://www.enom.com/resellers/Interfaceinfo.asp
I'd personally recommend NameCheap, but for the purposes of your question, any of these should do.
I can't make any promises but say you used jquery ajax to pull in the form the would have to fill out. Said form would then be on your client side so in theory I think you could use their input ids to fill out the form using javascript/jquery. All this would technically be client side. To bad that other site does not have an api for purchases.
Do you have control over the domain registration site? There are many ways you can send the user's input over to that site, but of course it has to be looking for this posted data and know how to handle it. PHP is not necessary to handle the data that is passed in. For example, if you send your info to the domain registration site via a form GET method, the info will become part of the URL, which can be accessed and parsed via javascripts window.location property.
So this is a pretty weird topic, but lets just say I made a big mistake while building a site. There is an application form on my website and people basically fill up the form and their entry gets saved in the database. Now how it is supposed to work is that the form is supposed to post to a page that catches the form fields and stores it in the database. However, I forgot to put the file under action. So basically the form has been posting to itself. Bummer. So based on analytics there were about 100 applicants on my site on that day which means that about 100 applicants are lost as the form was posted to just the page itself and not to the page that was supposed to catch form fields.
So is there a way, any way to get those applicants back?
Thanks
The only book I can think of that could possibly help is this: http://www.amazon.com/Build-Time-Machine-Paul-Davies/dp/0142001864
I hate to have to say it, but NO.
Unless you had the form input being recorded in a database, logfile, or other persistent storage, it's lost.
No.
You did not store the data, so it is gone.
Depending on what you are using I would check the logs. I'm not 100% on this but you maybe able to see some errors in there.
If not I think you are out of luck.
In some pretty weird cases you can find some data in your server access log file.
It doesnt hurt to check.
I used to have a "Buy Now" button that would go through PayPal, and then, through the button's advanced option, I redirected the users to a "Success" page that would give the serial for the product they purchased.
Obviously, this page had to get confirmation from PayPal, through the variables PayPal gave it, in order to know that a payment had actually been processed, and not only some person typing the page's URL in his browser to get a serial.
I did this only in PHP, without downloading any API, using, as far as I can remember, $_POST or $_SERVER variables from PayPal. There were a couple of nested "if"s, but in the end, it worked fine.
Now I've been Googling for an hour trying to find the code I used. All I find is framework downloads and bloated APIs, while I really only need to know these things:
Did the order process?
What is the email of the buyer?
I have a blank PHP file waiting for suggestions. In dummy-pseudo-code, it would go around the lines of:
<?php
$serial = ...;
if ($paypal_succeeded)
{
echo($serial);
}
?>
Please don't tell me this is impossible, I know I already did it, I just lost my old code.
Thanks!
I don't have any experience with this sort of thing, but google showed me a few possible relevant links here, here, and here.
The main page for this was https://www.paypal.com/ipn
I'm new here, also a novice programmer, and not really familiar with PHP. I don't even know the name of some of the techniques I used when building my apps. I'm sorry for that, but I'll try to explain the best I can.
So I'm building a web apps with PHP / AJAX right now, and I've got to the point where some users (with their own privilege) have their own home page, which shows notification for them when something new happened in the system. I think I used the "get" method from the url to determine which page is the user in right now.
Here's a simple illustration :
A user with "Staff" privilege logged in, and then redirected to his home page. (http://localhost/apps/staff.php)
He open the notification page, and the url changes to : "http://localhost/apps/staff.php?cmd=notification"
I don't know the name of the technique, but here's how I do it : I get the cmd value using "$_GET['cmd']" and then pass it onto a function that checks what page to display.
The problem is, I want to delete the content of notification table and move it to the history table when the user leave the page so only the newest notification will shows. So I think I need to know when the user leave (move) to another page, or when the cmd value change. My question is, how ?
Ps. I'm still a student on a university so this is my homework. Please just point me on a direction and/or clue rather than write the code for me (and a clue to the name of that "get" technique is welcomed :p). I know I still got a lot to learn, but english is not my native and I've tried google and stackoverflow with no result (I believe it's because of my bad english and not knowing the name of the techniques I used).
Use a cookie to track the status of the notification.
See this thread for more info: Best way to show an admin message to certain users?
You can check if user went to notification (after his default user page) page like this:
if (isset($_GET['cmd']))
{
// delete old notifications
// and move to history table
// show new ones now
}
This checks if query string value cmd is there, he has moved to notification page.