Help with php
Posted: Thu Sep 03, 2009 10:35 pm
I have created a script for my listing site and this script does is asks user to add a line of code to his/her site to verify that they are the owner of the sites...
The script is working fine with one big flaw.
Say a user goes to verify the code put on her/her sites they add the code to one site but not the other and hit verify...
the script will update all sites as verified and not just the site that actually has the code.
I assume the problem is in the line
$ver_update=("UPDATE `sit_details_tmp` SET `id_verification` = '2' WHERE `email` = '".$_SESSION[EMAIL]."'") or die(mysql_error());
but I can't think of another way to write it so that it only updates the site that has the verification code.
If anyone has an idea of how I could fix this it sure would be appreciated.
Thanks in advance!!
Code: Select all
<?php
session_start();
include("config.php");
$sql_site = ("SELECT * FROM sit_details_tmp WHERE `email` = '$_SESSION[EMAIL]' ");
$site_con = mysql_query($sql_site, $conn) or die(mysql_error());
$numrows = mysql_num_rows($site_con);
if($numrows > 0){
while($row = mysql_fetch_array($site_con))
{
$partnersURL="$row[Url]";
$htmlString=file_get_contents($partnersURL);
$var_code = "$row[ver_code]";
if (eregi($var_code, $htmlString)) {
$ver_update=("UPDATE `sit_details_tmp` SET `id_verification` = '2' WHERE `email` = '".$_SESSION[EMAIL]."'") or die(mysql_error());
if (!mysql_query($ver_update,$conn))
{
die('Error: ' . mysql_error());
}
echo '<script language=javascript>';
echo 'alert("Validation code was found! \n Your site has been successfully verified.");';
echo '</script>';
echo '<SCRIPT language="JavaScript">
<!--
window.location="my_account.php";
//-->
</SCRIPT>
';
}else{
echo"$var_code";
echo '<script language=javascript>';
echo 'alert("Validation code was not found! \n Please make sure you have entered the correct \n validation code and that its on the index page of your site.");';
echo '</script>';
echo '<SCRIPT language="JavaScript">
<!--
window.location="my_account.php";
//-->
</SCRIPT>
';
}
}
}else{
echo"User not logged.";
}
?>Say a user goes to verify the code put on her/her sites they add the code to one site but not the other and hit verify...
the script will update all sites as verified and not just the site that actually has the code.
I assume the problem is in the line
$ver_update=("UPDATE `sit_details_tmp` SET `id_verification` = '2' WHERE `email` = '".$_SESSION[EMAIL]."'") or die(mysql_error());
but I can't think of another way to write it so that it only updates the site that has the verification code.
If anyone has an idea of how I could fix this it sure would be appreciated.
Thanks in advance!!