本文整理汇总了PHP中fix_string函数的典型用法代码示例。如果您正苦于以下问题:PHP fix_string函数的具体用法?PHP fix_string怎么用?PHP fix_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fix_string函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: fix_input_array
function fix_input_array($input_array)
{
$new_array = array();
foreach ($input_array as $input) {
if (strlen(trim($input)) == 0) {
continue;
} else {
$new_array[] = fix_string($input);
}
}
return $new_array;
}
开发者ID:alexanderpugh,项目名称:polling-questions,代码行数:12,代码来源:input.php
示例2: fix_input_assoc_array
function fix_input_assoc_array($input_array)
{
$new_array = array();
foreach ($input_array as $key => $value) {
if (strlen(trim($key)) == 0) {
continue;
}
if (strlen(trim($value)) == 0) {
continue;
} else {
$new_array[fix_string($key)] = fix_string($value);
}
}
return $new_array;
}
开发者ID:alexanderpugh,项目名称:Ajax-Organiser,代码行数:15,代码来源:input.php
示例3: mysql_connect
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?php
require_once 'login.php';
require_once 'signup/validatephp.php';
$db_server = mysql_connect($db_hostname, $db_username, $db_password);
if (!$db_server) {
mysql_error_message();
}
if (!mysql_select_db($db_database)) {
echo mysql_error();
}
$fail = "";
if (isset($_POST['username'])) {
$user = fix_string($_POST['username']);
$pass = fix_string($_POST['password']);
$fail .= validate_username($user);
$fail .= validate_password($pass);
if ($fail == "") {
$query = "SELECT * FROM user\r\nWHERE Username='{$user}' AND Password='{$pass}' ";
$result = mysql_query($query);
$rows = mysql_num_rows($result);
if (!$rows) {
$fail = 'Wrong details!';
} else {
session_start();
$_SESSION['user'] = $user;
$_SESSION['pass'] = $pass;
die("You are now logged in. Please <a href= 'server1.php'>click here to continue</a>...");
}
}
}
开发者ID:rohitchawla22,项目名称:Brain-Spark,代码行数:31,代码来源:homepage.php
示例4: session_start
<?php
session_start();
require_once '../file-includes.php';
$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$info = array();
$info[] = fix_string($request->task);
$info[] = fix_string($request->importance);
$info[] = (string) date('d-m-Y');
$info[] = '-';
$userID = get_userID_session();
add_task($info, $userID);
开发者ID:alexanderpugh,项目名称:Ajax-Organiser,代码行数:13,代码来源:add-task.php
示例5: fix_string
<?php
function fix_string($a)
{
echo "Called @ " . xdebug_call_file() . ":" . xdebug_call_line() . " from " . xdebug_call_function();
}
$ret = fix_string(array('Derick'));
开发者ID:exakat,项目名称:exakat,代码行数:7,代码来源:Extxdebug.01.php
示例6: session_start
<?php
session_start();
require_once '../file-includes.php';
$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$info = array();
$info[] = fix_string($request->title);
$info[] = fix_string($request->content);
$info[] = (string) date('d-m-Y');
$info[] = '-';
$userID = get_userID_session();
add_note($info, $userID);
开发者ID:alexanderpugh,项目名称:Ajax-Organiser,代码行数:13,代码来源:add-note.php
示例7: session_start
<?php
session_start();
require_once $_SERVER['DOCUMENT_ROOT'] . "/exam-simulator/private/functions/sql_functions.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/exam-simulator/private/functions/session_functions.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/exam-simulator/private/functions/input.php";
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$examID = fix_string($_POST['examID']);
$examCat = fix_string($_POST['examCat']);
delete_exam_contents($examID);
delete_exam($examID);
deincrement_exam($examCat);
} else {
go_home();
}
开发者ID:alexanderpugh,项目名称:exam-simulator,代码行数:15,代码来源:delete_exam_handle.php
示例8: session_start
<?php
session_start();
require_once '../file-includes.php';
$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$info = array();
$info[] = fix_string($request->name);
$info[] = fix_string($request->address);
$info[] = fix_string($request->number);
$info[] = fix_string($request->email);
$userID = get_userID_session();
add_contact($info, $userID);
开发者ID:alexanderpugh,项目名称:Ajax-Organiser,代码行数:13,代码来源:add-contact.php
示例9: myProject
$adduser = new myProject();
$status = $adduser->addUser($_POST);
if($status === true) {
//everything worked
} else {
echo "Errors occurred: $status";
}*/
// Start with the PHP code
$projectName = $description = "";
if (isset($_POST['pname2'])) {
$projectName = fix_string($_POST['pname2']);
}
if (isset($_POST['desc2'])) {
$description = fix_string($_POST['desc2']);
}
// This is where you would enter the posted fields into a database,
// preferably using hash encryption for the password.
require_once 'session.php';
require_once 'login.php';
$connection = new mysqli($db_hostname, $db_username, $db_password, $db_database);
if ($connection->connect_error) {
die($connection->connect_error);
}
$projectID = $_SESSION['selected_category'];
$query = "UPDATE projects SET projectname='{$projectName}',description ='{$description}' WHERE id = {$projectID}";
$result = $connection->query($query);
$query2 = "UPDATE users_assigned SET projectname='{$projectName}',projectdescription ='{$description}' WHERE projectsID = {$projectID}";
$result2 = $connection->query($query2);
echo "<a href='../projectpage.php?category={$projectID}'>Update Complete. Click To return!</a>";
开发者ID:NJ3355,项目名称:team-meet,代码行数:30,代码来源:editprojectprofile.php
示例10: session_start
<?php
session_start();
require_once $_SERVER['DOCUMENT_ROOT'] . "/exam-simulator/private/functions/sql_functions.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/exam-simulator/private/functions/session_functions.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/exam-simulator/private/functions/input.php";
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$username = fix_string($_POST['username']);
$password = encrypt_password(fix_string($_POST['password']));
$msg = "";
$conn = get_conn();
if (user_exists($conn, $username, $password)) {
log_in($username);
$msg = '<script>location.href = \'//localhost/exam-simulator/public/index.php\'</script>';
} else {
$msg .= "<li>The provided information is incorrect.</li>";
}
$conn->close();
echo $msg;
} else {
go_home();
}
开发者ID:alexanderpugh,项目名称:exam-simulator,代码行数:22,代码来源:login_handle.php
示例11: mysql_entities_fix_string
$to_temp = mysql_entities_fix_string($connection, $total_pages);
if (isset($_POST['entry_id'])) {
$ei_temp = mysql_entities_fix_string($connection, $_POST['entry_id']);
$query = "UPDATE movies SET title='{$ti_temp}', author='{$di_temp}', total_pages='{$ye_temp}',\n imdb_rating='{$im_temp}', rating='{$ra_temp}', date='{$da_temp}'\n WHERE user_id='{$user_id}' AND entry_id='{$ei_temp}'";
} else {
$query = "INSERT INTO user_books(title, author, total_pages, user_id)\n VALUES('{$ti_temp}', '{$au_temp}', '{$to_temp}', '{$user_id}')";
}
$result = $connection->query($query);
if (!$result) {
die($connection->error);
}
header('Location: books.php');
}
}
if (isset($_GET['entry_id'])) {
$entry_id = fix_string($_GET['entry_id']);
$entry_id = mysql_entities_fix_string($connection, $entry_id);
$query = "SELECT * FROM movies WHERE entry_id='{$entry_id}' AND user_id='{$user_id}'";
$result = $connection->query($query);
if (!$result) {
die($connection->error);
} elseif ($result->num_rows) {
$row = $result->fetch_array(MYSQLI_ASSOC);
$title = html_entity_decode($row['title']);
$author = html_entity_decode($row['author']);
$total_pages = html_entity_decode($row['total_pages']);
$imdb_rating = html_entity_decode($row['imdb_rating']);
$rating = html_entity_decode($row['rating']);
$date = html_entity_decode($row['date']);
$submit_string = 'Edit entry';
$entry_input = "<input type='hidden' name='entry_id' value='" . $row['entry_id'] . "'>";
开发者ID:drjimmyz,项目名称:-effective-journey,代码行数:31,代码来源:add_book.php
示例12: session_start
<?php
session_start();
require_once $_SERVER['DOCUMENT_ROOT'] . "/exam-simulator/private/functions/sql_functions.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/exam-simulator/private/functions/session_functions.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/exam-simulator/private/functions/input.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/exam-simulator/private/functions/templates.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/exam-simulator/private/classes/exam.php";
if (logged_in() && isset($_GET['catID']) && isset($_GET['examName']) && isset($_GET['examID'])) {
$catID = fix_string($_GET['catID']);
$examName = fix_string($_GET['examName']);
$examID = fix_string($_GET['examID']);
if (!category_exists($catID)) {
go_home();
}
if (!exam_exists($examID, $examName)) {
go_home();
}
$get_script = "\$.getScript('javascript/take_exam.js');";
$exam = new Exam($catID, $examName, $examID);
$content = $exam->get_form();
get_main_template($content, $get_script);
} else {
go_home();
}
开发者ID:alexanderpugh,项目名称:exam-simulator,代码行数:25,代码来源:take_exam.php
示例13: session_start
<?php
session_start();
require_once '../file-includes.php';
$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$taskID = fix_string($request->id);
$userID = get_userID_session();
tick_task($taskID, $userID);
开发者ID:alexanderpugh,项目名称:Ajax-Organiser,代码行数:9,代码来源:tick-task.php
示例14: session_start
<?php
session_start();
require_once "../file-includes.php";
$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$note_id = fix_string($request->noteID);
$userID = (int) get_userID_session();
delete_note($note_id, $userID);
开发者ID:alexanderpugh,项目名称:Ajax-Organiser,代码行数:9,代码来源:delete-note.php
示例15: fix_input_array
if (isset($_POST['question_keyword_answer_id']) && isset($_POST['keyword_answers'])) {
$question_keyword_answer_id = fix_input_array($_POST['question_keyword_answer_id']);
$keyword_answers = fix_input_array($_POST['keyword_answers']);
if (count($keyword_answers) > 0) {
for ($i = 0; $i < count($question_keyword_answer_id); $i++) {
$keyword_answers[$i] = preg_replace("/[^A-Za-z0-9 ]/", '', $keyword_answers[$i]);
// remove non alphanumeric characters
$keyword_answers[$i] = strtoupper($keyword_answers[$i]);
$kwID_answer[$question_keyword_answer_id[$i]] = array_unique(explode(' ', $keyword_answers[$i]));
$kwID_answer[$question_keyword_answer_id[$i]] = array_values($kwID_answer[$question_keyword_answer_id[$i]]);
}
}
}
if (isset($_POST['num_of_questions']) && isset($_POST['num_of_correct_answers']) && isset($_POST['questionID_order'])) {
$num_of_questions = fix_string($_POST['num_of_questions']);
$num_of_correct_answers = fix_string($_POST['num_of_correct_answers']);
$questionID_order = fix_string($_POST['questionID_order']);
$questionID_order = explode(',', $questionID_order);
}
$marked = new MarkedExam($saID_answer, $multID_answerID, $kwID_answer);
$marked->set_question_amount($num_of_questions);
$marked->set_correct_answer_amount($num_of_correct_answers);
$marked->set_questionID_order($questionID_order);
$marked->set_connection(get_conn());
$marked->generate_html();
$get_script = "\$.getScript('javascript/taken_exam.js');";
$content = $marked->get();
get_main_template($content, $get_script);
} else {
go_home();
}
开发者ID:alexanderpugh,项目名称:exam-simulator,代码行数:31,代码来源:taken_exam.php
示例16: array
$UN_fail = $PW_fail = $EM_fail = $KEY_fail = "";
$red_border = array("pw" => "", "un" => "", "key" => "", "em" => "");
$un_val = $key_val = $em_val = "";
if (isset($_POST['username'])) {
$username = fix_string($_POST['username']);
$un_val = $username;
}
if (isset($_POST['password'])) {
$password = fix_string($_POST['password']);
}
if (isset($_POST['email'])) {
$email = fix_string($_POST['email']);
$em_val = $email;
}
if (isset($_POST['key'])) {
$key = fix_string($_POST['key']);
$key_val = $key;
}
if (isset($_POST['submit'])) {
$fail = validate_username($username);
$fail .= validate_password($password);
$fail .= validate_email($email);
$fail .= validate_key($key);
if ($fail == "" && isset($_POST['username']) && isset($_POST['password']) && isset($_POST['email']) && isset($_POST['key'])) {
$connection = new mysqli($db_hostname, $db_username, $db_password, $db_database);
$un_temp = mysql_entities_fix_string($connection, $_POST['username']);
$pw_temp = mysql_entities_fix_string($connection, $_POST['password']);
$em_temp = mysql_entities_fix_string($connection, $_POST['email']);
$key_temp = mysql_entities_fix_string($connection, $_POST['key']);
$query = "SELECT * FROM users WHERE username='{$un_temp}'";
$query2 = "SELECT * FROM users WHERE email='{$em_temp}'";
开发者ID:drjimmyz,项目名称:-effective-journey,代码行数:31,代码来源:register.php
示例17: session_start
<?php
session_start();
// edit the selected todo task
require_once '../file-includes.php';
$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$userID = get_userID_session();
$taskID = fix_string($request->taskID);
$last_edit = (string) date('d-m-Y');
$task = fix_string($request->task);
edit_task($task, $last_edit, $taskID, $userID);
开发者ID:alexanderpugh,项目名称:Ajax-Organiser,代码行数:12,代码来源:edit-task.php
示例18: session_start
<?php
session_start();
require_once $_SERVER['DOCUMENT_ROOT'] . "/exam-simulator/private/functions/sql_functions.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/exam-simulator/private/functions/session_functions.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/exam-simulator/private/functions/input.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/exam-simulator/private/functions/templates.php";
if (logged_in() && isset($_GET['questionName']) && isset($_GET['examID']) && isset($_GET['examCat']) && isset($_GET['questionID']) && isset($_GET['examName']) && isset($_GET['questionType'])) {
$examCat = fix_string($_GET['examCat']);
$examName = fix_string($_GET['examName']);
$examID = fix_string($_GET['examID']);
$questionName = fix_string($_GET['questionName']);
$questionID = fix_string($_GET['questionID']);
$questionType = fix_string($_GET['questionType']);
if (!exam_exists($examID, $examName) || !question_exists($questionID, $examID) || !category_exists($examCat)) {
go_home();
}
$get_script = "\$.getScript('javascript/question_edit.js');";
$content = get_question_content($examID, $examName, $examCat, $questionID, $questionName, $questionType);
get_main_template($content, $get_script);
} else {
go_home();
}
开发者ID:alexanderpugh,项目名称:exam-simulator,代码行数:23,代码来源:question.php
示例19: session_start
<?php
session_start();
require_once $_SERVER['DOCUMENT_ROOT'] . "/exam-simulator/private/functions/sql_functions.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/exam-simulator/private/functions/session_functions.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/exam-simulator/private/functions/input.php";
if (logged_in()) {
log_out();
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$username = fix_string($_POST['new_username']);
$password = fix_string($_POST['new_password']);
$msg = "";
if (!username_valid($username)) {
$msg .= "<li>The username provided is not valid</li>";
}
if (!password_valid($password)) {
$msg .= "<li>The password provided is not valid</li>";
}
$conn = get_conn();
$password = encrypt_password($password);
if (username_available($conn, $username) && $msg == "") {
new_user($conn, $username, $password);
log_in($username);
$msg = '<script>location.href = \'//localhost/exam-simulator/public/index.php\'</script>';
} else {
$msg .= "<li>The username already exists.</li>";
}
$conn->close();
echo $msg;
} else {
开发者ID:alexanderpugh,项目名称:exam-simulator,代码行数:31,代码来源:register_handle.php
示例20: session_start
<?php
session_start();
// delete the task from todo page
require_once "../file-includes.php";
$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$task_id = fix_string($request->taskID);
$userID = (int) get_userID_session();
delete_task($task_id, $userID);
开发者ID:alexanderpugh,项目名称:Ajax-Organiser,代码行数:10,代码来源:delete-task.php
注:本文中的fix_string函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论