php - Function page syntax error -
i can't find missing curly brace, getting message "parse error: syntax error, unexpected $end in /site/public_html/core/functions/users.php on line 75"
for following code..
<?php function activate($email, $email_code) { $email = mysql_real_escape_string($email); $email_code = mysql_real_escape_string($email_code); if (mysql_result(mysql_query("select count(`user_id`) `users` `email` = '$email' , `email_code` = '$email_code' , `active` = 0"), 0) == 1) { mysql_query("update `users` set `active` = 1 `email` = '$email'"); return true; } else { return false; } function change_password ($user_id, $password) { $user_id = (int)$user_id; $password = md5($password); mysql_query("update `users` set `password` = '$password' `user_id` = $user_id"); } function register_user($register_data) { array_walk($register_data, 'array_sanitize'); $register_data['password'] = md5($register_data['password']); $fields = '`' . implode('`, `', array_keys($register_data)) . '`'; $data = '\'' . implode('\', \'', $register_data) . '\''; mysql_query("insert `users` ($fields) values ($data)"); email($register_data['email'], 'activate account', " hello " . $register_data['username'] . ", \n\n need activate account, use link below: \n\nhttp://www.mysite.com/activate.php?email=" . $register_data['email'] . "&email_code=" . $register_data['email_code'] . "\n\n~admin~ "); } function user_count() { return mysql_result(mysql_query("select count('user_id') `users` `active` = 1"), 0); } function user_data($user_id) { $data = array(); $user_id = (int)$user_id; $func_num_args = func_num_args(); $func_get_args = func_get_args(); if ($func_num_args > 1) { unset($func_get_args[0]); $fields = '`' . implode('`, `', $func_get_args) . '`'; $data = mysql_fetch_assoc(mysql_query("select $fields `users` `user_id` = $user_id")); return $data; } } function logged_in() { return (isset($_session['user_id'])) ? true : false; } function user_exists($username) { $username = sanitize($username); return (mysql_result(mysql_query("select count(`user_id`) `users` `username` = '$username'"), 0) == 1) ? true : false; } function email_exists($email) { $email = sanitize($email); return (mysql_result(mysql_query("select count(`user_id`) `users` `email` = '$email'"), 0) == 1) ? true : false; } function user_active($username) { $username = sanitize($username); return (mysql_result(mysql_query("select count(`user_id`) `users` `username` = '$username' , `active` =1"), 0) ==1) ? true : false; } function user_id_from_username ($username) { $username = sanitize($username); return (mysql_result(mysql_query("select `user_id` `users` `username` = '$username'"), 0, 'user_id')); } function login ($username, $password) { $user_id = user_id_from_username($username); $username = sanitize($username); $password = md5($password); return (mysql_result(mysql_query("select count(`user_id`) `users` `username` = '$username' , `password` = '$password'"), 0) == 1) ? $user_id : false; } ?>
thanks help.
you missed }
it should be
function activate($email, $email_code) { $email = mysql_real_escape_string($email); $email_code = mysql_real_escape_string($email_code); if (mysql_result(mysql_query("select count(`user_id`) `users` `email` = '$email' , `email_code` = '$email_code' , `active` = 0"), 0) == 1) { mysql_query("update `users` set `active` = 1 `email` = '$email'"); return true; } else { return false; } } <---missing bracket here
Comments
Post a Comment