Jump to content

adv

Members
  • Posts

    179
  • Joined

  • Last visited

Posts posted by adv

  1. hey i am trying to make a script that checks if the username exists or not but i have a problem

     

     

    <?php
    
    
    
    function doRequest($method, $url, $referer, $agent, $cookie, $vars) {
        $ch=curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        if($referer != "") {
            curl_setopt($ch, CURLOPT_REFERER, $referer);
        }
        curl_setopt($ch, CURLOPT_USERAGENT, $agent);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
        curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
        if ($method == 'POST') {
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $vars);
        }
        if (substr($url, 0, 5) == "https") {
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
        }
        $data = curl_exec($ch);
        curl_close($ch);
        if ($data) {
            return $data;
        } else {
            return curl_error($ch);
        }
    }
    
    function get($url, $referer, $agent, $cookie) {
        return doRequest('GET', $url, $referer, $agent, $cookie, 'NULL');
    }
    function post($url, $referer, $agent, $cookie,  $vars) {
        return doRequest('POST', $url, $referer, $agent, $cookie, $vars);
    }
    
    
    
    
    
    $cookie ='cookie.txt';
    $agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
    $url = 'http://mail.tiscali.it/cp/sso/Login.jsp?d=tiscali.it&fpp=197310647636';
    $referer = 'https://mail.tiscali.it';
    
    $url1='https://selfcare.tiscali.it/unit/selfcare/it_usersuggest?application=username_suggest&node=gid&us=asdadsadas&dY=';
    //$str = post($url, $referer, $agent, $cookie, $vars);
    
    $str=get($url,$referer,$agent,$cookie); // register 
    $str1=get($url1,$referer,$agent,$cookie);  // here is where i get the link with the user check but something doesnt work 
    
    
    
    echo $str1;
    
    
    ?>
    

     

    i`m trying first to enter the site then the register page where u can check if a user exists or not

     

    <a class="b" href="javascript:verifyUserID();">Verifica disponibilità</a> 

     

    that is link check

     

    this is the error i`m getting

     

     <html><body><h1>403 Forbidden</h1>
    Request forbidden by administrative rules.
    </body></html>
    

  2. hello is there a way to read emails with curl ?

    like in gmail ... inbox or trash

     

    after i log in with curl and then go to lets say:

    http://mail.google.com/mail/?shva=1#inbox

     

    is there a way to open each message in inbox

    i see that when u read a message it shows like this

    http://mail.google.com/mail/?shva=1#inbox/11f08c542531d23d

     

    but how do i do it without knowing /11f08c542531d23d

    just to get all messages one by one ...

    something like that :D thanks

  3. thanks alot friends its works good

    corbin u misspelled

     

    function InValue($array, $valpiece) {
        foreach($array as $val) {
             // $val instead of array
            if(strpos($val, $valpiece) !== false) return true;
        }
        return false;
    }
    if(InValue($array, '76'))
        echo 'Found!';
    else
        echo 'Not found .';
    
    
    

     

    anyway thanks alot :D

    edit : ahh  just instead of array

  4. thanks alot i see know

    is there just one thing that i want to know if there`s possible

    is there a way to echo just one value if it doesnt find any results... something like this

     

    if($result===false){
       echo 'not found'; // loop through all the arrays and if no results in ALL of them just show that echo 
    }
    

  5. ahh i modify it and figure about die;

     

    russel i tried ur way... but it finds both ways

     

    NOT found it

    found it

     

    $array=array('first','second','third','3423a','76676');
    
    foreach($array as $arrays){
       $result=strpos($arrays,'76');    
       if($result!==false){
          echo 'found it<br />';
          die;
       } else { 
          echo 'NOT found it<br />';
       }
    }
    

     

    i`ve use it like this

     

    edit : ive tried like that and it shows

    i understand why but i dont know how to limit to only the valid one

     

    NOT found it

    NOT found it

    NOT found it

    NOT found it

    found it

  6. hello i`m trying to loop over and over the arrays

    and try to find some words

    the thing is it doesnt work .. i wanna find even a piece of it

    but its not working and cant understand why.....

     

     

    $array=array('first','second','third','3423a','3423');
    $c=count($array);
    for($i=0;$i<$c;$i++){
    $result=strpos($array[$i],'3423'); 	
    if($result!==false){
    echo 'found it';
    
    }else{ 
    echo 'NOT found it';
    
    }
    
    
    }

  7. another quick question

    in aa.txt i have

    spring:notcool
    summer:cool
    winter:bad
    

    and the php file:

    <?php
    echo '<pre>';
    
    $aa1=file('aa.txt');
    foreach($aa1 as $aaaa){
    $expl=explode(chr(58),$aaaa);
    
    echo $expl[0].'<br /><br />'; // shows first values  
    /*
    	spring
    	summer
    	winter
    */ 
    echo $expl[1];  // shows second values
    /*
    	notcool
    	cool
    	bad
    */ 
    }
    
    echo '</pre>';
    ?>
    

    there is not problem with it

    my question is.. can it be done with for() ? to be able to access it just the same

    and if it can can u please show me an example ... i just want to see how its done

  8. thanks Aaron but it get  an error  here

    list($thirdfile ,$fourfile) = explode(':',$lines[$n+1]);
    

    Notice: Undefined offset: 2 in C:\wamp\www\tst\aa.php on line 8

     

    Notice: Undefined offset: 1 in C:\wamp\www\tst\aa.php on line 8

     

    i`ve tried something like this and it works,but is it good?

     

    for($n=0;$n<count($lines);$n=10){
    $res=list($a,$b)=explode(':',$lines[$n]);
    echo '<pre>';
    print_r($res);
    echo '</pre>';
    $n++;
    $res1=list($c,$d)=explode(':',$lines[$n]);
    
    echo '<pre>';
    print_r($res1);
    echo '</pre>';
    }
    

    this is what is shows

     

    Array

    (

        [0] => firstfile

        [1] => secondfile

     

    )

     

    Array

    (

        [0] => thirdfile

        [1] => fourfile

     

    )

     

    if works just for 2 lines it must work if i have even 10 lines in the aa.txt :(

  9. hello i`m trying to grab 2 kinds of texts from a file

     

    in the file  grab.txt i have

    firstfile:secondfile

    thirdfile:fourfile

     

    each one separated by a new line

    and in php i`m trying this

     

    <?php
    $file=file('aa.txt');
    foreach($file as $files){
    $split=explode("\n",$files);
    $split=explode(':',$files);
    /*
    echo '<pre>';
    print_r($split);
    echo '</pre>';
    */
    }
    ?>
    

    how do i access $split[0] and $split[1] to rise automaticaly?

    i mean when i use them

    $split[0]=firstfile      $split[1]=secondfile

    $split[0]=thirdfile      $split[1]=fourfile

     

    something like this

    :|

     

     

     

  10. thanks :D

    i have another question and i dont think is needed to open a new thread :D

    my question is this

     

    i have email.php

     

     
    <?php
    if(isset($_GET['sendEmail'])){
    $sendEmail=1;
    $value1=$_GET['value1'];
    $value2=$_GET['value2'];
    $value3=$_GET['value3'];
    }
    if($senEmail==1){
    mail('email.com','subject','testing');
    }
    ?>
    

     

    and in another file i have this

    <?php
    $remote_send='http://site.com/email.php?';
    $send_mail=1;
    $value1='firstvalue';  $value2='secondvalue'; $value3='thirdvalue';
    if($send_mail==1){
    $remote_send.='sendEmail=&value1='.urlencode($value1).'&value2='.urlencode($value2).'&value3='.urlencode($value3);
    }
    ?>
    

     

    but it doesnt send , i dont understand why

    if i do this :

    http://site.com/email.php?sendEmail=&value1=firstvalue&value2=secondvalue&value3=thirdvalue

    if sends the email

     

  11. ken i knew all that

    i`ve used file_get_contents intentionally

    i just wanted to know how php memorize it all

     

    but the thing is i dont understand how it keeps it .. where it keeps the strings made into variables
    how does it know.. 

     

    not to show me i can echo it :|

  12. hello i`ve played a little in php and there`s a thing that i don`t understand.

    I have a file :  test.txt , inside of it i have

    &test=testing&value=cool&blabla=ok

     

    and in php

    $h=file_get_contents('test.txt');
    parse_str($h);
    

    i know that parse_str()  makes strings into variables

    and  u can acces $test as a variable

    but the thing is i dont understand how it keeps it .. where it keeps the strings made into variables

    how does it know..

    kinda weird question :| sorry if  i didnt make myself clear ... my english is buggy :(

  13. hello i have this function to generate random letters and numbers with any length that u want

     

    
    <?php
    
    function randomPassword($length =  {
       // all the chars we want to use
       $all = explode( " ",
             "a b c d e f g h i j k l m n o p q r s t u v w x y z "
             . "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z "
             . "0 1 2 3 4 5 6 7 8 9 _");
        for($i=0;$i<$length;$i++) {
          srand((double)microtime()*1000000);
          $randy = rand(0, 61);
          $pass .= $all[$randy];
        }
    
         return $pass;
    }
    
    echo $new_filename = randomPassword(15);
    
    ?> 
    

    i didnt make this myself i found it from google

    but the thing that i dont understand  is here

     

    $pass .= $all[$randy];  

     

    why does it need to concatentate ??

    i tried without the "." but it will show only one random letter or number

    how is the concatentate operator makes such a big difference ::|

    any oppion is good :D

    thanks

     

  14. hello

    i`m having a problem that i just can`t seem to figure it out :(

    its start like this :

    i`m trying to get the content of 'file.txt'  and what i wanna do is login with curl with the users and passwords from the 'file.txt'

     

    <?php
    //get the file with file()  - its an array
    $file=file('file.txt');
    ?>
    

    in file.txt i have

    its just an example in the file.txt

    user1:password1
    user2:password2
    

     

    // i`ve tried with for() and then using explode to get user and password separatly 
    $file=file('file.txt');
    for($i=0;$i<count($file);$i++){
    	$res=explode(':',$file[$i]);
    
    $LOGINURL = "http://www.phpfreaks.com/forums/index.php?action=login2";
    
    // here at postfields i cant get it done
    // ived tried $res[0] for user and $res[1] for password
    $POSTFIELDS = 'user='.$res[0].'&passwrd='.$res[1].'&cookielength=-1&openid_url=&hash_passwrd=';
    $agent='Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3';
    $cookie_file_path='cook.txt';
    $reffer='http://phpfreaks.com/';
    
    $ch = curl_init(); 
        	curl_setopt($ch, CURLOPT_URL,$LOGINURL);
    curl_setopt($ch, CURLOPT_USERAGENT, $agent);
       	curl_setopt($ch, CURLOPT_POST, 1); 
       	curl_setopt($ch, CURLOPT_POSTFIELDS,$POSTFIELDS); 
       	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_REFERER, $reffer);
    curl_setopt($ch, CURLOPT_COOKIE,$cookie_file_path);
    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
    curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
        $result = curl_exec ($ch);
        curl_close ($ch);
    
    //echo $result;
    
    if(stristr($result,'<li id="name">Hello')){
    	$match=strip_tags(substr($result,strpos($result,'<li id="name">Hello')+14,40));
    }
    echo $match;
    }
    //its prints Hello adv Hello adv 
    
    

     

    I want to achive :

    1 - loop until it reached end of line;

    2 - try all the users in the 'file.txt' file and echo message like Hello username

     

  15. i was just wondering how doest xcart works

    how does it crypts the data?

    i downloaded the script and saw the functions

    this is crypted in xcart

    Snhmsmoljmdmmmg

    how does this works

    just letters .. how does it knows

  16. the problem is when i submit the page and is empty one of the values is shows the second form

    but if i submit the second form and the inputs are not empty it redirects me to the first form

    i`ve tried with $_SESSION and it works ... but i wanna know is there is a way just with variables

     

    when i submit the second form and the values are not empty i just wanna show lets say

    thanks in advance

     

    you didnt understand my point

    read carefully what i was saying

×
×
  • 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.