本文整理汇总了PHP中uploadImage函数的典型用法代码示例。如果您正苦于以下问题:PHP uploadImage函数的具体用法?PHP uploadImage怎么用?PHP uploadImage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了uploadImage函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _before_update
/**
* 修改之前的操作
* 在修改操作之前先判断是否有图片上传,
* 有图片上传则删掉之前的图片,保存新的图片;
* 没有图片上传则保留原来的图片
*/
protected function _before_update(&$data, $options)
{
//判断是否有图片上传
if (!empty($_FILES['bg_imgpath']['name'])) {
//获取修改的数据id
$bg_id = $options['where']['bg_id'];
//获取改数据的图片路径,并判断是否存在,存在则删除
$img_path = $this->field('bg_imgpath')->where(array('bg_id' => $bg_id))->find();
if ($img_path['bg_imgpath']) {
$path = C('rootPath') . $img_path['bg_imgpath'];
//拼接图片所在的位置
@unlink($path);
//unlink:删除文件的函数 @防止报错
}
//图片上传操作
$config = array('mimes' => array('image/jpg', 'image/png', 'image/jpeg', 'image/gif'), 'rootPath' => C('rootPath'), 'maxSize' => 0, 'savePath' => 'Blog/', 'is_array' => 0);
//执行上传文件和生成缩略图的操作
$res = uploadImage('bg_imgpath', $config);
//判断上述操作是否执行成功
if ($res['ok'] == 1) {
//将源图和缩略图的地址存放$data数组中写入数据库
$data['bg_imgpath'] = $res['img'][0];
} else {
//返回上传文件和生成缩略图中产生的错误
$this->error = $res['error'];
return false;
}
}
}
开发者ID:xy-lp,项目名称:myblog,代码行数:35,代码来源:BlogModel.class.php
示例2: addToBook
function addToBook()
{
//set all of the variables
$address_group_id = filter_input(INPUT_POST, 'address_group_id');
$fullname = filter_input(INPUT_POST, 'fullname');
$email = filter_input(INPUT_POST, 'email');
$address = filter_input(INPUT_POST, 'address');
$phone = filter_input(INPUT_POST, 'phone');
$website = filter_input(INPUT_POST, 'website');
$birthday = filter_input(INPUT_POST, 'birthday');
//replace the phone number with the appropriate formatting
$phoneRegex = '/^\\(?([2-9]{1}[0-9]{2})\\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/';
$phone = preg_replace($phoneRegex, '($1) $2-$3', $phone);
if (strlen($fullname) < 1 || strlen($email) < 1 || strlen($address) < 1 || strlen($phone) < 1) {
return false;
}
try {
$image = uploadImage('upfile');
} catch (RuntimeException $ex) {
//echo $ex->getMessage();
$image = '';
}
//connect and set statement
$db = dbconnect();
$stmt = $db->prepare("INSERT INTO address SET user_id = :user_id, address_group_id = :address_group_id, fullname = :fullname, email = :email, address = :address, phone = :phone, website = :website, birthday = :birthday, image = :image");
$binds = array(":user_id" => $_SESSION['user_id'], ":address_group_id" => $address_group_id, ":fullname" => $fullname, ":email" => $email, ":address" => $address, ":phone" => $phone, ":website" => $website, ":birthday" => $birthday, ":image" => $image);
if ($stmt->execute($binds) && $stmt->rowCount() > 0) {
return true;
} else {
return false;
}
}
开发者ID:Dayakes,项目名称:PHPWinterCLass2016,代码行数:32,代码来源:Add-functions.php
示例3: update
public function update($postData, $book_id, $target_dir)
{
if (uploadImage($target_dir) !== 'success' && uploadImage($target_dir) !== 'Image is not chosen.') {
return uploadImage($target_dir);
} else {
$postData['image'] = basename($_FILES["image"]["name"]);
if ($postData['image'] === '') {
$postData['image'] = $_SESSION['oldImage'];
}
db_update($this->table, $postData, 'id=' . $book_id);
return 'success';
}
}
开发者ID:huynhtrucquyen0812,项目名称:EntryBlog,代码行数:13,代码来源:book.php
示例4: ajouterActivite
/**
* Fonction permettant d'ajouter une activité en base de données grâce aux données d'un formulaire.
* @return mixed : soit un tableau contenant tous les messages d'erreurs relatif à l'ajout d'activité, soit un tableau
* contenant un message de succès de l'ajout de l'activité.
*/
function ajouterActivite()
{
$cat = $_POST['categorie'];
$act = $_POST['activite'];
$desc = $_POST['description'];
$cm = new CategorieManager(connexionDb());
$am = new ActivityManager(connexionDb());
$categorie = $cm->getCategorieByLibelle($cat);
$activityVerif = $am->getActivityByLibelle($act);
if (strtolower($activityVerif->getLibelle()) == strtolower($act)) {
$tabRetour['Error'] = "Cette activité existe déjà, ajoutez-en une autre !";
} else {
if (strlen($act) >= 5 && strlen($act) <= 100) {
if (champsTexteValable($desc)) {
$desc = nl2br($desc);
$activityToAdd = new Activity(array("Libelle" => $act, "description" => $desc));
$am->addActivity($activityToAdd);
$activityToRecup = $am->getActivityByLibelle($act);
include "../Manager/Categorie_ActivityManager.manager.php";
$typePhoto = $_FILES['image']['type'];
if (!strstr($typePhoto, 'jpg') && !strstr($typePhoto, 'jpeg')) {
$tabRetour['Error'] = "Votre image n'est pas .jpg ou .jpeg !";
} else {
if ($_FILES['ImageNews']['size'] >= 2097152) {
$tabRetour['Error'] = "Votre image est trop lourde !";
} else {
if ($_FILES['image']['tmp_name'] != null) {
uploadImage('../Images/activite', $activityToRecup->getId());
$cam = new Categorie_ActivityManager(connexionDb());
$um = new UserManager(connexionDb());
$um->updateUserLastIdea($_SESSION['User']);
$cam->addToTable($activityToRecup, $categorie);
$tabRetour['Ok'] = "Votre activité a bien été ajoutée au contenu du site, merci de votre participation !";
} else {
$tabRetour['Error'] = "Pas d'image !";
}
}
}
} else {
$tabRetour['Error'] = "Votre description contient des caractères indésirables !";
}
} else {
$tabRetour['Error'] = "Votre titre d'activité n'a pas une taille correcte !";
}
}
return $tabRetour;
}
开发者ID:OvynFlavian,项目名称:IntegrationTP_Groupe_1,代码行数:52,代码来源:ajouterActivite.lib.php
示例5: insertNewMeal
function insertNewMeal($values, $connectionObject)
{
$fileName = uploadImage("mealPicture", "content/pictures/");
if ($fileName) {
$createMealQuery = "INSERT INTO meal VALUES (DEFAULT, :name_, :price, :quantity, :snack, :drink, :picture)";
$createMealResult = $connectionObject->prepare($createMealQuery);
$createMealResult->execute(array(':name_' => $values['newMealName'], ':price' => $values['newMealPrice'], ':quantity' => $values['newMealQuantity'], ':snack' => $values['newMealSnack'], ':drink' => $values['newMealDrink'], ':picture' => $fileName));
if (!$createMealResult) {
echo "An error occurred.\n";
error_log("Error on insertNewMeal function");
return Null;
}
} else {
echo "Error uploading image";
error_log("Error uploading image");
}
}
开发者ID:pLesur,项目名称:orgaMIsation,代码行数:17,代码来源:administrationFunctions.php
示例6: index
public function index()
{
$amount = (int) $this->input->get('amount');
$imagesArray = $this->Image->getImages(0, $amount);
foreach ($imagesArray as $key => $value) {
if (file_exists($this->config->item('PATH_IMAGE') . $value->image)) {
$pathImage = $this->config->item('PATH_IMAGE') . $value->image;
$result = uploadImage(['PATH_IMAGE' => $pathImage, 'PATH_COOKIE' => $this->config->item('PATH_COOKIE'), 'title' => $value->title]);
sleep(30);
unlink($pathImage);
$this->Image->deleteImage($value->id);
}
}
print_r($imagesArray);
// $this->output
// ->set_status_header($result['status'])
// ->set_output(json_encode($result['data']));
}
开发者ID:sasha8-1,项目名称:instagram,代码行数:18,代码来源:UploadImage.php
示例7: uploadImage
function uploadImage($conf, $depth = 0)
{
$depth = (int) $depth;
$depth = $depth + 1;
$result = postingImage($conf);
print_r($result);
if ($result['status'] != 200 && $depth < 3) {
// hack
file_get_contents("http://localhost/instagram/index.php/GetCookie/");
return uploadImage($conf, $depth);
} else {
if ($result['status'] != 200 && $depth >= 3) {
log_message('error', 'Don\'t upload Image');
// throw new Exception('Error');
} else {
return $result;
}
}
}
开发者ID:sasha8-1,项目名称:instagram,代码行数:19,代码来源:upload_helper.php
示例8: admin_edit
/**
* @param null $id
* Cette méthode permet d'editer et d'enregistrer, selon qu'on ait le ID ou pas
*/
public function admin_edit($id = null)
{
$this->loadModel('Offreancia');
//on charge le controller qu'on veut éditer
$this->Offreancia->changeID();
$d['id'] = '';
if ($this->request->data) {
//debug($_FILES['IMAGE']['name']);
if (!empty($_FILES['IMAGE']['name'])) {
$imageValid = uploadImage('IMAGE');
if ($imageValid['ok']) {
$this->request->data->IMAGE = $imageValid['chemin'];
// debug($this->request->data);
// die();
} else {
echo '<script>alert("' . $imageValid['msg'] . '")</script>';
}
}
if ($this->Offreancia->validates($this->request->data)) {
if ($this->Offreancia->save($this->request->data)) {
$this->Session->setFlash('le contenu a bien été modifié', 'success');
}
// die($id=$this->Post->id);
//echo("ajouté ou modifié");
} else {
$this->Offreancia->save($this->request->data);
$this->Session->setFlash('Merci de corriger vos informations', 'danger');
}
}
if ($id) {
$id = intval($id);
$this->request->data = $this->Offreancia->findOne(array('conditions' => array('ID_OFFRE_ANCIA' => $id)));
$d['id'] = $id;
}
$this->loadModel('Utilisateur');
$this->Utilisateur->changeID();
$d['utilisateurs'] = $this->Utilisateur->find(array());
$this->loadModel('Client');
$this->Client->changeID();
$d['clients'] = $this->Client->find(array());
$this->set($d);
}
开发者ID:ronaldodia,项目名称:backend_al,代码行数:46,代码来源:OffreanciasController.php
示例9: uploadPhoto
function uploadPhoto($ip, $image, $nick, $email, $path, $albumName)
{
$existsAlbum = isAlbum($nick, $albumName);
if (!$existsAlbum) {
if (!newAlbum($ip, $nick, $email, $albumName, "private", "DEFAULT")) {
return '1';
}
}
if (uploadImage($image, $path)) {
$newPhoto = addPhoto($nick, $path, $albumName);
if (!newPhoto and !$existsAlbum) {
deleteAlbum($nick, $albumName);
// Remove Photo
return '2';
}
addAction($nick, $email, $ip, 'new_photo');
return '0';
}
return '3';
}
开发者ID:jagumiel,项目名称:bigou-Album,代码行数:20,代码来源:photo_logic.php
示例10: modifyCategory
function modifyCategory()
{
$catId = (int) $_GET['catId'];
$name = $_POST['txtName'];
$description = $_POST['mtxDescription'];
$image = $_FILES['fleImage'];
$catImage = uploadImage('fleImage', SRV_ROOT . 'images/category/');
// if uploading a new image
// remove old image
if ($catImage != '') {
_deleteImage($catId);
$catImage = "'{$catImage}'";
} else {
// leave the category image as it was
$catImage = 'cat_image';
}
$sql = "UPDATE tbl_category \n SET cat_name = '{$name}', cat_description = '{$description}', cat_image = {$catImage}\n WHERE cat_id = {$catId}";
$result = dbQuery($sql) or die('Cannot update category. ' . mysql_error());
header('Location: index.php');
}
开发者ID:joevanni,项目名称:gallantic-shopping-cart,代码行数:20,代码来源:processCategory.php
示例11: product_update
function product_update()
{
$id = $_POST['id'];
if (isset($_POST['update'])) {
$data['product_object'] = model('product')->getOne($id);
//var_dump($data);die;
$data['template_file'] = 'product/update.php';
render('layout.php', $data);
}
if (isset($_POST['saveUpdate'])) {
unset($_POST['saveUpdate']);
$postData = postData();
if ($_FILES["fileImage"]['name'] != "") {
$postData['image'] = uploadImage();
deleteImage($_POST['image']);
}
if (model('product')->updateProduct($postData, $id)) {
redirect('/index.php?c=product&m=list');
}
}
}
开发者ID:nguyenlevietphi,项目名称:MyBlog,代码行数:21,代码来源:product.php
示例12: mysql_select_db
mysql_select_db($database, $dbConn);
$transaccion = $_POST['transaccion'];
switch ($transaccion) {
case 'INSERT':
// Obtiene de la base de datos el último id de los celulares
$query_newId = "SELECT (MAX(id_celular) + 1) as newId FROM celularesMasPopulares";
$newId = mysql_query($query_newId, $dbConn) or die(mysql_error());
$row_newId = mysql_fetch_assoc($newId);
$id_celular = $row_newId["newId"];
$dir_celular = "../../uploads/celulares_mas_populares/" . $id_celular . "/";
$filename = NULL;
if ($_FILES['foto']['tmp_name'] != NULL) {
$filename = uploadImage("foto", $dir_celular, 120, 248);
}
$sql = sprintf("INSERT INTO celularesMasPopulares(id_celular, nombre, foto) VALUES(%s, %s, %s)", GetSQLValueString($id_celular, "int"), GetSQLValueString(utf8_decode($_POST['nombre']), "text"), GetSQLValueString($filename, "text"));
echo "{$sql}";
break;
case 'UPDATE':
$dir_celular = "../../uploads/celulares_mas_populares/" . $_POST['id_celular'] . "/";
$filename = NULL;
if ($_FILES['foto']['tmp_name'] != NULL) {
$filename = uploadImage("foto", $dir_celular, 120, 248);
} else {
$filename = $_POST['foto_actual'];
}
$sql = sprintf("UPDATE celularesMasPopulares SET nombre=%s, foto=%s WHERE id_celular=%s", GetSQLValueString(utf8_decode($_POST['nombre']), "text"), GetSQLValueString($filename, "text"), GetSQLValueString($_POST['id_celular'], "int"));
break;
}
// switch
$result = mysql_query($sql, $dbConn) or die(mysql_error());
mysql_free_result($result);
开发者ID:designomx,项目名称:eligefacil,代码行数:31,代码来源:saveCelularData.php
示例13: date
<?php
if (isset($_POST['sg'])) {
if (!empty($_FILES['thumb']['tmp_name'])) {
$pasta = "../upload/";
$ano = date('Y');
$mes = date('m');
if (!file_exists($pasta . $ano) && is_dir($pasta . $ano)) {
mkdir($pasta . $ano, 0755);
}
if (!file_exists($pasta . $ano . '/' . $mes)) {
mkdir($pasta . $ano . '/' . $mes, 0755);
}
$img = $_FILES['thumb'];
$ext = substr($img['name'], -3);
$thumb = $ano . '/' . $mes . '/' . setUri($img['name']);
uploadImage($img['tmp_name'], setUri($img['name']), '600', $pasta . $ano . '/' . $mes . '/');
}
$d = date('Y-m-d H:i:s');
$campos = array('post_id' => $postId, 'img' => $thumb, 'data' => $d);
create("galeria", $campos);
}
?>
<?php
// deleta imagem no bando e na pasta upload
if (!empty($_GET['iddel'])) {
$iddel = $_GET['iddel'];
$img = $_GET['img'];
$pasta = $pasta = "../upload/";
if (file_exists($pasta . $img)) {
unlink($pasta . $img);
开发者ID:wilsonazer,项目名称:santodaime,代码行数:31,代码来源:gallery.php
示例14: elseif
} elseif (!valMail($f['email'])) {
echo '<span class="ms al">Atenção: O e-mail informado nao tem um formato válido!</span>';
} elseif (strlen($f['code']) < 8 || strlen($f['code']) > 12) {
echo '<span class="ms no">Erro: A senha deve ter entre 8 e 12 caracteres!</span>';
} else {
if (!empty($_FILES['avatar']['tmp_name'])) {
$imagem = $_FILES['avatar'];
$pasta = '../uploads/avatars/';
if (file_exists($pasta . $user['avatar']) && !is_dir($pasta . $user['avatar'])) {
unlink($pasta . $user['avatar']);
}
$tmp = $imagem['tmp_name'];
$ext = substr($imagem['name'], -3);
$nome = md5(time()) . '.' . $ext;
$f['avatar'] = $nome;
uploadImage($tmp, $nome, 200, $pasta);
}
unset($f['date']);
unset($f['statusS']);
update('up_users', $f, "id = '{$userEditId}'");
$_SESSION['return'] = '<span class="ms ok">Usuário atualizado com sucesso!</span>';
header('Location: index2.php?exe=usuarios/usuarios-edit&userid=' . $userEditId);
}
} elseif (!empty($_SESSION['return'])) {
echo $_SESSION['return'];
unset($_SESSION['return']);
}
?>
<form name="formulario" action="" method="post" enctype="multipart/form-data">
<label class="line">
<span class="data">Nome:</span>
开发者ID:CivalCs,项目名称:ProPHP,代码行数:31,代码来源:usuarios-edit.php
示例15: getAddressGroups
<?php
$addressGroups = getAddressGroups();
$newAddressData = array();
if (isPostRequest()) {
$newAddressData[0] = $_SESSION['currentUserID'];
$newAddressData[1] = filter_input(INPUT_POST, 'selected_address_group');
$newAddressData[2] = filter_input(INPUT_POST, 'fullname');
$newAddressData[3] = filter_input(INPUT_POST, 'email');
$newAddressData[4] = filter_input(INPUT_POST, 'address');
$newAddressData[5] = formatPhone(stripPhone(filter_input(INPUT_POST, 'phone')));
$newAddressData[6] = filter_input(INPUT_POST, 'website');
$newAddressData[7] = filter_input(INPUT_POST, 'birthday');
$errors = validation($newAddressData);
if (count($errors) == 0) {
$newAddressData[8] = uploadImage();
if (empty($newAddressData[8])) {
$errors[] = 'Image could not be uploaded';
$results = 'Empty Image';
}
if (createContact($newAddressData)) {
$results = 'New item added to address book';
} else {
$results = 'Item was not Added';
}
} else {
$results = 'Errors found';
}
}
?>
开发者ID:NWhitaker27,项目名称:PHPClassSummer2015,代码行数:29,代码来源:add.php
示例16: uploadImage
*/
if (checkSensorId($conn, $sensor_id) != 0) {
return;
}
// date
$date_created = $_POST['date_image'];
// description
$description = $_POST['desc_image'];
// Image Type Check
$imgType = $_FILES['file_image']['type'];
if ($imgType != "image/jpeg") {
echo "File Not Found/Extension not allowed, please choose a JPG file";
return;
}
// Upload Image
uploadImage($conn, $sensor_id, $date_created, $description);
}
// ----Upload Scalar----
// separate a string by another string
// http://php.net/manual/en/function.explode.php
if (isset($_POST["submit_scalar"])) {
$scalarType = $_FILES['file_scalar']['type'];
if ($scalarType != "text/csv") {
echo "File Not Found/Extension not allowed, please choose a csv file";
return;
}
$fp = fopen($_FILES['file_scalar']['tmp_name'], 'r');
/*
while ( ($line = fgets($fp)) !== false) {
echo $line."<br>";
$pieces = explode(",", $line);
开发者ID:ayunita,项目名称:OOSproject,代码行数:31,代码来源:datacurator.php
示例17: Database
<?php
include 'includes/header.php';
$db = new Database();
$ca = new Category();
$pi = new Picture();
$categories = $db->select($ca->getAllCategories());
uploadImage();
?>
<h2 class="page-header">Add Image</h2>
<div class="row">
<div class="col-md-10">
<form method="post" action="add_image.php" enctype="multipart/form-data">
<div class="form-group">
<label>Image Title</label>
<input name="title" type="text" class="form-control" placeholder="Enter image title">
</div>
<div class="form-group">
<label>Image Description</label>
<textarea name="description" class="form-control" placeholder="Enter image description"></textarea>
</div>
<div class="col-md-5">
<label>Select image to upload:</label>
<input type="file" name="image" id="image">
</div>
<div class="col-md-5">
<div class="form-group">
<label>Year</label>
<input name="year" type="number" class="form-control" placeholder="Enter estimated year">
</div>
开发者ID:Owlnofeathers,项目名称:hansennorthforkranch.ajamesb.com,代码行数:31,代码来源:add_image.php
示例18: uploadImage
<title></title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
<title></title>
</head>
<body>
<?php
// Uploads Images of Products into DataBase
include '../../functions/products-functions.php';
try {
$uploadName = uploadImage('upfile');
echo $uploadName;
} catch (Exception $e) {
echo $e->getMessage();
}
?>
<!-- The data encoding type, enctype, MUST be specified as below -->
<form enctype="multipart/form-data" action="#" method="POST">
<!-- MAX_FILE_SIZE must precede the file input field -->
<!-- <input type="hidden" name="MAX_FILE_SIZE" value="30000" /> -->
<!-- Name of input element determines name in $_FILES array -->
Send this file: <input name="upfile" type="file" />
<input type="submit" value="Send File" />
</form>
开发者ID:carvalhobr1993,项目名称:PHPClassWinter2016,代码行数:30,代码来源:upload-form.php
示例19: tagImage
return $itemID;
}
function tagImage($itemID)
{
global $hostname;
$ch = curl_init();
$data = array('tagIDs' => implode("|", $_POST['options']));
curl_setopt($ch, CURLOPT_URL, "http://{$hostname}/api/taxonomy/tagItem/{$itemID}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-Scitemwebapi-Username: sitecore\\admin', 'X-Scitemwebapi-Password: b'));
$response = curl_exec($ch);
}
if (isset($_POST["submit"])) {
$itemID = uploadImage();
tagImage($itemID);
header("Location: /?done=1");
die;
}
?>
<!DOCTYPE html>
<html>
<head>
<title>ARM PHP Asset Uploader</title>
<script>
var hostname = '<?php
echo $hostname;
?>
';
</script>
开发者ID:BIGANDYT,项目名称:arm-prototype,代码行数:31,代码来源:index.php
示例20: addnow
function addnow()
{
$adddate[0][1] = trim(filter_input(INPUT_POST, "fname"), " ");
$adddate[1][1] = trim(filter_input(INPUT_POST, "lname"), " ");
$adddate[2][1] = filter_input(INPUT_POST, "email");
$adddate[3][1] = filter_input(INPUT_POST, "addr");
$adddate[4][1] = filter_input(INPUT_POST, "tel");
$adddate[5][1] = filter_input(INPUT_POST, "url");
$adddate[6][1] = filter_input(INPUT_POST, "month");
$adddate[7][1] = filter_input(INPUT_POST, "group");
if ($adddate[0][1] == "") {
echo "First Name Invaild";
return false;
}
if ($adddate[1][1] == "") {
echo "Last Name Invaild";
return false;
}
if ($adddate[2][1] == "") {
echo "Email is invaild";
return false;
}
if ($adddate[3][1] == "") {
echo "Address is invaild";
return false;
}
if ($adddate[4][1] == "") {
echo "Phone number is invaild";
return false;
}
if ($adddate[5][1] == "") {
echo "Website is invaild";
return false;
}
if (filter_var($adddate[5][1], FILTER_VALIDATE_URL) === false) {
echo "Website Not Vaild";
return false;
}
if ($adddate[6][1] == "") {
echo "Birth day is invaild";
return false;
}
$adddate[8] = uploadImage();
$searchAll = getDatabase()->prepare("insert into address set user_id = :id,address_group_id = :group,fullname = :name, email = :email,address= :addr,phone = :phone,website = :web, birthday = :birthday, image = :image");
$binds = array(":id" => $_SESSION["theid"], ":group" => implode($adddate[7]), ":name" => implode($adddate[0]) . " " . implode($adddate[1]), ":email" => implode($adddate[2]), ":addr" => implode($adddate[3]), ":phone" => implode($adddate[4]), ":web" => implode($adddate[5]), ":birthday" => implode($adddate[6]), ":image" => $adddate[8]);
if ($searchAll->execute($binds)) {
return true;
} else {
return false;
}
}
开发者ID:ChrisTUth,项目名称:PHPSummber2015,代码行数:51,代码来源:add.php
注:本文中的uploadImage函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论