זה דף שממנו עורכים משתמשים מהניהול של המערכת שאני בונה , בדף ניהול בוחרים את המשתמש ולוחצים על submit מהפקודה <form> .
שזה שולח לדף של העריכה של המשתמש שבחרתי זה מראה לי :
Database INSERT Error
זה לא בעיה בדף שאני בוחר משתמש כי בדף שאני בוחר משתמש יש אפשרות שמוחקת משתמש והיא עובדת על אותו עיקרון ..
מה הבעיה בקוד ?
PHP קוד:
<?
session_start();
include "../affconfig.php";
include "../lang/$language";
if(!aff_admin_check_security())
{
aff_redirect('index.php');
exit;
}
mysql_connect($server, $db_user, $db_pass) or die ("Database CONNECT Error (line 18)");
$errorMsg = '';
if($_POST['commited'] == 'yes')
{
// check
if($_POST['password'] == '')
$errorMsg .= AFF_SI_PWDMISSING.'<br>';
if($_POST['clientemail'] == '')
$errorMsg .= AFF_SI_EMAILMISSING.'<br>';
if($errorMsg == '')
{
mysql_db_query($database, "UPDATE affiliates SET pass = '".$_POST['password']."', company = '".$_POST['clientcompany']."', payableto = '".$_POST['clientpayableto']."', title = '".$_POST['clienttitle']."', firstname = '".$_POST['clientfirstname']."', lastname = '".$_POST['clientlastname']."', email = '".$_POST['clientemail']."', street = '".$_POST['clientstreet']."', town = '".$_POST['clienttown']."', county = '".$_POST['clientcounty']."', country = '".$_POST['clientcountry']."', postcode = '".$_POST['clientpostcode']."', website = '".$_POST['webpage']."', phone = '".$_POST['clientphone']."', fax = '".$_POST['clientfax']."' WHERE refid = '".$_POST['edit']."'")
or die ("Database INSERT Error (line 7)");
echo "<p align=center><font color=#009900>".AFF_D_CHANGED."</font></p>";
}
}
$result = mysql_db_query($database, "select * from affiliates where refid = '".$_REQUEST['edit']."' ORDER BY id DESC") or die ("Database INSERT Error (line 19)");
if($errorMsg != '')
echo "<p align=center><font color=#ff0000>$errorMsg</font></p>";
if (mysql_num_rows($result))
{
while ($qry = mysql_fetch_array($result))
{
print "<form action=adetails.php method=post ENCTYPE=multipart/form-data>
<p><font face=verdana><small> </small></font><font face=verdana><small></small></font></p>
<font face=verdana><small>
<div align=center>
<p>
<table border=0>
<tr>
<td width=170>Affiliate ID: </td>
<td width=152>".$_SESSION['aff_valid_user']."</td>
</tr>
<tr>
<td>Password: </td>
<td>
<input type=password name=password value=\"$qry[pass]\">
</td>
</tr>
<tr>
<td>Company: </td>
<td>
<input type=text name=clientcompany value=\"$qry[company]\">
</td>
</tr>
<tr>
<td>Title: </td>
<td>
<select name=clienttitle>
<option value=Mr>Mr</option>
<option value=Mrs>Mrs</option>
<option value=Miss>Miss</option>
<option value=Ms>Ms</option>
<option value=Dr>Dr</option>
</select>
</td>
</tr>
<tr>
<td>First Name: </td>
<td>
<input type=text name=clientfirstname value=\"$qry[firstname]\">
</td>
</tr>
<tr>
<td>Last Name: </td>
<td>
<input type=text name=clientlastname value=\"$qry[lastname]\">
</td>
</tr>
<tr>
<td>Email: </td>
<td>
<input type=text name=clientemail value=\"$qry[email]\">
</td>
</tr>
<tr>
<td>Street: </td>
<td>
<input type=text name=clientstreet value=\"$qry[street]\">
</td>
</tr>
<tr>
<td>Town: </td>
<td>
<input type=text name=clienttown value=\"$qry[town]\">
</td>
</tr>
<tr>
<td>County/State: </td>
<td>
<input type=text name=clientcounty value=\"$qry[county]\">
</td>
</tr>
<tr>
<td>Country: </td>
<td>
<select name=clientcountry class=dropdown value=\"$qry[country]\">
<option value=AF>Afghanistan
<option value=AL>Albania
</select>
</td>
</tr>
<tr>
<td>Postcode/Zip: </td>
<td>
<input type=text name=clientpostcode value=\"$qry[postcode]\">
</td>
</tr>
<tr>
<td>Web Site Address: </td>
<td>
<input type=text name=webpage value=\"$qry[website]\">
</td>
</tr>
<tr>
<td>Phone Number: </td>
<td>
<input type=text name=clientphone value=\"$qry[phone]\">
</td>
</tr>
<tr>
<td>Fax Number: </td>
<td>
<input type=text name=clientfax value=\"$qry[fax]\">
</td>
</tr>
<tr>
<td height=37 colspan=2 valign=top>
<center>
<input type=hidden name=commited value=yes>
<input type=submit name=Submit>
</center>
</td>
</tr>
</table>
<p></p>
</div>
</small></font>
</form>
</p>";
}
}
?>
הבעיה כאן :
PHP קוד:
mysql_db_query($database, "UPDATE affiliates SET pass = '".$_POST['password']."', company = '".$_POST['clientcompany']."', payableto = '".$_POST['clientpayableto']."', title = '".$_POST['clienttitle']."', firstname = '".$_POST['clientfirstname']."', lastname = '".$_POST['clientlastname']."', email = '".$_POST['clientemail']."', street = '".$_POST['clientstreet']."', town = '".$_POST['clienttown']."', county = '".$_POST['clientcounty']."', country = '".$_POST['clientcountry']."', postcode = '".$_POST['clientpostcode']."', website = '".$_POST['webpage']."', phone = '".$_POST['clientphone']."', fax = '".$_POST['clientfax']."' WHERE refid = '".$_POST['edit']."'")
or die ("Database INSERT Error (line 7)");