Jump to content

morrisjohnny

Members
  • Posts

    300
  • Joined

  • Last visited

Posts posted by morrisjohnny

  1. correct me if i'm wrong but i think he means the CMS {Content management system}if not could you please expand or explain in a bit more detail?the system of on-line examples are all in different directorylook this is where the xhtml tutorial is located in a 'folder' (directory) called xhtml

    http://w3schools.com/[b]xhtml/default.asp[/b]

    while the php tutorial is located in another 'folder' (directory) calledphp

    http://w3schools.com/[b]php/default.asp[/b]

    I hope this explains a bit about the how they(W3Schools) organized the system of on-line examplesIf I'm wrong with anything someone please correct me I'm not as well educated as most people are around here.if you wasn't looking for this information again could you explain in a bit more detail what your looking for?

  2. output

    <html><header><link href='../style.css' rel='stylesheet' type='text/css'></header><body><table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"><tr><td><table width="100%" border="0" cellpadding="3" cellspacing="1" bordercolor="1" bgcolor="#FFFFFF"><tr><td class="fheader"><strong>Title:Welcome</strong></td></tr><tr><td class="fsub"><b>By</b> jnymris <b>On:</b> 06/04/07 01:27:04</td></tr><tr><td class="fmain">Welcome To The Forums<br /><br />Please use your comman sense</td></tr></table></td></tr></table><br><table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"><tr><td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"><tr><td class="fsub"><b>By:</b> jnymris <b>On</b> 06/04/07 07:39:42</td></tr><tr><td class="fmain">Testing Replies</td></tr></table></td></tr></table><br><table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"><tr><td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"><tr><td class="fsub"><b>By:</b> admin <b>On</b> 06/04/07 12:47:52</td></tr><tr><td class="fmain">[b]larger Bold B's [/b][b]smaller bold B's[/b]</td></tr></table></td></tr></table><br><BR><table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"><tr><form name="form1" method="post" action="forum_add_answer.php"><td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"><tr><td valign="top"><strong></strong></td></tr><tr><td colspan='2'><textarea name="a_answer" cols="45" rows="3" id="a_answer"></textarea></td></tr><tr><td><input name="id" type="hidden" value="3"></td><td align='center'><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td></tr></table></td></form></tr></table>  </body></html>

    __________________________The Scriptslog_in.php

    <html>  <header>   <link href="style.css" rel="stylesheet" type="text/css">   <title>Log In - Management Tycoon</title><script language='javascript' type='text/javascript'> if (top.location != self.location) {top.location.replace(self.location)};</script>  </header>  <body><table align='center' border='1'><tr><td class='indextitle' colspan='2'><img src='banner.bmp'></tr></td><tr><td class='indextitle' colspan='2'>Welcome To Management Tycoon</td></tr><tr><td width='50%'>	<table with='100%' valign='top'>		<tr><td>Management Tycoon is a new online text based game, where you become the manager of your own business in hope to make millions. You being the manager will have to deal with the creation of your product, the staff, sponsors backing your product in order ho help you make millions.<br>But is it as simple as that?</td></tr>	</table>	</td><td>	<table width='50%' border='0'>		<tr><td>Existing Members can log in below</td></tr>		<tr><td><?php echo "<font color='red'>" .$msg . "</font>"; ?><form action="" method="post"></td></tr>    			<tr><td>Username:<input type="text" name="username" /></td></tr>    			<tr><td>Password:<input type="password" name="password" /></td></tr>			<tr><td><input type="submit" name="submit" value="Log In" /></td></tr>			<tr></td></form></td></tr>	</table></td></tr><tr><td align='center' colspan='2'>- <a href='screenshots.html'>Screenshots</a> - <a href='register.php'>Register</a> -</td></tr></table>

    forum_view_topic.php

    <?phpinclude ("logincheck.php");?><?php if ($logged_in) { ?><?php$host="localhost"; // Host name$username="root"; // Mysql username$password=""; // Mysql password$db_name="mt"; // Database name$tbl_name="forum"; // Table name// Connect to server and select databse.mysql_connect("$host", "$username", "$password")or die("cannot connect");mysql_select_db("$db_name")or die("cannot select DB");// get value of id that sent from address bar$id=$_GET['id'];$sql="SELECT * FROM $tbl_name WHERE id='$id'";$result=mysql_query($sql);$rows=mysql_fetch_array($result);?><html><header><link href='style.css' rel='stylesheet' type='text/css'></header><body><table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"><tr><td><table width="100%" border="0" cellpadding="3" cellspacing="1" bordercolor="1" bgcolor="#FFFFFF"><tr><td class="fheader"><strong>Title:<? echo $rows['topic']; ?></strong></td></tr><tr><td class="fsub"><b>By</b> <? echo $rows['name']; ?> <b>On:</b> <? echo $rows['datetime']; ?></td></tr><tr><td class="fmain"><? echo $rows['detail']; ?></td></tr></table></td></tr></table><br><?php$tbl_name2="forum_answer"; // Switch to table "forum_answer"$sql2="SELECT * FROM $tbl_name2 WHERE question_id='$id'";$result2=mysql_query($sql2);while($rows=mysql_fetch_array($result2)){?><table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"><tr><td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"><tr><td class="fsub"><b>By:</b> <? echo $rows['a_name']; ?> <b>On</b> <? echo $rows['a_datetime']; ?></td></tr><tr><td class="fmain"><? echo $rows['a_answer']; ?></td></tr></table></td></tr></table><br><?}$sql3="SELECT view FROM $tbl_name WHERE id='$id'";$result3=mysql_query($sql3);$rows=mysql_fetch_array($result3);$view=$rows['view'];// if have no counter value set counter = 1if(empty($view)){$view=1;$sql4="INSERT INTO $tbl_name(view) VALUES('$view') WHERE id='$id'";$result4=mysql_query($sql4);}// count more value$addview=$view+1;$sql5="update $tbl_name set view='$addview' WHERE id='$id'";$result5=mysql_query($sql5);mysql_close();?><BR><table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"><tr><form name="form1" method="post" action="forum_add_answer.php"><td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"><tr><td valign="top"><strong></strong></td></tr><tr><td colspan='2'><textarea name="a_answer" cols="45" rows="3" id="a_answer"></textarea></td></tr><tr><td><input name="id" type="hidden" value="<? echo $id; ?>"></td><td align='center'><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td></tr></table></td></form></tr></table><?php } else { ?><?php include("log_in.php") ?><?php } ?>  </body></html>

    logincheck.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("mt", $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 login, pazzword FROM Users WHERE login = '$username' AND pazzword = '$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();*/?>

    NEWoutput

    <html><header><link href='../style.css' rel='stylesheet' type='text/css'></header><body><table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"><tr><td><table width="100%" border="0" cellpadding="3" cellspacing="1" bordercolor="1" bgcolor="#FFFFFF"><tr><td class="fheader"><strong>Title:Welcome</strong></td></tr><tr><td class="fsub"><b>By</b> jnymris <b>On:</b> 06/04/07 01:27:04</td></tr><tr><td class="fmain">Welcome To The Forums<br /><br />Please use your comman sense</td></tr></table></td></tr></table><br><table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"><tr><td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"><tr><td class="fsub"><b>By:</b> jnymris <b>On</b> 06/04/07 07:39:42</td></tr><tr><td class="fmain"></td></tr></table></td></tr></table><br><table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"><tr><td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"><tr><td class="fsub"><b>By:</b> admin <b>On</b> 06/04/07 12:47:52</td></tr><tr><td class="fmain"></td></tr></table></td></tr></table><br><BR><table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"><tr><form name="form1" method="post" action="forum_add_answer.php"><td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"><tr><td valign="top"><strong></strong></td></tr><tr><td colspan='2'><textarea name="a_answer" cols="45" rows="3" id="a_answer"></textarea></td></tr><tr><td><input name="id" type="hidden" value="3"></td><td align='center'><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td></tr></table></td></form></tr></table>  </body></html>

    forum_view_topic.php

    <?phpinclude ("../logincheck.php");?><?php if ($logged_in) { ?><?php$host="localhost"; // Host name$username="root"; // Mysql username$password=""; // Mysql password$db_name="mt"; // Database name$tbl_name="forum"; // Table name// Connect to server and select databse.mysql_connect("$host", "$username", "$password")or die("cannot connect");mysql_select_db("$db_name")or die("cannot select DB");// get value of id that sent from address bar$id=$_GET['id'];$sql="SELECT * FROM $tbl_name WHERE id='$id'";$result=mysql_query($sql);$rows=mysql_fetch_array($result);?><html><header><link href='../style.css' rel='stylesheet' type='text/css'></header><body><table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"><tr><td><table width="100%" border="0" cellpadding="3" cellspacing="1" bordercolor="1" bgcolor="#FFFFFF"><tr><td class="fheader"><strong>Title:<? echo $rows['topic']; ?></strong></td></tr><tr><td class="fsub"><b>By</b> <? echo $rows['name']; ?> <b>On:</b> <? echo $rows['datetime']; ?></td></tr><tr><td class="fmain"><? echo $rows['detail']; ?></td></tr></table></td></tr></table><br><?php$tbl_name2="forum_answer"; // Switch to table "forum_answer"$sql2="SELECT * FROM $tbl_name2 WHERE question_id='$id'";$result2=mysql_query($sql2);/*** AddPattern* @param list        The array/list to add the pattern to* @param pattern    The (perl) regular expression pattern to add* @param string    The string that the pattern should be replaced with* @param escape    Should we "escape" the pattern (escapes /, [ and ] ) and adds*                            "delitimers" ( /pattern/ ) and any defined "rule"* @param modifs    Any modifiers that should be added to the pattern (ignored if escape is false)*                         could be i (case-insensitive) etc. (see manual)* @author Christopher Hindefjord - Mr_CHISOL - Kachtus.net  2007**/function AddPattern( &$list, $pattern, $string, $escape = false, $modifs = '' ) {    // Just in case...    if (!isset($list[0])) {        $list[0] = array();        $list[1] = array();    }    // If we should "escape" the string and treat it... (default: No)    if ($escape) {        // Escape...        $pattern = str_replace( '/', '\/', $pattern );        $pattern = str_replace( '[', '\[', $pattern );        $pattern = str_replace( ']', '\]', $pattern );        // add /        $pattern = '/'.$pattern.'/'.$modifs;    }    $list[0][] = $pattern;    $list[1][] = $string;}$patterns = array( array(), array() );AddPattern( $patterns, '[b](.*)[/b]', '<span class="bold">$1</span>', true, 'i' ); // ignore case and escape itAddPattern( $patterns, '[i](.*)[/i]', '<span class="italic">$1</span>', true, 'i' ); // ignore case and escape itAddPattern( $patterns, '[url="http://(.*)"](.*)[/url]', '<a href="$1">$1</span>', true, 'i' ); // ignore case and escape it// You can add the rest yourself...// Adding the newline replace here, then you don't need multiple call to a replace function...AddPattern( $patterns, "/\n/", "<br />\n" );$_message = preg_replace( $patterns[0], $patterns[1], $rows['a_answer']);while($rows=mysql_fetch_array($result2)){?><table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"><tr><td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"><tr><td class="fsub"><b>By:</b> <? echo $rows['a_name']; ?> <b>On</b> <? echo $rows['a_datetime']; ?></td></tr><tr><td class="fmain"><? echo $_message; ?></td></tr></table></td></tr></table><br><?}$sql3="SELECT view FROM $tbl_name WHERE id='$id'";$result3=mysql_query($sql3);$rows=mysql_fetch_array($result3);$view=$rows['view'];// if have no counter value set counter = 1if(empty($view)){$view=1;$sql4="INSERT INTO $tbl_name(view) VALUES('$view') WHERE id='$id'";$result4=mysql_query($sql4);}// count more value$addview=$view+1;$sql5="update $tbl_name set view='$addview' WHERE id='$id'";$result5=mysql_query($sql5);mysql_close();?><BR><table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"><tr><form name="form1" method="post" action="forum_add_answer.php"><td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"><tr><td valign="top"><strong></strong></td></tr><tr><td colspan='2'><textarea name="a_answer" cols="45" rows="3" id="a_answer"></textarea></td></tr><tr><td><input name="id" type="hidden" value="<? echo $id; ?>"></td><td align='center'><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td></tr></table></td></form></tr></table><?php } else { ?><?php include("../log_in.php") ?><?php } ?>  </body></html>

  3. okay, I', understand it. I'll try and convert it all to when it's being displayed :)Thanks :)*EDITI didn't add the middle part i have added it now if i put something in text it just sends nothing?like i said i'm going to convert everyting so it changes on display rather than post.*UN-EDITYou have been a big help :)*EDITNow when i show the text it just display it like it is in the databasewith [ b]bold[ /b] without the spaceshere is my code

    <?phpinclude ("../logincheck.php");?><?php if ($logged_in) { ?><?php$host="localhost"; // Host name$username="root"; // Mysql username$password=""; // Mysql password$db_name="mt"; // Database name$tbl_name="forum"; // Table name// Connect to server and select databse.mysql_connect("$host", "$username", "$password")or die("cannot connect");mysql_select_db("$db_name")or die("cannot select DB");// get value of id that sent from address bar$id=$_GET['id'];$sql="SELECT * FROM $tbl_name WHERE id='$id'";$result=mysql_query($sql);$rows=mysql_fetch_array($result);?><html><header><link href='../style.css' rel='stylesheet' type='text/css'></header><body><table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"><tr><td><table width="100%" border="0" cellpadding="3" cellspacing="1" bordercolor="1" bgcolor="#FFFFFF"><tr><td class="fheader"><strong>Title:<? echo $rows['topic']; ?></strong></td></tr><tr><td class="fsub"><b>By</b> <? echo $rows['name']; ?> <b>On:</b> <? echo $rows['datetime']; ?></td></tr><tr><td class="fmain"><? echo $rows['detail']; ?></td></tr></table></td></tr></table><br><?php$tbl_name2="forum_answer"; // Switch to table "forum_answer"$sql2="SELECT * FROM $tbl_name2 WHERE question_id='$id'";$result2=mysql_query($sql2);while($rows=mysql_fetch_array($result2)){<?php/*** AddPattern* @param list        The array/list to add the pattern to* @param pattern    The (perl) regular expression pattern to add* @param string    The string that the pattern should be replaced with* @param escape    Should we "escape" the pattern (escapes /, [ and ] ) and adds*                            "delitimers" ( /pattern/ ) and any defined "rule"* @param modifs    Any modifiers that should be added to the pattern (ignored if escape is false)*                         could be i (case-insensitive) etc. (see manual)* @author Christopher Hindefjord - Mr_CHISOL - Kachtus.net  2007**/function AddPattern( &$list, $pattern, $string, $escape = false, $modifs = '' ) {    // Just in case...    if (!isset($list[0])) {        $list[0] = array();        $list[1] = array();    }    // If we should "escape" the string and treat it... (default: No)    if ($escape) {        // Escape...        $pattern = str_replace( '/', '\/', $pattern );        $pattern = str_replace( '[', '\[', $pattern );        $pattern = str_replace( ']', '\]', $pattern );        // add /        $pattern = '/'.$pattern.'/'.$modifs;    }    $list[0][] = $pattern;    $list[1][] = $string;}$patterns = array( array(), array() );AddPattern( $patterns, '[b](.*)[/b]', '<span class="bold">$1</span>', true, 'i' ); // ignore case and escape itAddPattern( $patterns, '[i](.*)[/i]', '<span class="italic">$1</span>', true, 'i' ); // ignore case and escape itAddPattern( $patterns, '[url="http://(.*)"](.*)[/url]', '<a href="$1">$1</span>', true, 'i' ); // ignore case and escape it// You can add the rest yourself...// Adding the newline replace here, then you don't need multiple call to a replace function...AddPattern( $patterns, "/\n/", "<br />\n" );$_message = preg_replace( $patterns[0], $patterns[1], $rows['a_answer']);?>?><table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"><tr><td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"><tr><td class="fsub"><b>By:</b> <? echo $rows['a_name']; ?> <b>On</b> <? echo $rows['a_datetime']; ?></td></tr><tr><td class="fmain"><? echo $_message; ?></td></tr></table></td></tr></table><br><?}$sql3="SELECT view FROM $tbl_name WHERE id='$id'";$result3=mysql_query($sql3);$rows=mysql_fetch_array($result3);$view=$rows['view'];// if have no counter value set counter = 1if(empty($view)){$view=1;$sql4="INSERT INTO $tbl_name(view) VALUES('$view') WHERE id='$id'";$result4=mysql_query($sql4);}// count more value$addview=$view+1;$sql5="update $tbl_name set view='$addview' WHERE id='$id'";$result5=mysql_query($sql5);mysql_close();?><BR><table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"><tr><form name="form1" method="post" action="forum_add_answer.php"><td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"><tr><td valign="top"><strong></strong></td></tr><tr><td colspan='2'><textarea name="a_answer" cols="45" rows="3" id="a_answer"></textarea></td></tr><tr><td><input name="id" type="hidden" value="<? echo $id; ?>"></td><td align='center'><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td></tr></table></td></form></tr></table><?php } else { ?><?php include("../log_in.php") ?><?php } ?>  </body></html>

  4. Here's how you could use it (see http://www.php.net/manual/en/ref.pcre.php for more info about reg.exp and modifiers):

    $patterns = array( array(), array() );AddPattern( $patterns, '[b](.*)[/b]', '<span class="bold">$1</span>', true, 'i' ); // ignore case and escape itAddPattern( $patterns, '[i](.*)[/i]', '<span class="italic">$1</span>', true, 'i' ); // ignore case and escape itAddPattern( $patterns, '[url](.*)[/url]', '<a href="$1">$1</span>', true, 'i' ); // ignore case and escape it// You can add the rest yourself...// Adding the newline replace here, then you don't need multiple call to a replace function...AddPattern( $patterns, "/\n/", "<br />\n" );$_message = preg_replace( $patterns[0], $patterns[1], $_POST['a_answer']);

    Please NOTE: the function is currently untested, but it should work just fine...After putting this into my script it says "call to undefined function AddPattern"I have no idea on functions but i'm gussing it's not be 'set-up'correctly? i'm gussing?

  5. I'm using this while i post it into the database. should i make it so it changes it when it's being loaded instead?what do you mean by flexible codes?so thoses tags are right then? for <b> ect yeah?cheers i'll add it in nowis their anyway you can reset the auto_increment back to 1 or anything? i'm doing so much testing it's on about 90 and i want it to be 'fresh' or would that jsut imple being running the sql_query again?

  6. would i jut place that where i placed the line break code?so it does for <b> for <i> for <u>hyperlink for <a href='link>Hyperlink</a>ect right? would that work fine or would i need to install bb code or something?that would still turn out like <html> tags when displayed right?

  7. For the Page to download XAMPP for windows: Click hereForm that page i have given you should be able to download the program if you can't i'll send you the one i used.When installing unplugged your internet connection. and any network connection and open certain ports ( not sure which onces but it will tell you)From their you should remeber where u installed XAMPP from here you can then begin to make php scripts Putting them in the folder C:/Program Files/XAMPP/htdocs/ or in folders in more folders. from their you must start your internet broswer and type127.0.0.1/(where your files is located after htdocs)then you should be able to run php filesif you file is located in this locationC:/Program Files/XAMPP/htdocs/folder1and your files is called index.phptype into firefox/Internet explorer127.0.0.1/folder1/index.phpor localhost/folder1/index.phpif you need anymore help just respond i will check back.-JohnnyWelcome Aboard :)

  8. thanks working perfectly so how would i find out the other functions like would it just$_message = str_replace('', '<b>', $_POST['a_answer']);is it possible to insert code into the input box form clicking a button?for the likes of inserting after clicking the bold links

  9. Thanks I'm just having a look now.I'll report back with my finding seems to be perfect.*EDITFCKeditor is something which is a bit too complex since it lets users input checkboxs. I'm hoping to find something i little more simple although i would rather do it all manually to learn. Also i don't know how to 'install' then and extract the data the user is inputting to insert into the data base. I will find one suitable and play around.I will look for a much simpler one**RE-EDITI have found out how to use string replace which is what i want for the replacement does anybody now know what the char is for linebreak for i can replace it with <br>$_message=str_replace("(line-break-char","<br>".$_POST['a_answer'])

  10. It says the headers already sent out. probably by logincheck.phpmaybe if the user isn't logged in i should direct them to the login.php page?

  11. Cheers that worked like a charm the location: was giving an error but i replaced it with the html refresh one :) Thanks :)Anyone know anything in regards to the activeness?so it would change $logged_in=falseor just repeat the logout action? after a time limit on a page refresh or something?

  12. Hello. i got this code from Herei have modified it a bit to suit my needslogincheck.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("mt", $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 login, pazzword FROM Users WHERE login = '$username' AND pazzword = '$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();*/?>

    Log_in.php

    <html>  <header>   <link href="style.css" rel="stylesheet" type="text/css">   <title>Log In - Management Tycoon</title>   <script language='javascript' type='text/javascript'>    if (top.location != self.location) {top.location.replace(self.location)};   </script>  </header>  <body><table align='center' border='1'><tr><td class='indextitle' colspan='2'><img src='banner.bmp'></tr></td><tr><td class='indextitle' colspan='2'>Welcome To Management Tycoon</td></tr><tr><td width='50%'>	<table with='100%' valign='top'>		<tr><td>Management Tycoon is a new online text based game, where you become the manager of your own business in hope to make millions. You being the manager will have to deal with the creation of your product, the staff, sponsors backing your product in order ho help you make millions.<br>But is it as simple as that?</td></tr>	</table>	</td><td>	<table width='50%' border='0'>		<tr><td>Existing Members can log in below</td></tr>		<tr><td><?php echo "<font color='red'>" .$msg . "</font>"; ?><form action="" method="post"></td></tr>    			<tr><td>Username:<input type="text" name="username" /></td></tr>    			<tr><td>Password:<input type="password" name="password" /></td></tr>			<tr><td><input type="submit" name="submit" value="Log In" /></td></tr>			<tr></td></form></td></tr>	</table></td></tr><tr><td align='center' colspan='2'>- <a href='screenshots.html'>Screenshots</a> - <a href='register.php'>Register</a> -</td></tr></table>

    Logout.php

    <?phpinclude ("logincheck.php");?>    <?php echo $msg; ?><?php if ($logged_in) { ?>	<html><body>WHERE TO SIGN THE USER OUT</body></html><?php } else { ?><?php include("log_in.php") ?><?php } ?>  </body></html>

    anyway I'm having problems Logging the user out i have tried<?phpsession_destroy();?>but it won't work. unless i am putting it in the incorrect place.also is it possible to change the code to that they user is logged out after a certain amount of time? if so how would this be done?Thanks-Johnny(Sorry to keep asking questions but I'm trying to get as much done while I'm in the mood for it)

  13. Hello.*EDITI have found wha ti'm looking for i just need to find the char for linebreak i've left my problem in for anyone who was having the same.*UN-EDITI've just created a forum for my websiteI'm having problems with a <text area>when you user types in

    MoreText

    The display is just

    More Text

    I want it to stay

    MoreText

    I'm just wondering how would i detec where their is a line break and type in <br> after it has been sumitted?While the topics open what would happen if they put in :) how would i turn this into an image?Thanks-Johnny

  14. I'm having problems understanding you, apparently butt is for password? What's the question?
    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.
  15. 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

  16. The easiest way to do it is to use phpMyAdmin, which will show you the SQL code that it uses to do everything. So you can create a new table with a column set to be auto_increment, and you will see the create table statement that it used to create it.You can also check the MySQL documentation:http://mysql.org/doc/refman/5.0/en/example...-increment.html
    Cheers i did notice the sql code that shows up :) Pretty handy i do have to say.
    ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY

    Should work

    Yip works like a charm cheers :)
×
×
  • Create New...