
PGTibs
Members-
Posts
73 -
Joined
-
Last visited
Never
Everything posted by PGTibs
-
It looks like it should work, i can't see any problems but then i'd normally run everything first to test it. Someone else might spot a problem but i can't see any.. Should work fine
-
I've managed to find this script... <script type="text/javascript" language="javascript"><!-- function Bolden() { var MyElement = document.getElementById("chatmsg"); MyElement.value("<b></b>"); return true; } //--></script> </head> <body> <a style='cursor: pointer;' onClick="Bolden()"><b>Bold</b></a> <input id="chatmsg" type="text" size="60" maxlength="80" onkeyup="keyup(event.keyCode);"> And basically its meant to be a very simple richtext editor, so you click the Bold link and in the input box it adds <b></b> to the input, which works. However, it just replaces any text with the bold tags instead of adding it on the end. Does anyone know the problem? I'm a complete beginner when it comes to javascript.
-
Id rather try and solve my problem the way my database is already but yano Its getting it from the person name, so the username is like ?user=name and then it looks in the database for a table with the member name as name And then basically it takes the id from that name and searchs for the table with that id with f after it.. E.g. name = bob then it looks for the id of bob = 1 and then it looks for and displays the data on table 1 f Full Page: <? session_start(); include "config.php"; include "online.php"; include('emoticon.php'); $em = new Emoticon(); $em->add('','faces/bigsmile.png'); $em->add(':-D','faces/bigsmile.png'); $em->add(":'(",'faces/cry.gif'); $em->add("",'faces/smile.png'); $em->add(":-)",'faces/smile.png'); $em->add("",'faces/sad.png'); $em->add(":-(",'faces/sad.png'); $em->add(":@",'faces/angry.png'); $em->add(":-@",'faces/angry.png'); $em->add("+o(",'faces/ill.png'); $em->add("+O(",'faces/ill.png'); $em->add(":S",'faces/confused.png'); $em->add(":-S",'faces/confused.png'); $em->add(":-s",'faces/confused.png'); $em->add(":s",'faces/confused.png'); $em->add("",'faces/tongue.png'); $em->add("",'faces/tongue.png'); $em->add("",'faces/wink.png'); $em->add(":^",'faces/embarras.png'); $em->add(":|",'faces/bored.png'); $em->add(";o",'faces/shocked.png'); $em->add(";O",'faces/shocked.png'); $em->add("",'faces/shocked.png'); $em->add("",'faces/shocked.png'); $em->add("(h)",'faces/cool.gif'); $em->add("(H)",'faces/cool.gif'); ?> <head> <link REL="STYLESHEET" TYPE="text/css" HREF="css.css"> </head> <body> <? $comm = str_replace( "", "<img src='faces/bigsmile.png'>", $comm ); $user = $_GET["user"]; $comment = $_GET["comment"]; $add = $_GET["add"]; $friend = $_GET["friend"]; $edit = $_GET["edit"]; $usernamem = $_SESSION['session_username']; $query = mysql_query("SELECT * FROM `members`"); while($result = mysql_fetch_array($query)) { $id = $result["id"]; $name = $result["name"]; $email = $result["Email"]; $age = $result["age"]; $location = $result["location"]; $aboutme = $result["aboutme"]; $music = $result["music"]; $films = $result["films"]; $books = $result["books"]; $buddy = $result["bestbuddy"]; $photo = $result["photo"]; $IDF = "$id f"; $IDC = "$id C"; if($user == "$name") { echo "<center>"; include "nav.php"; echo " <div class='box'> <div class='image'> <img src='$image' width='200px' border='0'> <div class='friends' align='left'> "; if($_SESSION['session_username'] == "$name") { echo ""; } else { echo "<div style='float:right;'> - <a href='profile.php?user=$name&add=addfriend'>Add As Friend</a> - </div>";}; echo "<h2>Friends</h2>"; if($add == "addfriend") { $friend = mysql_query("SELECT * FROM `members` WHERE `name` = '$usernamem'"); while($friendd = mysql_fetch_array($friend)) { $fid = $friendd["id"]; $IDFF = "$fid f"; $addfriend = mysql_query("INSERT INTO `$IDFF` (`maten`, `matep`) VALUES ('$user', '$photo');"); echo "Friend Added..."; echo "<meta http-equiv=\"refresh\" content=\"2;url=profile.php?user=$name\">"; }; }; $queryy = mysql_query("SELECT * FROM `$IDF`"); while($resultt = mysql_fetch_array($queryy)) { $maten = $resultt["maten"]; $matep = $resultt["matep"]; $iddd = $resultt["ID"]; echo " <div style='padding-left: 5px;'> - <a href='profile.php?user=$maten'>$maten</a>"; if($_SESSION['session_username'] == "$name") { echo " <a href='profile.php?user=$name&friend=del$maten$iddd'>[X]</a>";}; echo "</div>"; if($friend == "del$maten$iddd") { $del = mysql_query("DELETE FROM `$IDF` WHERE ID='$iddd' AND maten='$maten'"); echo "<meta http-equiv=\"refresh\" content=\"2;url=profile.php?user=$name\">"; echo "<div style='padding-left: 5px;'>$maten Deleted...</div>"; }; }; echo " </div> </div> <div class='content' align='left'>"; if($_SESSION['session_username'] == "$name") { echo " <a href='profile.php?user=$name&edit=$name$id' class='edit'>[Edit]</a>"; }; if($edit == "$name$id") { if($_SESSION['session_username'] == "$name") { include "profileedit.php"; } else { echo "BAD PERSON! Your not logged in with this username!"; echo "<meta http-equiv=\"refresh\" content=\"3;url=profile.php?user=$name\">"; }; } else { echo " <h2><a href='profile.php?user=$name'>$name</a></h2> <div class='info'> <b>Location</b>:<br> - $location<br> <b>Age</b>:<br> - $age<br> <b>About Me</b>:<br> - $aboutme<br> <b>Music</b>:<br> - $music<br> <b>Films</b>:<br> - $films<br> <b>Books</b>:<br> - $books<br> <b>Best Buddy</b>:<br> - $buddy<br> </div> ";}; echo " <div class='contentt' align='left'> <h2>Comment - <a href='profile.php?user=$name&comment=add'>Add Comment</a></h2>"; if($_POST['subsend']) { $comnn = $_SESSION['session_username']; $ccomm = $_POST["ccom"]; $sub = mysql_query("INSERT INTO `$IDC` (`comn`, `comm`) VALUES ('$comnn', '$ccomm');"); echo "Comment Posted..."; echo "<meta http-equiv=\"refresh\" content=\"2;url=profile.php?user=$name\">"; } else if($comment == "add") { echo $em->apply(" <div style='padding: 10px;'><form method='POST' action='profile.php?user=$name&comment=sub'> <textarea style='width: 100%;' id='ccom' name='ccom'>Add comment here...</textarea><br> <div align='right' style='padding-bottom: 10px; border-bottom: #41A317 2px solid;'> <input type='submit' name='subsend' value='Post'></div></form>"); } else { $queryyy = mysql_query("SELECT * FROM `$IDC` WHERE `ID` <> 1 ORDER BY `ID` DESC"); while($resulttt = mysql_fetch_array($queryyy)) { $comn = $resulttt["comn"]; $comm = $resulttt["comm"]; $idd = $resulttt["ID"]; if($_SESSION['session_username'] == "$name") { echo $em->apply("<div style='margin-top: 4px; background-color:#52D017'> <a class='deletec' href='profile.php?user=$name&comment=del$idd'>[Delete]</a> <div style='padding-left: 5px;'> - <a href='profile.php?user=$comn'>$comn</a> <div style='padding-left: 15px;'> $comm</a></div></div></div>");} else { echo $em->apply("<div style='margin-top: 4px; background-color:#52D017'> <div style='padding-left: 5px;'> - <a href='profile.php?user=$comn'>$comn</a> <div style='padding-left: 15px;'> $comm</a></div></div></div>");}; if($comment == "del$idd") { echo "Comment Deleted..."; $del = mysql_query("DELETE FROM `$IDC` WHERE ID='$idd'"); echo "<meta http-equiv=\"refresh\" content=\"2;url=profile.php?user=$name\">"; }; }; }; echo " </div> </div> </div> </div> "; include "footer.php"; echo "</center>"; }; }; mysql_close($ms); ?> </body>
-
This just causes a 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 '`SELECT` * `FROM` `users` WHERE `user_id`='1' at line 1 error
-
So basically instead of having a table for every user its just using the same ID's as the other tables?
-
Oh and plus, that change didn't work either
-
but i only want you to be able to add the friend when it isn't on your page, if its the same as $name then its only going to show on your own page?
-
It brings up the webaddress as &add=addfriend but nothing else happens, it doesn't add anything to the database or echo anything.
-
This still causes it to happen twice????
-
Right well, the $_POST['subsend'] worked, i don't quite see why but none the less it worked, so now i've got another problem which is the same it just uses a link instead? if($_SESSION['session_username'] == "$name") { echo ""; } else { echo "<div style='float:right;'> - <a href='profile.php?user=$name&add=addfriend'>Add As Friend</a> - </div>";}; echo "<h2>Friends</h2>"; if($add == "addfriend") { $friend = mysql_query("SELECT * FROM `members` WHERE `name` = '$usernamem'"); while($friendd = mysql_fetch_array($friend)) { $fid = $friendd["id"]; $IDFF = "$fid f"; $addfriend = mysql_query("INSERT INTO `$IDFF` (`maten`, `matep`) VALUES ('$user', '$photo');"); echo "Friend Added..."; The $_POST['addfriend'] doesn't work for this problem...
-
I'm building a webpage where you can leave comments which go into a database, however when you submit the form the query runs twice and i can't find the problem. I've looked online but that hasn't helped me any. if($comment == "sub") { $comnn = $_SESSION['session_username']; $ccomm = $_POST["ccom"]; $sub = mysql_query("INSERT INTO `$IDC` (`comn`, `comm`) VALUES ('$comnn', '$ccomm');"); echo "Comment Posted..."; echo "<meta http-equiv=\"refresh\" content=\"2;url=profile.php?user=$name\">"; } else if($comment == "add") { echo " <div style='padding: 10px;'><form method='POST' action='profile.php?user=$name&comment=sub'> <textarea style='width: 100%;' id='ccom' name='ccom'>Add comment here...</textarea><br> <div align='right' style='padding-bottom: 10px; border-bottom: #41A317 2px solid;'> <input type='submit' name='submit' value='Post'></div></form>"; } else { etc...etc...
-
Thanks
-
That just causes a parse error and solving the parse error then gives either the same problem or the textbox dissappears..
-
The form on this page wont submit, its found just under the if submit statement and no matter what i try, the action wont happen after i press the post button. Whats the problem??? <? session_start(); include "config.php"; ?> <head> <link REL="STYLESHEET" TYPE="text/css" HREF="css.css"> </head> <body> <? $user = $_GET["user"]; $comment = $_GET["comment"]; $query = mysql_query("SELECT * FROM `members`"); while($result = mysql_fetch_array($query)) { $id = $result["id"]; $name = $result["name"]; $age = $result["age"]; $location = $result["location"]; $aboutme = $result["aboutme"]; $music = $result["music"]; $films = $result["films"]; $books = $result["books"]; $buddy = $result["bestbuddy"]; $photo = $result["photo"]; $IDF = "$id f"; $IDC = "$id C"; if($user == "$name") { echo "<center>"; include "nav.php"; echo " <div class='box'> <div class='image'> <img src='$image' width='200px' border='0'> <div class='friends' align='left'> <h2>Friends</h2> "; $queryy = mysql_query("SELECT * FROM `$IDF`"); while($resultt = mysql_fetch_array($queryy)) { $maten = $resultt["maten"]; $matep = $resultt["matep"]; $matec = $resultt["matec"]; echo " <div style='padding-left: 5px;'> - <a href='profile.php?user=$maten'>$maten</a></div>"; }; echo " </div> </div> <div class='content' align='left'> <h2>$name</h2> <div class='info'> <b>Location</b>:<br> - $location<br> <b>Age</b>:<br> - $age<br> <b>About Me</b>:<br> - $aboutme<br> <b>Music</b>:<br> - $music<br> <b>Films</b>:<br> - $films<br> <b>Books</b>:<br> - $books<br> <b>Best Buddy</b>:<br> - $buddy<br> </div> <div class='contentt' align='left'> <h2>Comment - <a href='profile.php?user=$name&comment=add'>Add Comment</a></h2>"; $queryyy = mysql_query("SELECT * FROM `$IDC` WHERE `ID` <> 1 ORDER BY `ID` DESC"); while($resulttt = mysql_fetch_array($queryyy)) { $comn = $resulttt["comn"]; $comm = $resulttt["comm"]; if($comment == "sub") { $comnn = "Username Failed"; $ccomm = $_POST["ccom"]; $add = mysql_query("INSERT INTO `$IDC` ( `comn`, `comm`) VALUES ('$comnn', '$ccomm')"); } if($comment == "add") { echo " <div style='padding: 10px;><form method='POST' action='profile.php?user=$name&comment=sub'> <textarea style='width: 100%;' id='ccom'>Add comment here...</textarea><br> <div align='right' style='padding-bottom: 10px; border-bottom: #41A317 2px solid;'> <input type='submit' name='submit' value='Post'></div></form>"; }; echo "<div style='margin-top: 2px; background-color:#52D017'> <div style='padding-left: 5px;'> - <a href='profile.php?user=$comn'>$comn</a></div> <div style='padding-left: 15px;'> $comm</a></div></div>"; }; echo " </div> </div> </div> </div> "; include "footer.php"; echo "</center>"; }; }; mysql_close($ms); ?> </body>
-
Awesome, thanks. Told ya it was simple
-
Thats how it is at the moment, but it doesn't work? The page url just changes too index.php?action=1 but the if ($action == "1") stuff doesn't appear.
-
Sorry for this simple question but i can't find the answer... I have a webpage and on a link click i want the content to change so i set it up with $action = $_GET["action"]; if ($action == "1") { echo "portfolio"; } however, $_GET is for forms, this is just meant to be $action = when link pressed Whats the command for this?
-
I have a login page which contains an avatar image, however at this time i only shows the avatar of the last logged on contact. Is there a way for the image too be a default avatar until you enter the username into the login username is entered and it searches for the correct image and displays it? index.php <?php session_start(); include 'config.php'; $query = mysql_query("SELECT * FROM `staff`"); while($result = mysql_fetch_array($query)) { $photo = $result["photo"]; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Admin Panel :: Login</title> <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 5px; margin-right: 0px; margin-bottom: 0px; background: #F4CFFB; } .style1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; } .login { position: absolute; top: 20px; left:350px; width:320px; height:256px; background: #ffffff; border-color: #000000; border-width: 2px; border-style: solid; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; } .input:hover { border: 1px solid #f00; background: #ff6; } .input2:hover { border: 1px solid #f00; background: #FFC872; } --> </style> </head> <body> <div class="login"> <table width="315" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="315" height="10"></td> </tr> <tr> <td height="25"><table width="315" height="19" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="8"> </td> <td><div align="center"><span class="style1"><u>Login to the Admin Panel </u></span></div></td> <td width="9"> </td> </tr> </table></td> </tr> <tr> <td width="315" height="4"></td> </tr> <tr> <td height="144" valign="top"><table width="315" height="144" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="3"></td> <td valign="top"><center> <? echo "<img style='border-width:1px; border-color:black; border-style:solid;' src='admin/$photo' height='80px' width='80px'>"; ?></center> <? echo " <form action='index.php?login=login' method='POST'><center> <font size='1' face='Verdana'><b>Username:</b></font> <br><input size='26' class='input' type='username' name='username_post' style='border-width:1px; border-color:black; border-style:solid; font-family: Verdana; font-size: 10px; color: #000000;'>"; echo " </input> <br /> <font size='1' face='Verdana'><b>Password:</b></font> <font color='#FFFFFF' size='1' face='Verdana'> <br><input type='password' class='input' name='password_post' size='26' style='border-width:1px; border-color:black; border-style:solid; font-family: Verdana; font-size: 10px; color: #000000;'></font><br><br> <input type='submit' class='input2' name='myclicker' value='Login' style='border-width:1px; border-color:black; border-style:solid; font-family: Verdana; font-weight: bold; font-size: 14px; color: #000000;'> </center></form><br><br>"; if($_GET['login'] == "login") { $user1_post = addslashes($_POST["username_post"]); $pass1_post = addslashes($_POST["password_post"]); $pass1_post = md5($pass1_post); if($user1_post == "" or $pass1_post == "") { echo "<b><font color='#FF0000' size='1' face='Verdana'> Error: You Did Not Enter A Password</b></font>"; exit; } list($user) = mysql_fetch_array(mysql_query("SELECT `username` FROM `staff` WHERE username='$user1_post'")); list($pass) = mysql_fetch_array(mysql_query("SELECT `password` FROM `staff` WHERE password='$pass1_post'")); if($user1_post == "$user" and $pass1_post == "$pass") { $sql = mysql_query("SELECT * FROM `staff` WHERE username='$user' AND password='$pass'"); if(mysql_num_rows($sql)!= 1) { exit; } $result = mysql_fetch_array($sql); $_SESSION['session_username'] = $result['username']; $_SESSION['session_level'] = $result['level']; $_SESSION['session_ip'] = $_SERVER['REMOTE_ADDR']; echo "<meta http-equiv=\"refresh\" content=\"4;url=main.php\">"; echo "<font size='1' color='green' face='Verdana'>You Have Successfully Logged In... Please Wait..."; exit; } else { echo "<b><font color='#FF0000' size='1' face='Verdana'> Error: Your username and password didn't match</b></font>"; } } ?></td> <td width="4"></td> </tr> </table></td> </tr> <tr> <td width="315" height="12"></td> </tr> </table> </div> </body> </html> <? } mysql_close($ms); ?>
-
I've had a look and the only visible way to stop a form from submitting on the enter key pressed is javascript, however, upon using onkeydown='return event.keyCode != 13 && event.which != 13;' The textarea wont move down another line. Is there a way to make the textarea move down lines, add those extra lines too the sql database AND disable enter key submitting the form? Thanks
-
Thanks... I'll be sure too
-
What about with this line... $result = MYSQL_QUERY("SELECT * from `news` ORDER BY `ID` DESC") If i change it too $result = MYSQL_QUERY("SELECT * from `news` <> 1 ORDER BY `ID` DESC") It makes the error underneath show... <? if($_SESSION['session_level'] == "1") { $result = MYSQL_QUERY("SELECT * from `news` ORDER BY `ID` DESC") or die("<b>An Error Has Occured</b>"); Shown: An Error Has Occured
-
I have a webpage which basically shows notes and then allows you to add more notes or remove them. However, i have added in a note with ID 1 as default which must not be removed as there are other important uses for this note. How can i make the page show every note in the database other than the note with ID 1? <? session_start(); include 'config.php'; //if the username is not set or the session username is empty or the ip does not match the session ip log them out ?> <? if($_SESSION['session_level'] == "1") { ?> <font face="verdana" size="1"><b>To Add A Note Click <a href="admin/add_notice.php">Here</a> | To Remove A Note Click <a href="admin/removenews.php">Here</a></b><Br><br> <? } ?> <font face="verdana" size="1">Welcome To The Notebook, This Is The Perfect Place For You To Store Your Precious Notes About Anything!<br></font> <br> <? $query = mysql_query("SELECT * FROM `news` ORDER BY `ID` DESC"); while($result = mysql_fetch_array($query)) { $NoticeUsername = $result["NoticeUsername"]; $NoticeMessage = $result["NoticeMessage"]; $NoticeDAT = $result["NoticeDAT"]; $NoticeTitle = $result["NoticeTitle"]; $NoticeUrgent = $result["NoticeUrgent"]; echo "<table width='100%' border='0' bgcolor='#ffccff' style='border-color: #000000; border-width: 1px; border-style: solid;'> <td colspan=2><B><font face=verdana size=1><u>$NoticeTitle</u></B></td></td> <tr> <td colspan='2'><font face=verdana size=1><li>$NoticeMessage</color></td> </tr> <tr> <td width=50%><font face=verdana size=1><b>How Urgent:</b> $NoticeUrgent</td> <td width=50%><font face=verdana size=1><b>Posted On:</b> $NoticeDAT</td> </tr> </table><br><br>"; } mysql_close($ms); ?>
-
[SOLVED] Is there a command to make echo happen at different times?
PGTibs replied to PGTibs's topic in PHP Coding Help
Big thanks, it worked very well the script on the link... http://www.dynamicdrive.com/dynamicindex17/seqreveal.htm And thanks for the info on a more php way, i'll give that a try some other time. Thanks -
Rightttt.... it doesn't take very long and the file is 31kb so it's not even large. Plus the fact that i'm running it offline on xxamp, could that be part of the problem?