Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.
preg_match errors
Hey, i got this code
require_once('core.php');
require_once('top.php');
require_once('left.php');
?>
<td>
<?php
if(!isset($username_cu)){
print "You Must Be Logged In To Edit A Profile";
}else{
//set the vars
$email = $_POST['email'];
$avatar = $_POST['avatar'];
$sig = htmlentities($_POST['sig']);
$dob = $_POST['dob'];
$aim = $_POST['aim'];
$msn = $_POST['msn'];
$skype = $_POST['skype'];
//checks if the user has inputted anything into the fields
if($_POST){
print "<table><tr><Td>";
//email
if(!preg_match("/\>\<\(\)-0-9A-Z_\$\+\^\.\/\\/", $email) | !preg_match("/@/")){
print "Email Is Invalid And/or COntains Invalid Characters";
}else{
//Edit The Email Section
$email_edit = "UPDATE `users` SET `email` = '$email' WHERE `name` = '$username' LIMIT 1";
$email_update = mysql_query($email_edit);
}
//avatar
if(!preg_match("/[-0-9A-Z_@\$\+\.\\/", $avatar)){
print "Avatar Location Contains Invalid Characters";
}else{
//Edit the Avatar Section
$avatar_edit = "UPDATE `users` SET `avvie` = '$avatar' WHERE `name` = $username LIMIT 1";
$avatar_update = mysql_query($avatar_edit);
}
//skype
if(!preg_match("/\<\>\(\)\'\^-0-9A-Z_\$\+\^\/\\/", $skype)){
print "Skype Name Contains Invalid Characters";
}else{
//Edit The Skype Section
$skype_edit = "UPDATE `users` SET `skype` = '$skype' WHERE `name` = $username LIMIT 1";
$skype_update = mysql_query($skype_edit);
}
//password
if($pass!= $pass_2){
print "Both Passwords Must Be The Same";
}else{
$password_edit = "UPDATE `users` SET `password` = '$password' WHERE `name` = $username LIMIT 1";
$password_update = mysql_query($password_edit);
}
//aim
if(!preg_match("/-0-9A-Z_@\$\^\+\/\\/", $aim)){
print "AIM address Contains Invalid Characters";
}else{
$aim_edit = "UPDATE `users` SET `aim` = '$aim' WHERE `name` = $username LIMIT 1";
$aim_update = mysql_query($aim_edit);
}
//msn
if(!preg_match("/-0-9A-Z_@\$\+/.\^\/\\/", $msn)){
print "<br>Msn Address Contains Invalid Characters";
}else{
$msn_edit = "UPDATE `users` SET `msn` = '$msn' WHERE `name` = $username LIMIT 1";
$msn_update = mysql_query($msn_edit);
}
/* //dob
if(!preg_match("/0-9/", $dob)){
print "<br>Date Of Birth Contains Invalid Characters";
}else{
$dob_edit = "UPDATE `users` SET `dob` = '$dob' WHERE `name` = $username LIMIT 1";
$dob_update = mysql_query($dob_edit);
}
*/
print "<br>All changes Saved Sucsessfully!<br>";
print "</td></tr></table>";
//if the user doesnt input anything , then display the form
}
print "<form method=post>";
print "<table>";
print "<tr>";
print "<td>Password</td>";
print "<td><input class=tb type='password' name='pass' value=''></td>";
print "</tr>";
print "<tr>";
print "<td>Confirm Password</td>";
print "<td><input class=tb type='password' name='pass_2' value=''></td>";
print "</tr>";
print "<tr>";
print "<td>Msn</td>";
print "<td><input class=tb type='text' name='msn' value='" . $current['msn'] . "'></td>";
print "</tr>";
print "<tr>";
print "<td>AIM</td>";
print "<td><input class=tb type='text' name='aim' value='" . $current['aim'] . "'></td>";
print "</tr>";
print "<tr>";
print "<td>Skype</td>";
print "<td><input class=tb type='text' name='skype' value='" . $current['skype'] . "'></td>";
print "</tr>";
print "<tr>";
print "<td>Avatar</td>";
print "<td><input class=tb type='text' name='avatar' value='" . $current['avvie'] . "'></td>";
print "</tr>";
print "<tr>";
print "<td>Email</td>";
print "<td><input class=tb type='text' name='email' value='" . $current['email'] . "'></td>";
print "</tr>";
print "<tr>";
print "<td>Signiture</td>";
print "<td> <textarea cols=70 rows=8 class=ta name='sig'>" . $current['sig'] . "</textarea></td></tr>";
print "<Tr><td colspan=2 align=center><input type=submit name=submit value=Submit! class=button></td>";
print "</tr></table>";
}
print "</td>";
require_once('right.php');
require_once('bottom.php');
?>
ok but i keep getting preg_match errors. Any help? Thanks :happy:
//password
if($pass != $pass_2){
print "<br>Both Passwords Must Be The Same";
}else{
$password_edit = "UPDATE `users` SET `password` = '$new_pwd' WHERE `name` = '$username_cu' LIMIT 1";
$password_update = mysql_query($password_edit) or
mysql_error();
}
Added the single quotes around $username_cu, and where is $new_pwd being defined?