Example #1
0
function launchFacebook($terminoBuscar)
{
    $app_access_token = genToken();
    $resultFacebook = app_request("https://graph.facebook.com/v2.5/search?q=" . $terminoBuscar . "&type=page&limit=10&fields=id,name,picture.type(normal),likes&" . $app_access_token);
    //printVar($resultFacebook,$_SERVER['SERVER_NAME'].'/publication/search/results/resultFacebook.json');
    //printVar($_SERVER["DOCUMENT_ROOT"]);
    $fp = fopen($_SERVER["DOCUMENT_ROOT"] . '/publication/search/results/resultFacebook.json', 'w');
    $qpaso = fwrite($fp, json_encode($resultFacebook));
    fclose($fp);
    //printVar($qpaso,'que paso');
    $obj = DB_DataObject::Factory('MpBrand');
    $obj->name = $terminoBuscar;
    $find = $obj->find();
    if ($find > 0) {
        // echo 'entra al if';
        while ($obj->fetch()) {
            //DB_DataObject::debugLevel(1);
            $obj->picture = $resultFacebook['data'][0]['picture']['data']['url'];
            $obj->update();
        }
    } else {
    }
    $obj->free();
    //echo json_encode('');
}
Example #2
0
<?php

# Generate a random token for a transaction
include 'token.php';
$token = genToken();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>QCN Purchase Form</title>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
  google.load("jquery", "1.3.2");
</script>
<script src="_javascripts/address.js" type="text/javascript"></script>
<script src="_javascripts/validate.js" type="text/javascript"></script>
<link type="text/css" rel="stylesheet" href="_stylesheets/forms.css" media="screen" />
</head>
<body>

<div id="container">

  <h3>Quake Catcher Network $49 Sensor Order Form</h3>
  <form action="confirm.php" method="post" id="qcnpurchase">
    <fieldset>
      <h4>Billing Information:</h4><br />
      <label>Full Name</label>
      <input type="text" name="NAME" id="billname" />
    
      <label>Phone</label>
