Jump to content

hodgey87

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Everything posted by hodgey87

  1. Thanks i tried your script but couldnt get it too work properly, but with the other one it worked fine. Ive added in your logic though with the if statements and it works perfect. Im not a php developer and probably will never do this again i think as long it does what its supposed to thatll do for now. Thanks for your help
  2. Thanks for your help really appreciate it, got it working had re arranged the code and it worked fine. Just one final thing though On the index page i have 'login' but when i go back to the index page once logged in it still displays login. Ive looked at the code like so: <?php if(!empty($_SESSION['LoggedIn']) && !empty($_SESSION['Username'])) { $link1 = '<a href="login.php">Member</a>'; $link = '<a href="logout.php">Logout</a>'; ?> <!--<h1>Member Area</h1>--> <!--<center><p>Thanks for logging in! You are <b><?=$_SESSION['Username']?></b> and your email address is <b><?=$_SESSION['EmailAddress']?></b>.</p></center>--> <ul> <!--<li><a href="logout.php">Logout.</a></li>--> <!--<li><?php echo $link; ?></li>--> </ul> <?php } elseif(!empty($_POST['username']) && !empty($_POST['password'])) { $username = mysql_real_escape_string($_POST['username']); $password = md5(mysql_real_escape_string($_POST['password'])); $checklogin = mysql_query("SELECT * FROM users WHERE Username = '".$username."' AND Password = '".$password."'"); if(mysql_num_rows($checklogin) == 1) { $row = mysql_fetch_array($checklogin); $email = $row['EmailAddress']; $_SESSION['Username'] = $username; $_SESSION['EmailAddress'] = $email; $_SESSION['LoggedIn'] = 1; echo "<h1>Success</h1>"; echo "<p>We are now redirecting you to the member area.</p>"; echo "<meta http-equiv='refresh' content='=2;member.php' />"; } else { echo "<h1>Error</h1>"; echo "<p>Sorry, your account could not be found. Please <a href=\"login.php\">click here to try again</a>.</p>"; } } else { ?> <?php } ?> <nav> <ul id="menu"> <li id="active"><a href="index.php">Home</a></li> <li><a href="About.php">About</a></li> <li><a href="Contact.php">Contact</a></li> <!--<li><a href="login.php">Member</a></li>--> [b]<li><?php echo $link; ?></li> <li class="end"><?php echo $link1; ?></li>[/b] </ul> </nav> </div> Is it possible to switch between the 2 links depending on whether your logged in or not? With this bit in the navigation: <ul id="menu"> <li id="active"><a href="index.php">Home</a></li> <li><a href="About.php">About</a></li> <li><a href="Contact.php">Contact</a></li> <li><?php echo $link; ?></li> <li class="end"><?php echo $link1; ?></li> </ul> Thanks in advance.
  3. Ok thank you, ive added the extra if statement in but i cant display the logout link in the navigation. Ive edited the code like you said: <li class="end"><?php echo $link; ?></li> and <?php if(!empty($_SESSION['LoggedIn']) && !empty($_SESSION['Username'])) { ?> <!--<h1>Member Area</h1>--> <center><p>Thanks for logging in! You are <b><?=$_SESSION['Username']?></b> and your email address is <b><?=$_SESSION['EmailAddress']?></b>.</p></center> <ul> <!--<li><a href="logout.php">Logout.</a></li>--> </ul> <?php } elseif(!empty($_POST['username']) && !empty($_POST['password'])) { $username = mysql_real_escape_string($_POST['username']); $password = md5(mysql_real_escape_string($_POST['password'])); $checklogin = mysql_query("SELECT * FROM users WHERE Username = '".$username."' AND Password = '".$password."'"); if(mysql_num_rows($checklogin) == 1) { $row = mysql_fetch_array($checklogin); $email = $row['EmailAddress']; $_SESSION['Username'] = $username; $_SESSION['EmailAddress'] = $email; $_SESSION['LoggedIn'] = 1; echo "<h1>Success</h1>"; echo "<p>We are now redirecting you to the member area.</p>"; echo "<meta http-equiv='refresh' content='=2;member.php' />"; } else { echo "<h1>Error</h1>"; echo "<p>Sorry, your account could not be found. Please <a href=\"login.php\">click here to try again</a>.</p>"; } } else { ?> [b]<?php if(isset ($_SESSION['Username']) && isset($_SESSION['LoggedIn']) && $_SESSION['LoggedIn']=== 1){ $link = '<a href="logout.php">Logout</a>'; }else{ $link = '<a href="login.php">Logout</a>'; } ?>[/b] Yes i know im not the best at this, but i am trying
  4. Ok, that makes sense but is that 'if' statement separate to the statement i already have like so: elseif(!empty($_POST['username']) && !empty($_POST['password'])) { $username = mysql_real_escape_string($_POST['username']); $password = md5(mysql_real_escape_string($_POST['password'])); $checklogin = mysql_query("SELECT * FROM users WHERE Username = '".$username."' AND Password = '".$password."'"); if(mysql_num_rows($checklogin) == 1) { $row = mysql_fetch_array($checklogin); $email = $row['EmailAddress']; $link = '<a href="logout.php">Logout</a>'; $_SESSION['Username'] = $username; $_SESSION['EmailAddress'] = $email; $_SESSION['LoggedIn'] = 1; echo "<h1>Success</h1>"; echo "<p>We are now redirecting you to the member area.</p>"; echo "<meta http-equiv='refresh' content='=2;member.php' />"; } else { $link = '<a href="login.php">Login</a>'; echo "<h1>Error</h1>"; echo "<p>Sorry, your account could not be found. Please <a href=\"login.php\">click here to try again</a>.</p>"; } }
  5. Thank you for your response, websites / php in general arent my forte. Im a Cisco engineer but been roped into building our website I see what your saying though, the part where its checking it a user is logged in or not is here: if(mysql_num_rows($checklogin) == 1) { $row = mysql_fetch_array($checklogin); $email = $row['EmailAddress']; [b]$link = '<a href="logout.php">Logout</a>';[/b] - Can you even do that? $_SESSION['Username'] = $username; $_SESSION['EmailAddress'] = $email; $_SESSION['LoggedIn'] = 1; echo "<h1>Success</h1>"; echo "<p>We are now redirecting you to the member area.</p>"; echo "<meta http-equiv='refresh' content='=2;member.php' />"; } else { $link = '<a href="logout.php">Logout</a>'; echo "<h1>Error</h1>"; echo "<p>Sorry, your account could not be found. Please <a href=\"login.php\">click here to try again</a>.</p>"; } } else { ?> Honestly im not sure how it'd be formatted but, ill work on it and see if i can get it in the right area.
  6. Hi, Just wondered if anyone could help Ive been following this tutorial: http://net.tutsplus.com/tutorials/php/user-membership-with-php/ Ive got a simple membership system working now, but just wondering about the login / login links that i currently have. The login link is currently hard coded like so: <ul id="menu"> <li id="active"><a href="index.html">Home</a></li> <li><a href="About.html">About</a></li> <li><a href="Contact.php">Contact</a></li> <li class="end"><a href="login.php">Login</a></li> </ul> and same for the logout: <ul id="menu"> <li id="active"><a href="index.html">Home</a></li> <li><a href="About.html">About</a></li> <li><a href="Contact.php">Contact</a></li> <li class="end"><a href="logout.php">Logout</a></li> </ul> But the problem is, when i go to the about us page for example it will still display the login which really it should have logout. Could anyone offer some assistance please
  7. Ive seen this while ive been searching, ive been working with php for about 4 weeks now ive read that on the index.php you need to have the <?php ?> tag at the top so i just added: <?php session_start(); ?> in the login.php its saying about this line: [b] header("Location: index.php"); // Goes to main page.[/b] But im not sure what i need to be doing with it.
  8. Cheers, ive seen that but still not quite sure.
  9. Hi Everyone, Just wondered if anyone could help with error: In my index file i have: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <LINK REL="SHORTCUT ICON" HREF="images/cuju8.ico" type="image/x-icon"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" > <title>英超联赛,英超积分榜,英超赛程表,英超新闻 - 蹴鞠吧</title> <link href="default.css" rel="stylesheet" type="text/css" media="screen" > <!-- start header --> <?php include("menu.php");?> <!-- end header --> <div id="wrapper"> <!-- start page --> <div id="page"> <?php include("side.php");?> <!-- start content --> <div id="content"> <div class="post"> <div class="entry"> <SCRIPT LANGUAGE="JavaScript"> //-- Begin Scroller's Parameters and message --> //scroller width: change to your own; var wwidth=470; //scroller height: change to your own; var wheight=20; //background color: change to your own; var wbcolor="white"; //scroller's speed: change to your own; var sspeed=2; var restart=sspeed; var rspeed=sspeed; //text: change to your own wwholemessage='<nobr class=tab><b><a href="http://www.cuju8.com/CompetitionWinners.php">上周蹴鞠吧英超互动短信竞赛获奖名单及奖品详细内容。 '+ ''+ '</b></nobr>'; //-- begin: Scroller's Algorithm --> var sizeupw=0;var operbr=navigator.userAgent.toLowerCase().indexOf('opera');if(operbr==-1&&navigator.product&&navigator.product=="Gecko"){var agt = navigator.userAgent.toLowerCase();var rvStart = agt.indexOf('rv:');var rvEnd = agt.indexOf(')', rvStart);var check15 = agt.substring(rvStart+3, rvEnd);if(parseFloat(check15)>=1. operbr=0;}if (navigator.appVersion.indexOf("Mac")!=-1)operbr=0; function goup(){if(sspeed!=rspeed*{sspeed=sspeed*2;restart=sspeed;}} function godown(){if(sspeed>rspeed){sspeed=sspeed/2;restart=sspeed;}} function startw(){if(document.getElementById)ns6marqueew(document.getElementById('wslider'));else if(document.all) iemarqueew(wslider);else if(document.layers)ns4marqueew(document.wslider1.document.wslider2);}function iemarqueew(whichdiv){iedivw=eval(whichdiv);iedivw.style.pixelLeft=wwidth+"px";iedivw.innerHTML='<nobr>'+wwholemessage+'</nobr>';sizeupw=iedivw.offsetWidth;ieslidew();}function ieslidew(){if(iedivw.style.pixelLeft>=sizeupw*(-1)){iedivw.style.pixelLeft-=sspeed+"px";setTimeout("ieslidew()",100);}else{iedivw.style.pixelLeft=wwidth+"px";ieslidew();}}function ns4marqueew(whichlayer){ns4layerw=eval(whichlayer);ns4layerw.left=wwidth;ns4layerw.document.write('<nobr>'+wwholemessage+'</nobr>');ns4layerw.document.close();sizeupw=ns4layerw.document.width;ns4slidew();}function ns4slidew(){if(ns4layerw.left>=sizeupw*(-1)){ns4layerw.left-=sspeed;setTimeout("ns4slidew()",100);}else{ns4layerw.left=wwidth;ns4slidew();}}function ns6marqueew(whichdiv){ns6divw=eval(whichdiv);ns6divw.style.left=wwidth+"px";ns6divw.innerHTML='<nobr>'+wwholemessage+'</nobr>';sizeupw=ns6divw.offsetWidth;if(operbr!=-1){document.getElementById('operaslider').innerHTML='<nobr>'+wwholemessage+'</nobr>';sizeupw=document.getElementById('operaslider').offsetWidth;}ns6slidew();}function ns6slidew(){if(parseInt(ns6divw.style.left)>=sizeupw*(-1)){ns6divw.style.left=parseInt(ns6divw.style.left)-sspeed+"px";setTimeout("ns6slidew()",100);}else{ns6divw.style.left=wwidth+"px";ns6slidew();}} //-- end Algorithm --> </script> <!-- End of Script between <head> & </head> tags--> <link rel="stylesheet" type="text/css" href="style.css" /> <script type="text/javascript" src="js/jquery-1.2.6.min.js"></script> <script type="text/javascript" src="js/jquery-easing-1.3.pack.js"></script> <script type="text/javascript" src="js/jquery-easing-compatibility.1.2.pack.js"></script> <script type="text/javascript" src="js/coda-slider.1.1.1.pack.js"></script> <script type="text/javascript"> var theInt = null; var $crosslink, $navthumb; var curclicked = 0; theInterval = function(cur){ clearInterval(theInt); if( typeof cur != 'undefined' ) curclicked = cur; $crosslink.removeClass("active-thumb"); $navthumb.eq(curclicked).parent().addClass("active-thumb"); $(".stripNav ul li a").eq(curclicked).trigger('click'); theInt = setInterval(function(){ $crosslink.removeClass("active-thumb"); $navthumb.eq(curclicked).parent().addClass("active-thumb"); $(".stripNav ul li a").eq(curclicked).trigger('click'); curclicked++; if( 6 == curclicked ) curclicked = 0; }, 3000); }; $(function(){ $("#main-photo-slider").codaSlider(); $navthumb = $(".nav-thumb"); $crosslink = $(".cross-link"); $navthumb .click(function() { var $this = $(this); theInterval($this.parent().attr('href').slice(1) - 1); return false; }); theInterval(); }); </script> <body> <div id="page-wrap"> <div class="slider-wrap"> <div id="main-photo-slider" class="csw"> <div class="panelContainer"> <div class="panel" title="Panel 1"> <div class="wrapper"> <a href ="News396.php"><img src="images/teveznews396gallery.png" alt="temp" /> </a> <div class="photo-meta-data"> 特维斯转会计划宣告流产,何去何从又成未知数</a><br /> <span></span> </div> </div> </div> <div class="panel" title="Panel 2"> <div class="wrapper"> <a href ="MatchCommentatorComp.php"><img src="images/comgallery.png" alt="temp" /> </a> <div class="photo-meta-data"> 想要成为赛事当天的实况广播员…<br /> <span></span> </div> </div> </div> <div class="panel" title="Panel 3"> <div class="wrapper"> <a href ="SignedShirtComp.php"><img src="images/shirtgallery.png" alt="temp" /> </a> <div class="photo-meta-data"> 赢签名球衣大奖<br /> <span></span> </div> </div> </div> <div class="panel" title="Panel 4"> <div class="wrapper"> <a href ="GuessThePlayerComp.php"><img src="images/guessgallery.png" alt="temp" /> </a> <div class="photo-meta-data"> 猜猜这名球员是谁<br /> <span></span> </div> </div> </div> <div class="panel" title="Panel 5"> <div class="wrapper"> <a href ="MeetAPlayer.php"><img src="images/meetaplayergallery.png" alt="temp" /> </a> <div class="photo-meta-data"> 赢得与一位明星球员见面的机会<br /> <span></span> </div> </div> </div> <div class="panel" title="Panel 6"> <div class="wrapper"> <a href ="IanArgues.php"><img src="images/ianarguesgallery.png" alt="temp" /> </a> <div class="photo-meta-data"> 爵爷炮轰裁判根本没道理!<br /> <span></span> </div> </div> </div> </div> </div> <a href="#1" class="cross-link active-thumb"><img src="images/teveznews396thumb.png" class="nav-thumb" alt="temp-thumb" /></a> <div id="movers-row"> <div><a href="#2" class="cross-link"><img src="images/comthumb.png" class="nav-thumb" alt="temp-thumb" /></a></div> <div><a href="#3" class="cross-link"><img src="images/shirtthumb.png" class="nav-thumb" alt="temp-thumb" /></a></div> <div><a href="#4" class="cross-link"><img src="images/guessthumb.png" class="nav-thumb" alt="temp-thumb" /></a></div> <div><a href="#5" class="cross-link"><img src="images/meetaplayerthumb.png" class="nav-thumb" alt="temp-thumb" /></a></div> <div><a href="#6" class="cross-link"><img src="images/ianarguesthumb.png" class="nav-thumb" alt="temp-thumb" /></a></div> </div> </div> </div> </div> </div> <br> <br> <!--<p class="byline"></p>--> <div class="post"> <!--<h2 class="title"><a></a></h2> <p class="byline"><small><a></a></small></p>--> <div class="post"> <h2 class="title"><div style="background-image: url(http://www.cuju8.com/images/title.png ); background-repeat: no-repeat; width:493px; height:40px; COLOR: white; text-indent:1.0em;margin: 0 0 0 0; padding: 10px 15px 0px 15px; ">蹴鞠吧 - 带英超回中国</div></h2> <div class="entry"> <div style="width:490px;height:179px;border-width:1px; border-style:dashed; border-color:grey"> <center><p>欢迎来到<a href="AboutUs.php">蹴鞠吧</a>!蹴鞠吧是一家坐落于英国史塔福郡利奇菲尔德的有限公司。蹴鞠吧代表英超并向中国广大球迷观众朋友们推广和宣传英超与<a href="AboutUs.php">英超联赛</a>。网站报道<a href="News.php">独家英超新闻</a>,涵盖曼联,阿森纳,利物浦,切尔西,曼城等世界顶尖足球俱乐部的一手消息,同时包括不断更新的<a href="Table.php">英超积分榜</a>和<a href="Fixtures.php">英超赛程表</a>。我们同时在五星体育举办<a href="Competitions.php">短信竞猜</a>活动,请查看<a href="CompetitionWinners.php">短信竞赛详细信息</a>。我们目前与中国电视体育联播平台(CSPN),Titan,体邀网,hisports,Tom.com等国内知名体育网络紧密合作,为了让中国广大英超球迷能更近距离的感受英超,甚至有机会亲临英超赛场!</p></center> </div> </div> </div> </div> <br> <br> <div class="post"> <!--<h2 class="title"><a></a></h2> <p class="byline"><small><a></a></small></p>--> <div class="post"> <h2 class="title"><a href="ExclusiveNews4.php"><div style="background-image: url(http://www.cuju8.com/images/title.png ); background-repeat: no-repeat; width:493px; height:40px; COLOR: white; text-indent:1.0em;margin: 0 0 0 0; padding: 10px 15px 0px 15px; ">蹴鞠吧独家报道</div></a></h2> <div class="entry"> <div style="width:490px;height:149px;border-width:3px; border-style:solid; border-color:#8C0209"> <img src="images/footballthumbhomepage.png" alt="" width="100" height="100" align="left" style="border: 15px white solid;"> <ul> <a href="News362.php"><li><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">霍利尔因病离开,维拉官方证实开始寻找新帅</font></li> <a/> <a href="News391.php"><li><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">曼城拒绝巴西俱乐部邀约,不放走摇钱树特维斯</font></li><a/> <a href="News347.php"><li><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">曼城胜热刺保住欧冠门票,砸钱多年终得回报</font></li><a/> <a href="News346.php"><li><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">红军状态全面复苏,下赛季叫板曼联</font></li><a/> <a href="ExclusiveNews4.php"><p style= text-indent:22.0em;>更多精彩新闻</p></a> </ul> </div> </div> </div> </div> <br> <br> <div class="post"> <!--<h2 class="title"><a></a></h2> <p class="byline"><small><a></a></small></p>--> <div class="post"> <h2 class="title"><a href="FootballClubActivities6.php"><div style="background-image: url(http://www.cuju8.com/images/title.png ); background-repeat: no-repeat; width:493px; height:40px; COLOR: white; text-indent:1.0em;margin: 0 0 0 0; padding: 10px 15px 0px 15px; ">球队动向</div></a></h2> <div class="entry"> <div style="width:490px;height:149px;border-width:3px; border-style:solid; border-color:#8C0209"> <img src="images/soccerthumbhomepage.png" alt="" width="100" height="100" align="left" style="border: 15px white solid;"> <ul> <a href="News396.php"><li><font face="Arialuni, 'Arial Unicode MS" size="2">特维斯转会计划宣告流产,何去何从又成未知数</font></li></a> <a href="News397.php"><li><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">曼城瞄准新目标,即将挖角阿奎罗</font></li></a> <a href="News395.php"><li><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">维拉挖角曼城板凳门将,谢恩吉文期待第二春</font></li></a> <a href="News394.php"><li><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">特维斯即将离开曼城,人缘好队友送祝福</font></li></a> <a href="FootballClubActivities6.php"><p style= text-indent:22.0em;>更多精彩新闻</p></a> </ul> </div> </div> </div> </div> <br> <br> <div class="post"> <!--<h2 class="title"><a></a></h2> <p class="byline"><small><a></a></small></p>--> <div class="post"> <h2 class="title"><a href="GeneralNews4.php"><div style="background-image: url(http://www.cuju8.com/images/title.png ); background-repeat: no-repeat; width:493px; height:40px; COLOR: white; text-indent:1.0em;margin: 0 0 0 0; padding: 10px 15px 0px 15px; ">每日新闻</div></a></h2> <div class="entry"> <div style="width:490px;height:165px;border-width:3px; border-style:solid; border-color:#8C0209"> <!--<img src="images/wolvesvideo.jpg" alt="" width="100" height="100" align="left" style="border: 15px white solid;">--> <!--<ul> <li>英国老牌劲旅狼队邀请中国球迷参观俱乐部主场,蹴鞫吧带您探访百年老店!</li> <li>英国老牌劲旅狼队邀请中国球迷参观俱乐部主场,蹴鞫吧带您探访百年老店!</li> <li>英国老牌劲旅狼队邀请中国球迷参观俱乐部主场,蹴鞫吧带您探访百年老店!</li> <li>英国老牌劲旅狼队邀请中国球迷参观俱乐部主场,蹴鞫吧带您探访百年老店!</li> </ul>--> <center><table border="0" cellspacing="5"> <tr> <td><a href="News345.php"><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">曼城2-1战胜切尔西,红魔目标双冠王</font></a></td> <td><a href="News329.php"><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">莫耶斯希望时间倒转</font></a></td> </tr> <tr> <td><a href="News334.php"><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">威尔希尔呼吁枪手们摆脱噩梦面向未来</font></a></td> <td><a href="News335.php"><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">科尔:赢球的感觉是我前进的动力</font></a></td> </tr> <tr> <td><a href="News339.php"><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">红蓝大战即将展开,曼联目标双冠王</font></a></td> <td><a href="News343.php"><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">狼队3-1战胜西布朗,成功脱离降级区</font></a></td> </tr> <tr> <td><a href="News326.php"><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">蓝队收到埃森这一重要助力</font> </a></td> <td><a href="News352.php"><font face="Arialuni, 'Arial Unicode MS", Times, serif" size="2">爵爷深谋远虑,后悔没举旗向利物浦炫耀</font></a></td> </tr> </table></center> <a href="GeneralNews4.php"><p style= text-indent:33.0em;>更多</p></a> </div> </div> </div> </div> <br> <br> <div class="post"> <!--<h2 class="title"><a></a></h2> <p class="byline"><small><a></a></small></p>--> <div class="post"> <h2 class="title"><a><div style="background-image: url(http://www.cuju8.com/images/title.png ); background-repeat: no-repeat; width:493px; height:40px; COLOR: white; text-indent:1.0em;margin: 0 0 0 0; padding: 10px 15px 0px 15px; ">英超精选图片</div></a></h2> <div class="entry"> <!--<div style="width:490px;height:115px;border-width:3px; border-style:solid; border-color:#0f2752 #00d0ff">--> <!--<img src="images/wolvesvideo.jpg" alt="" width="100" height="100" align="left" style="border: 15px white solid;"> <br> <ul> <li>英国老牌劲旅狼队邀请中国球迷参观俱乐部主场,蹴鞫吧带您探访百年老店!</li> <li>英国老牌劲旅狼队邀请中国球迷参观俱乐部主场,蹴鞫吧带您探访百年老店!</li> <li>英国老牌劲旅狼队邀请中国球迷参观俱乐部主场,蹴鞫吧带您探访百年老店!</li> <li>英国老牌劲旅狼队邀请中国球迷参观俱乐部主场,蹴鞫吧带您探访百年老店!</li> </ul>--> <img alt="this is image #1" src="images/home1thumb.png" style="width:110px; height:100px; border:5px white; padding:5px; float:left;"/> <img alt="this is image #2" src="images/home2thumb.png" style="width:110px; height:100px; border:5px white; padding:5px; float:left;" /> <img alt="this is image #3" src="images/home3thumb.png" style="width:110px; height:100px; border:5px white; padding:5px; float:left;" /> <img alt="this is image #4" src="images/home4thumb.png" style="width:110px; height:100px; border:5px white; padding:5px; float:left;" /> <!--<a href="FootballClubActivities3.php"><p style= text-indent:22.0em;>更多</p></a>--> <!--</div>--> </div> </div> </div> <br> <br> <br> <br> <br> <br> <div class="post"> <!--<h2 class="title"><a></a></h2> <p class="byline"><small><a></a></small></p>--> <div class="post"> <br> <br> <h2 class="title"><a href="Video.php"><div style="background-image: url(http://www.cuju8.com/images/title.png ); background-repeat: no-repeat; width:493px; height:40px; COLOR: white; text-indent:1.0em;margin: 0 0 0 0; padding: 10px 15px 0px 15px; ">精彩视频</div></a></h2> <center><div class="entry"> <!--<div style="width:490px;height:115px;border-width:3px; border-style:solid; border-color:#0f2752 #00d0ff">--> <!--<img src="images/wolvesvideo.jpg" alt="" width="100" height="100" align="left" style="border: 15px white solid;"> <br> <ul> <li>英国老牌劲旅狼队邀请中国球迷参观俱乐部主场,蹴鞫吧带您探访百年老店!</li> <li>英国老牌劲旅狼队邀请中国球迷参观俱乐部主场,蹴鞫吧带您探访百年老店!</li> <li>英国老牌劲旅狼队邀请中国球迷参观俱乐部主场,蹴鞫吧带您探访百年老店!</li> <li>英国老牌劲旅狼队邀请中国球迷参观俱乐部主场,蹴鞫吧带您探访百年老店!</li> </ul>--> <a href="Video.php"><img alt="this is image #2" src="images/busbythumbhomepage.png" style="width:150px; height:100px; border:5px white; padding:6px; float:left;" /></a> <a href="Video.php"><img alt="this is image #1" src="images/arsenalthumbhomepage.png" style="width:150px; height:100px; border:5px white; padding:6px; float:left;"/></a> <a href="Video.php"><img alt="this is image #3" src="images/wolvesthumbhomepage.png" style="width:150px; height:100px; border:5px swhite; padding:6px; float:left;" /></a> <!--</div>--> </div> </div></center> </div> </div> <!-- end content --> <!-- start sidebars --> <div id="sidebar2" class="sidebar"> <ul> <li> <form id="searchform" method="get" action="http://www.baidu.com/"> <div> <h2>搜索</h2> <!--<input type="text" name="s" id="s" size="15" value="Search" >--> <INPUT type="text" name="s" id="s" size="15" value="搜索" onfocus="if(this.value==this.defaultValue) this.value='';"> </div> </form> </li> <li> <h2>山姆预测</h2> <?php include("login.php");?> </li> <?php include("CompInclude.php");?> <?php include("Subscribe.php");?> <li> <h2>有奖竞赛日程表</h2> <?php include("calendar.php");?> </li> <li> <h2>山姆预测</h2> <ul> <li><a href="SamPredicts.php">纵观比赛全局,尽在山姆预测</a></li> </ul> </li> <li> <h2>向英超球星/主帅提问</h2> <ul> <li><a href="AskAManager.php">提问李青龙和麦卡锡</a></li> </ul> </li> <li> <!--<script src="http://widgets.twimg.com/j/2/widget.js"></script> <script> new TWTR.Widget({ version: 2, type: 'profile', rpp: 4, interval: 6000, width: 220, height: 300, padding:100, theme: { shell: { background: '#333333', color: '#ffffff' }, tweets: { background: '#000000', color: '#ffffff', links: '#4aed05' } }, features: { scrollbar: false, loop: false, live: false, hashtags: true, timestamp: true, avatars: false, behavior: 'all' } }).render().setUser('cuju8').start(); </script>--> </li> </ul> </div> <!-- end sidebars --> <div style="clear: both;"> </div> </div> <!-- end page --> </div> <div id="footer"> <p class="copyright">© 2010年独家版权 • 蹴鞫吧独家设计 <a href="AboutUs.php">CuJu8</a>. <a href="http://cuju8.com/forum/viewforum.php?f=10"><u>阿森纳</u></a> <a href="http://cuju8.com/forum/viewforum.php?f=16"><u>利物浦</u></a> <a href="http://www.cuju8.com/index.php"><u>英超</u></a> <a href="http://www.cuju8.com/AboutUs.php"><u>英超联赛</u></a> <a href="http://cuju8.com/forum/viewforum.php?f=12"><u>曼城</u></a> <a href="http://www.cuju8.com/Table.php"><u>英超积分榜</u></a> <a href="http://www.cuju8.com/Fixtures.php"><u>英超赛程表</u> </a><a href="http://www.cuju8.com/Table.php"><u>英超积分榜 2010</u></a> <a href="http://www.cuju8.com/Fixtures.php"><u>英超赛程</u></a> <a href="http://www.cuju8.com/News.php"><u>英超新闻</u></a> <a href="http://cuju8.com/forum/viewforum.php?f=16"><u>利物浦队</u></a> <a href="http://www.cuju8.com/Table.php"><u>英超排名</u></a></p> <p class="link">版权权益 &#8226; 使用条款 </p> </div> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-18832652-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </body> </html> and login.php <?php include("conf.inc.php"); // Includes the db and form info. session_start(); // Starts the session. if ($_SESSION['logged'] == 1) { // User is already logged in. header("Location: index.php"); // Goes to main page. exit(); // Stops the rest of the script. } else { if (!isset($_POST['submit'])) { // The form has not been submitted. echo "<form action=\"login.php\" method=\"POST\">"; echo "<table>"; echo "<tr>"; echo "<td colspan=\"2\">Login:</td>"; echo "</tr>"; echo "<tr>"; echo "<td width=\"50%\">Username:</td><td width=\"50%\"><input name=\"username\" size=\"18\" type=\"text\" />"; echo "</tr>"; echo "<tr>"; echo "<td width=\"50%\">Password:</td><td width=\"50%\"><input name=\"password\" size=\"18\" type=\"text\" />"; echo "</tr>"; echo "<tr>"; echo "<td colspan=\"2\"><input type=\"submit\" name=\"submit\" value=\"submit\"</td>"; echo "</tr>"; echo "</table>"; echo "</form>"; } else { $username = form($_POST['username']); $password = md5($_POST['password']); // Encrypts the password. $q = mysql_query("SELECT * FROM `users` WHERE username = '$username' AND password = '$password'") or die (mysql_error()); // mySQL query $r = mysql_num_rows($q); // Checks to see if anything is in the db. if ($r == 1) { // There is something in the db. The username/password match up. $_SESSION['logged'] = 1; // Sets the session. header("Location: member.php"); // Goes to main page. exit(); // Stops the rest of the script. } else { // Invalid username/password. exit("Incorrect username/password!"); // Stops the script with an error message. } } } mysql_close($db_connect); // Closes the connection. ?> Im new to php so just trying to work through everything bit by bit. Cheers
  10. Cheers that worked for me ill just stick with that
  11. Hi Everyone, Just wondered if someone could quickly help me out, im building a simple login system for my website but having a little bit of trouble, the error i keep getting is: I have done some research but cant find the answer to this, my login script is as follows: <?php require_once('include.php'); $error = ''; $form = $_POST['submit']; $email = $_POST['email']; $password = $_POST['password']; if( isset($form) ) { if( isset($email) && isset($password) && $email !== '' && $password !== '' ) { $sql = mysql_query("SELECT * FROM `usersystem` WHERE email='$email' and password='$password';"); if( mysql_num_rows($sql) != 0 ) { //success $_SESSION['logged-in'] = true; [b]header('Location: members.php');[/b] exit; } else { $error = "Incorrect login info"; } } else { $error = 'All information is not filled out correctly';} } ?> I think its the header location code thats causing the problem but im not sure where to move it too. If anyone could help i would really appreciate it. Cheers
  12. Cheers ill have a look at sessions, This is only my 3rd week doing this php stuff, i only have 1 piece of data in the database so did that, im not sure how else to do it.
  13. Hey Guys, Ive been searching for a while, but havent really come up with any answers. At the minute i have a page where i can add a new topic to a database, but i want to be able to update the query on another page if that makes sense :-\ So as an example say i have this below thats just been inserted into the database with an ID of 2. <?php // Details $id = $_POST['id']; $title = $_POST['title']; $detail = $_POST['detail']; mysql_connect("localhost", "web148", "123") or die(mysql_error()); mysql_select_db("web148") or die(mysql_error()); mysql_query("SET names 'utf8'"); mysql_query("INSERT into sunnyargues(ID, title, body) VALUES ('2', ''超级马里奥意大利再遭种族歧视', '当被问及在友谊赛上的不友好一幕会不会重演时,曼奇尼说,“有这种可能性。” “我当然不希望这样的事情发生,但是谁也不能保证。”'"); echo "<h1>Article Updated!</h1>"; ?> On the sunny argues page i currently have, where it only selects ID 1: <?php mysql_connect("localhost", "web148", "123") or die(mysql_error()); mysql_select_db("web148") or die(mysql_error()); mysql_query("SET names 'utf8'"); $result = mysql_query("SELECT body FROM sunnyargues WHERE ID='1'"); $row = mysql_fetch_array( $result ); echo nl2br($row['body']); ?> Is there a way i can update this query with the new ID of the 2nd article once its been inserted into the database. I hope that makes sense
  14. That looks overly complicated at the minute :-\ with my problem it just looks like the text thats in the text box isnt passing over the 'send' form, the update query and everything else works fine. in the edit page i have: <td><textarea name="detail" cols="50" rows="4" id="[b]detail[/b]"> and the 'send' page i have: $message="$detail"; $result = mysql_query("UPDATE aboutenglish SET body = '$message' where ID = '1'"); is that correct for passing the details across
  15. Cheers for the link, ill definately check those videos out. Yeh i have no php experience at all, i can do bits like displaying data from a database but stuck on this updating records. Any ideas where im going wrong above?
  16. Hey Guys, Im slowly updating our website to php/mysql, im getting there slowly but stuck at the minute. Im try to create a form where we can edit one of the pages text and then update the text in the database if that makes sense Basically at the moment i have a form where you can see the pages text like so: <table width="400" border="0" align="center" cellpadding="3" cellspacing="1"> <tr> <td><strong>Edit About Us English </strong></td> </tr> </table> <table width="400" border="0" align="center" cellpadding="0" cellspacing="1"> <tr> <td><form name="form1" method="post" action="send_update_english.php"> <table width="100%" border="0" cellspacing="1" cellpadding="3"> <tr> <td>Detail</td> <td>:</td> <td><textarea name="detail" cols="50" rows="4" id="detail"> [b]<?php mysql_connect("localhost", "web148", "123") or die(mysql_error()); mysql_select_db("web148") or die(mysql_error()); mysql_query("SET names 'utf8'"); $result = mysql_query("SELECT body FROM aboutenglish WHERE ID = '1'"); $row = mysql_fetch_array( $result ); echo nl2br($row['body']); ?>[/b] </textarea></td> </tr> <tr> <td> </td> <td> </td> <td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td> </tr> </table> </form> </td> </tr> </table> Ive got that php bit in the middle to pull out the text thats on that page but not sure if thats correct or not. But anyways on the 'send form' page i have: <?php // Details [b]$message="$detail";[/b] mysql_connect("localhost", "web148", "123") or die(mysql_error()); mysql_select_db("web148") or die(mysql_error()); mysql_query("SET names 'utf8'"); $result = mysql_query("UPDATE aboutenglish SET body = '$message' where ID = '1'"); ?> the update query works if i put text in there, but when i use '$message' the database is left blank. This is only my second week doing all this stuff, so bare with me I appreciate your answers.
  17. Thank you for your reply, i tried this from some sample code: mysql_connect("localhost", "web148-cuju8", "game8123") or die(mysql_error()); mysql_select_db("web148-cuju8") or die(mysql_error()); mysql_query("SET names 'utf8'"); $result = mysql_query("SELECT body FROM article WHERE ID='1'"); $row = mysql_fetch_array( $result ); [b]echo nl2br(htmlentities($row['body']));[/b] But the text all comes out like: ---edit---- Sorry just modified it slight to echo nl2br($row['body']); works perfect thanks you
  18. Hi Everyone, Ive been asked to try and convert our small website into PHP, im not a web developer but im going to give it a try Basically we have a news page, i can get all the text to print out onto the page its just theres no formating at all it comes out like this: I ideally need to add a break after each line in the text, ive searched around but dont really understand it all to be honest. This is the code im using to extract the article: <?php mysql_connect("localhost", "web148", "123") or die(mysql_error()); mysql_select_db("web148") or die(mysql_error()); mysql_query("SET names 'utf8'"); $result = mysql_query("SELECT body FROM article WHERE ID='1'"); $row = mysql_fetch_array( $result ); echo $row['body']; ?> If anyone could point me in the right direction id appreciate it
×
×
  • Create New...

Important Information

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.