elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Usando Git para manipular el directorio de trabajo, el índice y commits (segunda parte)


  Mostrar Mensajes
Páginas: 1 2 [3] 4 5
21  Programación / PHP / tiempo de vida en sesiones php en: 9 Agosto 2011, 20:58 pm
quiero crear una sesion y que tenga un tiempo de vida de 5 minutos y despues se elimine, me encontre este codigo en internet pero no me funciona.
pero es justo lo que busco, no se por que no funciona
Código:
<?php
ini_set("session.cookie_lifetime","300");
session_start();
$_SESSION["time"] = time();
if (time() - $_SESSION["time"] < 300) {
echo 'no ha pasado 5 minutos';
}else{
echo 'ha pasado mas de 5 minutos';
session_destroy();
}
?>
22  Programación / PHP / Re: imap con php en: 27 Julio 2011, 21:52 pm
el error es
Warning: imap_open() [function.imap-open]: Couldn't open stream
23  Programación / PHP / imap con php en: 21 Julio 2011, 03:04 am
anteriormente me conectaba con este code por imap
Código:
<?php
if($mbox = @imap_open("{imap.gmail.com:993/imap/ssl}", "user", "passw", OP_HALFOPEN)) 
{
    echo "Ingresaste con exito ";
}
else
 {
    echo "error";
}
?>
pero lo probe tiempo despues en un hosting y siempe me dice error y no me puedo conectar, no se si sea el hosting ya que cuando veo en phpinfo sale esto de imap
IMAP c-Client Version 2007e
SSL Support enabled
Kerberos Support enabled
se supone que esta instalado entonces no entiendo el error
24  Programación / PHP / Re: login curl en: 12 Julio 2011, 00:17 am
peor como lo obtengo y coo lo envio ? 
25  Programación / PHP / login curl en: 10 Julio 2011, 23:09 pm
intento logearme en una web mediante curl pero el problema es que siempre me dice que mi sesion a caducado, alparecer si se envia el ususario y la contraseña.
por ejemplo tengo:
formulario.html
login.php
panel.php

entonces realizo esto

$pd = "user=user&password=password";
$red = "localhost/panel.php";
$c = curl_init('localhost/login.php');
curl_setopt($c, CURLOPT_POSTFIELDS, $pd);
a login le envio los datos.
entonces pense en redireccionar a panel.php para ver si se logeo o no pero no puedo intente de esta forma
curl_setopt($c,CURLOPT_FOLLOWLOCATION,$red);
pero siempre me muestra el login.php, entonces no se que estoy asiendo mal, si e almacenado las cookies.
26  Programación / PHP / Re: uso de script en php en: 23 Mayo 2011, 00:02 am
se programar no mucho, pero me fallan las clases y solo quiero trabajar con esta clase y no con todo el paquete de openinviter, pero no se como manipular solo este archivo.
e intentado realizar la conexion por curl pero prefiero saber que se podria hacer con esta clase
27  Programación / PHP / uso de script en php en: 20 Mayo 2011, 23:36 pm
buenas tardes quiero utilizar este script para conectarme a twitter
Código:
<?php
$_pluginInfo=array(
'name'=>'Twitter',
'version'=>'1.1.1',
'description'=>"Get the contacts from a Twitter account",
'base_version'=>'1.8.0',
'type'=>'social',
'check_url'=>'http://twitter.com',
'requirement'=>'user',
'allowed_domains'=>false,
);
/**
 * Twitter Plugin
 *
 * Imports user's contacts from Twitter and
 * posts a new tweet from the user as a invite.
 *
 * @author OpenInviter
 * @version 1.0.3
 */