Example #3
0
}
function login($sig, $key, $text)
{
    # Set this to a private directory outside of the webroot. Make sure the permissions are correct
    putenv("GNUPGHOME=/var/www/clients/client0/web5/private/.gnupg");
    $res = gnupg_init();
    gnupg_seterrormode($res, GNUPG_ERROR_WARNING);
    gnupg_import($res, $key);
    $info = gnupg_verify($res, $text, $sig);
    $key = gnupg_keyinfo($res, $info[fingerprint])[0];
    $id = $key["subkeys"][0]["keyid"];
    $uid = $key["uids"][0];
    print " KeyId: " . $id;
    var_dump($uid);
}
function genToken($userdata = NULL)
{
    $characters = '0123456789abcdefghijklmnopqrstuvwxyz';
    $string = '';
    for ($p = 0; $p < 30; $p++) {
        $string .= $characters[mt_rand(0, strlen($characters))];
    }
    return base64_encode(get_curr_url($_SERVER) . ";" . $string . ";" . $userdata);
}
if (isset($_POST['sig'])) {
    // GPG verify signature
    login($_POST['sig'], $_POST['key'], $_POST['random']);
} else {
    echo genToken("test");
    #TODO: Active checking if token has been allowed in.
}
Example #4
0
function autenticar($login, $senha, $db)
{
    $res = $db->query(sprintf("SELECT nome FROM usr WHERE usr_login = '******' AND usr_sn = '%s'", $login, $senha));
    if ($res->num_rows > 0) {
        return genToken();
    } else {
        return "false";
    }
}
Example #5
0
error_reporting(E_ALL);
include 'db/requires.php';
if (isset($_POST['red']) && isset($_POST['url']) && !empty($_POST['url'])) {
    $red = $_POST['red'];
    $url = $_POST['url'];
    $find = '0';
    //  printVar($url.'Url de post');
    //printVar($red,'flag de red 0->f, 1->t, 2->y');
    switch ($red) {
        case '0':
            $dividir = explode('/?', $url);
            $dividir = is_array($dividir) ? $dividir : explode('?', $url);
            $url = is_array($dividir) ? $dividir[0] : $dividir;
            $dividir = is_array($dividir) ? explode('www.facebook.com/', $dividir[0]) : explode('www.facebook.com/', $dividir);
            $terminoBuscar = $dividir['1'];
            $app_access_token = genToken();
            $resultFacebook = app_request("https://graph.facebook.com/v2.5/search?q=" . $terminoBuscar . "&type=page&limit=6&fields=id,name,link,picture.type(normal),likes&" . $app_access_token);
            for ($i = 0; $i < count($resultFacebook['data']); $i++) {
                //   printVar($url,'url recortada');
                //  printVar($resultFacebook['data'][$i]['link']);
                if ($resultFacebook['data'][$i]['link'] == $url || $resultFacebook['data'][$i]['link'] == $url . '/') {
                    $fp = fopen($_SERVER["DOCUMENT_ROOT"] . '/publication/search/results/resultFacebook.json', 'w');
                    fwrite($fp, json_encode($resultFacebook));
                    fclose($fp);
                    $find = '1';
                }
            }
            if ($find != '0') {
                echo json_encode('1');
            } else {
                echo json_encode('0');
$start = intval($argv[1]);
$end = intval($argv[2]);
if (sizeof($argv) != 3) {
    die("SUCKER!!!");
}
$cookie = "yWzBRHaY7KP7QA8ReauAeIxYf5E0Uy1X7pPAm07mZoiAdqzpAh";
$fp = fopen('data' . $start . '.txt', 'w');
$i = $start;
while ($i < $end) {
    //$seed=strval($i);
    $seed = $i;
    mt_srand($seed);
    $cook = generateSession();
    if ($cook === $cookie) {
        $message = "seed: " . $seed . "\n";
        $message .= "token: " . genToken() . "\n";
        fwrite($fp, $message);
        break;
    }
    if ($seed % 10000 == 0) {
        $pourcent = ($seed - $start) * 100 / ($end - $start);
        $message = "Avancement: {$pourcent}%\n";
        fwrite($fp, $message);
    }
    $i += 1;
}
fclose($fp);
function genToken()
{
    $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    $token = "";
Example #7
0
<?php

session_start();
require_once dirname(__FILE__) . "/lib/header.php";
if (isset($_SESSION['loginID'])) {
    locate($URLPv . "index.php");
} else {
    if (isset($_POST['stuID']) && isset($_POST['stuPW'])) {
        if (CheckPOP3($_POST['mailserver'] . ".ndhu.edu.tw", $_POST['stuID'], $_POST['stuPW'])) {
            $_SESSION['loginID'] = $_POST['stuID'];
            $_SESSION['loginToken'] = genToken($DBmain, $_SESSION['loginID']);
            setLogin($DBmain, $_SESSION['loginID'], $_SESSION['loginToken']);
            if (checkAdmin($DBmain, $_SESSION['loginID'])) {
                setLog($DBmain, "info", "Admin Login", $_SESSION['loginID']);
            }
            if (checkReg($DBmain, $_SESSION['loginID'])) {
                locate($URLPv . "index.php");
            } else {
                locate($URLPv . "regist.php");
            }
        } else {
            alert("Login Failed! Please try again. ");
            locate($URLPv . "login.php");
        }
    } else {
        ?>
	<div class="login">
		<form action="login.php" method="post">
			<div class="form-horizontal">
				<div class="form-group">
					<label class="control-label col-sm-2">Email: </label>
Example #8
0
function check_localstorage($token)
{
    global $cache_file;
    $hashs = file($cache_file);
    if (count($hashs) !== 0) {
        $i = 0;
        foreach ($hashs as $hash) {
            $hash = explode(" ", $hash);
            $hash[2] = str_replace("\n", "", $hash[2]);
            if (time() - $hash[0] >= 2592000) {
                delLineFromFile($cache_file, $i);
                continue;
            }
            if ($token === $hash[1]) {
                delLineFromFile($cache_file, $i);
                $_SESSION['username'] = $hash[2];
                $_SESSION['isauth'] = 1;
                genToken();
                return TRUE;
            }
            $i++;
        }
    }
    return FALSE;
}
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $incidencia = Incidencia::find($id);
     $incidencia->fill($request->all());
     $incidencia->fecha_inicio = fecha_ymd($request->fecha_inicio);
     $incidencia->fecha_final = fecha_ymd($request->fecha_final);
     $incidencia->token = genToken();
     $incidencia->save();
     Flash::success('Incidencia editada con exito!');
     return redirect()->route('incidencias.index');
 }