Seditio ve Ldu hakkında sınırsız arama yapın
 
 
> 1 <

Etiketler: users kontrol sorunu

Author Message

core1

Members


Online status

129 posts

Location: Turkey
Occupation:
Age:

#19967   2008-03-22 14:43 GMT      

Arkadaşlar Bu kodu Sanırım users.register.tpl ye incude etmemizi istiyorlar ben yapamadım tam nereye incude etceğimi kodları veriyorum bilen biri varsa lütfen yardım etsin

Code:
<?php
// Include the Sajax library
include "Sajax2.php";

// Open conection to the database
mysql_connect('localhost', 'username', 'password');
mysql_select_db('database');

/*
CREATE TABLE `users` (
`user_id` INT( 9 ) NOT NULL AUTO_INCREMENT ,
`username` VARCHAR( 50 ) NOT NULL ,
`password` VARCHAR( 32 ) NOT NULL ,
PRIMARY KEY ( `user_id` ) ,
UNIQUE (`username`)
);

INSERT INTO `users` ( `username` , `password` ) VALUES ('username', 'password');
INSERT INTO `users` ( `username` , `password` ) VALUES ('tom', 'password');
INSERT INTO `users` ( `username` , `password` ) VALUES ('bill', 'password');
INSERT INTO `users` ( `username` , `password` ) VALUES ('bob', 'password');
*/

// Function to check if a username exists inside the database
function check_user_exist($username) {
$username = mysql_escape_string($username);
// Make a list of words to postfix on username for suggest
$suggest = array('007', '1', 'theman', 'rocks');
//$suggest = array();
$sql = "SELECT `username` FROM `users` WHERE `username` = '$username'";
$result = mysql_query($sql);
if(mysql_num_rows($result) > 0) {
// Username not available
$avail[0] = 'no';
$i = 2;
// Loop through suggested ones checking them
foreach($suggest AS $postfix) {
$sql = "SELECT `username` FROM `users` WHERE `username` = '".$username.$postfix."'";
$result = mysql_query($sql);
if(mysql_num_rows($result) < 1) {
$avail[$i] = $username.$postfix;
$i ++;
}
}
$avail[1] = $i - 1;
return $avail;
}
// Username is available
return array('yes');
}

sajax_init(); // Intialize Sajax
//$sajax_debug_mode = 1; //Uncomment to put Sajax in debug mode
sajax_export("check_user_exist"); // Register the function
sajax_handle_client_request(); // Serve client instances
?>

<html>
<head>
<title>Gmail Style Check Username AJAX</title>
<script type="text/javascript">
<?php
sajax_show_javascript();
?>
function check_handle(result) {
if(result[0] == 'yes') {
document.getElementById('not_available').style.display = 'none';
document.getElementById('available').style.display = 'block';
}
else {
document.getElementById('available').style.display = 'none';
document.getElementById('not_available').style.display = 'block';
var str = 'Sorry that username is not available try these <br />';
for(i = 1; i < result[1]; i++) {
str += "<input type=\"radio\" name=\"try\" onclick=\"switch_username('"+result[i+1]+"')\"/>" + result[i+1] + "<br />";
}
document.getElementById('not_available').innerHTML = str;
}
}

function check_user_exist() {
var username = document.getElementById('username').value;
x_check_user_exist(username, check_handle);
}

function switch_username(username) {
document.getElementById('username').value = username;
}
</script>

<style type="text/css">
        @import url( test.css );
#available {
display: none;
color: green;
}
#not_available {
display: none;
color: red;
}
</style>
</head>
<body>
<h2>AJAX Check Username</h2>
<p>The following does a gmail style check on the username supplied to see if it is a unqiue username, using the AJAX method.
<br />If not, it makes some suggestions to ones which are available. It uses a development version of Sajax.
<br /><a href="username-ajax.phps">View Source</a> (<a href="Sajax2.phps">Sajax2.php</a>) | <a href="">Comments</a> | <a href="ajax_user.zip">Download Files</a></p>
<h2>Example</h2>
Some examples of taken usernames are: <strong>tom</strong> , <strong>bill</strong>, <strong>bob</strong>, <strong>username</strong><br />
<input type="text" name="username" id="username" size="20" value="tom">
<input type="button" name="check" value="Check Username"
onclick="check_user_exist(); return false;">

<div id="available">
Username is available!
</div>

<div id="not_available">
Sorry that username is not available.
</div>


</body>
</html>

Kripteks

Bilgili Üye


Online status

440 posts

Location: Turkey Eskisehir
Occupation: PhP Delisi
Age: 26

#19969   2008-03-22 14:52 GMT      
Yapmak/Olmasini istedigin nedir ?
+
Konuyu daha önce acmis'sin:
http://www.seditio-tr.com/son6900-users-kontrol-sorunu-last.html#bottom
Internetim kapandi, izin'lerden sonra actiracam insallah!

core1

Members


Online status

129 posts

Location: Turkey
Occupation:
Age:

#19970   2008-03-22 14:56 GMT      

pardon

Kripteks

Bilgili Üye


Online status

440 posts

Location: Turkey Eskisehir
Occupation: PhP Delisi
Age: 26

#19977   2008-03-22 15:19 GMT      
Quote
core1 :
pardon



Arkasi ?
Sorununu cözdunmu yoksa ?
Internetim kapandi, izin'lerden sonra actiracam insallah!

core1

Members


Online status

129 posts

Location: Turkey
Occupation:
Age:

#19978   2008-03-22 15:37 GMT      
Quote
Kripteks :
Quote
core1 :
pardon



Arkasi ?
Sorununu cözdunmu yoksa ?



anlamadım

Kripteks

Bilgili Üye


Online status

440 posts

Location: Turkey Eskisehir
Occupation: PhP Delisi
Age: 26

#19979   2008-03-22 16:30 GMT      
Konu'yu neden actin ?
Internetim kapandi, izin'lerden sonra actiracam insallah!
> 1 <

Benzer konular (Similar topics) #BETA

KonularMesajlarSon YazarGüncelleme
Users Kontrol Sorunu4Xiao142 Gün
users kontrol.4Kaan43 Gün
users kontrol2Kaan64 Gün
Kontrol Panelleri2Dvdbil450 Gün
Büyük Harf Kontrol Sistemi9Xiao116 Gün

Keywords (beta):

Forum Arşiv (beta):

[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] [140] [141] [142] [143] [144] [145] [146] [147] [148] [149] [150] [151] [152] [153] [154] [155] [156] [157] [158] [159] [160] [161] [162] [163] [164] [165] [166] [167] [168] [169] [170] [171] [172] [173] [174] [175] [176] [177] [178] [179] [180] [181] [182]