Jump to content

Deoctor

Members
  • Posts

    663
  • Joined

  • Last visited

Posts posted by Deoctor

  1. try this

     

    <?
    error_reporting(0);
    session_start(); // start session.
    ?>
    <!-- header tags, edit to match your own, or include template header file. -->
    <html>
    <head>
    <title>Login</title>
    </head>
    <body>
    <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
    <p align="center">Members only. Please login to access this document.</p>
    <table align="center" border="0">
    <tr>
      <th>
    Username:
      </th>
      <th>
    <input type="text" name="username">
      </th>
    </tr>
    <tr>
      <th>
    Password:
      </th>
      <th>
    <input type="password" name="password">
      </th>
    </tr>
    <tr>
      <th colspan="2" align="right">
    <input type="submit" name="submit" value="Login">
    
      </th>
    </tr>
    </table>
    </form>
    </body>
    </html>
    
    <?
    // If all is well so far.
    if(isset($_POST['submit']))
    {
    echo "Hai";    
    $username=$_POST['username'];
    $password=$_POST['password'];
    session_register("username");
    session_register("password"); // register username and password as session variables.
    
    $dbHost = "sql01.dk";
    $dbUser = "elmerdahldk";
    $dbPass = "rNnj5Tc2";
    $dbDatabase = "elmerdahldk";
    $mysqli = mysql_connect("$dbHost", "$dbUser", "$dbPass");
    mysql_select_db($dbDatabase, $mysqli) or die("Can not connect");
    // Check connection
    if (mysql_error()) {
    printf("Unable to connect to database: %s", mysql_error());
    exit();
    }
    $sql = mysql_query("SELECT * FROM users WHERE username = '$username' and password='$password'");
    //$fetch_em = mysql_fetch_array($sql);
    $numrows = mysql_num_rows($sql);
    if($numrows != "0")
    {
        $valid_user = 1;
    }
    else 
    {
        $valid_user = 0;
    }
    // If the username exists and pass is correct, don't pop up the login code again.
    // If info can't be found or verified....
    if ($valid_user == 0)
    {
    echo " sorry wrong details";
    session_unset();   // Unset session variables.
    session_destroy(); // End Session we created earlier.
    // escape from php mode.
    }
    else
    {
        echo "Success";
    }
    }
    ?>

  2. but just as a matter of interest, what if there was only 2 files in the folder.. one was called scan0001.txt and the other was called scann0004.txt file.. how would this work then...

     

    for this one i cannot do anything..

    u have to check the files before..

     

    and how do i put all the content of each of these files into a variable?

     

    for this what u need to do is that instead of echo

    use some thing like this

     

    $value="C:\\Users\\kevin\\Documents\\My Scans\\scan";
    //echo $fole."<br>";
    
    for($i=1;$i<=130;$i++)
    {
        if($i>=100)
        {
            $val1=$value.'0'.$i.".txt<br>";
            $fole .= file_get_contents($val1);
        }
        elseif($i>=10)
        {
            $val2=$value.'00'.$i.".txt<br>";
            $fole .= file_get_contents($val2);
        }
        else
        {
            
            $val3=$value.'000'.$i.".txt<br>";
            $fole .= file_get_contents($val3);
        }
        
    }
    echo "File====><br> ".$fole;
    ?>

     

  3. u can do that some thing like u need to make a group for that email id which is unique..

    these things u need to do in the mail server....this thing i too dont knoowww... :P

     

    obviously this is one solution for this..

     

    the other is that u write a script that when ever he sends an email u fetch the email and then search for the contacts for that mail id and run a script so that it can send mails..

     

    i have done with the bulk mailer..

    contact me if u need any help

     

     

  4. for($i = 1; $i <= 10; $i++) 
    {
    if($line = mysql_fetch_assoc($result))
    {
    <table>
    <tr>
    <td>
    echo $line["name"];
    </td>
    <td>
    echo $line["finalTime"];
    </td>
    </tr>
    </table>
    //echo "".$i."=".$line["name"]."".$i."=".$line["finalTime"];
    }
    }

     

    try this

  5. try this code..

     

    <form enctype="multipart/form-data" action="upload.php" method="POST">
    <input type="hidden" name="MAX_FILE_SIZE" value="9999999999999999" />
    Choose a file to upload: <input name="uploaded" type="file" /><br />
    <input type="submit" name="submit_x" value="Upload File" />
    </form>
    <?php
    //Working for uploading the files of a particular type
    if(isset($_POST['submit_x']))
    {
           function file_upload_error_message($error_code)
    {
        switch ($error_code)
        {
            case 0:
                return 'There is no error, the file uploaded with success...';
            case 1:
                return 'The uploaded file exceeds the upload_max_filesize directive in php.ini';
            case 2:
                return 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form';
            case 3:
                return 'The uploaded file was only partially uploaded';
            case 4:
                return 'No file was uploaded';
            case 6:
                return 'Missing a temporary folder';
            case 7:
                return 'Failed to write file to disk';
            case 8:
                return 'File upload stopped by extension';
            default:
                return 'Unknown upload error';
        }
    }
    
        $host="localhost";
        $user="root";
        $pass="admin";
        $db="develop";
        mysql_connect($host,$user,$pass) or die(mysql_error());
        mysql_select_db($db) or die(mysql_error());
        $query="select type_name from filetype";
        $result=mysql_query($query);
        ini_set("display_errors",1);
        //error_reporting(E_ALL);
        $target = "upload/";
        $target = $target . basename( $_FILES['uploaded']['name']) ;
        $uploaded_type=strtolower(substr($_FILES['uploaded']['name'],strrpos($_FILES['uploaded']['name'],'.')+1));
        print_r($_FILES['uploaded']);
        $error_code=$_FILES['uploaded']['error'];
           $error_message = file_upload_error_message($error_code);
        echo "Name ".$_FILES['uploaded']['name']."<br>";
        echo "Type ".$_FILES['uploaded']['type']."<br>";
        echo "Error ".$error_message."<br>";
        echo "Size ".$_FILES['uploaded']['size']."<br>";
    
    
        //echo "<br>FileX ".$uploaded_type;
         while($row = mysql_fetch_array($result))
         {
              if($uploaded_type==$row['type_name'])
              {
    
                  if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
                  {
                  echo "The file ". basename( $_FILES['uploaded']['name']). " has been uploaded";
                      break;
                  }
                  else
                  {
                  echo "Sorry, there was a problem uploading your file.";
                  }
    
              }
         }
    }
    ?>

  6. so can u tell me what u have tried with i mean ur code... :P

     

    i believe  u want to get the contents of the site if yes try using this script

     

    here actually i am wrting the content back in the browser.. but u can try returning it to a file so that u can fetch what ever u want by file_get_contents

     

    <?php
    
    
    $url = '[url=http://php.net]http://php.net[/url]';
    
    // disguises the curl using fake headers and a fake user agent.
    function disguise_curl($url)
    {
      $curl = curl_init();
    
      // Setup headers - I used the same headers from Firefox version 2.0.0.6
      // below was split up because php.net said the line was too long. :/
      $header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,";
      $header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
      $header[] = "Cache-Control: max-age=0";
      $header[] = "Connection: keep-alive";
      $header[] = "Keep-Alive: 300";
      $header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
      $header[] = "Accept-Language: en-us,en;q=0.5";
      $header[] = "Pragma: "; // browsers keep this blank.
    
      curl_setopt($curl, CURLOPT_URL, $url);
      curl_setopt($curl, CURLOPT_USERAGENT, 'Googlebot/2.1 (+http://www.google.com/bot.html)');
      curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
      curl_setopt($curl, CURLOPT_REFERER, '[url=http://www.google.com]http://www.google.com[/url]');
      curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
      curl_setopt($curl, CURLOPT_AUTOREFERER, true);
      curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($curl, CURLOPT_TIMEOUT, 10);
    
      $html = curl_exec($curl); // execute the curl command
      curl_close($curl); // close the connection
    
      return $html; // and finally, return $html
    }
    
    // uses the function and displays the text off the website
    $text = disguise_curl($url);
    echo $text;
    ?> 

     

  7. <?php
    /* Titel en send to email adres */
    $emailTitle = '*****';
    $webMaster = 'XXX@XXX.com';
    /* Textfield namen */
    $naamField = $_POST['naam'];
    $bedrijfField = $_POST['bedrijf'];
    $emailField = $_POST['email'];
    $telefoonField = $_POST['telefoonnummer'];
    $opmerkingenField = $_POST['vraag'];
    $body = <<<EOD
    <br><hr><br>
    Naam: $naamField <br>
    Bedrijf: $bedrijfField <br>
    Email: $emailField <br>
    Telefoon: $telefoonField <br>
    Opmerkingen en vragen: $opmerkingenField<br>
    EOD;
    $headers = "From: $emailField\r\n";
    $headers = "Content-type: text/html\r\n";
    $success = mail($webMaster,$emailTitle,$body,$headers);
    $theResults = <<<EOD

     

    this one u modify it as

     

    <?php
    if(isset($_POST['verzenden'])){
    /* Titel en send to email adres */
    $emailTitle = '*****';
    $webMaster = 'XXX@XXX.com';
    /* Textfield namen */
    $naamField = $_POST['naam'];
    $bedrijfField = $_POST['bedrijf'];
    $emailField = $_POST['email'];
    $telefoonField = $_POST['telefoonnummer'];
    $opmerkingenField = $_POST['vraag'];
    $body = <<<EOD
    <br><hr><br>
    Naam: $naamField <br>
    Bedrijf: $bedrijfField <br>
    Email: $emailField <br>
    Telefoon: $telefoonField <br>
    Opmerkingen en vragen: $opmerkingenField<br>
    EOD;
    $headers = "From: $emailField\r\n";
    $headers = "Content-type: text/html\r\n";
    $success = mail($webMaster,$emailTitle,$body,$headers);
    $theResults = <<<EOD
    }

  8. Just an FYI: HTTP_REFERER is a header that comes with the HTTP request. It can easily be set to anything and in fact most of the web proxy scripts set it to be the same as the domain being requested so that requests that come through such a proxy look like they are from someone who is actually browsing on your site. HTTP_REFERER cannot really be trusted or used for anything more than informational purposes.

     

    can u provide me with a sample of how to set that ??

  9. it is not regarding the errors that i am asking about..

    what i am trying to say here is that

    suppose if an user logs into ur site

    then these are the following details u can fetch from that

    SERVER_ADDR

    REQUEST_METHOD

    REQUEST_TIME

    QUERY_STRING

    HTTP_REFERER--used to find whether he is coming from a valid url...

    REMOTE_ADDR

    SCRIPT_FILENAME

     

    and so on......

     

    these are quite helpfull for you to trace the things while u are working on..

    also have a check whether some one is directly accessing ur database and deleting the things

     

    change ur mysql password and also the access levels for the user id...

     

     

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