Jump to content


TheDenny

Member Since 02/12/2009
Offline Last Active 02/07/2010, 14:35
-----

Topics I've Started

Armazenar Cache Em Consultas Mysql?

01/07/2010, 17:45

Olá!

Estou fazendo um sistema de contador de visitas. Até aí não tem nada de difícil. O que eu estava querendo implementar nesse sistema era a cache da consultas MySQL. Ou seja, não se consulta o banco para contagem de visitas toda vez que alguém entra no site, mas com um mínimo de intervalo (ou pega o valor do cache). Alguém tem ideia doq eu eu posso fazer?

Abrações!

Menu Scroll Em Movimento

01/06/2010, 15:04

Olá,

Preciso fazer um menu scroll contínuo em movimento, mas não está saindo. Já tentei vários códigos, mas nunca dá totalmente certo. O código tem que ser em Javascript, não podendo usar flash.

<html>

<head>
<title>Scroller</title>
<script>
///////////////////
//www.fortochka.com
//Alexander Babichev 2006 Coopyright
//This script is free for private use. Otherwise a $10 fee per a site is required.
//the script can be modified but the copyright notice should be left unchanged.
///////////////////


var pic = new Array()

function banner(name, width, link, label){
this.name = name
this.width = width
this.link = link
this.label = label
}

pic[0] = new banner('URL',102,'img/1.jpg','Imagem 1')
pic[1] = new banner('URL',102,'img/1.jpg','Imagem 2')
pic[2] = new banner('URL',102,'img/1.jpg','Imagem 3')
pic[3] = new banner('URL',102,'img/1.jpg','Imagem 4')
pic[4] = new banner('URL',102,'img/1.jpg','Imagem 5')

var speed = 50

var kk = pic.length
var ii
var hhh
var nnn
var myInterval
var myPause
var mode = 0


var imgArray = new Array(kk)
var myLeft = new Array(kk)

for (ii=0;ii<kk;ii++){
imgArray[ii] = new Image()
imgArray[ii].src = pic[ii].name
imgArray[ii].width = pic[ii].width

hhh=0
for (nnn=0;nnn<ii;nnn++){
hhh=hhh+pic[nnn].width
}
myLeft[ii] = hhh
}

function ready(){
for (ii=0;ii<kk;ii++){
if (document.images[ii].complete == false){
return false
break
}
}
return true
}


function startScrolling(){
if (ready() == true){
window.clearInterval(myPause)
myInterval = setInterval("autoScroll()",speed)
}
}


function autoScroll(){
for (ii=0;ii<kk;ii++){
myLeft[ii] = myLeft[ii] - 1

if (myLeft[ii] == -(pic[ii].width)){
hhh = 0
for (nnn=0;nnn<kk;nnn++){
if (nnn!=ii){
hhh = hhh + pic[nnn].width
}
}
myLeft[ii] = hhh
}


document.images[ii].style.left = myLeft[ii]
}
mode = 1
}

function stop(){
if (mode == 1){
window.clearInterval(myInterval)
}
if (mode == 0){
window.clearInterval(myPause)
}
}

function go(){
if (mode == 1){
myInterval = setInterval("autoScroll()",speed)
}
if (mode == 0){
myPause = setInterval("startScrolling()",3000)
}
}

myPause = setInterval("startScrolling()",3000)
</Script>

<body bgcolor='#eeffff'>
<script>
for (ii=0;ii<kk;ii++){
document.write(' <a href = ' + pic[ii].link + ' target="_blank" id=""><img space=0 hspace=0 vspace=0 border=0 height=75 style=position:absolute;top:0;left:' + myLeft[ii] + '; src=' + pic[ii].name + ' onMouseOver=stop() onMouseOut=go() alt='+ pic[ii].label + '></a>')
}
</Script>
</body>

</html>


Esse código, quando sozinho, pega perfeitamente. MAs ao tentar inseri-lo em uma div, fica muito desconfigurado (até porque tenho 39 imagens). Além disso, seria interessante que essas imagens tivessem um label. Não preciso continuar com esse código, foi apenar um ponto de partida.

Obrigado

Get Numa Api

20/05/2010, 14:55

Olá. Sou novo em Ajax e Javascript e por isso ainda tenho poucos conhecimentos. Preciso fazer uma conexão via GET com uma API. Há duas dúvidas principais: o código que está fora de uma função deveria comecar automaticamente, mas isso não está acontecendo (testei com uns windows alerts). Outra dúvida é: a sintaxe do GET está certa? Não tenho certeza onde é a falha. Montei um código Frankenstein, baseado em outros que vi.


<?
$ip = getenv("REMOTE_ADDR"); //linha que captura o ip do usuario.
?>
<html>
<head>
<title>Formulário Teste</title>

<script type="text/javascript">


xmlHttp=GetXmlHttpObject();
var url="http://api.getclicky...api/stats/4/?";
url=url+"site_id=ID&sitekey=SITEKEY&type=visitors-list&ip_address=<?=$ip>";
url=url+"&visitor-details=landing_page,referrer_url";
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
xmlHttp.onreadystatechange=stateChanged;

//criar xmlHTTP
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}


//mudanca estado da requisicao
function stateChanged()
{
if (xmlHttp.readyState==4)
{
document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
}
}

</script>
</head>

<body>

<p><span id="txtHint"></span></p>
</body>
</html>


[Resolvido] Includesa Automaticos?

04/12/2009, 13:42

Aqui está minha dúvida. Tenho um formulário em ASP que faz a conexão com o banco de dados. O problema é que os campos para a conexão estão em variáveis Session, só que não tenho ideia onde essas variáveis foram definidas. Em nenhum include isso acontece.

Script conexão com banco de dados:
[codebox]<%
Set cnDados = Server.CreateObject("ADODB.Connection")

cnDados.Open "driver={SQL Server};server=blablabla ; UID=" + CStr(Session("DBUser")) + ";PWD=" + CStr(Session("DBSenha")) + ";Database=" + CStr(Session("DBName"))
%>[/codebox]


Como sou iniciante no ASP, gostaria de saber se ele inclui automaticamente algum tipo de arquivo ou algum diretório, que tenha definido essas variáveis. Caso alguém tenha uma ideia de como possa achar essas variáveis sem ter que abrir e olhar milhares de formulários, também vale.

IPB Skin By Virteq