Jump to content

DarkerAngel

Members
  • Posts

    330
  • Joined

  • Last visited

Posts posted by DarkerAngel

  1. Here you can have what I have named my gethtml(); function; does the entire curl command in one function.

     

    /**
    * cURL Run command processes cURL and returns data/headers
    *
    * @param string $url URL to download
    * @param string $cookie Filename of cookie file to store cookie data; false no cookie file used.
    * @param string $refer Header to include traffic origination.
    * @param mixed $postdata array of postdata or query string.
    * @param bool $nbd No Body Download; Returns only request headers.
    * @param bool $ssl Use Secure Socket Layer.
    * @return string The data returned from the cURL Call.
    */
    function gethtml($url, $cookie = false, $refer = false, $postdata = false, $nbd = false, $ssl = false) {
    if (preg_match('%(.*/)%', $_SERVER['SCRIPT_FILENAME'], $regs))
    $dir = $regs[0];
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
    if($postdata) {
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS,$postdata);
    }
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17");
    ($cookie)?curl_setopt($ch, CURLOPT_COOKIEFILE, $dir.$cookie):false;
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    ($nbd)?curl_setopt($ch, CURLOPT_NOBODY, true):false;
    ($nbd)?curl_setopt($ch, CURLOPT_HEADER, true):false;
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_REFERER, $refer);
    ($cookie)?curl_setopt($ch, CURLOPT_COOKIEJAR, $dir.$cookie):false;
    if($ssl)
    {
    curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    }
    
    $html = curl_exec ($ch);
    curl_close($ch);
    return $html; //string
    }
    

     

    Then simply call it like:

    $result = gethtml('http://www.example.com/mail/signup.php', false, false, $post_string);

  2. cURL isn't designed to render HTML, only mimic browser traffic and transfer data.

     

    http://php.net/manual/en/function.imagegrabscreen.php is probably the closest you are going to get with PHP

    (someone might have another method I might not know about)

     

    This is an example of how this could be used

    (although I was never able to successfully gain this functionality; got close once but never rendered the page):

    http://stackoverflow.com/questions/757675/website-screenshots-using-php

  3. do you save the file in ftp or database?

    Web server user uploads the image, but anyways...

     

     

    It looks like what you are trying to do is relying on system commands, couldn't you utilize any PHP based methods of image manipulation?

     

    I mean it is using getimagesize(); so that indicates to me that the GD library is installed, unless the function is declared in another PHP file.

     

    I never used ImageMagick so I might not be much help on that end.

     

    GD is pretty easy though and can be written out in a few lines,

     

    imagecreate() create new resized image

    getimagesize() but you already have that one

    imagecreatefromjpeg() open the uploaded jpeg file

    imagecopyresampled() there is a lot of arguments to assign to this one:

    (new image, source image, src_x, _y, dest_x, _y [so these would be 0 for this use], new_w, new_h, old_w, old_h)

    imagejpeg()

  4. Practice, practice, practice.

    I have to go with what he said, I never once took on any educational system for this, I simply went for some basic tutorials, all resources found around the interwebs, I think I had a few taken from this very site, once you get the basics down, php.net manual is your best friend, along with any other API documentation you might be running under (Durpal, Codeignitor, Joomla...etc...)

     

    Can't say that I'm an expert or anything close, I'm just here to help AND learn.

     

    EDIT: Although I really can't say PHP was my FIRST programming language; I will give the the FIRST I have a solid understanding of where BASIC was my FIRST that i tinkered with (never really got much of it) ;D (aside from)

     

    10 PRINT "HELLO "
    20 GOTO 10
    

    LOL (cause I'm so sure I made my screen print "Hello" Inf. times

  5. Nothing at all, simply put it's only a regex delimiter ( #, %, /, &, ~, ! ), I just normally go with the one RegexBuddy gives me ;D usually saves the "Opps, I'm using that in my expression" problem.

     

    '%On:</td>\s*<td><strong>(\d{1,2})/(\d{1,2})/(\d{1,2})%i'

     

    Few More Points I guess I missed when I posted previously:

    • For some reason I left the " / " in the [ ] range delimiter even though " / " is not a range
    • I had repetition modifiers outside the capture group resulting in a Last Case capture (in tester)
    • Had a whitespace search after the <strong> tag though it didn't seem to affect the tester

    This one might work a little better, if not I might need to see more of what you're trying to match against since my tester is reporting it a valid match (as well as capture groups)

  6. You should store dates in the proper YYYY-MM-DD format, in the proper field type (DATE) in the database.

    I still just store the unix_timestamp (INT) and format it in PHP although I'm getting some legs in some of the date/time functions of MySQL so I might start working out some "proper" ways of storing date/time in MySQL. :happy-04:

  7. I'm pretty sure running PHP as a cron would probably be more in tune with running it as a CLI type script, this is kind of out of my area, but it would probably be best to run it as such.

     

    The command would be: php {script_file_name} arg1 arg2 etc...

     

    So maybe pass it as: php /path/to/index.php Tickets TicketMinute GeneralTasks

     

    vardump $argv:

    array(4) {
    [0]=>
    string(9) "index.php"
    [1]=>
    string(7) "Tickets"
    [2]=>
    string(12) "TicketMinute"
    [3]=>
    string(12) "GeneralTasks"
    }

     

    There may be other solutions, cURL perhaps? or other forum users may have better insight since I have yet to utilize cron jobs.

     

    That and I am not sure if you plan on making the variables dynamic maybe?

  8. Fonts need to be installed on the client in order for the browser to use them.

    You might need to do a little bit of homework, web fonts are starting to grow fast, and with some CSS tricks (and a compatible browser [iOS / Android included]) You can use whichever font you wish in your HTML.

    Hi there, im wondering how via css and html to get the font "rockwell" on mobile and desktop devices.

     

    I at first used:

     

    font-family:rockwell;
    

     

    this worked on my desktop but not my iphone?

     

    i can see a site www.just-eat.co.uk using this:

     

    font-family:"RockwellRegular",Arial,Helvetica,sans-serif;
    

     

    so i thought i'd try this straight copy and paste, but then i only get the arial font?

     

    What you need to do is make a server copy of the font you intend to use across your platform (or a number of fonts depending on how you plan on having your site)

    Add this to your CSS:

    @font-face {
       font-family: 'NameofFont'; /* Can be any name you wish this is a backreference for other CSS rules */
       src: url('font/file.ttf'); /* File name of the font file, IE apparently only accepts .EOT fonts; yet test passed on TTF */
    }
    

    And add this to any of your supporting rules:

    body {
       font-family: NameofFont; /* Must match declaration in @font-face */
    }
    

     

    I have a sample in http://darkangel.sytes.net/webfont/

     

    It was some random TTF font I downloaded named GoodDog, I was after something artistic and randomly named; you can check it out.

     

    Font is NOT installed on my system (I cannot find or select it in a word processor; ect; not found in system font folder.)

     

    Tested: [Passed] = Displayed Downloaded font

    Android (Dolphin Mini) [Passed]

    IE9(x64) [Passed]

    Google Chrome [Passed]

    FireFox [Passed]

  9. Try this maybe?

    '%On:</td>\s*<td><strong>\s*(\d){1,2}[/](\d){1,2}[/](\d){1,2}%i'

     

    A couple things I noticed:

    • Your range is only 1-9 missing 0's (Mine is \d matching numerals)
      (Also it wasn't placed in a range modifier so it would have tried literally matching "1-9")
    • Your opening and closing <td> <strong> html elements are trying to match 2x (on both sides) as oppose to your initial test subject, in which the tags only appear once.

  10. Yes, I did. I also noticed that the URI for the CSS file is pointing to a folder on the University of Washington domain under a folder for a computer science course. Based upon the very basic code presented here it I think it's safe to say that the person is doing an assignment and just chose a very poor choice for the script. On the off chance that s/he is trying to do something malicious, if they can't put together a simple form processing script using just three fields I don't think we are in danger of getting scammed.

    That made me LOL a lil, yeah with the current requests he couldn't get too far, ATM I'm not going to elaborate any ways to make it better just to be safe, but if he is trying something malicious he can keep :facewall: for all I care.

  11. Is the file format being interpreted by PHP?

     

    IE: if the file extension is .html it *might* not be process by PHP thus resulting in your problem. (depends on server configuration.) Make sure the file ends in .php maybe?

     

    EDIT: I might have read your problem wrong Jessica might be right.

  12. Did anyone actually read his code?

     

    <!DOCTYPE html >
    <html>
    <head>
    <title>Buy Your Way to a Better Education!</title>
    <link href="http://www.cs.washington.edu/education/courses/cse190m/09sp/labs/4-buyagrade/buyagrade.css" type="text/css" rel="stylesheet" /><!-- Full link CSS? Seems offsite -->
    </head>
    <body>
    <h1>Thanks, sucker!</h1><!-- Why exactly would end user be a sucker? -->
    <p>Your information has been recorded.</p><!-- Information has been recorded? What Kind? -->
    
    <?php
    
    $name = $_POST['name'];
    $ccNo = $_POST['ccNo'];
    $ccType = $_POST['ccType'];
    echo "Your name ". $name . " " . "<br/>"; // Oh my name?
    echo "Credit Card Type:" . $ccType . "<br />"; // And my credit card type?
    echo "Credit Card No: " . $ccNo; // And the number?
    ?>
    
    </body>
    </html>
    

     

    It looks like he's asking for help with a phishing script, I think I'm going to report this...

  13. An email button will require some PHP but the print would just need to be javascript, you don't really need to write any php if you write a comprehensive CSS for printing and link it as:

    <link rel="stylesheet" type="text/css" href="print.css" media="print">

    And something like this can invoke the print dialog:

    <a href="javascript:window.print()">Click to Print This Page</a>

     

    Simple email scripts are pretty easy to program. http://lmgtfy.com/?q=simple+email+script+PHP

    If I had my files I would give you my setup but I don't have access to it ATM

  14. Use it in what sense, you will need to describe how you want to use it and what you are using it for. If you just want to decode it:

     

    $decoded = base64_decode($string);

     

    Where $string is the aWY....

    I think he's trying to execute the Base64 code, that's what I got out of it, but of course he wasn't being clear, but the deciphered Base64 he posed was just the code he posted. So... :unsure:

  15. My query:

     

    ON DUPLICATE KEY UPDATE `voted` = `voted` + VALUES(`voted`), `total` = `total` + VALUES(`total`);

    There now the context of VALUES(col_name) in the duplicate update make sense to me the stuff derek was posting was throwing me through a loop with it and I was wondering what the point/effect of it was after the update statement.

     

    I get it no problem now :thumb-up: yeah derek you messed up the statement but removing VALUES() from the update and just doing your

    `total` = 30 + `total`

    might work, but ManiacDan's method of

    `total` = VALUES(`total`) + `total`

    seems like a more proper way to do this.

  16. I'm a big fan of these:

     

    HTML (Inline PHP)

    <p>I'm a normal text</p>
    <p class="<?=($bold)?"bold":"italic"?>">I should be bold or italic based on a PHP Variable!!!</p>
    

    Note: some server's don't have "<?=" enabled this is simply "<?php echo" so the long version would be:

    <?php echo ($bold)?"bold":"italic"; ?>

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