function introducirPalabra($palabra)
{
    var_dump($palabra);
    $id = getMaxId('palabras');
    insertMySQL('palabras', array('id', 'palabra'), 'is', array($id, $palabra["palabra"]));
    $valoresSignificados = array(getMaxId('significados'), $id, getIdCampoCte('cte_tipos_palabras', 'tipo', 's', $palabra["significado"]["tipo"]), $palabra["significado"]["acepcion"]);
    insertMySQL('significados', array('id', 'palabra_id', 'tipo', 'acepción'), 'iiis', $valoresSignificados);
    foreach ($palabra["etimologia"] as $etimologia) {
        if (!isset($palabraPrevia)) {
            $palabraPrevia = null;
        }
        $valoresEtimologias = array(getMaxId('etimologias'), $id, "2013-07-31", getIdCampoCte('cte_idiomas', 'idioma', 's', $etimologia["idioma"]), $etimologia["palabra"]);
        $palabraPrevia = $etimologia["palabra"];
        insertMySQL('etimologias', array('id', 'palabra_id', 'fecha', 'idioma', 'palabra'), 'iidss', $valoresEtimologias);
    }
}
Exemplo n.º 2
0
function userEarnedNotify(){
    try{
        $cnt = 0;
        $maxId = getMaxId();
        if(!$_COOKIE['max_id']){
            setcookie('max_id', $maxId);
        }else{
            if($maxId != $_COOKIE['max_id']){
            $db = new PDO("mysql:host=localhost;dbname=".DB_NAME, DB_USER, DB_PASSWORD);
            $db->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
                for($i = $maxId; $i > $_COOKIE['max_id']; $i--){
                    $query = $db->query("SELECT user_id, item_id FROM `wp_bp_notifications` WHERE id = $i");
                    $result = $query->fetch(PDO::FETCH_ASSOC);
                    if($result['user_id'] == get_current_user_id() and $result['user_id'] != 0){
//                        получаем title страницы
                        $title = get_the_title($result['item_id']);
//                        получаем url прикрепленного изображения страницы
                        $img_id = get_post_thumbnail_id($result['item_id']);
                        $img_url =  wp_get_attachment_image_src($img_id,'thumbnail', true);
                        $img_url = $img_url[0];
//                        получаем ссылка на страницу
                        $item_url = get_permalink($result['item_id']);
                        $output .= "<li><b><a href='$item_url'>".get_the_title($result['item_id'])."</a></b></li>";
                        $output .= 
<<<SCRIPT
<a href="#" onclick="Share.vkontakte('$item_url','$title','$img_url','Я получил новую ачивку от ВПШ!')">Поделится ВК</a>
SCRIPT;
                        $cnt += 1;//если будет равен 0 тогда не выводим popup окно на сайте
                    }
                }
                setcookie('max_id', $maxId);
            }
        }
        //        скрываем popup окно если показывать нечего
        if($cnt == 0)
               echo "<style type='text/css'> #overlay-sidebar-wrap {display:none;} </style>"; 
        return $output;
    }catch(PDOException $e){
        die($e->getMessage());
    }
}
Exemplo n.º 3
0
                }
            }
        }
    }
    return $max;
}
function cpm($a, $b)
{
    return $a["id"] < $b["id"] ? -1 : 1;
}
if (isset($_POST['newUser'])) {
    $newUser = $_POST['newUser'];
    $users = json_decode(file_get_contents($file), true);
    if ($users) {
        $count = count($users);
        $maxId = getMaxId($users);
        $newUser = array('id' => $maxId + 1) + $newUser;
    } else {
        $users = [];
        $newUser = array('id' => 1) + $newUser;
    }
    array_push($users, $newUser);
    usort($users, "cpm");
    file_put_contents($file, json_encode($users));
    echo json_encode($users);
    exit;
}
if (isset($_POST['editUser']) && $_POST['editUser']) {
    $editUser = $_POST['editUser'];
    $users = json_decode(file_get_contents($file), true);
    if ($users) {
Exemplo n.º 4
0
 function getprofile()
 {
     $intId = '1';
     $region_image_img_name = "";
     if ($_POST['md_title'] != '') {
         $_POST['md_region_id'] = implode(",", $_POST['md_regions']);
         //  $strSql ='SELECT * FROM tbl_profiles where  title =\'' .$objDatabase->con->real_escape_string(trim($_POST['md_title'])).'\' and region_id = \''.trim($_POST['md_region_id']).'\'  ';
         //	$namecheck_rs = $this->db->query($strSql);
         //   $namecheck=$namecheck_rs->result_array();
         $namecheck = $this->db->where('title', trim($_POST['md_title']))->where('region_id', trim($_POST['md_region_id']))->count_all_results('tbl_profiles');
         $dataint = 0;
         if ($namecheck) {
             $datamsg = 'Profile Name already exists';
             $dataint = 0;
         } else {
             $_POST['db_dob'] = $_POST['year'] . '-' . $_POST['month'] . '-' . $_POST['day'];
             unset($_POST['year']);
             unset($_POST['month']);
             unset($_POST['day']);
             //	$intId= $objDatabase->insertForm('tbl_suggestion');
             $maxid = getMaxId("tbl_suggestion", "id");
             $data = array('gname' => $_POST['db_gname'], 'email' => $_POST['db_email'], 'title' => $_POST['md_title'], 'dob' => $_POST['db_dob'], 'image' => '', 'region_id' => $_POST['md_region_id'], 'kind' => trim($_POST['md_kind']), 'description' => addslashes($_POST['md_description']));
             $this->db->insert('tbl_suggestion', $data);
             if (!empty($_FILES["db_image"]['name'])) {
                 $gettmp_tumbs_arr = array();
                 $imagecounter = 1;
                 $ext = explode(".", $_FILES["db_image"]['name']);
                 $ext = strtolower($ext[1]);
                 $uploadConst['upload_path'] = SITE_UPLOADPATH;
                 $uploadConst['allowed_types'] = 'gif|jpg|png|bmp|jpeg';
                 //$uploadConst['max_size'] = REGION_MAP;
                 //  $uploadConst['min_width'] = '1200';
                 //   $uploadConst['min_height'] = '900';
                 $uploadConst['file_name'] = 'suggestionprofile-' . $maxid . "." . $ext;
                 $this->upload->initialize($uploadConst);
                 if (!$this->upload->do_upload('db_image')) {
                     $remap_error = $this->upload->display_errors();
                     $images_error["masterlist_error"] = $remap_error;
                 } else {
                     $config = array();
                     $image_data = array();
                     $image_data = $this->upload->data();
                     $region_image_img_name = $image_data["orig_name"];
                     $region_ext_img_name = $image_data["file_ext"];
                 }
                 $this->db->query("update tbl_suggestion set image='" . $region_image_img_name . "' where id='" . $maxid . "' ");
             } else {
                 $region_image_img_name = "";
             }
             if ($intId) {
                 $datamsg = 'Thank you! Your submission has been received and is awaiting approval';
                 $dataint = 1;
                 if ($_POST['db_email'] != '') {
                     //*****************************************
                     $strSql = 'SELECT * FROM tbl_mailtemplates  where id=%d';
                     $objRecord1 = $this->db->query(sprintf($strSql, '1'));
                     $messagearr = $objRecord1->row_array();
                     $message = $messagearr["temp_content"];
                     $name = $_POST['db_gname'] != '' ? $_POST['db_gname'] : 'User';
                     $message = str_replace("[#name]", $name, $message);
                     $message = str_replace("[#profilename]", trim($_POST['md_title']), $message);
                     $message = str_replace("[#kind]", $_POST['md_kind'], $message);
                     $message = str_replace("[#description]", $_POST['md_description'], $message);
                     //*****************  Send to Add User **********************
                     send_email($messagearr["subject"], $message, $_POST['db_email'], $_POST['md_title'], $messagearr["from_mail"], $messagearr["title"]);
                     //*******************************************************
                 }
             } else {
                 $datamsg = 'Sorry, your request not sent try later';
                 $dataint = 0;
             }
         }
     } else {
         $datamsg = 'Sorry, your request not sent try later';
         $dataint = 0;
     }
     $data = array($dataint, $datamsg);
     // echo "<pre>";
     // print_r($_POST);
     //  print_r($_FILES);
     //  exit;
     echo json_encode($data);
 }
Exemplo n.º 5
0
<?php

/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
include_once '../../mainfile.php';
include_once XOOPS_ROOT_PATH . '/header.php';
$tablename = $_GET['tablename'];
$idname = $_GET['idname'];
switch ($tablename) {
    case "sim_groups":
        echo getMaxId($idname, $tablename, "");
        break;
    case "":
        break;
    case "":
        break;
    default:
        break;
}
function getMaxId($idname, $tablename, $wherestr)
{
    global $xoopsDB;
    $sql = "SELECT max(" . $idname . ") as id FROM " . $tablename . "  " . $wherestr;
    $query = $xoopsDB->query($sql);
    while ($row = $xoopsDB->fetchArray($query)) {
        return $row['id'];
    }
}
Exemplo n.º 6
0
/**
 * Created by PhpStorm.
 * User: Adriana Valenzuela, Mayra Ruiz & Roberto Ruiz
 * Date: 04/11/2015
 * Time: 11:04
 */
$code = $_GET["code"];
$conn = new mysqli('localhost', 'root', '', 'osham');
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
$result = $conn->query("select * from tempusers where code = '{$code}'");
$row = $result->fetch_assoc();
if (isset($row["email"])) {
    echo "Entro";
    $email = $row["email"];
    $password = $row["password"];
    include "getId.php";
    $id = getMaxId();
    $result->free();
    $result = $conn->query("insert into users values('{$id}','{$email}','{$password}')");
    $conn->close();
    header("location:html/profile.html");
} else {
    echo '<a href=\'login.html\' ><h1>Usuario o password incorrectos, vuelva a intentarlo</h1> </a>';
    echo "bien";
}
?>
</body>
</html>
Exemplo n.º 7
0
    <?php 
include_once 'dbq.php';
$a = $_POST['fname'];
$b = $_POST['lname'];
$c = $_POST['add1'];
$d = $_POST['add2'];
$e = $_POST['city'];
$f = $_POST['state'];
$g = $_POST['zip'];
$h = $_POST['country'];
$i = $_POST['contact'];
$j = $_POST['email'];
$k = $_POST['uname'];
$l = $_POST['pass'];
$q = getDataFromUserName($k, 1);
$mx = intval(getMaxId());
$mx = $mx + 1;
$id = $mx;
if ($q = 'false') {
    $rnd = rand(1111, 9999);
    mysql_query("insert into users values(\n '" . $k . "',\n '" . $l . "',\n '" . $a . "',\n '" . $b . "',\n '" . $c . "',\n '" . $d . "',\n '" . $e . "',\n '" . $f . "',\n '" . $g . "',\n '" . $h . "',\n '" . $i . "',\n '" . $rnd . "',\n '0',\n '" . $mx . "',\n 'NA',\n '" . $j . "')\n ");
    $to = $j;
    $subject = "Email Verification Mail from Indian Web Analyst";
    $message = "\n<html>\n<head>\n<title>Email Verification</title>\n\n</head>\n<body>\n<h1>Your verification code is <a href='http://www.indianwebanalyst.in/verify.php?id=" . $id . "&code=" . $rnd . "'>" . $rnd . "</a></h1>\n<br />\n<a href='http://www.indianwebanalyst.in/verify.php?id=" . $mx . "&code=" . $rnd . "'>Click here to verify.</a>   <br />\nIf this link not working just copy and paste it...<br /><br />\nhttp://www.indianwebanalyst.in/verify.php?id=" . $mx . "&code=" . $rnd . " <br />\n\n\n</body>\n</html>\n";
    // Always set content-type when sending HTML email
    $headers = "MIME-Version: 1.0" . "\r\n";
    $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
    // More headers
    $headers .= 'From: <*****@*****.**>' . "\r\n";
    $headers .= 'Cc: account@indianwebanalyst.in' . "\r\n";
    $from = "*****@*****.**";