Jump to content

Attila

Members
  • Posts

    71
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Attila's Achievements

Member

Member (2/5)

0

Reputation

  1. First question I have a field in a MYSQL database that stores a users blog information. If the user performs another blog action it adds the two fields together and stores them in the same field. Am I going to be limited on how long of text I can store in that one field? Will it eventually capp out? Would I be better to make each user their own table and store each blog as a new record? Ok the above question was a simple question with alot of answers....LOL sorry but thanks. Next question is when I retreive the people from the database I would like to display them diferently. You can see how I have it displayed here. http://www.thaczero.com/members.php. I would like to have 2-3 names across but I am not compleatly positive on how to do it. I would assume I would have to store the data for each colum into an array but not sure how to do it. Can someone get me going in the correct direction? here is the code I am curently using: <? $sql = "SELECT * FROM `Character` ORDER BY `maintoonsname` ASC"; database_connected(); $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_array($result)) { ?><BR/><br /> <table align="center"> <tr class="cindex"> <td>Main Toons Name:</td> <td><?php echo '<a href="membersblog.php?Uname='.$row['maintoonsname'].'">'.$row['maintoonsname'].'</a>' ?></td> </tr> <tr class="cindex"> <td colspan="2"><p align="center"><? echo "<img src=".$row['picture'].">"; ?></p> </td> </tr> </table> <br /> <? } ?> <p> </p>
  2. Not sure what I am doing wrong here. So some help and guidance would be great. It dosen't apear to be converting the BBC code to what it should be. Here is my coding. The value going into the functions is $str function bbcode_format ($str) { $str = htmlentities($str); $simple_search = array( '/\[b\](.*?)\[\/b\]/is', '/\[i\](.*?)\[\/i\]/is', '/\[u\](.*?)\[\/u\]/is', '/\[url\=(.*?)\](.*?)\[\/url\]/is', '/\[url\](.*?)\[\/url\]/is', '/\[align\=(left|center|right)\](.*?)\[\/align\]/is', '/\[img\](.*?)\[\/img\]/is', '/\[mail\=(.*?)\](.*?)\[\/mail\]/is', '/\[mail\](.*?)\[\/mail\]/is', '/\[font\=(.*?)\](.*?)\[\/font\]/is', '/\[size\=(.*?)\](.*?)\[\/size\]/is', '/\[color\=(.*?)\](.*?)\[\/color\]/is', ); $simple_replace = array( '<strong>$1</strong>', '<em>$1</em>', '<u>$1</u>', '<a href="$1">$2</a>', '<a href="$1">$1</a>', '<div style="text-align: $1;">$2</div>', '<img src="$1" />', '<a href="mailto:$1">$2</a>', '<a href="mailto:$1">$1</a>', '<span style="font-family: $1;">$2</span>', '<span style="font-size: $1;">$2</span>', '<span style="color: $1;">$2</span>', ); // Do simple BBCode's $str = preg_replace ($simple_search, $simple_replace, $str); // Do <blockquote> BBCode $str = bbcode_quote ($str); return $str; } function bbcode_quote ($str) { $open = '<blockquote>'; $close = '</blockquote>'; // How often is the open tag? preg_match_all ('/\[quote\]/i', $str, $matches); $opentags = count($matches['0']); // How often is the close tag? preg_match_all ('/\[\/quote\]/i', $str, $matches); $closetags = count($matches['0']); // Check how many tags have been unclosed // And add the unclosing tag at the end of the message $unclosed = $opentags - $closetags; for ($i = 0; $i < $unclosed; $i++) { $str .= '</blockquote>'; } // Do replacement $str = str_replace ('[' . 'quote]', $open, $str); $str = str_replace ('[/' . 'quote]', $close, $str); return $str; } Being new at this I am not sure if I am suppost to call both functions when putting the data into the database. Or do I just call them when showing the data on the webpage? If the webpage what one do I show?
  3. WOW I neverthought of looking in the functions I didn't think it would carry over like that. genericnumber1 I had an extra ?> at the end of it thanks for your quick help and repsonses all.
  4. I am courious if this helped or if you found something for the julian date?
  5. Having a probelm finding an extra character in all of my webpages. I beleive it is in what I call the header.php but I have provided one of the main pages as well just in case it is in all of them. If someone could find the extra ?> it would be much appreciated. You can see what I am talking about by going here and looking in the top left corner: http://www.thaczero.com/ Thanks in advanced. The main page <? // start the session session_start(); ob_start(); include ('includes/allfunctions.php'); header("Cache-control: private"); //IE 6 Fix ?> <title>THAC0 (To Hit Armor Class Zero)</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="CSS/style.css" rel="stylesheet" type="text/css"> <body bgcolor="#000000" text="#CCCCCC"> <div> <? include ('includes/thacoheader.php'); ?> <table> <tr> <td height="500">To Hit Armor Class Zero... That is our goal.<BR> <BR> Welcome to the official website of THAC0! (Yes, that is spelled with a zero.)<BR> <BR> THAC0 operates on the Ghallanda server of Dungeons & Dragons Online. We are primarily a social guild, and although our officers are known to be online at various hours most of them play primarily in the evenings. Our guild name is a reflection of the 'old school' pen-and-paper roots of our founding members.<BR> <BR> Our membership includes players from Canada, the US, and Australia and we are always looking for good people to join. Although we are primarily a social guild, we are not above forming raid parties and hosting guild runs for some of the more difficult quests. You will find all of our members helpful and encouraging for both new players and old. Whether you need advice on quests, character builds, or just have general questions about DDO, you will always find our officers and senior members helpful and (usually!) well versed in the world of Ebberon.<BR> <BR> All of our players are dedicated to having fun, helping one another, and fostering our founding philosophy of cooperation and support. In THAC0 we believe you can take any person and make them into a good player, and that's why we only recruit good people who are willing to work with everyone else to improve both themselves and the whole team.<BR> <BR> If you are interested in joining THAC0 or have questions about the BEST GUILD EVER please locate one of our officers online or leave us a post on this site.<BR> <BR> Bronko Lawbringer<BR> Officer, Founder, and Official Meat Shield™ for THAC0<BR> </td> </tr> </table> <? include ('includes/thacofooter.php')?> The include header file. <link href="../CSS/style.css" rel="stylesheet" type="text/css" /> <div align="center"> <table bgcolor="#000000"> <tr> <td> <div align="center"><img src="../Pictures/header.gif" alt="THACO" width="850" height="200" /></div> <p align="center"> <span class="searchnotes">| <a href="index.php">Home</a> | <a href="items.php">DDO Item Database</a> | <a href="apply.php">Apply to Thaco</a> | <a href="../forums/index.php">Forums</a> | </span></td> </tr> </table> </div> The include footer file: <link href="../CSS/style.css" rel="stylesheet" type="text/css" /> <div align="left" class="footer"><font size="-1">Web Design by <a href="mailto:tarman@thaczero.com">Tarman Thaco</a> <br> Copyright © 2008-2009 DDO Items. All Rights Reserved. </font><br> </div>
  6. I am new to this as well but here are my thoughts. I am not sure if it is possible to convert todays date IE 01 Jan 2008 to 001 a julian date. If it is make a table with 365 items in it. when someone logs into your page have a variable get the date convert it to julian and then pull that julian date number out of the table. Ex ID Scripture Script 001 Genesis 1-2 Matthew 1 In the beginning God created the heavens and the earth...... So now the date is equal to the id and have it pull that information. I hope this makes sence to you. There are probably easier ways to do this as I am still a rookie too. <?php //if mysql $con = mysql_connect("localhost","reading","reading"); if (!$con) { die('Could not connect: ' . mysql_error()); } $date = date("F d Y"); $juliandate = $date //this needs to be converted to julian date have no clue how to do it. Possible make a constant with 01 Jan 08 then subtract 01 Jan 08 from current date. Not sure $sql = 'SELECT * FROM `database` WHERE `id` = $juliandate'; $result = mysql_query($sql) or die(mysql_error()); $num_rows = mysql_num_rows($result); $date = date("F d Y"); echo "Today is: " .$date; echo "Today/'s Bible reading section is: " . $row['Scripture']; echo $row['Script']; ?> Not sure if my syntaxt it correct but this should help.
  7. Thank you so much that worked. I do have anothe rminor problem though. The only thing I changed in the above code is what you reposted. But now I have no data in the following fields: $_POST['username'] $_POST['password'] $_POST['realname'] $_POST['maintoonsname'] $_POST['location'] $_POST['timezone'] $_POST['playtime'] Am I trying to do too much on the page did I loose the values somwhere?
  8. You all have provided me great ways to do this and I tried both ways with still no luck. The problem is me not you guys. I am so new at this that I am not sure if I have something from above all this wrong. So here is the entire page. If you can help with this it would be much appreciated. Don't laugh too much. To see the page please go to: http://thaczero.com/memberslog.php The user is: userS Password is: passwordS I am still getting the same error. Thanks again. <? // start the session session_start(); ob_start(); header("Cache-control: private"); //IE 6 Fix ?> <title>THAC0 (To Hit Armor Class Zero)</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="CSS/style.css" rel="stylesheet" type="text/css"> <body bgcolor="#000000" text="#CCCCCC"> <div> <? include ('includes/thacoheader.php'); include ('includes/allfunctions.php'); if ($count != "1") { $sql = "SELECT * FROM `Character` WHERE `user` = \"$_SESSION[name]\" AND `password` = \"$_SESSION[pass]\""; database_connected(); $result = mysql_query($sql) or die(mysql_error()); $num_rows = mysql_num_rows($result); while($row = mysql_fetch_array($result)) { $count = 1; $uname = $_SESSION['name']; $pass = $_SESSION['pass']; $img = $row['picture']; $rname = $row['realname']; $toon = $row['maintoonsname']; $loc = $row['location']; $tim = $row['timezone']; $ptim = $row['playtime']; $origblog = $row['blog']; $idd = $row['id']; } //end to the while loop } ?> <p align="center"><img src="<? echo $img; ?>"></p> <? $top_form = "<form method=\"post\" action=\"$_SERVER[php_SELF]\"> <table align=\"center\"> <tr class=\"cindex\"> <td>Field Name</td> <td>This is what is in the database</td> <td>This is the colum you edit</td> <td>Notes</td> </tr> <tr class=\"cindex\"> <td>User Name:</td> <td>$uname</td> <td><input name=\"textfield\" type=\"text\" name=\"username\" size=\"30\" maxlength=\"30\" value=\"$_POST[username]\"/></td> <td>This can only be up to 30 Characters long with no spaces just your first name.</td> </tr> </tr> <tr class=\"cindex\"> <td>Password:</td> <td>$pass</td> <td><input name=\"textfield\" type=\"text\" name=\"password\" size=\"30\" maxlength=\"30\" value=\"$_POST[password]\"/></td> <td>This can only be up to 30 Characters long with no spaces just your first name.</td> </tr> </tr> <tr class=\"cindex\"> <td>Real Name:</td> <td>$rname</td> <td><input name=\"textfield\" type=\"text\" name=\"realname\" size=\"30\" maxlength=\"30\" value=\"$_POST[realname]\"/></td> <td>This can only be up to 30 Characters long with no spaces just your first name.</td> </tr> <tr class=\"cindex\"> <td>Main Toons Name:</td> <td>$toon</td> <td><input name=\"textfield\" type=\"text\" name=\"maintoonsname\" size=\"30\" maxlength=\"30\" value=\"$_POST[maintoonsname]\"/></td> <td>This can only be up to 30 Characters long with no spaces just your characters first name.</td> </tr> <tr class=\"cindex\"> <td>Location:</td> <td>$loc</td> <td><input name=\"textfield\" type=\"text\" name=\"location\" size=\"30\" maxlength=\"30\" value=\"$_POST[location]\"/></td> <td>This can only be up to 30 Characters long and it is where you live.</td> </tr> <tr class=\"cindex\"> <td>Time Zone:</td> <td>$tim</td> <td><input name=\"textfield\" type=\"text\" name=\"timezone\" size=\"30\" maxlength=\"30\" value=\"$_POST[timezone]\"/></td> <td>What time zone do you live in?</td> </tr> <tr class=\"cindex\"> <td>Play time:</td> <td>$ptim</td> <td><input name=\"textfield\" type=\"text\" name=\"playtime\" size=\"30\" maxlength=\"30\" value=\"$_POST[playtime]\"/></td> <td>What time of day do you usually play?</td> </tr> <tr class=\"cindex\"> <td colspan=\"4\">Blog:</td> </tr> </tr> <tr class=\"cindex\"> <td colspan=\"4\"><p>Just add more of your blog information at the top here. If you delete any data here and submit it will be lost. This data is going to be parsed with BBC code. So some things that you can do to spruce up your coding look like this: </p> <p>This is for Bold [b][/b] <br> This is for italix [i][/i] <br> This is for underline [u][/u] <br> This is for a hyperlink [url][/url] <br> This is to align left [align=left][/align] <br> This is to align center [align=center][/align] <br> This is to align right [align=right[/align] <br> This is for an image [img][/img] </p> <br> You will need to put your text between those tags so they will work. If you accidantly screwed up on what you are adding and want to start over please go to another web address like www.thaczero.com then relog back in so you will not loose what you already have in the database. </td> </tr> <tr class=\"cindex\"> <td colspan=\"2\"><div align=\"center\" align=\"top\">$origblog</div> <td colspan=\"2\"><div align=\"center\"><textarea name=\"blog\" cols=\"75\" rows=\"30\">$_POST[blog]</textarea></div> </tr> </tr> </tr> <tr class=\"cindex\"> <td colspan=\"4\"><div align=\"center\"> <input type=\"submit\" name=\"Submit\" value=\"Submit\" /> <input type=\"hidden\" name=\"op\" value=\"ds\"> </div></td> </tr> </table> </form>"; if ($_POST[op] != "ds") { // they need to see the form echo $top_form; } else if ($_POST[op] == "ds") { $blogging = $origblog.$_POST['blog']; database_connected(); $postedrealname = $_POST['realname']; $postedmaintoonsname = $_POST['maintoonsname']; $postedulocation = $_POST['location']; $postedtimezone = $_POST['timezone']; $postedplaytime = $_POST['playtime']; //$query = ("UPDATE `Character` SET `maintoonsname` = '$_POST[maintoonsname]' //, `location` = '$_POST[location]' //, `timezone` = '$_POST[timezone]' //, `playtime` = '$_POST[playtime]' //, `blog` = '$blogging' //WHERE `id` = '$row[id]' "); foreach ($_POST as $name => $value) { $_POST[$name] = mysql_real_escape_string($value); } $qinsert = "UPDATE `Character` SET `user` = '".$_POST['username']."', `password` = '".$_POST['password']."', `realname` = '".$_POST['realname']."', `maintoonsname` = '".$_POST['maintoonsname']."', `location` = '".$_POST['location']."', `timezone` = '".$_POST['timezone']."', `playtime` = '".$_POST['playtime']."', `blog` = `$blogging` WHERE `id`='$idd'"; mysql_query($qinsert) or die(mysql_error()); } include ('includes/thacofooter.php'); ?>
  9. If I compleatly understood you this is what I did. Sorry just tinker with this stuff I did go to http://us2.php.net/mysql_real_escape_string to see how to do it but not the best at this stuff so I am confused. I would think you would want to do this: mysql_real_escape_string($idd); before you created the query to remove what ever it is removing. LOL sorry but thanks for your help all of you. $qinsert = "UPDATE `Character` SET `user` = '$_POST[username]', `password` = '$_POST[password]', `realname` = '$_POST[realname]', `maintoonsname` = '$_POST[maintoonsname]', `location` = '$_POST[location]', `timezone` = '$_POST[timezone]', `playtime` = '$_POST[playtime]', `blog` = `$blogging` WHERE `id` = $idd LIMIT 1"; mysql_real_escape_string($idd); mysql_real_escape_string($blogging); mysql_query($qinsert) or die(mysql_error());
  10. To the best of my knowledge everything has a value. I did the change you sugested now I am getting this error: Unknown column 'This is Greg's TestERt' in 'field list' $qinsert = "UPDATE `Character` SET `user` = '$_POST[username]', `password` = '$_POST[password]', `realname` = '$_POST[realname]', `maintoonsname` = '$_POST[maintoonsname]', `location` = '$_POST[location]', `timezone` = '$_POST[timezone]', `playtime` = '$_POST[playtime]', `blog` = `$blogging` WHERE `id` = $idd LIMIT 1"; mysql_query($qinsert) or die(mysql_error());
  11. Can't seam to see what is wrong with this. The error I am getting is this: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Greg's TestER WHERE `id` = 3 LIMIT 1' at line 8 $qinsert = "UPDATE `Character` SET `user` = '$_POST[username]', `password` = '$_POST[password]', `realname` = '$_POST[realname]', `maintoonsname` = '$_POST[maintoonsname]', `location` = '$_POST[location]', `timezone` = '$_POST[timezone]', `playtime` = '$_POST[playtime]', `blog` = $blogging WHERE `id` = $idd LIMIT 1"; mysql_query($qinsert) or die(mysql_error());
  12. Good call on adding the or DIE now I am getting this error. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Character WHERE user = 'Test' AND password = 'test')' at line 1 Line 1 is <?
  13. Can someone see why I am getting this error. Warning: mysql_result(): supplied argument is not a valid MySQL on line 56 //check for member $name = $_POST['Uname']; $pass = $_POST['Password']; database_connected(); $sql = "(SELECT COUNT(*) FROM Character WHERE user = '$name' AND password = '$pass')"; $loginresult = mysql_query($sql); $count = mysql_result($loginresult, 0); //This is line 56. I have tried it this way as well $count = mysql_result($loginresult, 0, 0); with no help echo "$count"; $number_of_results = mysql_num_rows($loginresult); if ($count > 0) { // Register session key with the value $_SESSION['name'] = $name; $_SESSION['pass'] = $pass; ob_end_clean(); header ("Location:../membersloggedin.php"); } Thanks
  14. OK all I am trying to create a very simple blog for members of my online video game guild. I know that sessions would be the best way to go but it is not anything that is extreamly critical for passwords sensativity. So what I am doing is in the database I will hard code there user name and password. I have the members go to one page to login. You can see that page here: http://thaczero.com/memberslog.php Useer name is Test and Password is Test Since I am being lazy after you enter I am using $_POST['Uname'] and $_POST['Password'] inside a link to get to the page the member can use to adjust their data such as Main character name and their blog information. This is where my problem is. The first php code below here is the form and method to get it to display. It also displays what they have in the database and provides them text blocks to adjust what is in the database if they with plus add more blog information. So this part quiries the database with the information from the previus page for user and password <? <? include ('includes/thacoheader.php'); include ('includes/allfunctions.php'); if ($count != "1") { $sql = "SELECT * FROM `Character` WHERE `user` = \"$_GET[uname]\" AND `password` = \"$_GET[Password]\""; database_connected(); $result = mysql_query($sql) or die(mysql_error()); $num_rows = mysql_num_rows($result); while($row = mysql_fetch_array($result)) { $count = 1; $uname = $_GET['Uname']; $pass = $_GET['Password']; $img = $row['picture']; $rname = $row['realname']; $toon = $row['maintoonsname']; $loc = $row['location']; $tim = $row['timezone']; $ptim = $row['playtime']; $origblog = $row['blog']; } //end to the while loop } ?> <p align="center"><img src="<? echo $img; ?>"></p> <? $top_form = "<form method=\"post\" action=\"$_SERVER[php_SELF]\"> <table align=\"center\"> <tr class=\"cindex\"> <td>Field Name</td> <td>Whats in the Database</td> <td>This is the colum you edit</td> <td>Notes</td> </tr> <tr class=\"cindex\"> <td>Real Name:</td> <td>$rname</td> <td><input name=\"textfield\" type=\"text\" name=\"realname\" size=\"30\" maxlength=\"30\" value=\"$_POST[realname]\"/></td> <td>This can only be up to 30 Characters long with no spaces just your first name.</td> </tr> <tr class=\"cindex\"> <td>Main Toons Name:</td> <td>$toon </td> <td><input name=\"textfield\" type=\"text\" name=\"maintoonsname\" size=\"30\" maxlength=\"30\" value=\"$_POST[maintoonsname]\"/></td> <td>This can only be up to 30 Characters long with no spaces just your characters first name.</td> </tr> <tr class=\"cindex\"> <td>Location:</td> <td>$loc</td> <td><input name=\"textfield\" type=\"text\" name=\"location\" size=\"30\" maxlength=\"30\" value=\"$_POST[location]\"/></td> <td>This can only be up to 30 Characters long and it is where you live.</td> </tr> <tr class=\"cindex\"> <td>Time Zone:</td> <td>$tim</td> <td><input name=\"textfield\" type=\"text\" name=\"timezone\" size=\"30\" maxlength=\"30\" value=\"$_POST[timezone]\"/></td> <td>What time zone do you live in?</td> </tr> <tr class=\"cindex\"> <td>Play time:</td> <td>$ptim</td> <td><input name=\"textfield\" type=\"text\" name=\"playtime\" size=\"30\" maxlength=\"30\" value=\"$_POST[playtime]\"/></td> <td>What time of day do you usually play?</td> </tr> <tr class=\"cindex\"> <td colspan=\"4\">Blog:</td> </tr> </tr> <tr class=\"cindex\"> <td colspan=\"4\"><p>Just add more of your blog information at the top here. If you delete any data here and submit it will be lost. This data is going to be parsed with BBC code. So some things that you can do to spruce up your coding look like this: </p> <p>This is for Bold [b][/b] <br> This is for italix [i][/i] <br> This is for underline [u][/u] <br> This is for a hyperlink [url][/url] <br> This is to align left [align=left][/align] <br> This is to align center [align=center][/align] <br> This is to align right [align=right[/align] <br> This is for an image [img][/img] </p> <br> You will need to put your text between those tags so they will work. If you accidantly screwed up on what you are adding and want to start over please go to another web address like www.thaczero.com then relog back in so you will not loose what you already have in the database. </td> </tr> <tr class=\"cindex\"> <td colspan=\"2\" valign=\"top\">$origblog <td colspan=\"2\"><div align=\"center\"><textarea name=\"blog\" cols=\"75\" rows=\"30\">$_POST[blog]</textarea></div> </tr> </tr> </tr> <tr class=\"cindex\"> <td colspan=\"4\"><div align=\"center\"> <input type=\"submit\" name=\"Submit\" value=\"Submit\" /> <input type=\"hidden\" name=\"op\" value=\"ds\"> </div></td> </tr> </table> </form>"; Next after they have made an update I use the following code to update the database. This is the part that is not working: if ($_POST[op] != "ds") { // they need to see the form echo $top_form; } else if ($_POST[op] == "ds") { $blogging = $origblog.$_POST['blog']; $query = ("UPDATE `charactedatabase` SET `maintoonsname` = '$_POST[maintoonsname]' , `location` = '$_POST[location]' , `timezone` = '$_POST[timezone]' , `playtime` = '$_POST[playtime]' , `blog` = '$blogging' WHERE `user` = '$uname'"); mysql_query($query); echo "this is the realname: ".$_POST["realname"]."<br>"; echo "this is the toons name: ".$_POST["maintoonsname"]."<br>"; echo "this is the location: ".$_POST["location"]."<br>"; echo "this is the timezone: ".$_POST["timezone"]."<br>"; echo "this is the playtime: ".$_POST["playtime"]."<br>"; echo "this is the blogging: ".$blogging."<br>"; echo "this is the username: ".$uname."<br>"; echo "this is the Password: ".$Pass."<br>"; echo "these are the variables<br>"; echo $uname; echo "<br>"; echo $pass; echo "<br>"; echo $img; echo "<br>"; echo $rname; echo "<br>"; echo $toon; echo "<br>"; echo $loc; echo "<br>"; echo $tim; echo "<br>"; echo $ptim; echo "<br>"; echo $origblog; echo "<br>"; exit; } include ('includes/thacofooter.php'); I have all the echo statements in there to show me what the values of each item is and almost all of them ar NULL. Am I echoing them wrong? I know it is not updating the database because I look in the database and there are no changes. Please any help would be greatly appreciated. If you have coding that can make this happen easier I am willing to learn. Thanks for all you people do and all your help.
×
×
  • 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.