SitePoint Sponsor |
|
User Tag List
Results 1 to 25 of 25
Thread: if Problem ??
-
Feb 8, 2005, 08:48 #1
- Join Date
- Dec 2004
- Location
- Vienna, AT
- Posts
- 171
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
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];
}
-
Feb 8, 2005, 08:53 #2
- 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?
-
Feb 8, 2005, 08:57 #3
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.
-
Feb 8, 2005, 09:00 #4
- 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 Deutschbertrand Gugger toggg.com linux, PHP, Auvergne/France open source
-
Feb 8, 2005, 09:56 #5
- Join Date
- Dec 2004
- Location
- Vienna, AT
- Posts
- 171
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Yesss
YESSSSS Big thanks guys !!!
AarakastCode Perfect
kleinemeCode Perfect
toggg ich bin aus östereich und english Ist nicht so meine Stärke, aber...geht !
-
Feb 8, 2005, 11:46 #6
- Join Date
- Dec 2004
- Location
- Vienna, AT
- Posts
- 171
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
dam##*~ß? they use my nick
know somebody how can i make ip based nicknames protection
-
Feb 8, 2005, 11:54 #7
- 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.
-
Feb 8, 2005, 12:01 #8
- Join Date
- Dec 2004
- Location
- Vienna, AT
- Posts
- 171
- 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.
-
Feb 8, 2005, 12:09 #9
- 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.
-
Feb 8, 2005, 12:18 #10
- Join Date
- Dec 2004
- Location
- Vienna, AT
- Posts
- 171
- 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 />";
}
-
Feb 8, 2005, 12:24 #11
- Join Date
- Feb 2005
- Location
- Germany
- Posts
- 39
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
If it works like this: exactly.
-
Feb 8, 2005, 12:36 #12
- Join Date
- Dec 2004
- Location
- Vienna, AT
- Posts
- 171
- 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
-
Feb 8, 2005, 12:45 #13
- Join Date
- Dec 2004
- Location
- Vienna, AT
- Posts
- 171
- 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 />";
}
-
Feb 8, 2005, 13:46 #14
- 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) {
PHP Code:if ($poster == $adminname AND $_SERVER['REMOTE_ADDR'] != $adminip) {
bertrand Gugger toggg.com linux, PHP, Auvergne/France open source
-
Feb 8, 2005, 14:59 #15
- Join Date
- Dec 2004
- Location
- Vienna, AT
- Posts
- 171
- 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
-
Feb 8, 2005, 15:26 #16
- Join Date
- Dec 2004
- Location
- Vienna, AT
- Posts
- 171
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by doca
-
Feb 8, 2005, 15:32 #17
- 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) {
-
Feb 8, 2005, 16:01 #18
- Join Date
- Dec 2004
- Location
- Vienna, AT
- Posts
- 171
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
hm komisch jetzt funk.. nicht
-
Feb 9, 2005, 03:01 #19
- 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) {
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 />";
}
}
bertrand Gugger toggg.com linux, PHP, Auvergne/France open source
-
Feb 9, 2005, 04:48 #20
- Join Date
- Dec 2004
- Location
- Vienna, AT
- Posts
- 171
- 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..
-
Feb 9, 2005, 05:27 #21
- 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 />";
}
à+Last edited by toggg; Feb 9, 2005 at 05:32. Reason: little bug
bertrand Gugger toggg.com linux, PHP, Auvergne/France open source
-
Feb 9, 2005, 05:49 #22
- Join Date
- Dec 2004
- Location
- Vienna, AT
- Posts
- 171
- 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!
-
Feb 9, 2005, 06:03 #23
- 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
-
Feb 9, 2005, 06:52 #24
- Join Date
- Dec 2004
- Location
- Vienna, AT
- Posts
- 171
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
das mit paypal das meinte ich ernst. ...
Du hast mir wirklich geholfen
-
Feb 9, 2005, 09:29 #25
- Join Date
- Dec 2004
- Location
- Vienna, AT
- Posts
- 171
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
togggggggggg
Ich glaube ich werde brauchen deine Hilfe.
noch ein bischen
Bookmarks