Jump to content

AshleyByrom

Members
  • Posts

    51
  • Joined

  • Last visited

Everything posted by AshleyByrom

  1. Okay well I am making a simple private messaging system where when a user creates a message that adds a row to a database then when you go on your inbox you get all the messages where read='0' (false) and touser=(their username) One question I have is in the inbox, I want a simple preview of messages I do not want to display the full message. So is there any way I can restrict the amount of characters that are displayed? Say, the first 50 or the first 100. My problem I also face is here is my query: $connectToInboxQuery = "SELECT * FROM messages WHERE touser='" . $_SESSION["theUSERNAME"] . "' AND read='0'"; and here is the MySQL error I get: Any help is appreicated!
  2. Anybody heard about googles new OS coming out?
  3. Okay well.. for a little project I am working on I need help with one thing. I have a database with users, some of them are 'staff' and some are regular users. When a 'staff' user logs in they get access to a few more things such as editing the normal users etc. I would like a way, if possible, for the staff to create a quiz... possibly with multiple choice answers and then when the normal users log in they can take that quiz and there score is logged. They will need to take the quiz twice so i can compare both results. I hope i got the message across. Any help would be highly appreciated!
  4. Okay well my presumption is this would work but I thought I would check before I do it. Basically if I made a php file named includes.php and then on a php page (such as index.php) I placed <?PHP require_once("includes.php"); ?> <body>.... Would that work? If i placed ALL of the <head> code inside the includes.php page? That way every page would have the same <HEAD> and it could be easily changed?
  5. Okay so I have set up a little skins function on my website that works fine. There is a jump menu with two values inside it. The values are blue and pink. When blue is selected you are sent to executeBlue.php When pink is selected you are sent to executePink.php the execute pages then need to change the skin (which they do) and then send you BACK to the page you were viewing. That is where I am stuck. Using the following code I have managed to store the page name inside a javascript variable. <script language="javascript"> var sPath = window.location.pathname; //var sPage = sPath.substring(sPath.lastIndexOf('\\') + 1); var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); </script> so sPage stores the page name. I would like to link to each of the execute files so instead of sending you to executeBlue.php you are sent to executeBlue.php?page=sPage How could this be done? <select name="jumpMenu" id="jumpMenu" onchange="MM_jumpMenu('parent',this,0)"> <option>Skin</option> <option value="executeBlueSkin.php?page=">Blue</option> <option value="executePinkSkin.php">Pink</option> </select> there's my jump menu code if it helps.
  6. Thanks for backing it up. I feared I would have to do that. I now have to go back and user the spacer technique changing all images to backgrounds... should be fun... thanks anyway!
  7. Okay well I made the mistake of making a website and then deciding I want skins. Here is how it goes... I am looking for the easiest way possible to crete a simple skins script that directs a user to use a different style sheet depending on their preference. I would create a column in my users table in my database, call it skin and entries can be pink, blue, whatever... then those entries would direct to pink.css, blue.css etc. Thanks!
  8. I could but i placed the script in a members only area? Ill create a demo account now... http://byrom.freehostia.com It isn't fully finished yet... work in progress... Company: demo username: demo password: demo BTW: It is hosted on a free server so it may be pritty slow... with me being 15... I can't buy hosting just yet...
  9. wow, thanks for all the replies! I tried my idea and it worked successfully but all of your options seem to be a lot more 'secure' so i will definitely try them out!! The alert text is simply saved in a alert.txt file. When a new alert is sent out, alert.txt is cleared and wrote over.
  10. haha, i was kind of looking for help? tips? has anybody else done it? is my idea possible?
  11. Well here is my plan... I have a database with a table named 'users', a column on the table is called admin, by default this is set to 0 (meaning they are not an admin) but for a few entries admin is set to 1. I would like it so an admin can create an alert. When the admin creates the alert, whenever any user logs in (or loads a page) I would like a little alert box to pop up ONCE. So each user sees the alert ONCE. This could be useful for lots of reasons I am just a bit stuck because i dont know how I could do it. I could create an extra column on the table named 'seenAlert'. by default this would be 1 (meaning true, meaning yes). Then whenever an admin creates an alert I would set ALL entries underneath seenAlert to 0 (meaning false, meaning no). Then a script such as <?PHP if ($r["seenAlert"]==0) { echo "<SCRIPT LANGUAGE='JavaScript'>" echo "<!-- Hide from older browsers" echo "alert('" . $alert . "');" echo "// end hiding -->" echo "</SCRIPT>" }
  12. Okay well I already have a database with a table (users). The table looks like this: I would like a way, if possible to create a little users online script (Which would just basically echo their first and last name) and then if possible a little chat script. I know the chat script might be asking for a bit much... but hey, it's worth a shot. Thanks!!
  13. I decided to do what I couldnt be botherd doing. Basically i had a page with a PHP require. I switched that round so I had pages that had require('header.php'); etc. Same principles apply, I guess this is better. Thanks for clearing it up!
  14. Okay, well here is my problem. I have one page.. inside that is a few PHP require()'s that load seperate pages into that page. Simple.. But, i want to be able to add a link to my page that will CHANGE that PHP include/require. For example. Say I have three pages... index.php, home.php, about.php On index.php there will be a <a href="home.php" blah blah that links to home.php. there will also be a PHP require that adds home.php to the page. When i click the link to ABOUT.PHP i want the php require to change from home.php to about.php. Is this possible? Anything similar I could try? I would use an iFrame but, i think i would probably get shot...
  15. Thanks for the reply. I found the error, there was a few SQL errors etc. that I was stupid enough not to put in. Everything works fine now though. Thanks!
  16. problem solved. I just realized I had no ')' at the end of $sql. I am now getting a 500 internal server error, can anbody answer why that may be?
  17. Well basically I am trying to create a register page. The page has been created and the form's action is executeRegister2.php in execute register2.php i have the following code: <?PHP session_start(); require("dbconfig.php"); $_SESSION["company"] = $_POST["cname"]; $_SESSION["fname"] = $_POST["fname"]; $_SESSION["sname"] = $_POST["sname"]; $_SESSION["uname"] = $_POST["fname"] . $_POST["sname"]; $_SESSION["password"] = $_POST["dpass"]; $_SESSION["admin"] = $_POST["admin"]; $_SESSION["dob"] = $_POST["yyyy"] . $_POST["mm"] . $_POST["dd"]; $_SESSION["class"] = $_POST["class"]; $_SESSION["email"] = $_POST["email"]; $company = $_POST["cname"]; $fname = $_POST["fname"]; $sname = $_POST["sname"]; $uname = $_POST["fname"] . $_POST["sname"]; $password = $_POST["dpass"]; $admin = $_POST["admin"]; $class = $_POST["class"]; $email = $_POST["email"]; if( strcmp($_POST["dpass"], $_POST["conpass"]) != 0 ) { header("location:itfailed.php"); } $connect = mysql_connect(DB_HOST, DB_USER, DB_PASS); if(!$connect) { die("Unable to connect to database."); } $theDB = mysql_select_db(DB_NAME); if (!$theDB) { die("Unable to select database."); } //Function to sanitize values received from the form. Prevents SQL injection function clean($str) { $str = @trim($str); if(get_magic_quotes_gpc()) { $str = stripslashes($str); } return mysql_real_escape_string($str); } //Sanitize the POST values $company = clean($_POST['company']); $fname = clean($_POST['fname']); $sname = clean($_POST['sname']); $uname = clean($_POST['uname']); $password = clean($_POST['dpass']); $admin = clean($_POST['admin']); $dob = clean($_POST["yyyy"] . "-" . $_POST["mm"] . "-" . $_POST["dd"]); $class = clean($_POST['class']); $email = clean($_POST['email']); $encryptedpassword = md5($password); $sql = "INSERT INTO users (company, admin, username, password, firstname, lastname, email, dob, class) VALUES('$company', '$admin', '$uname', '$encryptedpassword', '$fname', '$sname', '$email', '$dob', '$class'"; $result = @mysql_query($sql); if($result) { header("registerd.php"); exit(); }else { die("Query failed" . mysql_error()); } ?> When i try it, i fill out the form, click register and i get this error: I know it is from where $result has not worked but I cannot work myself around it. This is seriously stressing me out. Any help would be HIGHLY appreciated. I bet it is one little mistake I have made... thanks!!!!
  18. Oh.. now it works? That is highly confusing. I am running apache with PHP on my mac and I also have an external server I am accessing via FTP. Maybe on Apache it doesn't work but on the external server it does. Freaky but, i dont have to worry now. Thanks anyway!
  19. Thanks for the fast replies, I tried that but, i face the same problem. My IP Address still seems to be ::1
  20. Well, on my previous post I mentioned I am making a basic user login script. I am trying to log IP's a user logs in from but I am stuck at the first hurdle. After a goole search I have tried using <?php //Gets the IP address $ip = getenv("REMOTE_ADDR") ; Echo "Your IP is " . $ip; ?> but when I use that I am given: any help?
  21. Problem solved! Thanks to paradoxz, the login script he recommended gave me the idea of when i click login go to a login-execute page, which loads the variables and then go to yourin. this saves the problem of re-loading variables and searching for POST variables which dont exist! Thank you so so much!
  22. Wow, thank you! so quick! Paradoxz, I have downloaded the login script, and i am looking at that. Thank you SO much! And, PFMaBiSmAd, I have done what you said.. thank you for your help and your suggestions too. they have worked! However I have a second problem now. When yourin.php is loaded, the session variables are loaded using POST. That is assuming the login form has been filled out. But if I am redirected to yourin.php because I am already logged in, I have not filled the form out so I get a bunch of PHP errors basicaly saying the session variables cannot be loaded because there is no POST information available. I understand that but, do you know of a way to work around this?
×
×
  • 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.