Professional Web Applications Themes

Total nOOb Question - PHP Development

I have just started programing in PHP (Love it!) however I have ru into two problems! here they are 1st One I'm sure is SIMPL I have two strings $stringa and $string If these these two strings are DIFFERENT then I want to do X on strin What would the IF operator be My second issue seems to be more of an IE issue than a PHP issu I work for a company that develops software for the building industr and would like to distribute one of our software products via th web. here is the proble The main file ...

  1. #1

    Default Total nOOb Question

    I have just started programing in PHP (Love it!) however I have ru
    into two problems! here they are

    1st One I'm sure is SIMPL

    I have two strings $stringa and $string

    If these these two strings are DIFFERENT then I want to do X on strin


    What would the IF operator be

    My second issue seems to be more of an IE issue than a PHP issu

    I work for a company that develops software for the building industr
    and would like to distribute one of our software products via th
    web.

    here is the proble

    The main file sits on my web server. We generate unique URLs for th
    buyer to download the software. We also generate unique filenames an
    store it in a database along with the unique URL This in essence is
    pseudo filename (i.e a filename that is unique to the user and doe
    NOT exist on our web server

    When the user clicks on the URL that we send him I need the PH
    script to initiate the file transfer giving the user the pseud
    filename rather than the actual filename on the serve

    I have everything working except for the ability to send the user th
    pseudo filename! at this moment in time we are sending them the sam
    filename as the file sitting on our server

    Is there anyway of doing this with PHP

    Any help would much be appreciate

    Edit: In my code I have tried the followin

    header('Content-Description: Fil
    Transfer');
    header('Content-Type: application/force-download'); /
    Tells the browser to expect a downloa
    header("Content-Transfer-Encoding: Binary"); /
    Tells the browser the format of the data
    header('Content-Length: '
    filesize($realfilename)); // Tells the browser the siz
    of the fil
    header('Content-Disposition: attachment; filename='
    basename($uniquefilename)); // Tells the browser th
    name of the fil

    readfile($realfilename);

    As you can see I am reading the original filename's properties howeve
    using the Content-Disposition header to tell the browser the filenam
    to download

    For some reason I.E always recieves a 0k file...??

    Ace Guest

  2. #2

    Default Re: Total nOOb Question

    "Ace" <no-spam.invalid> kirjoitti
    viestissä:net... 

    if(trim($stringa) !== trim($stringb)){
    // Do something.
    }

    A simple if($stringa != $stringb) would work too, but when using timr, you
    can eliminate possible occurances of whitespace before and after the string.
    I assume that you'd like to match "cat" with " cat" even though there's a
    space before the second cat. If you don't want, but you need _exact_
    matches, remove the trim's. A second thing is that I've used the
    type-specific version of not equal operator, !==. It differs from a single
    type-blind != in that it requires the types to match as well. It just adds a
    tad more security to your script, although I'm not sure whether you'll be
    needing it or not, concider it "just in case".

    --
    SETI Home - Donate your cpu's idle time to science.
    Further reading at <http://setiweb.ssl.berkeley.edu/>
    Kimmo Laine <com>


    Kimmo Guest

  3. #3

    Default re:Total nOOb Question

    Hi
     
    trim($stringb)){ 

    Ahhaaa! I see the difference! Thanks I will use that operator

    On my other problem I did some research. There is nothing wrong wit
    my code - the problem is with Internet Explorer. It works just fin
    with Firefox

    Ace Guest

Similar Threads

  1. Noob question
    By Hill in forum Ubuntu
    Replies: 4
    Last Post: November 3rd, 07:26 PM
  2. sorry noob question
    By the rebel in forum Macromedia Director 3D
    Replies: 3
    Last Post: September 26th, 12:17 PM
  3. Total Noob
    By pBarrelas webforumsuser@macromedia.com in forum Macromedia Flash Sitedesign
    Replies: 4
    Last Post: December 1st, 05:48 AM
  4. Noob question
    By drew146 webforumsuser@macromedia.com in forum Macromedia Fireworks
    Replies: 1
    Last Post: October 5th, 11:24 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139