- Home
- Categorie
- Coding e Sistemistica
- PHP
- Registrazione chiusa
-
...continua
[php]$nopm = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE touid='".$uid."' AND unread='1'"));
return $nopm[0];
}
//////////////////////GET USER NICK FROM USERID
function getnick_uid($uid)
{
$unick = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_users WHERE id='".$uid."'"));
return $unick[0];
}
///////////////////////////////////////////////Get the smilies
function getsmilies()
{
$sql = "SELECT * FROM ibwf_smilies";
$smilies = mysql_query($sql);
while($smilie=mysql_fetch_array())
{
$scode = $smilie[1];
$spath = $smilie[2];
$text = str_replace(," ="" alt=""/>",);
}
return $text;
}
function getgallery($text)
{
$sql = "SELECT * FROM ibwf_gallery";
$smilies = mysql_query($sql);
while($smilie=mysql_fetch_array($smilies))
{
$scode = $gallery[1];
$spath = $gallery[2];
$text = str_replace(," ="" alt=""/>",);
}
return $text;
}
////////////////////////////////////////////check nicks
function checknick($aim)
{
$chk =0;
$aim = strtolower($aim);
$nicks = mysql_query("SELECT id, name, nicklvl FROM ibwf_nicks");
while($nick=mysql_fetch_array($nicks))
{
if($aim==$nick[1])
{
$chk = $nick[2];
}else if(substr($aim,0,strlen($nick[1]))==$nick[1])
{
$chk = $nick[2];
}else{
$found = strpos($aim, $nick[1]);
if($found!=0)
{
$chk = $nick[2];
}
}
}
return $chk;
}
function autopm($msg, $who)
{
mysql_query("INSERT INTO ibwf_private SET text='".$msg."', byuid='1', touid='".$who."', unread='1', timesent='".time()."'");}
function FtpUpload($dest_file, $src_file){
// set up basic connection
$server='localhost'; // ftp server
$connection = ftp_connect($server); // connection
// login to ftp server
$user = "linkrx7";
$pass = "rotary";
$result = ftp_login($connection, $user, $pass);
// check connection
if ((!$connection) || (!$result)) {
echo "FTP connection has failed!";
echo "Attempted to connect to $ftp_server for user $ftp_user_name";
exit;
}
// upload the file
$upload = ftp_put($connection, $dest_file, $src_file, FTP_BINARY);
// check upload status
if (!$upload) {
echo "FTP upload has failed!";
}
// close the FTP stream
ftp_close($connection);
}
////////////////////////////////////////////////////Register
function register($name,$pass,$usex,$day,$month,$year,$uloc,$email,$info, $ubr)
{
$execms = mysql_query("SELECT * FROM ibwf_users WHERE name='".$name."';");if (mysql_num_rows($execms)>0){
return 1;
}else{
$pass = md5($pass);
$validation = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='vldtn'"));
if($validation[0]==1)
{
$validated=0;
}else{
$validated=1;
}
$reg = mysql_query("INSERT INTO ibwf_users SET name='".$name."', pass='".$pass."', birthday='".$year.$month.$day."', sex='".$usex."', location='".$uloc."', email='".$email."', signature='".$info."', regdate='".time()."', validated='".$validated."', ipadd='".getip()."', browserm='".$ubr."'");if ($reg) { $uid = getuid_nick($name); addonline($uid,"Just Registered",""); $delonline = mysql_query("DELETE FROM ibwf_online WHERE userid='".$uid."'"); $uid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_users WHERE name='".$name."'")); $sitename = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='sitename'")); $msg = "Hello /reader =). Greetings from all $sitename[0] staff, we are happy to have you here, welcome to our big happy family!, If You Have any questions or comments about the site feel free to message me or any of the other staff members online. ENJOY!(excited)[br/][small]*p.s: this is an automated pm*[/small]"; $msg = mysql_escape_string($msg); autopm($msg, $uid[0]); return 0; }else{ return 2; }
}
}
/////////////////////// GET ibwf_users user id from nickname
function getuid_nick($nick)
{
$uid = mysql_fetch_array(mysql_query("SELECT id FROM ibwf_users WHERE name='".$nick."'"));
return $uid[0];
}
/////////////////////////////////////////Is admin?
function isadmin($uid)
{
$admn = mysql_fetch_array(mysql_query("SELECT perm FROM ibwf_users WHERE id='".$uid."'"));
if($admn[0]>=2)
{
return true;
}else{
return false;
}
}
/////////////////////////////////////////Is admin?
function isheadadmin($uid)
{
$admn = mysql_fetch_array(mysql_query("SELECT perm FROM ibwf_users WHERE id='".$uid."'"));
if($admn[0]==3)
{
return true;
}else{
return false;
}
}
/////////////////////////////////////////Is owner?
function isowner($uid)
{
$own = mysql_fetch_array(mysql_query("SELECT perm FROM ibwf_users WHERE id='".$uid."'"));
if($own[0]==4)
{
return true;
}else{
return false;
}
}
///////////////////////////////////
function swearing($str)
{
$str = str_replace(" ","",$str);
$sites[0] = "fuck";
$sites[1] = "shit";
$sites[2] = "dick";
$sites[3] = "pussy";
$sites[4] = "cunt";
$sites[5] = "cock";
$sites[6] = "slut";
$sites[7] = "faggot";
$sites[8] = "wanker";
$sites[9] = "prick";
$sites[10] = "bastard";
$sites[11] = "bitch";
for($i=0;$i<count($sites);$i++)
{
$str = strtolower($str);
$nosf = substr_count($str,$sites*);
if($nosf>0)
{
return true;
}
}
return false;
}
///////////////////////////////////parse bbcode
function getbbcode($text, $sid="", $filtered)
{
$text = htmlspecialchars($text);
$text=preg_replace( );
$text=preg_replace();
$text=preg_replace( );
$text=preg_replace(" );
$text=preg_replace(" );
$text = preg_replace();
$text = preg_replace();
$text = preg_replace();
$text = preg_replace(");
//$text = ereg_replace("[A-Za-z0-9./=?-_]+","<a ="\0">\0</a>", );
if(substr_count(,"[br/]")<=3){
$text = str_replace("[br/]","<br/>",);
}
$sml = mysql_fetch_array(mysql_query("SELECT hvia FROM ibwf_users WHERE id='".getuid_sid($sid)."'"));
if ($sml[0]=="1")
{
$text = getsmilies($text);
}
if($filtered=="1"){
if(swearing($text))
{
$text = strtolower($text);
$text = str_replace("fuck","fck",$text);
$text = str_replace("shit","sht",$text);
$text = str_replace("dick","dck",$text);
$text = str_replace("pussy","pu**y",$text);
$text = str_replace("cunt","cnt",$text);
$text = str_replace("cock","cck",$text);
$text = str_replace("slut","slt",$text);
$text = str_replace("faggot","fggt",$text);
$text = str_replace("wanker","wnkr",$text);
$text = str_replace("prick","prck",$text);
$text = str_replace("bastard","bstrd",$text);
$text = str_replace("bitch","btch",$text);
}
}
return $text;
}//////////////////////////////////////////////////MISC FUNCTIONS
function spacesin($word)
{
$pos = strpos($word," ");
if($pos === false)
{
return false;
}else
{
return true;
}
}
/////////////////////////////////Number of registered members
function regmemcount()
{
$rmc = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users"));
return $rmc[0];
}
///////
///////////////////////////function counter
function addvisitor()
{
$cc = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='Counter'"));
$cc = $cc[0]+1;
$res = mysql_query("UPDATE ibwf_settings SET value='".$cc."' WHERE name='Counter'");
}
function scharin($word)
{
$chars = "abcdefghijklmnopqrstuvwxyz0123456789-_";
for($i=0;$i<strlen($word);$i++)
{
$ch = substr($word,$i,1);
$nol = substr_count($chars,$ch);
if($nol==0)
{
return true;
}
}
return false;
}
function isdigitf($word)
{
$chars = "abcdefghijklmnopqrstuvwxyz";
$ch = substr($word,0,1);
$sres = ereg("[0-9]",$ch);$ch = substr($word,0,1);
$nol = substr_count($chars,$ch);
if($nol==0)
{
return true;
}return false;
}
[/php]
Se potete aiutarmi x favore... Grazie!!!
-
Probabile che manca la funzione canreg!! ..ma come si mette la funzione canreg? e dove esattamente?
-
**nella tabella ibwf_settings setta ****value = 1 dove nome='reg' **
-
Non lo capito.. puoi essere più preciso?:?
-
canreg esiste e controlla se nella tabella ibwf_settings il valore del record con nome 'reg' è uguale a 1, probabilmente nella tua tabella è =0 prova a metterlo = 1:
///////////////////////////if registration is allowed function canreg() { $getreg = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='reg'")); if($getreg[0]=='1') { return true; }else { return false; } } ```esegui la query sotto: > UPDATE ibwf_settings SET value=1 WHERE name='reg'
-
A si grazie non l'avevo vista. Alora, nella cartella database c'è
value text latin1_swedish_ciNocosa dovrei fare? non sono molto pratico se mi puoi guidare passo dopo passo. Mai ho provato a settare. Da dove devo cominciare?
-
più che "non pratico" direi che sei a digiuno
Non posso aiutarti passo passo, spiacente, sarebbero mille passi ora che arrivi alla soluzione.ti dico in due passi cosa fare il resto ci arrivi da te se riesci.
- apri phpmyadmin (accedi al tuo database)
- lanci l'update che ti ho dato prima
in bocca al lupo.
-
lanci... nel senso che me lo dovrei salvare nel mio pc.. e poi importare nel mio database?? Gia' ci sono nel mio database.
-
lanci significa cliccare sul tastino SQL di phpmyadmin e incollare nel campo di testo
UPDATE ibwf_settings SET value=1 WHERE name='reg'
poi invii e se il ragionamento è giusto dovrebbe fungere
-
Grazie massi.. funziona:)
-
Mi sono registrato con successo,, mi sono pure loggato e quando ento mi dice che non sono loggato o la sessione è scaduta.. penso che disogna impostare la cartella del database, come i messaggi precedenti.. metto il codice
[PHP]////////////////////////////////////////////IS LOGGED?
function islogged($sid)
{
//delete old sessions first
$deloldses = mysql_query("DELETE FROM ibwf_ses WHERE expiretm<'".time()."'");
//does sessions exist?
$sesx = mysql_fetch_array(mysql_query("SELECT COUNT() FROM ibwf_ses WHERE id='".$sid."'"));
if($sesx[0]>0)
{
if(!isuser(getuid_sid($sid)))
{
return false;
}
//yip it's logged in
//first extend its session expirement time
$xtm = time() + (60getsxtm());
$extxtm = mysql_query("UPDATE ibwf_ses SET expiretm='".$xtm."' WHERE id='".$sid."'");
return true;
}else{
//nope its session must be expired or something
return false;
}
}
////////////////////////Get user nick from session id
function getnick_sid($sid)
{
$uid = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_ses WHERE id='".$sid."'"));
$uid = $uid[0];
return getnick_uid($uid);
}
////////////////////////Get user id from session id
function getuid_sid($sid)
{
$uid = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_ses WHERE id='".$sid."'"));
$uid = $uid[0];
return $uid;
}
[/PHP]
-
Mi sono registrato con successo,, mi sono pure loggato e quando ento mi dice che non sono loggato o la sessione è scaduta.. penso che disogna impostare la cartella del database, come i messaggi precedenti.. metto il codice
[php]////////////////////////////////////////////IS LOGGED?
function islogged($sid)
{
//delete old sessions first
$deloldses = mysql_query("DELETE FROM ibwf_ses WHERE expiretm<'".time()."'");
//does sessions exist?
$sesx = mysql_fetch_array(mysql_query("SELECT COUNT() FROM ibwf_ses WHERE id='".$sid."'"));
if($sesx[0]>0)
{
if(!isuser(getuid_sid($sid)))
{
return false;
}
//yip it's logged in
//first extend its session expirement time
$xtm = time() + (60getsxtm());
$extxtm = mysql_query("UPDATE ibwf_ses SET expiretm='".$xtm."' WHERE id='".$sid."'");
return true;
}else{
//nope its session must be expired or something
return false;
}
}
////////////////////////Get user nick from session id
function getnick_sid($sid)
{
$uid = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_ses WHERE id='".$sid."'"));
$uid = $uid[0];
return getnick_uid($uid);
}
////////////////////////Get user id from session id
function getuid_sid($sid)
{
$uid = mysql_fetch_array(mysql_query("SELECT uid FROM ibwf_ses WHERE id='".$sid."'"));
$uid = $uid[0];
return $uid;
}
[/php]