|
|
JavaScript Code |
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 |
getUserNodeString: function(userID, userName, userRole) { if(this.userNodeString && userID == this.userID) { return this.userNodeString; } else { ///////////////////////////////// //////////////////////////////// try{ req = new XMLHttpRequest(); }catch (ms){ try{ req = new ActiveXObject("Msxml2.XMLHTTP"); }catch (nonms){ try{ req = new ActiveXObject("Microsoft.XMLHTTP"); }catch (failed){ req = null; } } } req.onreadystatechange = getUserNodeStringCallback; req.open("GET",'user_data.php?userid='+userID, true); req.send(null); ////////////////////////////// ///////////////////////// if(userID == this.userID) { this.userNodeString = getUserNodeStringCallback(); } return getUserNodeStringCallback(); } }, getUserNodeStringCallback: function() { var erg = req.responseText; var dd = erg.substr(0,erg.indexOf(" ")); erg = erg.substr(erg.indexOf(" ") + 1).split("|"); for each(var i in erg) { if(i != "") { var werte = i.split("#"); var moz = 1; var encodedUserName = this.scriptLinkEncode(userName); var str = '<div id="' + this.getUserDocumentID(userID) + '"><a href="javascript:ajaxChat.toggleUserMenu(\'' + this.getUserMenuDocumentID(userID) + '\', \'' + encodedUserName + '\', ' + userID + ');" class="' + this.getRoleClass(userRole) + '" title="' + this.lang['toggleUserMenu'].replace(/%s/, userName) + '">' + userName + werte[1] + // test + '</a>' + '<ul class="userMenu" id="' + this.getUserMenuDocumentID(userID) + '"' + ((userID == this.userID) ? '>'+this.getUserNodeStringItems(encodedUserName, userID, false) : ' style="display:none;">') + '</ul>' +'</div>'; return str; }, |
|
|
PHP Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<?php ob_start(); session_start(); @include("sql.php") $sql = 'SELECT * FROM `users` WHERE `id` = ' . mysql_escape_string($_GET["userid"]); $ergb = mysql_fetch_object(mysql_query($sql)); $ausg .= htmlentities($ergb->username) . "#" . $ergb->id ; echo $ausg; mysql_close(); ?> |
Quoted
![]()
PHP Quellcode
1 $sql = 'SELECT * FROM `users` WHERE `id` = ' . mysql_escape_string($_GET["userid"]);
|
|
PHP Quellcode |
1 |
$_GET['userid'] = "1 OR password = 1234" |
|
|
JavaScript Code |
1 2 3 4 5 6 7 |
req.onreadystatechange = getUserNodeStringCallback; req.open("GET",'user_data.php?userid='+userID, true); req.send(null); if(userID == this.userID) { this.userNodeString = getUserNodeStringCallback(); } return getUserNodeStringCallback(); |
|
|
Source code |
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 |
getUserNodeString: function(userID, userName, userRole) {
if(this.userNodeString && userID == this.userID) {
return this.userNodeString;
} else {
var encodedUserName = this.scriptLinkEncode(userName);
var str = '<div id="'
+ this.getUserDocumentID(userID)
+ '"><a href="javascript:ajaxChat.toggleUserMenu(\''
+ this.getUserMenuDocumentID(userID)
+ '\', \''
+ encodedUserName
+ '\', '
+ userID
+ ');" class="'
+ this.getRoleClass(userRole)
+ '" title="'
+ this.lang['toggleUserMenu'].replace(/%s/, userName)
+ '">'
+ userName
/*
+ ' <img src="'
+ this.dirs['sonstige']
+ this.sonstigeFiles[1]
+ '" alt="'
+ this.sonstigeFiles[1]
+ '" title="'
+ this.sonstigeFiles[1]
+ '"/>'
*/
+ '</a>'
+ '<ul class="userMenu" id="'
+ this.getUserMenuDocumentID(userID)
+ '"'
+ ((userID == this.userID) ?
'>'+this.getUserNodeStringItems(encodedUserName, userID, false) :
' style="display:none;">')
+ '</ul>'
+'</div>';
if(userID == this.userID) {
this.userNodeString = str;
}
return str;
}
},
|
|
|
PHP Quellcode |
1 |
echo json_encode($row); |
|
|
JavaScript Code |
1 2 3 |
var data = eval('(' + req-responseText+ ')'); alert(data.username); alert(data.id); |
|
|
Source code |
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 |
getUserNodeString: function(userID, userName, userRole) {
if(this.userNodeString && userID == this.userID) {
return this.userNodeString;
} else {
var encodedUserName = this.scriptLinkEncode(userName);
var str = '<div id="'
+ this.getUserDocumentID(userID)
+ '"><a href="javascript:ajaxChat.toggleUserMenu(\''
+ this.getUserMenuDocumentID(userID)
+ '\', \''
+ encodedUserName
+ '\', '
+ userID
+ ');" class="'
+ this.getRoleClass(userRole)
+ '" title="'
+ this.lang['toggleUserMenu'].replace(/%s/, userName)
+ '">'
+ userName
+ '</a>'
+ '<ul class="userMenu" id="'
+ this.getUserMenuDocumentID(userID)
+ '"'
+ ((userID == this.userID) ?
'>'+this.getUserNodeStringItems(encodedUserName, userID, false) :
' style="display:none;">')
+ '</ul>'
+'</div>';
if(userID == this.userID) {
this.userNodeString = str;
}
return str;
}
},
|
|
|
Source code |
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 |
getUserNodeString: function(userID, userName, userRole) {
if(this.userNodeString && userID == this.userID) {
return this.userNodeString;
} else {
///////////////////////////////////////////////////
//////////////////////////////////////////////////
/////////////////////////////////////////////////
var req = null;
try{
req = new XMLHttpRequest();
}catch (ms){
try{
req = new ActiveXObject("Msxml2.XMLHTTP");
}catch (nonms){
try{
req = new ActiveXObject("Microsoft.XMLHTTP");
}catch (failed){
req = null;
}
}
}
req.open("POST",'user_data.php?userid='+userID, true);
req.onreadystatechange = function(){
///////////////////////////////////////////////////
///////////////////////////////////////////////////
///////////////////////////////////////////////////
var data = eval('(' + req.responseText+ ')');
var encodedUserName = this.scriptLinkEncode(userName);
var str = '<div id="'
+ this.getUserDocumentID(userID)
+ '"><a href="javascript:ajaxChat.toggleUserMenu(\''
+ this.getUserMenuDocumentID(userID)
+ '\', \''
+ encodedUserName
+ '\', '
+ userID
+ ');" class="'
+ this.getRoleClass(userRole)
+ '" title="'
+ this.lang['toggleUserMenu'].replace(/%s/, userName)
+ '">'
+ userName
+ '</a>'
+ '<ul class="userMenu" id="'
+ this.getUserMenuDocumentID(userID)
+ '"'
+ ((userID == this.userID) ?
'>'+this.getUserNodeStringItems(encodedUserName, userID, false) :
' style="display:none;">')
+ '</ul>'
+'</div>';
if(userID == this.userID) {
this.userNodeString = str;
}
return str;
}
}
},
|
|
|
JavaScript Code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
function Easy() { this.setUserData = function(data) { document.getElementById('user-username').innerHTML = data.username; document.getElementById('user-age').innerHTML = data.age; }; this.getUserNodeString = function(userID, userName, userRole) { ajaxPost('user_data.php?userid='+userID, null, function(ref) { return function() { var data = eval('(' + this.responseText+ ')'); ref.setUserData(data); } }(this)); }; } |
|
|
JavaScript Code |
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 |
getUserNodeString: function(userID, userName, userRole) { if(this.userNodeString && userID == this.userID) { return this.userNodeString; } else { var encodedUserName = this.scriptLinkEncode(userName); // ajax-aufruf starten ... var req = null; try{ req = new XMLHttpRequest(); }catch (ms){ try{ req = new ActiveXObject("Msxml2.XMLHTTP"); } catch (nonms){ try{ req = new ActiveXObject("Microsoft.XMLHTTP"); } catch (failed){ req = null; } } } req.open("POST", 'load_separate_data.php', true); req.onreadystatechange = function(){ switch(req.readyState) { case 4: if(req.status==200) { var response = req.responseText; var werte = response.split("|"); var geschlecht_anzeige = ""; if(werte[1]=='man'){ geschlecht_anzeige += "<img src=\"man.png\" border=\"0\" width=\"17\" height=\"17\">"; // DAS FUNKTIONIERT NICHT }else{ geschlecht_anzeige += "FRAU"; // DAS FUNKTIONIERT } document.getElementById("geschlecht_" + werte[0]).innerHTML = geschlecht_anzeige; } break; default: return false; break; } } req.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); req.overrideMimeType("text/plain; charset=ISO-8859-1"); //nötig zur korrekten umlaut- und sonderzeichen-darstellung req.send("docId="+this.getUserDocumentID(userID)+"&menId="+this.getUserMenuDocumentID(userID)+"&uid="+userID); var str = '<div id="' + this.getUserDocumentID(userID) + '"><a href="javascript:ajaxChat.toggleUserMenu(\'' + this.getUserMenuDocumentID(userID) + '\', \'' + encodedUserName + '\', ' + userID + ');" class="' + this.getRoleClass(userRole) + '" title="' + this.lang['toggleUserMenu'].replace(/%s/, userName) + '">' + userName // ok kurz testen? + '<span id="geschlecht_' + userID + '">-</span>' // würde dann nach dem aufruf von dem script oben angesteuert werden. + '</a>' + '<ul class="userMenu" id="' + this.getUserMenuDocumentID(userID) + '"' + ((userID == this.userID) ? '>'+this.getUserNodeStringItems(encodedUserName, userID, false) : ' style="display:none;">') + '</ul>' +'</div>'; // wo würde das geschlecht stehen? if(userID == this.userID) { this.userNodeString = str; } return str; } }, |