Jump to content

morrisjohnny

Members
  • Posts

    300
  • Joined

  • Last visited

Everything posted by morrisjohnny

  1. basicly i 'm not sure how to compare to variables like the username and password the user put in the input boxes and the onces already in the database.I have no idea how to do this I would be even more greatful if you would help/tell me understand this.
  2. i though i would jsut ask here as it is almost relavent to the topic thread.I'm having problems check when users try to log in.I'm using post okay for form transferwhen the user enters their details username is what the input type is(for their username)butt is for password (the users input password on the log-in page)pazzword is the database storage for users passwords while login is where the usersname are store in a table called users under the database mt
  3. GIMP?gimp.org i think. It's like paint shop pro but it's open source, lots of features. only some times i can take awhile to do the simplest of things
  4. Cheers i did notice the sql code that shows up Pretty handy i do have to say. Yip works like a charm cheers
  5. Cheers, works Like a charm
  6. i though i would jsut ask here as it is almost relavent to the topic thread.I'm having problems check when users try to log in.I'm using post okay for form transferwhen the user enters their details username is what the input type is(for their username)butt is for password (the users input password on the log-in page)pazzword is the database storage for users passwords while login is where the usersname are store in a table called users under the database mtThis has been solved I now have have another problem 8above here*Heres the code which is causing the error: mysql_select_db("mt",$con);$sql="INSERT INTO users (ID, login, pazzword, mail, dosh) VALUES(",'$_POST[username]','$_POST[######]''$_POST[email]''1000000')";if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } I get the error message Parse error:parse errpr, unxpected ',' In [drectory] on line 12line 12 is (",'$_POST[username]','$_POST[######]''$_POST''1000000')";the bit in red is causeing the error but is that not how to input the ID if the ID is auto_increment?please help i would be very greatful. Thanks-Johnny
  7. I'm having problems setting up the ID to auto_incrementI can do everything else apart from when i go to add another user to the database i can't make the ID increase by it's self.I would like a few rows if possibleID PRIMARY KEY (auto_increment?)login VARCHAR(999);pazzword VARCHAR(999);mail VARCHAR(999);dosh NUMBER;I'd be very grea tful if someone could type out the code so i could learn. and use it.I am new to databases so I'm sorry if this isn't clear. thanks-Johnny(a bit off topic using php how would i insert the ID? like in PHP it would be $_POST['name'] for their name what about ID auto_increment?)
  8. Okay Firstly Thanks. I Have no idea Wht i was ment to do. I showed the code i was using but it was just displaying the current page as it was. It was totaly wrong.I would be very greatful if someone could provide a full working code or even an address to google in which i could contact and more than certain get a reply since on their personalnised homepage it works perfect and this is where i got the idea from.I'm not using the code i posted in the first topic. I'm only wanting to extract the title and convert the title into a hyperlink while showing the titles text as the hyperlink. I hopesomeone can help me.Thanks for trying Mr_CHISOL
  9. I d't think you have the idea. I'm trying to extra two bits of data given off from an RSS feed.using PHP i want to extract the title which is being given from a RSS feed ( then inset the hyperlink into the title)EG the RSS feed Gives off <title>Nokia 3650 Combines Phone And Photos</title><description>I've been playing with the new Nokia 3650. Finally, someone has got the combination of a cell phone with digital camera capabilities right!</description><link>http://allgadgetsreviewed.com/nokia3650.html</link> I want to turn that into this <a href='http://allgadgetsreviewed.com/nokia3650.html'>Nokia 3650 Combines Phone And Photos</a> But only show a maxium off three.
  10. I've started to learn PHP and i've been improving my knowledge. I'm currently trying to create An RSS reader using PHP. I have tried searching the forums but i can't search for 'PHP RSS reader' as PHP and RSS are below for words.I'm using the current code below i found online but it shows the full page. I only want to retire the title and the link. <?phpset_time_limit(0);$file = "http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/motorsport/formula_one/rss.xml";$rss_channel = array();$currently_writing = "";$main = "";$item_counter = 0;function startElement($parser, $name, $attrs) { global $rss_channel, $currently_writing, $main; switch($name) { case "RSS": case "RDF:RDF": case "ITEMS": $currently_writing = ""; break; case "CHANNEL": $main = "CHANNEL"; break; case "IMAGE": $main = "IMAGE"; $rss_channel["IMAGE"] = array(); break; case "ITEM": $main = "ITEMS"; break; default: $currently_writing = $name; break; }}function endElement($parser, $name) { global $rss_channel, $currently_writing, $item_counter; $currently_writing = ""; if ($name == "ITEM") { $item_counter++; }}function characterData($parser, $data) { global $rss_channel, $currently_writing, $main, $item_counter; if ($currently_writing != "") { switch($main) { case "CHANNEL": if (isset($rss_channel[$currently_writing])) { $rss_channel[$currently_writing] .= $data; } else { $rss_channel[$currently_writing] = $data; } break; case "IMAGE": if (isset($rss_channel[$main][$currently_writing])) { $rss_channel[$main][$currently_writing] .= $data; } else { $rss_channel[$main][$currently_writing] = $data; } break; case "ITEMS": if (isset($rss_channel[$main][$item_counter][$currently_writing])) { $rss_channel[$main][$item_counter][$currently_writing] .= $data; } else { //print ("rss_channel[$main][$item_counter][$currently_writing] = $data<br>"); $rss_channel[$main][$item_counter][$currently_writing] = $data; } break; } }}$xml_parser = xml_parser_create();xml_set_element_handler($xml_parser, "startElement", "endElement");xml_set_character_data_handler($xml_parser, "characterData");if (!($fp = fopen($file, "r"))) { die("could not open XML input");}while ($data = fread($fp, 4096)) { if (!xml_parse($xml_parser, $data, feof($fp))) { die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); }}xml_parser_free($xml_parser);// output as HTMLprint ("<html><head><title>PHP RSS Reader</title></head><body>");if (isset($rss_channel["IMAGE"])) { print ("<a href=\"" . $rss_channel["LINK"] . "\" target=\"_blank\"><img border=\"0\" src=\"" . $rss_channel["IMAGE"]["URL"] . "\" align=\"middle\" alt=\"" . $rss_channel["IMAGE"]["TITLE"] . "\"></a> <font size=\"5\">" . $rss_channel["TITLE"] . "</font><br><br>");} else { print ("<font size=\"5\">" . $rss_channel["TITLE"] . "</font><br><br>");}print ("<i>" . $rss_channel["DESCRIPTION"] . "</i><br><br>");if (isset($rss_channel["ITEMS"])) { if (count($rss_channel["ITEMS"]) > 0) { for($i = 0;$i < count($rss_channel["ITEMS"]);$i++) { print ("\n<table width=\"100%\" border=\"1\"><tr><td width=\"100%\"><a href=\"" . $rss_channel["ITEMS"][$i]["LINK"] . "\" target=\"_blank\"><h2>" . $rss_channel["ITEMS"][$i]["TITLE"] . "</h2></a></b>"); print ("<i>" . html_entity_decode($rss_channel["ITEMS"][$i]["DESCRIPTION"]) . "</i>"); print ("</td></tr></table><br>"); } } else { print ("<b>There are no articles in this feed.</b>"); }}print ("</body></html>");?> I want to display a maxium of three titles and hyperlinks but i would like it layout out like this <table><tr><td><a href='exteral_link_1'>Item1</a></td></tr><tr><td><a href='exteral_link_2'>Item2</a></td></tr><tr><td><a href='exteral_link_3'>Item3</a></td></tr></table>
  11. The main reason i want the code to be as short as possible is because i like a clean text document and like to be able to start from 'scratch' and know excatly wht is going into my document.I'm not sure wht is going on with all of this code. How safe is it?
  12. Thanks for your reply once again, while i though using this code would be a realli good idea it seems i no not enoguht to use this code. instead i have taken the code u have helped me with (with the log in part) and changed it a bit to below.<?php$db=mysql_connect("localhost", "root", "");mysql_select_db("jny", $db);$username = ($_POST['Username']);$password = ($_POST['Password']);$query = mysql_query("SELECT username, password FROM Users WHERE username = '$username' AND password = '$password'");if(mysql_num_rows($query) == 1) {echo "Correct Username & Password";}else{echo "Wrong Username Or password";}mysql_free_result($query);mysql_close($db);?> using this i can detect if the user has entered the correct username & password combanationI will then create a cookie if they username and cookie has been entered correctly storing their username in the cookie. And will then be able to revert back to the cookie to see if the user is logged in. If the user doesn't have a cookie then it has expired and will then be reverted back to the log in page.Do you think this is a good way to do wht i am trying to do? or can a cookie easier be modified?
  13. Okay i have just woke up and have placed them back into the same file. They work. Maybe you where right, i have replaced the include with require it still doesn't work :'( is their an easier way where i can create pages then without having to have so much code on one bit of page?
  14. Thanks thibo1025 I havn't treid it but i have made a note of it for later use when i plan to fully customise my php scripts.Anybody have any idea on why the code justsomeguy gave me isn't working once i split it up? (i can put all the pieces back together so it works again.) {I have checked over and they are all split at the right places.}
  15. thanksYes i am ALSO having problems with databases.I'm not sure what the functions r to get the data out of my database. I 'm having problems with extracting someones information exampleif theirs 5 different users in my database I'm not sure how to extract the person who is logged in how to extract THEIR email and show it and not a random one I'm gathering it's something to do with the where function?thanks for the reply and i hope u can help-jny
  16. Firstly thanks justsomeguyI have played around with the a bit more than before. i have tried to split the code into three parts.Part one inclu/top.php <?phpsession_start();$logged_in = false;$msg = "";if ($_SESSION['online']) $logged_in = true;else if (isset($_POST['username'])){ $db=mysql_connect("localhost", "root", ""); mysql_select_db("jny", $db); $username = htmlentities($_POST['username']); $password = htmlentities($_POST['password']); $username = mysql_real_escape_string($username); $password = mysql_real_escape_string($password); $query = mysql_query("SELECT username, password FROM Users WHERE username = '$username' AND password = '$password'"); if(mysql_num_rows($query) == 1) { $_SESSION['online'] = true; $_SESSION['username'] = $username; $logged_in = true; } else $msg .= "The username and password did not match.<br /><br />"; mysql_free_result($query); mysql_close($db);}/*at this point you can do a header redirect if necessary because you have not sent any outputheader("Location: login.php");exit();*/?><html> <head> </head> <body> <?php echo $msg; ?><?php if ($logged_in) { ?> Part Two The Current Page <?php [i]include[/i]("inclu/top.php"); ?>[b]Welcome <?php echo $_SESSION['username']; ?> <br /><br /><br /> <a href="1.php">Add news <b>with</b> image</a><br /><br /> <a href="other.php">Add news <b>without</b> image</a>[/b]<?php [i]include[/i]("inclu/bottom.php"); ?> I have replaced the function include with the function require i still get an error of Parse error: parse error, unexpected $end in C:\My Software\xampp\htdocs\test\new\inclu\top.php on line 53 which appears to be this line of code <?php if ($logged_in) { ?> meaning i broke the code in the wrong place?The reason i want to put them into three parts is so i could change ever page without having to scroll down like 53 lines of code. I would be very greatful if someone could help me.Part Three inclu/bottom.php <h1>Login</h1> <form action="" method="post"> <p>Username<br /><input type="text" name="username" /></p> <p>Password<br /><input type="password" name="password" /></p> <p> <br /><input type="submit" name="submit" value="Login" /></p> </form><?php } ?> </body></html> EDIT* BTW if all the 'parts' are one file it works fine I'm presuming that it is the way i have split it up.*
  17. Thanks, i ahve had a look on the sessons page on w3schools, but dn't full understand it how would i detect if they are logged in? i'm gathering i wud need to include the session in every page. then then direct them back to the index page if they wasn'tHow would i go about checking their username and password in the database and then storing if they are in a session, and then extracting if they are logged in from a session onto a page?Am i thinking like this correctly in the terms of use of a session or not?
  18. First hello and thanks for your reply.This is in my index page<html> <header> <title>index Page</title> </header><body><form action="Members/index.php" method="post"><table align='center'> <tr> <td>Username:</td><td><input type="text" name="Username" /></td> </tr><tr> <td>Password:</td><td><input type="password" name="Password" /></td> </tr><tr> <td colspan'2'><input type="submit" /></td> </tr><tr> <td colspan='2'><a href='Reg.php'>Register</a></td> </tr></table></form></body></html> This is in the members section <html><header><title>Member Section</title></header><body><br /><br /><br /><table align="center" border="1" width="75%"> <tr> <td width="75%">Boo</td><td width="25%">Welcome [b]<?php echo $_POST["Username"]?>[/b]</td> </tr></table></body></html> i have non shown my register code as it it fully working and isn't the problemokay now you have seen my code i have Bold the text i wish to try and change. i dn't want to use $_POST["Username"] i want to read the user name who is logged in from the database.By "row" i meanUsername|password|AgeSo i could read the members username and their age and not a random age. i hope i have explained enought.I dn't want to use $_POST i want to extract their username from the table database.Also i was wondering how could i check a users Username & Password so if it is incorrect it takes them back to the index page. else if it is corect take it to another page.
  19. Hello, i've just started learning php and i'm a bit of problems. I can echo the $_POST name that is entered but i was wondering is it safe to use this or would it be safer to learn sessions?Also using the $_POST function i was wondering would it be possible to run around a "row" and match the username (from post) to the usernames e-mail address so i could echo their email address?i'd be very greatful if anyone could help. Thanks-Jny
  20. Site: http://johnnymorris.110mb.com/Username: testpassword: testWhen u try to logg in nothing happens, or when u create a new account again nothing happens, I have had the same codes working on a different host and i had to change teh data base for mySQL so i have changed them so they r working but nothing seems to be happening, I'm using this code for the index pageindex.php <?require_once( '_check_user.php' );// bezoekers statistieken$pagename = "Index";include("./counter.inc.php");?><html><head> <title>Mafia Beta</title> <link rel="stylesheet" type="text/css" href="src/standard.css" /><script language=JavaScript> function screenshots(){var popurl="screenshots.php"winpops=window.open(popurl,"","width=800,height=600,")}function firstFocus(){ if (document.forms.length > 0) { var TForm = document.forms[0]; for (i=0;i<TForm.length;i++) { if ((TForm.elements[i].type=="text")|| (TForm.elements[i].type=="textarea")|| (TForm.elements[i].type.toString().charAt(0)=="s")) { document.forms[0].elements[i].focus(); break; } } }}</SCRIPT></head><body><table class="login"><tr><td align="center"> <table class="windowLogin"> <tr> <td class="loginLeft"> <img src="images/logoLogin.jpg" /> </td> <td class="loginRight"> <div class="mainTitle"><div class="logo"> </div></div> <div class="mainText"><?if ($melding) { echo "<b>$melding</b>"; echo "<br />";} else {?> Last reset: <i>03-05-2005</i> <br /> <br /><?}?> <form method="post"> <table> <tr><td class="column1"><li></td><td class="column2">Username</td><td class="column3"><input type="text" name="name" /></td><td></td></tr> <tr><td class="column1"><li></td><td class="column2">Password</td><td class="column3"><input type="password" name="password" /></td><td></td></tr> <tr><td></td><td></td><td class="column4"><input class="button" type="submit" value="Enter" /></td></tr> </table> </form> </div> </td> </table> <div class="windowLoginStatus"> <a class="login" href="register.php">Register!</a> | <a class="login" href="recover.php">Lost Password!</a> | <a class="login" href="java script:screenshots()">Screenshots!</a></div></td></tr></table></body></html><??> I am looking for a free PHP host with MySQL features thts very relibable, if anybody can help.Thanks in advance-Jny*I'm not sure if i have missed something out but i think thts how's it was, cause once i got it working on my old free host i re-downloaded it so i only needed to change a few things rather than alot.
  21. Hi I'm Using this codeFor my "import" page <form method="get" action="Welcome.asp">First Name: <input type="text" name="fname" /><br />Last Name: <input type="text" name="lname" /><br /><br /><input type="submit" value="Submit" /></form> Then This code for "Welcome" page <%response.write(request.querystring("fname"))response.write(" " & request.querystring("lname"))%> Then I'm Having problems recalling their fname on a future page, IS their anyway i can store their fname so it can be recalled on any page they visit?I Have Set up my idea on a web pageI'd Be Very greatful if someone could help me out-JnyBtw I would much rather use Javascript Sine i'm using a webhost that won't alow .asp files so i also plan in run the .asp file from a Javascript document, Is that possible?
  22. I Know I probably know nothing on the subject but will it not have something to do with this? function displaymessage(){alert("Hello World!")} Change the Hello World So it displays what the user typed into the Box?
  23. It Doesn't Show If I Remove Alert it doesn't ask for my nameIf you could get it working Great I think Its obiouse that i have missed something out, Do u Merge the cookie Script and teh Web page together? cause thts what i have done, Please Help If possible <html><head><title>Johnnys Junk F1</title><link href="CSS/sheet.css" rel="stylesheet" type="text/css"/><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"><!-- Start of Cookie Script --><script type="text/javascript">function getCookie(c_name){if (document.cookie.length>0){ c_start=document.cookie.indexOf(c_name + "=")if (c_start!=-1){ c_start=c_start + c_name.length+1 c_end=document.cookie.indexOf(";",c_start)if (c_end==-1) c_end=document.cookie.lengthreturn unescape(document.cookie.substring(c_start,c_end))} }return null}function setCookie(c_name,value,expiredays){var exdate=new Date()exdate.setDate(exdate.getDate()+expiredays)document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : "; expires="+exdate)}function checkCookie(){username=getCookie('username')if (username!=null) document.getElementById("Test").value=welcome messageelse { username=prompt('Please enter your name:',"") if (username!=null && username!="") { setCookie('username',username,365) } }}</script></head><!-- End Cookie in Head --><body onLoad="checkCookie()"><!-- Open a main table that is 75% the width of the screen --><table border="1" cellspacing="1" width="75%" align="center"> <tr> <td colspan="3" align="center"><p><marquee direction="up" height="50" scrollamount="3" onMouseover=this.scrollAmount="0" onMouseout=this.scrollAmount="3">Welcome To <br /><br /> . : : Johnnys Junk : : . <br /><br /> I Hope Enjoy Your Stay.<br /><br />Please feel Free to browse the site use facilities</marquee></p></td> </tr> <tr> <th bgcolor='#181818' colspan="3" ><br /><center>Welcome <label id="Test"></label> To Johnnys Junk On <script type="text/javascript">var d=new Date()var weekday=new Array(7)weekday[0]="Sunday"weekday[1]="Monday"weekday[2]="Tuesday"weekday[3]="Wednesday"weekday[4]="Thursday"weekday[5]="Friday"weekday[6]="Saturday"document.write(weekday[d.getDay()] + " " + d.getDate());</script><script type="text/javascript">var d=new Date()var Month=new Array(12)Month[0]="January"Month[1]="Febuary"Month[2]="March"Month[3]="April"Month[4]="May"Month[5]="June"Month[6]="July"Month[7]="August"Month[8]="September"Month[9]="October"Month[10]="November"Month[11]="December"document.write(Month[d.getMonth()])</script> at<script type='text/javascript'>function startTime(){var today=new Date()var h=today.getHours()var m=today.getMinutes()var s=today.getSeconds()// add a zero in front of numbers<10m=checkTime(m)s=checkTime(s)document.getElementById('txt').innerHTML=h+':'+m+':'+st=setTimeout('startTime()',500)}function checkTime(i){if (i<10){i='0' + i}return i}</script><body onload="startTime()"><div id="txt"></div></center><br /></th> </tr> <tr> <td colspan="3" align="center"><img src="Images/banner.jpg"><br/><br/><br/></td> </tr> <tr align="center"> <th width="15%" bgcolor='#181818' align='center'> - Navigation - </th><th width="70%" bgcolor='#181818' align='center'> - News - </th><th width="15%" bgcolor='#181818' align='center'> - ShoutBox - </th> </tr> <tr> <td valign="Top"><script type="text/javascript" src="JS/Menu.js"></script></td> <td valign="Top"><table width=100% border="1"><tr><th width="50%" align="center"><a href='http://www.f1.com'>Formula 1</a> News</th><th width="50%" align="center"><a href='http://81.179.53.97/?section=1'>F1-Tm</a> News</th> </tr><tr><td width="50%" align="center"><script type="text/javascript" language="JavaScript" src="http://www.totalf1.com/news/TotalF1News5.txt"></script></td><td width="50%" align="center"><script type="text/javascript" src="JS/F1.js"></script></td> </tr></table><center><colour="red">Note While this hopefully what the new Website will look like I am still trying to get it done While i Have decided To Upload what i can when i can, I Hope Everything Turns to normal Soon</colour></center></td> <td><!-- BEGIN MYSHOUTBOX.COM CODE --><iframe src="http://454520.myshoutbox.com/" width="152" height="300" frameborder="0" allowTransparency="true"></iframe><!-- END MYSHOUTBOX.COM CODE--></td> </tr><tfoot> <tr><td colspan="3" align="center">© 2006 Johnny Morris.<td></tr></tfoot></table></body></body></html>
  24. Okay this code has been taken fomr the w3Schools site so it asks the user for their username, I was wondering is it possible to display their name somewhere eles on the page and not in a message box that appears.I would like it to appear in two places could someone explain how this can be done?( Why two places?First place, I would like near their top so it says "Welcome (Username)"Second Place, I would like in the side of the page ( not sure which side ) so it says "Users Online: (Username1) (Username2)" Ect, i can use php any mysql, but i can't find a host that will do free hosting :)Thanks in Advance-JnyI know i still need to remove the section to stop the button coming up that says welcome <html><head><script type="text/javascript">function getCookie(c_name){if (document.cookie.length>0){ c_start=document.cookie.indexOf(c_name + "=")if (c_start!=-1){ c_start=c_start + c_name.length+1 c_end=document.cookie.indexOf(";",c_start)if (c_end==-1) c_end=document.cookie.lengthreturn unescape(document.cookie.substring(c_start,c_end))} }return null}function setCookie(c_name,value,expiredays){var exdate=new Date()exdate.setDate(exdate.getDate()+expiredays)document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : "; expires="+exdate)}function checkCookie(){username=getCookie('username')if (username!=null) {alert('Welcome again '+username+'!')}else { username=prompt('Please enter your name:',"") if (username!=null && username!="") { setCookie('username',username,365) } }}</script></head><body onLoad="checkCookie()"></body></body></html>
  25. Thanks Very much, Currently I'm not up to this stage in the Devlopment since i'm Totaly "Re-vamping" my site but i will add it to my fav's for future use Thanks Like i say-Jny
×
×
  • Create New...