class twitter extends OpenInviter_Base
{
private $login_ok=false;
public $showContacts=true;
public $requirement='user';
public $internalError=false;
public $allowed_domains=false;
protected $timeout=30;
protected $maxUsers=100;

public $debug_array=array(
'initial_get'=>'username',
'login_post'=>'inbox',
'friends_url'=>'list-tweet',
'wall_message'=>'latest_text',
'send_message'=>'inbox'
);

/**
* Login function
*
* Makes all the necessary requests to authenticate
* the current user to the server.
*
* @param string $user The current user.
* @param string $pass The password for the current user.
* @return bool TRUE if the current user was authenticated successfully, FALSE otherwise.
*/
public function login($user,$pass)
{
$this->resetDebugger();
$this->service='twitter';
$this->service_user=$user;
$this->service_pass=$pass;
if (!$this->init()) return false;
$res=$this->get("https://mobile.twitter.com/session/new",true);
if ($this->checkResponse('initial_get',$res))
$this->updateDebugBuffer('initial_get',"https://mobile.twitter.com/session/new",'GET');
else
{
$this->updateDebugBuffer('initial_get',"https://mobile.twitter.com/session/new",'GET',false);
$this->debugRequest();
$this->stopPlugin();
return false;
}

$form_action="https://mobile.twitter.com/session";
$post_elements=array('authenticity_token'=>$this->getElementString($res,'name="authenticity_token" type="hidden" value="','"'),'username'=>$user,'password'=>$pass);
$res=$this->post($form_action,$post_elements,true);
if ($this->checkResponse('login_post',$res))
$this->updateDebugBuffer('login_post',"{$form_action}",'POST',true,$post_elements);
else
{
$this->updateDebugBuffer('login_post',"{$form_action}",'POST',false,$post_elements);
$this->debugRequest();
$this->stopPlugin();
return false;
}
$this->login_ok="http://mobile.twitter.com/{$user}/followers";
return true;
}

/**
* Get the current user's contacts
*
* Makes all the necesarry requests to import
* the current user's contacts
*
* @return mixed The array if contacts if importing was successful, FALSE otherwise.
*/
public function getMyContacts()
{
if (!$this->login_ok)
{
$this->debugRequest();
$this->stopPlugin();
return false;
}
else $url=$this->login_ok;
$res=$this->get($url);
if ($this->checkResponse('friends_url',$res))
$this->updateDebugBuffer('friends_url',"{$url}",'GET');
else
{
$this->updateDebugBuffer('friends_url',"{$url}",'GET',false);
$this->debugRequest();
$this->stopPlugin();
return false;
}
$contacts=array();$countUsers=0;
do
{
$nextPage=false;
$doc=new DOMDocument();libxml_use_internal_errors(true);if (!empty($res)) $doc->loadHTML($res);libxml_use_internal_errors(false);
$xpath=new DOMXPath($doc);
$query="//a[@name]";$data=$xpath->query($query);
foreach ($data as $node)
{
$user=(string)$node->getAttribute("name");
if (!empty($user)) {$contacts[$countUsers]=$user; $countUsers++; }
}
$query="//div[@class='list-more']/a";$data=$xpath->query($query);
foreach($data as $node) { $nextPage=$node->getAttribute("href");break; }
if ($countUsers>$this->maxUsers) break;
if (!empty($nextPage)) $res=$this->get('http://mobile.twitter.com'.$nextPage);
}
while ($nextPage);
return $contacts;
}

/**
* Send message to contacts
*
* Sends a message to the contacts using
* the service's inernal messaging system
*
* @param string $cookie_file The location of the cookies file for the current session
* @param string $message The message being sent to your contacts
* @param array $contacts An array of the contacts that will receive the message
* @return mixed FALSE on failure.
*/
public function sendMessage($session_id,$message,$contacts)
{
$countMessages=0;$res=$this->get("http://mobile.twitter.com");$auth=$this->getElementString($res,'name="authenticity_token" type="hidden" value="','"');

$form_action="http://mobile.twitter.com";
$post_elements=array("authenticity_token"=>$auth,'tweet[text]'=>$message['body'],'tweet[in_reply_to_status_id]'=>false,'tweet[lat]'=>false,'tweet[long]'=>false,'tweet[place_id]'=>false,'tweet[display_coordinates]'=>false);
$res=$this->post($form_action,$post_elements,true);

foreach($contacts as $screen_name)
{
$countMessages++;$form_action='http://mobile.twitter.com/inbox';
$post_elements=array('authenticity_token'=>$auth,'message[text]'=>$message['body'],'message[recipient_screen_name]'=>$screen_name,'return_to'=>false,);
$res=$this->post($form_action,$post_elements,true);
if ($this->checkResponse('send_message',$res))
$this->updateDebugBuffer('send_message',"{$form_action}",'POST',true,$post_elements);
else
{
$this->updateDebugBuffer('send_message',"{$form_action}",'POST',false,$post_elements);
$this->debugRequest();
$this->stopPlugin();
return false;
}
sleep($this->messageDelay);
if ($countMessages>$this->maxMessages) {$this->debugRequest();$this->resetDebugger();$this->stopPlugin();break;}
}
}

/**
* Terminate session
*
* Terminates the current user's session,
* debugs the request and reset's the internal
* debudder.
*
* @return bool TRUE if the session was terminated successfully, FALSE otherwise.
*
*/
public function logout()
{
if (!$this->checkSession()) return false;
$this->get("http://twitter.com/logout");
$this->debugRequest();
$this->resetDebugger();
$this->stopPlugin();
return true;
}
}

?>

quiero llamar el code en x.php desde aqui quiero enviar mi user y password para que lo valide y si es incorrecto me mande el error y si se ingreso me diga que mi login fue correcto, no se usar esta clase y no se si todo el codigo me sirva solo quiero hacer el login. como lo tendria que usar?
28  Informática / Hardware / Re: Lapto no enciende en: 29 Abril 2011, 22:34 pm
ok te comento tengo una laptop emachines e627 solo enciende el led del eliminador pero la pc esta muerta no enciende, el problema que tengo es que no cuento con otra ram para probarla ni tampoco una mother o procesador donde probarlos, por si llegara a ser este el problema
29  Informática / Hardware / Laptop no enciende en: 29 Abril 2011, 22:11 pm
cuando una laptop no enciende, solo el led del eliminador que pruebas hay que realizar?
y otra pregunta como es posible saber que el problema es la ram, la mother o el procesador ?  si no cuento con otras para probarlas, es posible que manualmente se pueda llegar a la concluicion ?  
30  Programación / PHP / Re: correos en php gmail en: 27 Enero 2011, 21:00 pm
pero si quiero enviar desde hotmail como le hago ? 
Páginas: 1 2 [3] 4 5
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines