5$ paypal to whom ever can help me

Alright, what i need to do here is verify a post login. If the login is successfull it then adds the post username and password to the database. If it failed to login then it will return error.

Example:

I have a login Box. It asks for both Username and Password. A member can donate an account to us, we want to verify that the account is real first before we add it to the database.

They put in the user/pass, it will then post to the url

http://WEBSITE.com/cgi-bin/premiumzone.cgi?login=USERNAME&password=PASSWORD

If the login was successfull then i can run the query to add those details into the database. If the login failed then it will echo an error.

This has to be done through the php, it cant actually change the page to that site and then try and login.

The only help ive got was this little code but im not sure how / if it will work

if($login = true; //they logged in //dosomething } else { //they didn't log in //dosomething } function test_log_in($connectiontoSQL) { if(something) { return true; } else { return false; } return $login; }

If you guys have any ideas or questions let me know, 5 $ instant payapl to whom ever can provide the help

You could look at fsockopen http://php.net/fsockopen as a means to connect.

I presume, however that you don’t actually want to pass a username and password as in your example (that is the “GET” method not the POST method).

By using the fsockopen you could test your connection and send the appropriate information (as a POST or more preferably using SSL with the POST). You should then get the response that you could parse.

Based on the response you could set the other details (Success = INSERT statement, Failure = TRY AGAIN MESSAGE )

Could you possibly explain what you mean by “Donate an account”?

Im writing a script for my site where users can download files from rapidshare using premium accounts i have in my database.

They can also donate an account to us. Before its added into the database i need to make sure its real so that when an account is pulled in, it doesnt say “this login is invalid”

blah blah

Would you be willing to help me write this little script part.

I will pay you for your time.

how bout this
[php]

<?php if (isset($_REQUEST['login'])){ if (!$_REQUEST['username'] || !$_REQUEST['userpassword']) { $display = " Please Insert User Name and Password"; } else { $check_user = "select * from login where name = '$_REQUEST[username]' && password = '$_REQUEST[userpassword]'"; $check_user_res = mysql_query($check_user) or die (mysql_error()); if (mysql_num_rows($check_user_res) < 1) { $display = " *Invalid User Name and Password."; } [/php]

That looks like its cheaking with my database to see if the name is in there.

What im trying to accomplish is when a person puts in the username and password its goign to verify that it exists on another site (which i dont have access to the database).

So it needs to some how login via php and if it was successull, then it inserts that info into my database.

I think fsockopen is the way to go (like peg110 said). After you recieve the requested page (I’m pretty sure you’re trying to login, and that won’t happen through GET variables on any self-respecting website), you can check the HTML for differences between the Login Succesful message and the Login Failed message, and act accordingly.

Any ideas how i will write the fsock to have it login?

Im not that great with php :confused:

This is the URL that the fsock will need to open

https://ssl.rapidshare.com/cgi-bin/premiumzone.cgi?login=$user&password=$pass

After it successsfully logs in ill be able to do the rest with the errors and what not.

After you login this is what you will see

Your Premium-Account is valid until

So it would need to be like

is_present($page,"Your Premium-Account is valid until ");

I think… :)

Thanks for the help so far, now that i know what has to be done i just need to find out how to code it. If some one can write that part for me, then PM me there paypal addy and ill give them the money

Thanks

Well, for starters, you could try clicking the link peg110 gave you (coz I have a feeling you went the lazy way and didn’t ;) ) It gives a pretty decent explanation of what fsockopen() does and an example of how to implement it.

Sure i clicked it…

I was reading up on it, it just got confusing.

I the fsock to connect to a site fine.

THen i tried puting in the name and password on the url that i wanted it to open, and it worked fine.

I changed the password, yet it still said it conencted…

fsockopen will create a connection. Just because the the passed parameters are not correct, it doesn’t mean that the socket is closed.

It’s sort of like getting a 404 page. For example if you enter a URL of http://phphelp.com/hereweare.php you will still connect (successfully) to phphelp.com but instead of the hereweare.php page, you get redirected to a 404 error page. That page gets sent back to your browser (or socket) succesfully. Even though it’s not what you expected… the communication was ultimately successful. Same thing with the fsocket functions. The communication is successful even if the result is not what is expected.

Sponsor our Newsletter | Privacy Policy | Terms of Service