Jump to content

DevilRocks92

Member
  • Posts

    184
  • Joined

  • Last visited

DevilRocks92's Achievements

void

void (1/5)

  • 1 Year

Recent Badges

0

Reputation

  1. Não está a funcionar, já tentei de tudo. a.nav-prev { background: url('img/prev.png'); } a.nav-next { background: url('img/next.png'); } if (this.options.navigation.active) { prevButton = $("<a class='nav-prev'>", { "class": "slidesjs-previous slidesjs-navigation", href: "#", title: "Previous", text: "Previous" }).appendTo($element); nextButton = $("<a class='nav-next'>", { "class": "slidesjs-next slidesjs-navigation", href: "#", title: "Next", text: "Next" }).appendTo($element); } $(".slidesjs-next", $element).click(function(e) { e.preventDefault(); _this.stop(true); return _this.next(_this.options.navigation.effect); }); $(".slidesjs-previous", $element).click(function(e) { e.preventDefault(); _this.stop(true); return _this.previous(_this.options.navigation.effect); });
  2. Ja experimentei e não aparece nem imagem nem o texto...
  3. Peço desculpa, estava a pedir demais... Com alguma pesquisa consegui o que queria. Agora só tenho uma dúvida como substituo o text por uma imagem (no codigo abaixo)? Ja experimentei por no texto a tag <img>, ja tentei substituir "text: " por "img" e "image" e nada resultou. Será que me podem ajudar? if (this.options.navigation.active) { prevButton = $("<a>", { "class": "slidesjs-previous slidesjs-navigation", href: "#", title: "Previous", text: "Previous" }).appendTo($element); nextButton = $("<a>", { "class": "slidesjs-next slidesjs-navigation", href: "#", title: "Next", text: "Next" }).appendTo($element); } Obrigado
  4. Boa tarde, Eu estou a fazer um Webfolio e a minha ideia é alterar as páginas com slide como se fosse um slideshow, mas sem a mudança automática. Isto é o que tenho até agora: index.php <!doctype html> <html> <head> <meta charset="utf-8"> <title>Basic jQuery Slider - Demo</title> <!-- bjqs.css contains the *essential* css needed for the slider to work --> <link rel="stylesheet" href="bjqs.css"> <!-- some pretty fonts for this demo page - not required for the slider --> <link href='http://fonts.googleapis.com/css?family=Source+Code+Pro|Open+Sans:300' rel='stylesheet' type='text/css'> <!-- demo.css contains additional styles used to set up this demo page - not required for the slider --> <link rel="stylesheet" href="demo.css"> <!-- load jQuery and the plugin --> <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script> <script src="js/bjqs-1.3.min.js"></script> </head> <body> <div id="header"> <div id="logo"> <img src="img/logo.png"> </div> <div id="nav"> <ul> <li><a href="#port">PORTFOLIO</a></li> <li><a href="#emp">SERVIÇOS</a></li> <li><a href="#cont">CONTACTOS</a></li> </ul> </div> </div> <div id="container"> <!-- Outer wrapper for presentation only, this can be anything you like --> <div id="banner-fade"> <!-- start Basic Jquery Slider --> <ul class="bjqs"> <li id="port"> <div id="portfolio"> <a class="shadow"><img src="img/Prom.PT_Port - V2.png" /></a> </div> </li> <li id="emp"> <div id="servicos"> <img src="img/Servico_Page.png" /> <div id="text"> <p> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum. </p> </div> </div> </li> <li id="cont"> <div id="contactos"> <div id="info"> <div id="map"> <img src="img/Mapa.png" /> </div> <div id="contact_form"> <img src="img/Contactswindow.png" /> <form> <input type="text" name="nome" value="NOME" class="text" style="color:#aaa" onfocus="if (this.value == 'NOME') {this.value = ''; this.style.color='#000'}" onblur="if (this.value == '') {this.value = 'NOME'; this.style.color='#aaa'}"> <br/><br/> <input type="email" name="email" value="EMAIL" class="text2" style="color:#aaa" onfocus="if (this.value == 'EMAIL') {this.value = ''; this.style.color='#000'}" onblur="if (this.value == '') {this.value = 'EMAIL'; this.style.color='#aaa'}"> <input type="text" name="contacto" value="CONTACTO" class="text2" style="color:#aaa" onfocus="if (this.value == 'CONTACTO') {this.value = ''; this.style.color='#000'}" onblur="if (this.value == '') {this.value = 'CONTACTO'; this.style.color='#aaa'}"> <br/><br/> <textarea rows="13" class="textarea" style="color:#aaa" onfocus="if (this.value == 'MENSAGEM') {this.value = ''; this.style.color='#000'}" onblur="if (this.value == '') {this.value = 'MENSAGEM'; this.style.color='#aaa'}">MENSAGEM<textarea> <br/><br/> <input type="image" src="img/Enviar_Button.png" alt="Submit" id="submit_img" /> </form> </div> </div> </div> </li> </ul> <!-- end Basic jQuery Slider --> </div> <script class="secret-source"> jQuery(document).ready(function($) { $('#banner-fade').bjqs({ height : 565, width : 1200, responsive : true }); }); </script> </div> </body> </html> bjqs.js /* * Basic jQuery Slider plug-in v.1.3 * * http://www.basic-slider.com * * Authored by John Cobb * http://www.johncobb.name * @john0514 * * Copyright 2011, John Cobb * License: GNU General Public License, version 3 (GPL-3.0) * http://www.opensource.org/licenses/gpl-3.0.html * */ ;(function($) { "use strict"; $.fn.bjqs = function(o) { // slider default settings var defaults = { // w + h to enforce consistency width : 700, height : 300, // transition values animtype : 'slide', animduration : 450, // length of transition animspeed : 4000, // delay between transitions automatic : false, // enable/disable automatic slide rotation // control and marker configuration showcontrols : true, // enable/disable next + previous UI elements centercontrols : true, // vertically center controls nexttext : 'Next', // text/html inside next UI element prevtext : 'Prev', // text/html inside previous UI element showmarkers : true, // enable/disable individual slide UI markers centermarkers : true, // horizontally center markers // interaction values keyboardnav : true, // enable/disable keyboard navigation hoverpause : true, // enable/disable pause slides on hover // presentational options usecaptions : true, // enable/disable captions using img title attribute randomstart : false, // start from a random slide responsive : false // enable responsive behaviour }; // create settings from defauls and user options var settings = $.extend({}, defaults, o); // slider elements var $wrapper = this, $slider = $wrapper.find('ul.bjqs'), $slides = $slider.children('li'), // control elements $c_wrapper = null, $c_fwd = null, $c_prev = null, // marker elements $m_wrapper = null, $m_markers = null, // elements for slide animation $canvas = null, $clone_first = null, $clone_last = null; // state management object var state = { slidecount : $slides.length, // total number of slides animating : false, // bool: is transition is progress paused : false, // bool: is the slider paused currentslide : 1, // current slide being viewed (not 0 based) nextslide : 0, // slide to view next (not 0 based) currentindex : 0, // current slide being viewed (0 based) nextindex : 0, // slide to view next (0 based) interval : null // interval for automatic rotation }; var responsive = { width : null, height : null, ratio : null }; // helpful variables var vars = { fwd : 'forward', prev : 'previous' }; // run through options and initialise settings var init = function() { // differentiate slider li from content li $slides.addClass('bjqs-slide'); // conf dimensions, responsive or static if( settings.responsive ){ conf_responsive(); } else{ conf_static(); } // configurations only avaliable if more than 1 slide if( state.slidecount > 1 ){ // enable random start if (settings.randomstart){ conf_random(); } // create and show controls if( settings.showcontrols ){ conf_controls(); } // create and show markers if( settings.showmarkers ){ conf_markers(); } // enable slidenumboard navigation if( settings.keyboardnav ){ conf_keynav(); } // enable pause on hover if (settings.hoverpause && settings.automatic){ conf_hoverpause(); } // conf slide animation if (settings.animtype === 'slide'){ conf_slide(); } } else { // Stop automatic animation, because we only have one slide! settings.automatic = false; } if(settings.usecaptions){ conf_captions(); } // TODO: need to accomodate random start for slide transition setting if(settings.animtype === 'slide' && !settings.randomstart){ state.currentindex = 1; state.currentslide = 2; } // slide components are hidden by default, show them now $slider.show(); $slides.eq(state.currentindex).show(); // Finally, if automatic is set to true, kick off the interval if(settings.automatic){ state.interval = setInterval(function () { go(vars.fwd, false); }, settings.animspeed); } }; var conf_responsive = function() { responsive.width = $wrapper.outerWidth(); responsive.ratio = responsive.width/settings.width, responsive.height = settings.height * responsive.ratio; if(settings.animtype === 'slide'){ // initial setup $slides.css({ 'height' : settings.height, 'width' : '100%' }); $slides.children('img').css({ 'height' : settings.height, 'width' : '100%' }); $slider.css({ 'height' : settings.height, 'width' : '100%' }); $wrapper.css({ 'height' : settings.height, 'max-width' : settings.width, 'position' : 'relative' }); if(responsive.width < settings.width){ $slides.css({ 'height' : responsive.height }); $slides.children('img').css({ 'height' : responsive.height }); $slider.css({ 'height' : responsive.height }); $wrapper.css({ 'height' : responsive.height }); } $(window).resize(function() { // calculate and update dimensions responsive.width = $wrapper.outerWidth(); responsive.ratio = responsive.width/settings.width, responsive.height = settings.height * responsive.ratio; $slides.css({ 'height' : responsive.height }); $slides.children('img').css({ 'height' : responsive.height }); $slider.css({ 'height' : responsive.height }); $wrapper.css({ 'height' : responsive.height }); }); } if(settings.animtype === 'slide'){ // initial setup $slides.css({ 'height' : settings.height, 'width' : settings.width }); $slides.children('img').css({ 'height' : settings.height, 'width' : settings.width }); $slider.css({ 'height' : settings.height, 'width' : settings.width * settings.slidecount }); $wrapper.css({ 'height' : settings.height, 'max-width' : settings.width, 'position' : 'relative' }); if(responsive.width < settings.width){ $slides.css({ 'height' : responsive.height }); $slides.children('img').css({ 'height' : responsive.height }); $slider.css({ 'height' : responsive.height }); $wrapper.css({ 'height' : responsive.height }); } $(window).resize(function() { // calculate and update dimensions responsive.width = $wrapper.outerWidth(), responsive.ratio = responsive.width/settings.width, responsive.height = settings.height * responsive.ratio; $slides.css({ 'height' : responsive.height, 'width' : responsive.width }); $slides.children('img').css({ 'height' : responsive.height, 'width' : responsive.width }); $slider.css({ 'height' : responsive.height, 'width' : responsive.width * settings.slidecount }); $wrapper.css({ 'height' : responsive.height }); $canvas.css({ 'height' : responsive.height, 'width' : responsive.width }); resize_complete(function(){ go(false,state.currentslide); }, 200, "some unique string"); }); } }; var resize_complete = (function () { var timers = {}; return function (callback, ms, uniqueId) { if (!uniqueId) { uniqueId = "Don't call this twice without a uniqueId"; } if (timers[uniqueId]) { clearTimeout (timers[uniqueId]); } timers[uniqueId] = setTimeout(callback, ms); }; })(); // enforce fixed sizing on slides, slider and wrapper var conf_static = function() { $slides.css({ 'height' : settings.height, 'width' : settings.width }); $slider.css({ 'height' : settings.height, 'width' : settings.width }); $wrapper.css({ 'height' : settings.height, 'width' : settings.width, 'position' : 'relative' }); }; var conf_slide = function() { // create two extra elements which are clones of the first and last slides $clone_first = $slides.eq(0).clone(); $clone_last = $slides.eq(state.slidecount-1).clone(); // add them to the DOM where we need them $clone_first.attr({'data-clone' : 'last', 'data-slide' : 0}).appendTo($slider).show(); $clone_last.attr({'data-clone' : 'first', 'data-slide' : 0}).prependTo($slider).show(); // update the elements object $slides = $slider.children('li'); state.slidecount = $slides.length; // create a 'canvas' element which is neccessary for the slide animation to work $canvas = $('<div class="bjqs-wrapper"></div>'); // if the slider is responsive && the calculated width is less than the max width if(settings.responsive && (responsive.width < settings.width)){ $canvas.css({ 'width' : responsive.width, 'height' : responsive.height, 'overflow' : 'hidden', 'position' : 'relative' }); // update the dimensions to the slider to accomodate all the slides side by side $slider.css({ 'width' : responsive.width * (state.slidecount + 2), 'left' : -responsive.width * state.currentslide }); } else { $canvas.css({ 'width' : settings.width, 'height' : settings.height, 'overflow' : 'hidden', 'position' : 'relative' }); // update the dimensions to the slider to accomodate all the slides side by side $slider.css({ 'width' : settings.width * (state.slidecount + 2), 'left' : -settings.width * state.currentslide }); } // add some inline styles which will align our slides for left-right sliding $slides.css({ 'float' : 'left', 'position' : 'relative', 'display' : 'list-item' }); // 'everything.. in it's right place' $canvas.prependTo($wrapper); $slider.appendTo($canvas); }; var conf_controls = function() { // create the elements for the controls $c_wrapper = $('<ul class="bjqs-controls"></ul>'); $c_fwd = $('<li class="bjqs-next"><a href="#" data-direction="'+ vars.fwd +'">' + settings.nexttext + '</a></li>'); $c_prev = $('<li class="bjqs-prev"><a href="#" data-direction="'+ vars.prev +'">' + settings.prevtext + '</a></li>'); // bind click events $c_wrapper.on('click','a',function(e){ e.preventDefault(); var direction = $(this).attr('data-direction'); if(!state.animating){ if(direction === vars.fwd){ go(vars.fwd,false); } if(direction === vars.prev){ go(vars.prev,false); } } }); // put 'em all together $c_prev.appendTo($c_wrapper); $c_fwd.appendTo($c_wrapper); $c_wrapper.appendTo($wrapper); // vertically center the controls if (settings.centercontrols) { $c_wrapper.addClass('v-centered'); // calculate offset % for vertical positioning var offset_px = ($wrapper.height() - $c_fwd.children('a').outerHeight()) / 2, ratio = (offset_px / settings.height) * 100, offset = ratio + '%'; $c_fwd.find('a').css('top', offset); $c_prev.find('a').css('top', offset); } }; var conf_markers = function() { // create a wrapper for our markers $m_wrapper = $('<ol class="bjqs-markers"></ol>'); // for every slide, create a marker $.each($slides, function(key, slide){ var slidenum = key + 1, gotoslide = key + 1; if(settings.animtype === 'slide'){ // + 2 to account for clones gotoslide = key + 2; } var marker = $('<li><a href="#">'+ slidenum +'</a></li>'); // set the first marker to be active if(slidenum === state.currentslide){ marker.addClass('active-marker'); } // bind the click event marker.on('click','a',function(e){ e.preventDefault(); if(!state.animating && state.currentslide !== gotoslide){ go(false,gotoslide); } }); // add the marker to the wrapper marker.appendTo($m_wrapper); }); $m_wrapper.appendTo($wrapper); $m_markers = $m_wrapper.find('li'); // center the markers if (settings.centermarkers) { $m_wrapper.addClass('h-centered'); var offset = (settings.width - $m_wrapper.width()) / 2; $m_wrapper.css('left', offset); } }; var conf_keynav = function() { $(document).keyup(function (event) { if (!state.paused) { clearInterval(state.interval); state.paused = true; } if (!state.animating) { if (event.keyCode === 39) { event.preventDefault(); go(vars.fwd, false); } else if (event.keyCode === 37) { event.preventDefault(); go(vars.prev, false); } } if (state.paused && settings.automatic) { state.interval = setInterval(function () { go(vars.fwd); }, settings.animspeed); state.paused = false; } }); }; var conf_hoverpause = function() { $wrapper.hover(function () { if (!state.paused) { clearInterval(state.interval); state.paused = true; } }, function () { if (state.paused) { state.interval = setInterval(function () { go(vars.fwd, false); }, settings.animspeed); state.paused = false; } }); }; var conf_captions = function() { $.each($slides, function (key, slide) { var caption = $(slide).children('img:first-child').attr('title'); // Account for images wrapped in links if(!caption){ caption = $(slide).children('a').find('img:first-child').attr('title'); } if (caption) { caption = $('<p class="bjqs-caption">' + caption + '</p>'); caption.appendTo($(slide)); } }); }; var conf_random = function() { var rand = Math.floor(Math.random() * state.slidecount) + 1; state.currentslide = rand; state.currentindex = rand-1; }; var set_next = function(direction) { if(direction === vars.fwd){ if($slides.eq(state.currentindex).next().length){ state.nextindex = state.currentindex + 1; state.nextslide = state.currentslide + 1; } else{ state.nextindex = 0; state.nextslide = 1; } } else{ if($slides.eq(state.currentindex).prev().length){ state.nextindex = state.currentindex - 1; state.nextslide = state.currentslide - 1; } else{ state.nextindex = state.slidecount - 1; state.nextslide = state.slidecount; } } }; var go = function(direction, position) { // only if we're not already doing things if(!state.animating){ // doing things state.animating = true; if(position){ state.nextslide = position; state.nextindex = position-1; } else{ set_next(direction); } // fade animation if(settings.animtype === 'slide'){ if(settings.showmarkers){ $m_markers.removeClass('active-marker'); $m_markers.eq(state.nextindex).addClass('active-marker'); } // fade out current $slides.eq(state.currentindex).fadeOut(settings.animduration); // fade in next $slides.eq(state.nextindex).fadeIn(settings.animduration, function(){ // update state variables state.animating = false; state.currentslide = state.nextslide; state.currentindex = state.nextindex; }); } // slide animation if(settings.animtype === 'slide'){ if(settings.showmarkers){ var markerindex = state.nextindex-1; if(markerindex === state.slidecount-2){ markerindex = 0; } else if(markerindex === -1){ markerindex = state.slidecount-3; } $m_markers.removeClass('active-marker'); $m_markers.eq(markerindex).addClass('active-marker'); } // if the slider is responsive && the calculated width is less than the max width if(settings.responsive && ( responsive.width < settings.width ) ){ state.slidewidth = responsive.width; } else{ state.slidewidth = settings.width; } $slider.animate({'left': -state.nextindex * state.slidewidth }, settings.animduration, function(){ state.currentslide = state.nextslide; state.currentindex = state.nextindex; // is the current slide a clone? if($slides.eq(state.currentindex).attr('data-clone') === 'last'){ // affirmative, at the last slide (clone of first) $slider.css({'left': -state.slidewidth }); state.currentslide = 2; state.currentindex = 1; } else if($slides.eq(state.currentindex).attr('data-clone') === 'first'){ // affirmative, at the fist slide (clone of last) $slider.css({'left': -state.slidewidth *(state.slidecount - 2)}); state.currentslide = state.slidecount - 1; state.currentindex = state.slidecount - 2; } state.animating = false; }); } } }; // lets get the party started init(); }; })(jQuery); Será que me podem ajudar a tirar a transição automática e que no menu (#nav) faça a transição (em slide, também). Obrigado
  5. Boas, eu tenho este popup com um form Login (e um form de registo comentado): <div id="login" style="float:right; width:15%; padding-top:3px;"> <a href="#" class="topopup">LOGIN | REGISTAR</a> <div id="toPopup"> <div class="close"></div> <div id="popup_content"> <!--your content start--> <h2>Login</h2> <form id="login"> <table cellpadding="3" cellspacing="2"> <tr> <td> Username: </td> <td> <input type="text" name="username" id="username" /> </td> </tr> <tr height="10px"></tr> <tr> <td> Password: </td> <td> <input type="password" name="password" id="password" /> <br/> <span style="font-size:10px;"><a href="">Esqueceu-se da password?</a></span> </td> </tr> <tr> <td> </td> <td style="text-align:left;"> <input type="submit" name="login" id="login" /> <span style="font-size:12px;"><a href="">Ainda não está inscrito?</a></span> </td> </tr> </table> </form> <!-- <form id="register"> <table cellpadding="3" cellspacing="2"> <tr> <td> Username: </td> <td> <input type="text" name="username" id="username" /> </td> </tr> <tr height="10px"></tr> <tr> <td> Password: </td> <td> <input type="password" name="password" id="password" /> <br/> <span style="font-size:10px;"><a href="#">Esqueceu-se da password?</a></span> </td> </tr> <tr> <td> </td> <td style="text-align:left;"> <input type="submit" name="login" id="login" /> <span style="font-size:12px;"><a href="#register">Ainda não está inscrito?</a></span> </td> </tr> </table> </form> --> </div> <!--your content end--> </div> <!--toPopup end--> <div class="loader"></div> <div id="backgroundPopup"></div> </div> O que eu quero é mudar de formulário com um efeito ao clickar no anchor link como neste exemplo: http://tympanus.net/Tutorials/AnimatedFormSwitching/ Será que me podem ajudar? Obrigado.
  6. Boa tarde, eu tenho uma tabela eventos: id_evento, evento_texto, evento_banner, evento_image, evento_cartaz, evento_idioma Para já faço o upload para o evento_banner e evento_image, pois sao a mesma imagem so altero o tamanho (o codigo esta dentro do <form>): <?php if(isset($_POST['Submit'])){ //Declara um Array para armazenar a mensagem de erro $error = array(); //se o nome for entregue if (empty($_POST['text'])){ $error[] = "text miss"; }else{ $text=$_POST['text']; } if (empty($_POST['cidade'])){ $error[] = "cidade"; }else{ $cidade=$_POST['cidade']; } if (empty($_FILES["file"]["name"])){ $error[] = "Choose an image for the band"; }else{ $image=$_FILES["file"]["name"]; } //send to Database if there's no error ' if (empty($error)) // If everything's OK... { $idioma=$_POST['idioma']; error_reporting(0); $change=""; $abc=""; define ("MAX_SIZE","2048"); function getExtension($str){ $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } $errors=0; if($_SERVER["REQUEST_METHOD"] == "POST") { $uploadedfile = $_FILES['file']['tmp_name']; if ($image) { $filename = stripslashes($_FILES['file']['name']); $extension = getExtension($filename); $extension = strtolower($extension); if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")){ $change='<div class="notification n-error">Unknown Image extension </div> '; $errors=1; }else{ $size=filesize($_FILES['file']['tmp_name']); if ($size > MAX_SIZE*1024){ $change='<div class="notification n-error">You have exceeded the size limit!</div> '; $errors=1; } if($extension=="jpg" || $extension=="jpeg" ){ $uploadedfile = $_FILES['file']['tmp_name']; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png"){ $uploadedfile = $_FILES['file']['tmp_name']; $src = imagecreatefrompng($uploadedfile); }else{ $src = imagecreatefromgif($uploadedfile); } echo $scr; list($width,$height)=getimagesize($uploadedfile); $newwidth=900; $newheight=($height/$width)*$newwidth; $tmp=imagecreatetruecolor($newwidth,$newheight); $newwidth1=300; $newheight1=($height/$width)*$newwidth1; $tmp1=imagecreatetruecolor($newwidth1,$newheight1); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height); imagecopyresampled($tmp1,$src,0,0,0,0,$newwidth1,$newheight1,$width,$height); $filename = "../../images/bands/". $_FILES['file']['name']; $file=explode(".".$extension, $_FILES['file']['name']); $filename1 = "../../images/bands/".$file[0]."_small".".".$extension; imagejpeg($tmp,$filename,100); imagejpeg($tmp1,$filename1,100); imagedestroy($src); imagedestroy($tmp); imagedestroy($tmp1); } } } //If no errors registred, print the success message if(!$errors) { $image=explode('../', $filename); $image1=explode('../', $filename1); $insert=("INSERT INTO eventos(evento_texto, evento_cidade, evento_banner, evento_image, evento_idioma) VALUES ('".$text."', '".$cidade."', '", '".$image[2]."', '".$image1[2]."', '".$idioma."')"); if(mysql_query($insert)){ header('Location: eventos.php'); } else{ echo '<div class="notification n-error">'.mysql_error().'.</div>'; } } else{ echo '<div class="notification n-error">The band already exists!</div>'; } }else{ //If the "error" array contains error msg , display them echo '<div class="notification n-error" <ul>'; foreach ($error as $key => $values) { echo '<li>'.$values.'</li>'; } echo '</ul></div>'; } } ?> O meu objectivo agora é adicionar uma imagem diferente no campo evento_cartaz. Será que me podem ajudar? Obrigado
  7. Boas, Eu estou a tentar criar um sistema de login mas estou com problemas em criar a $_SESSION. Este o meu index.php (form login): <?php include("../require/db_connection.php"); include("top_foot/header.php"); if(isset($_GET['msg'])){ if($_GET['msg']=="error"){ echo ' <span class="notification n-error" style="margin:auto; margin-top:2%; width:50%;">Error!! Wrong username or password!!</span>'; } elseif($_GET['msg']=="logout"){ echo ' <span class="notification n-success" style="margin:auto; margin-top:2%; width:50%;">Logged out successfully!!</span>'; } } ?> <form method="post" action="login.php" style="margin-top:7%; margin-left:25%;"> <table id="login_form" width="100%" border="0" align="center" cellpadding="4" cellspacing="4"> <tr> <td> <!--<img src="../images/" alt="" title="" />--> </td> </tr> <tr> <td width="20%" align="right" valign="middle">Username</td> <td width="3%" align="left" valign="middle">:</td> <td width="77%" align="left" valign="middle"> <label> <input name="login" type="text" style="width:200px; height:15px; padding:5px;" /> </label> </td> </tr> <tr> <td align="right" valign="middle">Password</td> <td align="left" valign="middle">:</td> <td align="left" valign="middle"> <label> <input name="password" type="password" style="width:202px; height:15px; padding:5px;" /> </label> </td> </tr> <tr> <td align="left" valign="middle"> </td> <td align="left" valign="middle"> </td> <td align="left" valign="middle"> <label> <input type="submit" name="button" id="button" value="Login" /> </label> </td> </tr> </table> </form> <?php include("top_foot/footer.php"); ?> login.php <?php ob_start(); require('../require/db_connection.php'); // Define $myusername and $mypassword $login = $_POST['login']; $password = $_POST['password']; // To protect MySQL injection (more detail about MySQL injection) $myusername = mysql_real_escape_string($login); $mypassword = sha1($password); $sql="SELECT * FROM admin WHERE admin_user='".$myusername."' and admin_password='".$mypassword."'"; $result=mysql_query($sql) or die(mysql_error()); $rows=mysql_fetch_assoc($result); // Mysql_num_row is counting table row $count=mysql_num_rows($result); if($count==1){ $_SESSION['user']=$rows['admin_user']; header("location:pages/dashboard.php"); } else { header("location:index.php?msg=error"); } ob_end_flush(); ?> dashboard.php (se login estiver correcto vem para esta pagina) <?php session_start(); if(!$_SESSION['user']){ echo $_SESSION['user']; //da erro nesta linha, nao conhece 'user' die(); } include('top_foot/header.php'); ?> <!-- Header. Main part --> <div id="header-main"> <div class="container_12"> <div class="grid_12"> <div id="logo"> <ul id="nav"> <li id="current"><a href="">Dashboard</a></li> <li><a href="">Users</a></li> <li><a href="">Banners</a></li> <li><a href="">Bands</a></li> <li><a href="">News</a></li> <!-- CONTINUA (....) --> Cumprimentos
  8. Ah, entao tenho de interligar um rss com o website e o Facebook? Será que me podes dar uma ajudinha? é a primeira vez que estou a trabalhar com isto...
  9. Boas, Eu estou a criar um website onde coloco notícias e eventos, o meu objetivo é ao adicionar ele adiciona também na pagina no facebook. Alguém me pode ajudar, sff? Obrigado, DevilRocks92
  10. Posso so dar um conselho? não uses o md5, usa o sha1, pq o md5 ja houve alguem que conseguiu desencriptar, enquanto o sha1, ate agora não tem tido problemas 🙂 Fica o conselho, mas fica a teu critério...
  11. Ja resolvi tudo só faltam umas cenas: no edit.php na lista dos identificadores só me aparece o que pertence à linha que escolhi e eu quero que apareça a lista de todos os identificadores, mas que venha seleccionada a que pertence à linha escolhida... outra, é a linguagem, são sempre as mesmas (Portugues e Ingles), mas eu quero que faça a mesma coisa, seleccione a que pertence à linha escolhida para editar. e por fim, quero que vá para o edit do id da informação que eu escolhi... admin.php: <?PHP include 'db_connect.php'; session_start(); //user 'logado' ou nao if (!isset($_SESSION['username']) || $_SESSION['username'] == '') header("Location: index.php"); $username = $_SESSION['username']; $query_cont_lang="SELECT * FROM content_lang"; $cont_lang=mysql_query($query_cont_lang, $connect); $row_cont_lang=mysql_fetch_assoc($cont_lang); ?> <html> <head> <title>Adminstração</title> <!----------------------------------------------> <script language="JavaScript"> function confirmBox(id) { if (confirm("Tem a certeza que pretende eliminar este registo? ")) { location.href="remover.php?id_content="+id; } else { return false; } } </script> <!----------------------------------------------> <style> a { color:#FFFFFF; text-decoration:none; } a:hover { color:#FFFFFF; text-decoration:underline; } </style> </head> <body style="color:#000000;" bgcolor="#666666"> <font color="#FFFFFF">Bem-Vindo ao Backoffice! <a href="logout.php"> Logout</a></font> <br/> <br/> <a href="adicionar.php"><input type="button" value="Adicionar Novo Conteúdo"></input></a> <!-- <a href="add_user.php"><input type="button" value="Adicionar Novo Utilizador"></input></a> --> <!-- <a href="logout.php"><input type="button" name="sair" value="Logout" /> --> <br/> <?PHP do { $query_cont="SELECT * FROM content WHERE id_content = '".$row_cont_lang['id_content']."'"; $cont=mysql_query($query_cont, $connect); $row_cont=mysql_fetch_assoc($cont); ?> <table width="100%" style="border:2px solid #000000; text-align:center;" align="center"> <tr style="border:3px solid #000000; background:#FFFFFF;"> <td width="10%"> IDENTIFICADOR </td> <td width="10%"> LINGUAGEM </td> <td width="20%"> TÍTULO </td> <td width="30%"> CONTEÚDO </td> <td width="15%"> </td> <td width="15%"> </td> </tr> <td width="5%"> <?PHP echo $row_cont['identifier']; ?> </td> <td width="5%"> <?PHP echo $row_cont_lang['lang']; ?> </td> <td width="10%"> <?PHP echo $row_cont_lang['titulo']; ?> </td> <td align="justify" width="50%"> <?PHP echo $row_cont_lang['descricao']; ?> </td> <?PHP if (!$row_cont_lang==0) { ?> <td width="5%"> <a style="a{text-decoration:none; color:#FFFFFF;} a:hove{text-decoration:underline; color:#FFFFFF;}" href="edit.php?identifier=<?php echo $row_cont['identifier']; ?>">Editar</a> </td> <td width="5%"> <a style="a{text-decoration:none; color:#FFFFFF;} a:hove{text-decoration:underline; color:#FFFFFF;}" href="#" onclick="confirmBox('<?php echo $row_cont_lang['id_content']; ?>')">Remover</a> </td> <?PHP ;} else {} ?> </tr> </table> <?PHP } while ($row_cont_lang=mysql_fetch_assoc($cont_lang)); ?> </body> </html> edit.php: <?PHP include 'db_connect.php'; session_start(); if (isset($_GET['identifier'])) { $sel_id = "SELECT * FROM content WHERE identifier='".$_GET['identifier']."'"; $ident = mysql_query($sel_id, $connect); $row_id = mysql_fetch_assoc($ident); ?> <html> <head> <title>Administração - Editar</title> </head> <body style="color:#FFFFFF;" bgcolor="#666666"> <form action="" method="post"> <table > <tr> <td align="right"> Identificador: </td> <td> <select name="identifier"> <?php do{ $select_content_lang = "SELECT * FROM content_lang WHERE id_content='".$row_id['id_content']."'"; $content_lang = mysql_query($select_content_lang, $connect); $row_content_lang = mysql_fetch_assoc($content_lang); ?> <option value="<?php echo $row_id['id_content']; ?>"> <?PHP echo $row_id['identifier'] ?> </option> <?PHP } while ($row_id = mysql_fetch_assoc($ident)); ?> </select> </td> </tr> <tr height="10px"></tr> <tr> <td align="right"> Linguagem: </td> <td> <select name="lang"> <option value="pt"> Português </option> <option value="en"> Inglês </option> </select> </td> </tr> <tr height="10px"></tr> <tr> <td align="right"> Título: </td> <td> <input value="<?php echo $row_content_lang['titulo'] ?>" type="text" name="titulo"> </input> </td> </tr> <tr height="10px"></tr> <tr> <td align="right" valign="top"> Conteúdo: </td> <td> <textarea name="descricao" cols="50" rows="10"><?php echo $row_content_lang['descricao']?></textarea> </td> </tr> <tr> <td></td> <td> <input type="submit" name="update" value="Editar Informação" /> <a href="admin.php"><input type="button" name="update" value="Voltar"/></a> </td> </tr> </table> </form> </body> </html> <?php if (isset($_POST['update'])) { $identifier=$_POST['identifier']; $lang=$_POST['lang']; $titulo=$_POST['titulo']; $descricao=$_POST['descricao']; $update_info="UPDATE content_lang SET id_content='".$identifier."', lang='".$lang."', titulo='".$titulo."', descricao='".$descricao."' WHERE id='".$row_content_lang['id']."'"; $info=mysql_query($update_info, $connect); if (!$info) { echo '<script>alert("Erro na edição devido a um erro no sistem. Tente mais tarde"); location.href="admin.php"<script>'; } else { echo '<script>alert("Informação editada com sucesso."); location.href="admin.php";</script>'; } } } ?>
  12. No segundo script, o editar, eu estou a tentar iniciar sessão com a linha escolhida e inserir a sua informação na respetiva textbox. O terceiro script, de eliminar eu quero eliminar por id, o id_content vai ter alguns iguais, pois a informação vai ser traduzida, logo vai haver varias linhas com o mesmo id_content... Aqui estao as tabelas para ajudar melhor: content: id_content | identifier content_lang: id | id_content | lang | titulo | descricao
  13. Boa tarde, eu estou a trabalhar num projecto onde estou a criar um Bacoffice. E estou a fazer no admin.php um select da tabela, so que ele dá-me o mesmo identifier qundo este tem velores diferentes: <?PHP include 'db_connect.php'; session_start(); //user 'logado' ou nao if (!isset($_SESSION['username']) || $_SESSION['username'] == '') header("Location: index.php"); $username = $_SESSION['username']; $query_cont_lang="SELECT * FROM content_lang ORDER BY id ASC"; $cont_lang=mysql_query($query_cont_lang, $connect); $row_cont_lang=mysql_fetch_assoc($cont_lang); $query_cont="SELECT * FROM content WHERE id_content = '".$row_cont_lang['id_content']."'"; $cont=mysql_query($query_cont, $connect); $row_cont=mysql_fetch_assoc($cont); ?> <html> <head> <title>Adminstração</title> <!----------------------------------------------> <script language="JavaScript"> function confirmBox(id) { if (confirm("Tem a certeza que pretende eliminar este registo? ")) { location.href="remover.php?id_content="+id; } else { return false; } } </script> <!----------------------------------------------> <style> .sample { border-width: 2px; border-spacing: 1px; border-style: solid; border-color: black; border-collapse: separate; background-color: none; } .sample_tr { border-width: 1px; padding: 1px; border-style: solid; border-color: black; background-color: #FFFFFF; } </style> </head> <body style="color:#000000;" bgcolor="#666666"> <font color="#FFFFFF">Bem-Vindo ao Backoffice! <a href="logout.php"> Sair</a></font> <br/> <br/> <a href="adicionar.php"><input type="button" value="Adicionar Novo Conteúdo"></input></a> <!--<a href="add_user.php"><input type="button" value="Adicionar Novo Utilizador"></input></a>--> <br/> <?PHP do { ?> <table width="100%" style="border:2px solid #000000; text-align:center;" align="center"> <tr style="border:3px solid #000000; background:#FFFFFF;"> <td width="10%"> IDENTIFICADOR </td> <td width="10%"> LINGUAGEM </td> <td width="20%"> TÍTULO </td> <td width="30%"> CONTEÚDO </td> <td width="15%"> </td> <td width="15%"> </td> </tr> <tr style="border:3px solid #000000; background:#FFFFFF; border-width:5px;"> <td width="5%"> <?PHP echo $row_cont['identifier']; ?> </td> <td width="5%"> <?PHP echo $row_cont_lang['lang']; ?> </td> <td width="10%"> <?PHP echo $row_cont_lang['titulo']; ?> </td> <td align="justify" width="50%"> <?PHP echo $row_cont_lang['descricao']; ?> </td> <?PHP if (!$row_cont_lang==0) { ?> <td width="5%"> <a href="edit.php">Editar</a> </td> <td width="5%"> <a href="#" onclick="confirmBox('<?php echo $row_cont_lang['id_content']; ?>')">Remover</a> </td> <?PHP ;} else {} ?> </tr> </table> <?PHP } while ($row_cont_lang=mysql_fetch_assoc($cont_lang)); ?> </body> </html> No editar, não estou a conseguir com que apareça a informação do item que escolho: <?PHP include 'db_connect.php'; session_start(); if (isset($_SESSION['identifier'])) { $identif = $_SESSION['identifier']; } else { $identif = array(); $_SESSION['identifier']=$identif; } $sel_id = "SELECT * FROM content WHERE identifier='".$_SESSION['identifier']."'"; $ident = mysql_query($sel_id, $connect); $row_id = mysql_fetch_assoc($ident); $select_content_lang = "SELECT * FROM content_lang WHERE id_content='".$row_id['id_content']."'"; $content_lang = mysql_query($select_content_lang, $connect); $row_content_lang = mysql_fetch_assoc($content_lang); ?> <html> <head> <title>Administração - Editar</title> </head> <body style="color:#FFFFFF;" bgcolor="#666666"> <form action="" method="post"> <table > <tr> <td align="right"> Identificador: </td> <td> <select> <?php do{ ?> <option value="<?php echo $row_id['id_content']; ?>"> <?PHP echo $row_id['identifier'] ?> </option> <?PHP } while ($row_id=mysql_fetch_assoc($ident)); ?> </select> </td> </tr> <tr height="10px"></tr> <tr> <td align="right"> Linguagem: </td> <td> <select> <!--selecciona opção definida--> <?PHP //if $row_lang="pt" {?> <option value="pt"> Português </option> <?PHP //;} elseif $row_lang="en"{ ?> <option value="en"> Inglês </option> <?PHP //;} ?> </select> </td> </tr> <tr height="10px"></tr> <tr> <td align="right"> Título: </td> <td> <input value="<?php echo $row_content_lang['titulo'] ?>" type="text" name="titulo"> </input> </td> </tr> <tr height="10px"></tr> <tr> <td align="right" valign="top"> Conteúdo: </td> <td> <textarea cols="50" rows="10"><?php echo $row_content_lang['descricao']?></textarea> </td> </tr> <tr> <td></td> <td> <input type="submit" name="update" value="Editar Informação" /> <a href="admin.php"><input type="button" name="update" value="Voltar"/></a> </td> </tr> </table> </form> </body> </html> <?php if (isset($_POST['update'])) { $sel_idcon="SELECT * FROM content WHERE identifier='".$identifier."'"; $idcon=mysql_query($sel_dicon, $connect); $row_idcon=mysql_fetch_assoc($idcon); $update_info="UPDATE content_lang SET id_content='".$row_idcon['id_content']."', lang='".$lang."', titulo='".$titulo."', descricao='".$descricao."' WHERE identifier='".$_SESSION['identifier']."'"; } ?> No delete, estou com dificuldade na parte em que ele me elimine por id, pois se for por id_content apaga-me os varios items com o mesmo id. Ja tentei mudar, mas nao me apaga: <?php include 'db_connect.php'; session_start(); $id_cont= $_REQUEST['id_content']; $delete = "DELETE FROM content_lang WHERE id_content='".$id_cont."'"; $resultado = mysql_query($delete, $connect); header ('Location: admin.php'); ?>
  14. Ei que cena :S Pronto problemas resolvidos, obrigado gente 😉
  15. Ok este ja esta a funcionar so tenho de ajeitar um select que tenho aqui. Agora em relação ao registo ha um ele adiciona username vazio, mas...: Array ( [user] => adminasdas [password] => adiasdas [registar] => Registar ) :S
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.