SitePoint Sponsor

User Tag List

Page 3 of 4 FirstFirst 1234 LastLast
Results 51 to 75 of 79
  1. #51
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dylannn
    That fastest way (correct me if I'm wrong) is
    PHP Code:
    echo 'Hello' $name// fastest 
    Correct.

  2. #52
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Young Twig
    PHP Code:
    echo '<div class="asdf"><label for="price">Price: $</label><input type="text" name="price" value="'.$info['price'].'" />'
    that first one is a nightmare! But Ive seen the same in Java .... now this one is funny because Id do the EXACT opposite in Java:

    Code:
    sb.append("<div class='asdf'><label for='price'>Price: $</label><input type='text' name='price' value='"+price+"' />");
    funny --- so Im starting to get it, do everything exactly opposite from what I would do in Java!

  3. #53
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, but you should use double quotes in HTML. You can do the same in PHP (double quote the string, single quote the attributes).

  4. #54
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by someonewhois
    Yeah, but you should use double quotes in HTML. You can do the same in PHP (double quote the string, single quote the attributes).
    Hate to disagree with you there Nathan but there is NO difference between a ' or a " around an attribute in HTML ... none whatsoever. The specs and standards state either delimiter will work the same... Ive been using 's for 6 years now with no problem at all!

  5. #55
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I realize that they're both valid, it's just double quotes look better on attributes. And single on PHP.

  6. #56
    SitePoint Addict DM3Dan's Avatar
    Join Date
    Sep 2004
    Location
    Albany, NY
    Posts
    204
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don't worry DC. I am just learning PHP too, and constantly ask Jon for clarification.

    PHP Code:
    <?php
    $dan 
    'Bad at PHP';
    $jon 'Good at PHP';
    $knowledge 0;
    $errors 1000;

    if(
    $dan == 'Talks to Jon'){
    $knowledge++;
    $errors--;
    } else {
    $errors++;
    }
    ?>
    God I hate not being able to tab.

  7. #57
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DM3Dan
    God I hate not being able to tab.
    You do that too? Ill be sitting here writing an example piece of code and hit tab, start typing and then look up and say "you idiot!"

  8. #58
    SitePoint Addict DM3Dan's Avatar
    Join Date
    Sep 2004
    Location
    Albany, NY
    Posts
    204
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dc dalton
    You do that too? Ill be sitting here writing an example piece of code and hit tab, start typing and then look up and say "you idiot!"
    . I used to try and code in cPanel's 'Edit' form. I would always hit tab, and change my filename to something like if($it == 'value').php . Now I use notepad.

  9. #59
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, whenever I do examples for SP, I open a new [unsaved] file in my editor. It happens that my editor is open every minute that my computer is on, regardless of whether I'm using it or not, so.

  10. #60
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK Im STUCK!

    Im trying to get a site together and AS PROMISED, Im using PHP... here's whats confusing me:

    I have a main index.php that grabs the variable pageName as such:

    PHP Code:
    <?php

        
    if ($pageName == "")     {
            
    $pageName 'main';
            }

        include 
    'header.php';

        
    readfile("pageText/" $pageName ".txt");

        include 
    'footer.php';

    ?>
    Now the header.php is really nothing more than an html file BUT I want to use that pageName variable in it (titles etc) ... so I did this:

    Code:
    <html>
    <head>
      <meta http-equiv='content-type' content='text/html; charset=iso-8859-1' />
      <title> <?php $pageName ?> </title>
    But the variable isnt there when I test it .. what the heck am I missing here or is it not possible to pass this variable like this?

  11. #61
    SitePoint Wizard Dylan B's Avatar
    Join Date
    Jul 2004
    Location
    NYC
    Posts
    1,150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dc dalton
    Now the header.php is really nothing more than an html file BUT I want to use that pageName variable in it (titles etc) ... so I did this:

    Code:
    <html>
    <head>
      <meta http-equiv='content-type' content='text/html; charset=iso-8859-1' />
      <title> <?php $pageName ?> </title>
    But the variable isnt there when I test it .. what the heck am I missing here or is it not possible to pass this variable like this?
    PHP Code:
      <title> <?php echo $pageName?> </title>

  12. #62
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Dylann ... figured it was something stupid... Im off to my next silly problem. As I said Im gonna learn this or else!

  13. #63
    SitePoint Wizard Dylan B's Avatar
    Join Date
    Jul 2004
    Location
    NYC
    Posts
    1,150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dc dalton
    Thanks Dylann ... figured it was something stupid...!
    Story of my life
    :P

  14. #64
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, believe it or not I have managed to get this site running, even doing a redirect or two going ... Im actually having some fun here!

    BUT I have another question! Is there an indexOf type function in PHP? What Im trying to do is look at the referrer of the page and make sure its coming from Paypal .. if not I want to give them an error page .... I looked thru the php.net manual but didnt find one...... in Java I would just try to find the index of paypal.com in the referrer something like this:


    if (referrer.indexOf("paypal.com") != -1) {
    // good screen
    }
    else {
    // screw you screen
    }

    thanks folks ... I think Im starting to get the hang of this stuff!

  15. #65
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your better off using regular expressions for this, but to answer your question, it is possible, for example

    PHP Code:
    // $string = 'http://www.paypal.com';
        
    $string 'www.paypal.com?arg1=hello&arg2=world&arg3=abc123xyz';
        
        if( 
    strstr$string'paypal.com' ) || strstr$string'paypal' ) ) {
            
    // good message
        
    } else {
            
    // bog off message 
        


  16. #66
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And I believe indexOf does the same as strpos in PHP.

  17. #67
    SitePoint Wizard Young Twig's Avatar
    Join Date
    Dec 2003
    Location
    Albany, New York
    Posts
    1,355
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think so, too. I believe strpos is identical to indexOf, but it returns false if needle is not found. (indexOf returns -1, correct?)

    Quote Originally Posted by php.net
    Note: If you only want to determine if a particular needle occurs within haystack, use the faster and less memory intensive function strpos() instead.
    PHP Code:
    // $string = 'http://www.paypal.com';
    $string 'www.paypal.com?arg1=hello&arg2=world&arg3=abc123xyz';
        
    if(
    strpos($string,'paypal.com')!==false
    {
            
    // good message


    else 
    {
            
    // bog off message

    Quote Originally Posted by DM3Dan
    God I hate not being able to tab.
    I've gotten good at the 5 space thing. It sounds like someone's getting shot.

  18. #68
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, a minor problem here and I dont know if its my code (probably) or something else... what Im doing is trying to lock donw a page so that it will ONLY display the contents if the referrer was paypal... Ive tried the strpos but when I tested it I get the "illegal access page" not the downloads page .... here's the code:

    PHP Code:
    <?php

        
    include 'header.php';

        
    $ref getenv('HTTP_REFERER'); 

        
    $pos strpos($ref'paypal.com');

        if (!
    $pos)    {
            
    readFile("downloads/paypal/illegal.txt");
            }
        else    {
            
    readfile("downloads/paypal/downloads.txt");
            }

        include 
    'pageText/sidebar.txt';

        include 
    'footer.php';

    ?>
    The other thing I was wondering about was about the fact that paypal is running under an ssl - but I didnt know (and couldnt find) anything about an HTTPS_REFERER .... anyone see what IM screwing up here ... I know its pretty basic but ya gotta start somewhere!

    I also tried this:

    PHP Code:
    <?php

        
    include 'header.php';

        
    $ref getenv('HTTP_REFERER'); 

        
    $pos strpos($ref'paypal.com');

        if (
    $pos)    {
            
    readfile("downloads/paypal/downloads.txt");
            }
        else    {
            
    readFile("downloads/paypal/illegal.txt");
            }

        include 
    'pageText/sidebar.txt';

        include 
    'footer.php';

    ?>

  19. #69
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you echo $ref, what do you get? You should also use if ($pos !== false). Oh, and you have a horrible combination of single and double quoets -- keep it consistant!

  20. #70
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by someonewhois
    Oh, and you have a horrible combination of single and double quoets -- keep it consistant!
    whoops, thats the java slipping back in .... the minute I type a ( Im used to following it with a "

    Quote Originally Posted by someonewhois
    If you echo $ref, what do you get? You should also use if ($pos !== false).
    I tried echo $ref and got NOTHING .... I did look at the source from Paypal on their "Return to merchant" button and its nothing more than a form using a get method, no variables to try and grab at all ..... thats why I was trying to grab the referer ..

    Ill try it again with the !== false and see what happens, pain in the BUTT cause with PP you have to test live! NO DAMN DEMO MODE!

  21. #71
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    They have a demo mode -- it's under the developers network.

    Also, are you using the IPN or the return to mercant button. The IPN is a LOT safer, and will probably be better.

  22. #72
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by someonewhois
    They have a demo mode -- it's under the developers network.

    Also, are you using the IPN or the return to mercant button. The IPN is a LOT safer, and will probably be better.
    Ill have to go find that ... I try to stay away from using Paypal but now that you dont have to have a paypal account Im using them. I usually use some kind of membership login app but this thing is so simple (a download after paying) I figure I try to keep it simple!

  23. #73
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well we can skip that developer central CRAP with those idiots today .... WHERE IN THE HELL did those MORONS at ebay (paypal same same) learn to program! 4 times Ive reset the password after confirming my developer account and every stinking time it tells me "you login does not match our records" ..... IDIOTS! ...... worst damn programmers I have EVER seen in my life!

    * sorry just needed to vent! *

  24. #74
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Haha. Yeah, they've got issues. I think the developers should hang out in their own developer network... it could help.

  25. #75
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    all right I tried the code again with the changes you recommended and still no go ....

    PHP Code:
    <?php

        
    include 'header.php';

        
    $ref getenv('HTTP_REFERER'); 

        
    $pos strpos($ref'paypal.com');

        if (
    $pos !== false)    {
            
    readfile('downloads/paypal/downloads.txt');
            }
        else    {
            
    readFile('downloads/paypal/illegal.txt');
            }

        include 
    'pageText/sidebar.txt';

        include 
    'footer.php';

    ?>
    Is it because its coming from a secure line that the PHP isnt picking up the referrer?


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
  •