Jump to content

pocobueno1388

Members
  • Posts

    3,369
  • Joined

  • Last visited

    Never

Everything posted by pocobueno1388

  1. I'm still having problems with this. Any help would be great!
  2. Hello, I am trying to use cURL to login to a website, but I can't seem to get it working. Website I'm trying to login to: http://www.uniquearticlewizard.com/amember/member.php Here is what their form code looks like: <form name="login" method="post" action="/amember/member.php"> <table class="vedit" > <tr> <th>Username</th> <td><input type="text" name="amember_login" size="15" value="" /></td> </tr> <tr> <th>Password</th> <td><input type="password" name="amember_pass" size="15" /></td> </tr> <tr> <td colspan="2" style='padding:0px; padding-bottom: 2px;'> <input type="checkbox" name="remember_login" value="1"> <span class="small">Remember my password?</span> </td> </tr> </table> <input type="hidden" name="login_attempt_id" value="1291657877" /> <br /> <span class='button'><input type="submit" value=" Login " /></span> <span class='button'><input type="button" value=" Back " onclick="history.back(-1)" /></span> </form> As you can see they are using a javascript button to submit the form, which doesn't have a name attribute. So I'm not sure how to get around this and tell cURL to submit the form. When I Googled I found something that said just submit the other information and it will submit itself, but I'm not sure if that's right. Here is my attempt, but I just get a blank screen. I think the script is working, but something on there end is exiting out due to me not supplying a required piece of information. I'm not sure what that is though. <?php set_time_limit(0); $options = array( CURLOPT_RETURNTRANSFER => true, // return web page CURLOPT_HEADER => false, // don't return headers CURLOPT_FOLLOWLOCATION => true, // follow redirects CURLOPT_ENCODING => "", // handle all encodings CURLOPT_USERAGENT => "spider", // who am i CURLOPT_AUTOREFERER => true, // set referer on redirect CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect CURLOPT_TIMEOUT => 120, // timeout on response CURLOPT_MAXREDIRS => 10, // stop after 10 redirects ); $ch = curl_init( "http://www.uniquearticlewizard.com/amember/member.php" ); curl_setopt_array( $ch, $options ); $content = curl_exec( $ch ); $err = curl_errno( $ch ); $errmsg = curl_error( $ch ); $header = curl_getinfo( $ch ); curl_close( $ch ); $header['content'] = $content; preg_match('/name="login_attempt_id" value="(.*)" \/>/', $header['content'], $form_id); $value = $form_id[1]; $ch = curl_init(); // SET URL FOR THE POST FORM LOGIN curl_setopt($ch, CURLOPT_URL, 'http://www.uniquearticlewizard.com/amember/member.php'); // ENABLE HTTP POST curl_setopt ($ch, CURLOPT_POST, 1); $data = array('amember_login' => '*****', 'amember_pass' => '*****', 'login_attempt_id' => $value, 'remember_login' => '1'); // SET POST PARAMETERS : FORM VALUES FOR EACH FIELD curl_setopt($ch, CURLOPT_POSTFIELDS, $data); // IMITATE CLASSIC BROWSER'S BEHAVIOUR : HANDLE COOKIES curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); # Setting CURLOPT_RETURNTRANSFER variable to 1 will force cURL # not to print out the results of its query. # Instead, it will return the results as a string return value # from curl_exec() instead of the usual true/false. curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); // EXECUTE 1st REQUEST (FORM LOGIN) $store = curl_exec($ch); echo $store; curl_close ($ch); ?> They do have a form value that changes on every page refresh, it just tracks the login attempt (which is a long number). I was able to scrape that and put it in the form with the correct value. I thought adding that would successfully log me in, but apparently there is something else going on. Any help would be greatly appreciated!
  3. I think if you want to do it that way, your going to have to use GROUP BY as well. SELECT DISTINCT * FROM `song` WHERE category='$cat' GROUP BY category If that doesn't work, you may have to just manually type all the fields SELECT DISTINCT field1, field2 FROM `song` WHERE category='$cat'
  4. I'm not exactly sure what your wanting, but it sounds like you want to use DISTINCT select *, DISTINCT(name) from table where user='$cat'
  5. I don't know what your function show_form() looks like, but if it returns a value of TRUE or FALSE, then you can do this: if (show_form()) { echo 'her'; } else if(isset($_POST["basic"])) { check_form(); } I can only tell you if the syntax is correct, other than that...I have no idea what your trying to accomplish.
  6. The code you just posted doesn't make any sense. You would have to explain what your trying to do. To make your code make sense, it would need to be something like this if (some condition) { echo 'her'; } else if(isset($_POST["basic"])) { //code here }
  7. It's because you are using double quotes within double quotes. Do this $message="<span class='style1'>Your profile has been created</span>";
  8. What doesn't work about it, and what would you like it to do?
  9. Could you post your table structures? This is the best I could do from the information you gave SELECT v.title, v.blurb , i.image_from_image_table FROM videos v LEFT JOIN images i ON i.videoID = v.videoID WHERE cat_id='$catID'
  10. Replace the line in your code exactly with the code I supplied you. P.S. - Best of luck with your health.
  11. That just means there is a problem with your query. Add a die error at the end of this line: $resultTemp = mysql_query($hlTemp); Like so $resultTemp = mysql_query($hlTemp)or die(mysql_error() . "<p>With Query:<br>$hlTemp");
  12. That pretty much put my code to shame...much more efficient.
  13. Try <?php $text = "The quick brown fox jumps over the lazy dog The quick brown fox jumps over the lazy dog The quick brown fox jumps over the lazy dog"; $text = explode(" ", $text); //array to hold the sections of words in $words = array(); //var to hold the sets in $set = ""; $count = 1; foreach ($text as $word){ $set .= $word . ' '; if ($count == 100){ $words[] = $set; $set = ""; $count = 0; } $count++; } echo '<pre>',print_r($words),'</pre>'; ?>
  14. Take a look at this http://vikjavev.no/highslide/
  15. pocobueno1388

    results

    Try this SELECT value1, value2, (value1 * value2) as total FROM test_oh WHERE total >= 300
  16. $location = $_SERVER['REQUEST_URI']; header("Location: $location");
  17. All you need to do is select the information from the database, and use a while loop to display it all. EX <?php //select info from db $query = mysql_query("SELECT * FROM table"); //display it using while loop while ($row = mysql_fetch_assoc($query)){ echo $row['col']; } ?> You just need to add the table in there. Read these tutorials http://www.tizag.com/phpT/fileopen.php http://www.tizag.com/phpT/fileread.php
  18. This is a nice class for this http://htmlpurifier.org/
  19. You need to have some sort of way to know whose profile is being viewed. You can do that by either using a session variable for the user that holds their ID or something of the sort, or you could do it through the URL, such as: www.your-site.com/profile.php?userID=5 Then you can use either one of those variables to create your query. Also, there is no need for a while loop when you only expecting one row from the db.
  20. My guess is your image input type isn't acting as a submit button, and that $_POST value isn't going through, which would give you a blank page because of the if statement returning false. Try this and see if you get the error message. <?php if (isset($_POST['Register'])){ //check email validity function checkEmail($Email) { if(eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]", $Email)) { return FALSE; } list($EmailName, $EmailDomain) = split("@",$Email); if(getmxrr($Domain, $MXHost)) { return TRUE; } else { if(fsockopen($Domain, 25, $errno, $errstr, 30)) { return TRUE; } else { return FALSE; } } } //check captcha input match If($_SESSION['security_code'] != $_POST['security_code'] || empty($_SESSION['security_code'])) { Header("location: Login.php?register&SecurityCodeError"); Die; } //check username $Username = mysql_real_escape_string($_POST['Username']); If(strlen($Username) > 20 OR strlen($Username)< 1 OR !(preg_match("/^\w+$/",$Username))){ Header("location: Login.php?register&UsernameError"); Die; } //check password $Password = mysql_real_escape_string($_POST['Password']); If(strlen($Password) > 20 OR strlen($Password) < 5 OR !(ctype_alnum($Password))){ Header("location: Login.php?register&PasswordError1"); Die; } //check re-entry of password $Password2 = mysql_real_escape_string($_POST['Password2']); If ($Password != $Password2) { Header("location: Login.php?register&PasswordError2"); Die; } //check string length of email $Email = mysql_real_escape_string($_POST['Email']); If(strlen($Email) > 50){ Header("location: Login.php?Register&EmailError"); Die; } //calls function to check email validity if(checkEmail($Email) == FALSE){ Header("location: Login.php?Register&EmailError"); Die; } //username exists check $CheckUsername = mysql_query("SELECT Username FROM `usertable` WHERE `Username` = '$Username'"); If (mysql_num_rows($CheckUsername)>0) { Header("location: Login.php?register&UsernameTakenError"); Die; } // email exists check $CheckEmail = mysql_query("SELECT Email FROM `usertable` WHERE `Email` = '$Email'"); If (mysql_num_rows($CheckEmail)>0) { Header("location: Login.php?register&EmailTakenError"); Die; } $IP = $_SERVER["REMOTE_ADDR"]; $Date = date("Y-m-d H:i:s",time()); $Password = md5($Password); $EmailCode = md5(uniqid(rand(), true)); $Query = "INSERT INTO `usertable` (Username,Password,Email,IP,RegisterDate,ActivateCode) Values ('$Username', '$Password', '$Email', '$Country', '$IP', '$Date', '$EmailCode')"; mysql_query($Query) or die(mysql_error()); Unset($_SESSION['security_code']); Header("location: Login.php?Register&Success"); } else { echo 'ERROR: No such variable as $_POST[register]'; } ?>
  21. If I understand what your wanting, try this: <?php $aUsers = array( "Ädams, Egbert", "Zaun, Jillie", ); $sql = "SELECT * FROM `members`"; $show = @mysql_query($sql,$connection) or die(mysql_error()); while ($row = mysql_fetch_array($show)){ $aUsers[] = $row['name']; } //new array with names added echo '<pre>',print_r($aUsers),'</pre>'; ?>
  22. Where are you getting the variable $_SESSION['new'] from? Also, you would need to call session_start() at the top of the page in order to maintain the session.
  23. Try <?php $query = "SELECT nick, (Monday + Tuesday + Wednesday + Thursday + Friday + Saturday + Sunday) AS added FROM table_name ORDER BY added DESC LIMIT 10"; $result = mysql_query($query)or die(mysql_error()); $i = 0; while ($row = mysql_fetch_assoc($result)){ echo $i .'. '.$row['nick'].'<br />'; $i++; } ?>
  24. It sounds like you need an UPDATE query. The rows actually exist already, so you want to update the columns. UPDATE tablename SET column1='new value', column2='new value' WHERE [...]
  25. You could separate each value by a delimiter, then explode() it when you use the data. So, something like this: <select> <option value="value1-value2-value3"> <option value="value1-value2"> </select> Give more information on what values your trying to pass, and why you need the multiple values. There could be a better way.
×
×
  • 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.