📄 verify.php
字号:
<?php
require( "inc/init.php" );
require( "inc/mysql.php" );
require( "inc/functions.php" );
require( "inc/pfunctions.php" );
require( "inc/qfunctions.php" );
$varnames = array( "sid", "uid", "emailaddr", "vsubmit" );
setvars( $varnames );
$relocateURL = "error.php";
if ( !ini_get( "sendmail_path" ) && !ini_get( "SMTP" ) )
{
header( "Location: {$relocateURL}?errormsg=NoMailSupport" );
exit( );
}
if ( !$uid || !$sid )
{
header( "Location: {$relocateURL}" );
exit( );
}
$mqsurvey = mysql_query( "select * from phpQSurvey where SID = \"".protectmysql( $sid )."\"" );
if ( !( $masurvey = mysql_fetch_array( $mqsurvey ) ) )
{
header( "Location: {$relocateURL}" );
exit( );
}
$mquser = mysql_query( "select * from phpQUser where UID = \"".protectmysql( $uid )."\" and SID = \"".protectmysql( $sid )."\"" );
if ( !( $mauser = mysql_fetch_array( $mquser ) ) )
{
header( "Location: {$relocateURL}" );
exit( );
}
setlanguage( $masurvey['Language'] );
$errorstyle = $masurvey['ErrorStyle'] ? $masurvey['ErrorStyle'] : "color: red;";
if ( $emailaddr )
{
if ( !ereg( "@", $emailaddr ) || !ereg( "\\.", $emailaddr ) )
{
$errormsg = sprintf( $phpQlang['EmailInvalid'], protecthtml( $emailaddr ) );
}
else
{
$mysqlemailaddr = protectmysql( $emailaddr );
$mqemailcheck = mysql_query( "select 1 from phpQUser where Email = \"{$mysqlemailaddr}\" && SID = \"".protectmysql( $sid )."\"" );
$mquidcheck = mysql_query( "select Email from phpQUser where UID = \"".protectmysql( $uid )."\" && SID = \"".protectmysql( $sid )."\"" );
if ( $maemailcheck = mysql_fetch_array( $mqemailcheck ) )
{
$errormsg = sprintf( $phpQlang['EmailDuplicate'], protecthtml( $emailaddr ) );
}
else if ( ( $mauidcheck = mysql_fetch_array( $mquidcheck ) ) && $mauidcheck['Email'] )
{
header( "Location: confirm.php?uid={$uid}&sid={$sid}" );
exit( );
}
else
{
$scriptloc = "";
if ( $HTTP_HOST != "" )
{
$scriptloc .= "http://{$HTTP_HOST}";
}
else if ( $HTTP_SERVER_VARS['HTTP_HOST'] != "" )
{
$scriptloc .= "http://".$HTTP_SERVER_VARS['HTTP_HOST'];
}
$php_self = $PHP_SELF ? $PHP_SELF : $HTTP_SERVER_VARS['PHP_SELF'];
if ( !$php_self && $HTTP_SERVER_VARS['REQUEST_URI'] )
{
$php_self = $HTTP_SERVER_VARS['REQUEST_URI'];
}
$scriptloc .= preg_replace( "/(.*)\\/(.*?)\\.php/", "\\1", $php_self );
$confirmpswd = $mauser['Confirm'];
$confirmurl = $scriptloc."/confirm.php?uid={$uid}&sid={$sid}&upasswd={$confirmpswd}";
if ( $masurvey['VerifyEmail'] )
{
$emailmsg = $masurvey['VerifyEmail'];
}
else
{
$emailmsg = $phpQlang['EmailDefaultMessage'];
}
$emailmsg = str_replace( "::SurveyName::", $masurvey['Name'], $emailmsg );
$emailmsg = str_replace( "::ConfirmPassword::", $confirmpswd, $emailmsg );
$emailmsg = str_replace( "::ConfirmURL::", $confirmurl, $emailmsg );
$from = $masurvey['EmailFrom'] ? "From: ".$masurvey['EmailFrom'] : "From: ".$phpQlang['EmailDefaultFrom'];
$subject = $masurvey['EmailSubject'] ? $masurvey['EmailSubject'] : sprintf( $phpQlang['EmailDefaultSubject'], $masurvey['Name'] );
mail( $emailaddr, $subject, $emailmsg, $from );
mysql_query( "update phpQUser set Email = \"{$mysqlemailaddr}\" where UID = \"".protectmysql( $uid )."\" and SID = \"".protectmysql( $sid )."\"" );
header( "Location: confirm.php?uid={$uid}&sid={$sid}" );
exit( );
}
}
}
$buttonsubmit = getbutton( $masurvey, "submit" );
if ( !$errormsg && $vsubmit )
{
$errormsg = $phpQlang['EmailEmpty'];
}
$contents = "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=".$masurvey['Width']."><TR><TD ALIGN=center><TABLE CELLSPACING=0 CELLPADDING=2 BORDER=0>\n";
$contents .= "<TR><TD>".$phpQlang['VerifyRequest']."</TD></TR>\n";
$contents .= "</TABLE>\n";
$contents .= "<TABLE CELLPADDING=2 CELLSPACING=0 BORDER=0>\n";
$contents .= "<FORM ACTION=verify.php METHOD=POST>\n";
$contents .= "<INPUT TYPE=hidden NAME=sid VALUE={$sid}>\n";
$contents .= "<INPUT TYPE=hidden NAME=uid VALUE={$uid}>\n";
$contents .= "<INPUT TYPE=hidden NAME=vsubmit VALUE=1>\n";
if ( $errormsg )
{
$contents .= "<TR><TD COLSPAN=3 STYLE=\"{$errorstyle}\">{$errormsg}</TD></TR>\n";
}
$contents .= "<TR>\n";
$contents .= "<TD>".$phpQlang['EmailPrompt']."</TD>\n";
$contents .= "<TD><INPUT TYPE=text NAME=emailaddr VALUE=\"".protecthtml( $emailaddr )."\"></TD>\n";
$contents .= "<TD>{$buttonsubmit}</TD>\n";
$contents .= "</TR>\n";
$contents .= "</FORM>\n";
$contents .= "</TABLE></TD></TR></TABLE>\n";
createpage( $sid, sprintf( $phpQlang['VerifyTitle'], $masurvey['Name'] ), $contents, false, "" );
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -