SitePoint Sponsor

User Tag List

Results 1 to 25 of 25

Thread: if Problem ??

Hybrid View

  1. #1
    SitePoint Zealot doca's Avatar
    Join Date
    Dec 2004
    Location
    Vienna, AT
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question if Problem ??

    Hello, I have a big problem on a if function ?? sorry about bad english

    if user IP is not a same like in $adminip field and paid=="0", script should load popup, but if IP is a same like in $adminip and paid=="0" script should not load this popup.

    if paid=="1" or something else Nothing should happen

    PHP Code:
    if ($paid=="0") {
            
    $sql "select html from $tableads where format='popup'";
                
    $result mysql_query($sql) or die("Failed: $sql");
            
    $resrow mysql_fetch_row($result);
            
    $popup $resrow[0];


  2. #2
    SitePoint Enthusiast Aarakast's Avatar
    Join Date
    Feb 2005
    Location
    Germany
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this:

    PHP Code:
    if ($_SERVER['REMOTE_ADDR'] != $adminip AND $paid == '0')
    {
        
    $sql "select html from $tableads where format='popup'";
          
    $result mysql_query($sql) or die("Failed: $sql");
        
    $resrow mysql_fetch_row($result);
        
    $popup $resrow[0]; 

    ~~~

    Do you speek german?

  3. #3
    Chessplayer kleineme's Avatar
    Join Date
    Apr 2004
    Location
    Germany
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    PHP Code:
    if ($paid == "0") {
      if (
    $_SERVER['REMOTE_ADDR'] != $adminip) {
        
    $sql "select html from $tableads where format='popup'";
        
    $result mysql_query($sql) or die("Failed: $sql");
        
    $resrow mysql_fetch_row($result);
        
    $popup $resrow[0];
      } else {
        
    //do something else
      
    }
    } else {
      
    //do nothing

    Never ascribe to malice,
    that which can be explained by incompetence.
    Your code should not look unmaintainable, just be that way.

  4. #4
    SitePoint Addict toggg's Avatar
    Join Date
    Jan 2005
    Location
    Auvergne/France
    Posts
    253
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    I don't understand your question.
    Please give some more explanation about what you like to do.
    à+
    ~~~
    Ich spreche Deutsch
    bertrand Gugger toggg.com linux, PHP, Auvergne/France open source

  5. #5
    SitePoint Zealot doca's Avatar
    Join Date
    Dec 2004
    Location
    Vienna, AT
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Yesss

    YESSSSS Big thanks guys !!!
    Aarakast Code Perfect
    kleineme Code Perfect

    toggg ich bin aus östereich und english Ist nicht so meine Stärke, aber...geht !

  6. #6
    SitePoint Zealot doca's Avatar
    Join Date
    Dec 2004
    Location
    Vienna, AT
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    dam##*~ß? they use my nick know somebody how can i make ip based nicknames protection

  7. #7
    SitePoint Enthusiast Aarakast's Avatar
    Join Date
    Feb 2005
    Location
    Germany
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What do you want to do???

    ~~~

    Ich spreche auch deutsch.
    Greets,
    Pablo

    aarakast.de

  8. #8
    SitePoint Zealot doca's Avatar
    Join Date
    Dec 2004
    Location
    Vienna, AT
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    homepage besucher benutzen mein username (admin, webmaster,......) wie kann ich es schützen etwas wie ein array eine tabelle mit webmaster,admin,...... das es IP basierend ist zum beispiel admin darf nur ip 111.222.333. benutzen webmaster darf nur IP 444.444.444 benutzen und so weiter, ist das möglich.????Es ist ein Shoutbox.

  9. #9
    SitePoint Enthusiast Aarakast's Avatar
    Join Date
    Feb 2005
    Location
    Germany
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    You can make another table, with forbidden usernames. Each username becomes an IP-adress. If a user wants to use a forbidden username, the script compares the two IPs (the IP in the table and your IP). If both IPs are the same, you can write the message, if they are different the user only sees an error and the message will not be written to the table.

    ~~~ and the same in german ~~~

    Du kannst eine weitere Tabelle anlegen, mit verbotenen Usernamen. Jedem verbotenem Usernamen wird eine IP zugewiesen. Bei jedem Eintrag in die Shoutbox wird geprüft, ob der Name verboten ist, wenn ja, werden beide IPs miteinander verglichen. Wenn beide IPs unterschiedlich sind, kommt ein Error, sonst wird die Nachricht eingetragen.
    Greets,
    Pablo

    aarakast.de

  10. #10
    SitePoint Zealot doca's Avatar
    Join Date
    Dec 2004
    Location
    Vienna, AT
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    bin nicht sicher meinst du etwa so???


    PHP Code:
    $sql "select adminip,adminname from $table where id='$id'";
            
    $result mysql_query($sql) or die("Failed: $sql"); 
            
    $resrow mysql_fetch_row($result); 
            
    $adminip $resrow[0];
            
    $adminname $resrow[1];
            if (
    $poster == '$adminname' AND $_SERVER['REMOTE_ADDR'] != $adminip) { 
            
    $error="1"
            
    $error_text .= "Name Reserved<br />";
            } 

  11. #11
    SitePoint Enthusiast Aarakast's Avatar
    Join Date
    Feb 2005
    Location
    Germany
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If it works like this: exactly.
    Greets,
    Pablo

    aarakast.de

  12. #12
    SitePoint Zealot doca's Avatar
    Join Date
    Dec 2004
    Location
    Vienna, AT
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hm es sollte funktionieren aber nur mein Name aber wie kriege ich mehrere namen ?? Ich teste es jetzt gleich

  13. #13
    SitePoint Zealot doca's Avatar
    Join Date
    Dec 2004
    Location
    Vienna, AT
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Keine Ahnung ? funkt nicht


    PHP Code:
    if ($tagname && $hdmsg && $id){
            
    $tagname addslashes($tagname);
            
    $emurl addslashes($emurl);
            
    $length "30"// Max Chars
             
    $hdmsg preg_replace('!(\w{'.$length.'})(?=\w+)!','                                                                   :) <b>Sorry !! width flood enabled !? chrs max !!</b> :)                                                                   '$hdmsg);
            
    $hdmsg strip_tags($hdmsg$allowedtags);
            
    $hdmsg addslashes($hdmsg);
            
    $poster str_replace("\""""$poster);
            
    $poster str_replace("'"""$poster);
            
    $emurl str_replace("\""""$emurl);
            
    $emurl str_replace("'"""$emurl);
            
    $emurl strip_tags($emurl);
            if (
    substr(strtolower($emurl),0,4)!="http" && !stristr($emurl"@")) $emurl "http://".$emurl;
            
    $sql "select adminip,adminname from $tableusers where id='$id'";
            
    $result mysql_query($sql) or die("Failed: $sql"); 
            
    $resrow mysql_fetch_row($result); 
            
    $adminip $resrow[0];
            
    $adminname $resrow[1];
            if (
    $poster == '$adminname' AND $_SERVER['REMOTE_ADDR'] != $adminip) { 
            
    $error="1"
            
    $error_text .= "Name Reserved<br />";
            } 

  14. #14
    SitePoint Addict toggg's Avatar
    Join Date
    Jan 2005
    Location
    Auvergne/France
    Posts
    253
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, you want ?
    PHP Code:
            if ($poster == '$adminname' AND $_SERVER['REMOTE_ADDR'] != $adminip) { 
    Sure you prefer:
    PHP Code:
            if ($poster == $adminname AND $_SERVER['REMOTE_ADDR'] != $adminip) { 
    à+
    bertrand Gugger toggg.com linux, PHP, Auvergne/France open source

  15. #15
    SitePoint Zealot doca's Avatar
    Join Date
    Dec 2004
    Location
    Vienna, AT
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Jo es funktioniert super !! hehe toggg bitte wie kann ich noch dazu case insensitive matchen und wenigstens zwei oder drei namen reservieren ich möchte das es reagiert wenn man schreibt WeBmaSter,webmaster wEbmastEr

  16. #16
    SitePoint Zealot doca's Avatar
    Join Date
    Dec 2004
    Location
    Vienna, AT
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by doca
    zwei oder drei namen reservieren
    OK i weiß aber case insensitive matchen das weiß ich nicht ??

  17. #17
    SitePoint Enthusiast Aarakast's Avatar
    Join Date
    Feb 2005
    Location
    Germany
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    You get alle the names case insensitive, when you write the forbidden names lowercase, and then do this:

    PHP Code:
    if ($poster == strtolower($adminname) AND $_SERVER['REMOTE_ADDR'] != $adminip) { 
    Greets,
    Pablo

    aarakast.de

  18. #18
    SitePoint Zealot doca's Avatar
    Join Date
    Dec 2004
    Location
    Vienna, AT
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hm komisch jetzt funk.. nicht

  19. #19
    SitePoint Addict toggg's Avatar
    Join Date
    Jan 2005
    Location
    Auvergne/France
    Posts
    253
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    For any case matching you could even do
    PHP Code:
    if (strtolower($poster) == strtolower($adminname)
     and 
    $_SERVER['REMOTE_ADDR'] != $adminip) { 
    I mean, was it working with AND uppercase ?
    Anyway, I ask myself if you could do more (all admin in once) by:
    PHP Code:
    $sql "select adminip from $tableusers
                 where adminname LIKE '
    $poster'"// case insensitive
    $result mysql_query($sql) or die("Failed: $sql");
    $numrow mysql_num_rows($result);
    if (
    $numrows) {        
        list(
    $adminip) = mysql_fetch_row($result);
        if (
    $_SERVER['REMOTE_ADDR'] != $adminip) {
            
    $error="1";
            
    $error_text .= "Name Reserved<br />";
        }

    Bis gleich
    bertrand Gugger toggg.com linux, PHP, Auvergne/France open source

  20. #20
    SitePoint Zealot doca's Avatar
    Join Date
    Dec 2004
    Location
    Vienna, AT
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    deine kombination für case matching funktioniert perfect !das ist erledigt.
    ich habe jetzt eine tabelle erstellt $tablebannnick mit id,nick,nickip und auf diese weise kann ich mehrere reservierte namen eingeben.
    beispiel:
    id=1 nick=webmaster nickip=111.111.111.111
    id=2 nick=admin nickip=222.222.222.222

    das wäre cool wenn ich sogar mehrere reservierte namen definieren kann mit verschiedernen
    adressen daran arbeite ich jetzt..

  21. #21
    SitePoint Addict toggg's Avatar
    Join Date
    Jan 2005
    Location
    Auvergne/France
    Posts
    253
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi
    It's quite the same:
    PHP Code:
     $sql "select adminip from $tableusers
                 where adminname LIKE '
    $poster'"// case insensitive
    $result mysql_query($sql) or die("Failed: $sql");
    $numrow mysql_num_rows($result);
    $error='';
    while (
    $numrows--) {        
        
    $error="1";
        list(
    $adminip) = mysql_fetch_row($result);
        if (
    $_SERVER['REMOTE_ADDR'] == $adminip) {
            
    $error='';
            break;
        }
    }
    if (
    $error) {
        
    $error_text .= "Name Reserved<br />";

    Was meinst du ?
    à+
    Last edited by toggg; Feb 9, 2005 at 05:32. Reason: little bug
    bertrand Gugger toggg.com linux, PHP, Auvergne/France open source

  22. #22
    SitePoint Zealot doca's Avatar
    Join Date
    Dec 2004
    Location
    Vienna, AT
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    toggg warum hast du nicht paypal donate link auf toggg.com ich möchte dir gerne ein Bier bezahlen No Comment ! Work perfect!

  23. #23
    SitePoint Addict toggg's Avatar
    Join Date
    Jan 2005
    Location
    Auvergne/France
    Posts
    253
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Du Wiener,
    Macht dir kein Angst, Ich habe Reserve hier
    Niederland auch nicht schlecht.
    à+
    bertrand Gugger toggg.com linux, PHP, Auvergne/France open source

  24. #24
    SitePoint Zealot doca's Avatar
    Join Date
    Dec 2004
    Location
    Vienna, AT
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    das mit paypal das meinte ich ernst. ... Du hast mir wirklich geholfen

  25. #25
    SitePoint Zealot doca's Avatar
    Join Date
    Dec 2004
    Location
    Vienna, AT
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    togggggggggg Ich glaube ich werde brauchen deine Hilfe. noch ein bischen


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
  •