Jump to content

Sniffy

Members
  • Posts

    403
  • Joined

  • Last visited

Everything posted by Sniffy

  1. Hey everyone, it is just me stopping in again to say "hi". I kind of forgot about this forum when I started getting into Java and object oriented programming in general. I am on my way to success in programming, messing with OpenGL bindings like Xith3D and JMonkey. I came across C# being able to make web applications with ASP.NET in a book that I was reading. If I look into it more, this forum just may be of some use to me once again.
  2. Sniffy

    Where are you?

    Neat web appletw3schools is global
  3. window.onLoad() is after the page is loaded.Make sure that all your content is not displayed (via the stylesheet or whatever method you choose)Make sure only the id "loading" is the only thing that is displayed (do this via stylesheet or....)Add the code that Synook gave you and you're done... I think.
  4. Sniffy

    Insert image problem

    One image with an x over it like an error but i test the url and it works.
  5. Ok, on my expiriment I am trying to load images by putting their urls in a text file.Screenshots.php <?$filename = "screenshots.txt";$fileopen = fopen($filename, "r");$fileread = fread($fileopen, filesize($filename));$arr = split(" + ", $fileread);$ac = count($arr);for($i = 0; $i < $ac; $i++){ echo "<img src='".$arr[i]."' /><br /><br />";}fclose($fileopen);?> screenshots.txt http://img207.imageshack.us/img207/127/elb3r3th14px4.jpg + http://http://img151.imageshack.us/img151/5935/kyallanaandnamoor1ek5.jpg how come it won't display my images?
  6. I thank you for all of the help you've given me with PHP and MySQL and I would recommend you to other users.

  7. I hope this isn't off topic, but I heard of a software that will sweep all of the unrestricted files from a site that used to be available but I'm not sure if it is now or not.
  8. I haven't ever dealt with this before but try something like \u38 as an escape char for &, but I am not sure how to use unicode escape characters in PHP/ActionScript, if you can. Try searching up Unicode Escape Characters + PHP/ActionScript on google or some search engine and that might help.Since it's such a weird problem to me, I can't really give much advice other than that.
  9. Sniffy

    mysql timestamp

    wow, thank you. I think i am starting to understand what the sql aliases are used for.
  10. Sniffy

    mysql timestamp

    I am having a little issue with my php script. I only have three rows but with this script it says users online is 4, and when I remove the intval($getActive) I get "resource id #4 users online", why is this? <?$openFile = fopen("userLog.txt", "a+") or exit("error");$contentsOfFile = fread($openFile, filesize("userLog.txt"));echo "&theLog=$contentsOfFile";include("dbConnect.php");$timeOnline = time() - (10 * 60);$getActive = mysql_query("SELECT COUNT(userName) FROM basicUserInfo WHERE lastActive>=$timeOnline") or die("error5");$updateFile = fwrite($openFile, " / " . intval($getActive) . " user(s) are online / ");fclose($openFile);?>
  11. nevermind, it's ok i managed to fix it just after i posted this problem with the AND keyword in my query
  12. Thanks guys, but after doing some research of my own i managed to do something simlar to the support i was given.Now I have another problem that i need suggestions on. I don't know PHP that well so it could be a syntax bug that i am unaware of. Anyways, i can sign up, the account was created, but when i try to log in it says user/password was invalid, why is this?logIn.php <?phpsession_start();if(isset($_SESSION['userName'])){ header("location:http://sniffygerbil.com");}?><html> <head> <title>Gerbius - Login</title> </head> <body> <form action='logProcess.php' method='post'> User Name: <input type='text' name='userName' /> <br /> Password: <input type='password' name='password' /> <input type='submit' value='Log In' /> <input type='reset' value='Clear Entry' /> </form> </body></html> logProcess.php (I will be joining the two together after i get this to work) <?phpsession_start();if(isset($_SESSION['userName'])){ header("location:http://sniffygerbil.com");}$userName = htmlentities($_POST['userName']);$password = htmlentities($_POST['password']);//connect to host$con = mysql_connect("fdb1.awardspace.com", "fghghfghfhfg", "hghgfhgfh") or die(mysql_error());//select databasemysql_select_db("sniffygerbil_db", $con) or die("could not connect to db");//validation begins$query = mysql_query("SELECT password FROM basicUserInfo WHERE userName='$userName'") or die(mysql_error());if(mysql_num_rows($query) == 1 && $query == $password){ $_SESSION['userName'] = $userName;}else{ echo "Password or user name was incorrect.";}?> what is my problem?
  13. So i have been working on a registration script for my site. It seems to be going quite smoothly until i came into an error in my script that i might be overlooking and need advice on.Ok, so here's what i put in on my form for my username:Username: tss909Here is my script for regProcess.php <?phpsession_start();//if already logged in, redirect to home pageif(isset($_SESSION['userName'])){ echo "<script type='text/javascript'>window.location = 'index.php';</script>";}//connect to host$con = mysql_connect("fdb1.awardspace.com", ".;..;;.;;..", ".;l;.;.;;..") or die(mysql_error());//select databasemysql_select_db("sniffygerbil_db", $con);$userName = htmlentities($_POST['userName']);if(preg_match("/^[a-zA-Z0-9]{3,16}$/", $userName)){ $checkUserName = mysql_query("SELECT userName FROM basicUserInfo WHERE userName='".$userName."'"); if(!$checkUserName) { //if username wasn't found insert it into the database $insertUserName = true; } else { $insertUserName = false; }}else{ $insertUserName = false;}//Check to make sure password is valid, insert it into database under new user name or stop processif($_POST['password'] == $_POST['confirmPassword']){ $password = htmlentities($_POST['password']); if(preg_match("/^[a-zA-Z0-9]{3,8}$/", $password)) { $insertPassword = true; } else { $insertPassword = false; }}else{ $insertPassword = false;}if($_POST['email'] == $_POST['confirmEmail']){ $email = htmlentities($_POST['email']); if(preg_match("/^[a-zA-Z0-9._-]{6,50}$/", $email)) { $insertEmail = true; } else { $insertEmail = false; }}else{ $insertEmail = false;}$furColor = $_POST['furColor'];$eyeColor = $_POST['eyeColor'];//if all required fields are accurate, insert newly created user into the databaseif($insertUserName && $insertPassword && $insertEmail){ $insertAll = mysql_query("INSERT INTO basicUserInfo VALUES ('".$userName."', '".$password."', '".$email."', '".$furColor."', '".$eyeColor."', 1, 0, 100, 0, 'no')"); if(!$insertAll) { $insertUserName = false; $insertPassword = false; $insertEmail = false; } else { echo "Success! You are now registered as:".$userName."!"; $regMailMessage = "Congratulations! You are now a member of Gerbius. Your user name is:".$userName.". Your password is:".$password.". [url="http://sniffygerbil.com";"]http://sniffygerbil.com";[/url] mail($email, "Gerbius Registration", $regMailMessage); }}//if not, alert the user on their errorselseif(!$insertUserName){ echo "User name was invalid. This could be that your desired user name was already taken."; echo "This could also be the fact that your user name was not between 3 to 16 characters in length."; echo "This could also be the fact that your user name was not made up of only alpha-numeric characters.";}elseif(!$insertPassword){ echo "Password was invalid. This could be that your password was not between 3 to 8 characters in length."; echo "This could also be the fact that your password was not made up of only alpha-numberic characters.";}elseif(!$insertEmail){ echo "Email was invalid. Please make sure your email is between 6 to 50 characters in length."; echo "Make sure your email address is also made up of alpha-numeric characters and \"-\",\".\",\"_\", only!";}?> Here is register.php with the form <?php//if already logged in, redirect to home pageif(isset($_SESSION['userName'])){ echo "<script type='text/javascript'>window.location = 'index.php';</script>";}?><html> <head> <title>Gerbius - Registration</title> </head> <body> <form action="regProcess.php" method="post"> Username: <input type="text" name="userName" /> <br /> Password: <input type="password" name="password" /> <br /> Confirm Password: <input type="text" name="confirmPassword" /> <br /> Email: <input type="text" name="email" /> <br /> Confirm Email: <input type="text" name="confirmEmail" /> <br /> Fur Color: <select name="furColor"> <option value="gold">Gold</option> <option value="white">White</option> <option value="red">Red</option> <option value="brown">Brown</option> <option value="black">Black</option> <option value="blue">Blue</option> <option value="green">Green</option> <option value="purple">Purple</option> </select> <br /> Eye Color: <select name="eyeColor"> <option value="white">White</option> <option value="black">Black</option> <option value="blue">Blue</option> <option value="green">Green</option> <option value="red">Red</option> <option value="yellow">Yellow</option> <option value="purple">Purple</option> <option value="brown">Brown</option> </select> <br /> <input type="submit" value="Submit" /> <input type="reset" value="Reset" /> </form> </body></html> When i click on submit, this is what comes up on regProcess.php:User name was invalid. This could be that your desired user name was already taken.This could also be the fact that your user name was between 3 to 16 characters in length.This could also be the fact that your user name was not made up of only alpha-numeric characters. I did enter a valid password though, so what is the problem?It could be a little bug in my script, my as i said, i am probably overlooking it.
  14. So i have been working on a registration script for my site. It seems to be going quite smoothly until i came into an error in my script that i might be overlooking and need advice on.Ok, so here's what i put in on my form for my username:Username: tss909Here is my script for regProcess.php <?phpsession_start();//if already logged in, redirect to home pageif(isset($_SESSION['userName'])){ echo "<script type='text/javascript'>window.location = 'index.php';</script>";}//connect to host$con = mysql_connect("fdb1.awardspace.com", ".;..;;.;;..", ".;l;.;.;;..") or die(mysql_error());//select databasemysql_select_db("sniffygerbil_db", $con);$userName = htmlentities($_POST['userName']);if(preg_match("/^[a-zA-Z0-9]{3,16}$/", $userName)){ $checkUserName = mysql_query("SELECT userName FROM basicUserInfo WHERE userName='".$userName."'"); if(!$checkUserName) { //if username wasn't found insert it into the database $insertUserName = true; } else { $insertUserName = false; }}else{ $insertUserName = false;}//Check to make sure password is valid, insert it into database under new user name or stop processif($_POST['password'] == $_POST['confirmPassword']){ $password = htmlentities($_POST['password']); if(preg_match("/^[a-zA-Z0-9]{3,8}$/", $password)) { $insertPassword = true; } else { $insertPassword = false; }}else{ $insertPassword = false;}if($_POST['email'] == $_POST['confirmEmail']){ $email = htmlentities($_POST['email']); if(preg_match("/^[a-zA-Z0-9._-]{6,50}$/", $email)) { $insertEmail = true; } else { $insertEmail = false; }}else{ $insertEmail = false;}$furColor = $_POST['furColor'];$eyeColor = $_POST['eyeColor'];//if all required fields are accurate, insert newly created user into the databaseif($insertUserName && $insertPassword && $insertEmail){ $insertAll = mysql_query("INSERT INTO basicUserInfo VALUES ('".$userName."', '".$password."', '".$email."', '".$furColor."', '".$eyeColor."', 1, 0, 100, 0, 'no')"); if(!$insertAll) { $insertUserName = false; $insertPassword = false; $insertEmail = false; } else { echo "Success! You are now registered as:".$userName."!"; $regMailMessage = "Congratulations! You are now a member of Gerbius. Your user name is:".$userName.". Your password is:".$password.". [url="http://sniffygerbil.com";"]http://sniffygerbil.com";[/url] mail($email, "Gerbius Registration", $regMailMessage); }}//if not, alert the user on their errorselseif(!$insertUserName){ echo "User name was invalid. This could be that your desired user name was already taken."; echo "This could also be the fact that your user name was not between 3 to 16 characters in length."; echo "This could also be the fact that your user name was not made up of only alpha-numeric characters.";}elseif(!$insertPassword){ echo "Password was invalid. This could be that your password was not between 3 to 8 characters in length."; echo "This could also be the fact that your password was not made up of only alpha-numberic characters.";}elseif(!$insertEmail){ echo "Email was invalid. Please make sure your email is between 6 to 50 characters in length."; echo "Make sure your email address is also made up of alpha-numeric characters and \"-\",\".\",\"_\", only!";}?> Here is register.php with the form <?php//if already logged in, redirect to home pageif(isset($_SESSION['userName'])){ echo "<script type='text/javascript'>window.location = 'index.php';</script>";}?><html> <head> <title>Gerbius - Registration</title> </head> <body> <form action="regProcess.php" method="post"> Username: <input type="text" name="userName" /> <br /> Password: <input type="password" name="password" /> <br /> Confirm Password: <input type="text" name="confirmPassword" /> <br /> Email: <input type="text" name="email" /> <br /> Confirm Email: <input type="text" name="confirmEmail" /> <br /> Fur Color: <select name="furColor"> <option value="gold">Gold</option> <option value="white">White</option> <option value="red">Red</option> <option value="brown">Brown</option> <option value="black">Black</option> <option value="blue">Blue</option> <option value="green">Green</option> <option value="purple">Purple</option> </select> <br /> Eye Color: <select name="eyeColor"> <option value="white">White</option> <option value="black">Black</option> <option value="blue">Blue</option> <option value="green">Green</option> <option value="red">Red</option> <option value="yellow">Yellow</option> <option value="purple">Purple</option> <option value="brown">Brown</option> </select> <br /> <input type="submit" value="Submit" /> <input type="reset" value="Reset" /> </form> </body></html> When i click on submit, this is what comes up on regProcess.php:User name was invalid. This could be that your desired user name was already taken.This could also be the fact that your user name was between 3 to 16 characters in length.This could also be the fact that your user name was not made up of only alpha-numeric characters. I did enter a valid password though, so what is the problem?It could be a little bug in my script, my as i said, i am probably overlooking it.
  15. Sniffy

    BIGINT error

    Thanks, i just wasn't sure what a "NULL" column was.
  16. Sniffy

    BIGINT error

    Thanks guys.And one more SQL question.What is the difference between setting a column to NULL and NOT NULL?If it is a NULL column does that mean I can't store information?
  17. Sniffy

    BIGINT error

    Ok, so i am trying to insert columns into my database that can handle large numbers like 1 million. On the mySQL manual it says BIGINT can handle really large numbers.So on PHPMyAdmin I tried to insert those columns (level, exp, reqExp) into the "basicUserInfo" table to hold max values of 10000, 1000000, 1000000, into the table with the attribute of BIGINT. I get this error:SQL query: ALTER TABLE `basicUserInfo` ADD `level` BIGINT( 10000 ) NOT NULL AFTER `eyeColor` ,ADD `exp` BIGINT( 1000000 ) NOT NULL AFTER `level` ,ADD `reqExp` BIGINT( 1000000 ) NOT NULL AFTER `exp` MySQL said: #1074 - Column length too big for column 'level' (max = 255); use BLOB or TEXT instead
  18. Also, here is another one of my past creations:aApplet.java import javax.swing.*;import java.awt.*;public class aApplet extends JApplet{ Container con = getContentPane(); String speech = " Duis nec lectus. Etiam aliquet, nulla non elementum"; String speech2 = "aliquam,libero urna rhoncus eros, vel luctus"; String speech3 = "tellus urna at mauris. Sed tincidunt consequat"; String speech4 = "erat. Nulla facilisi. Cras varius. Suspendisse"; String speech5 = "posuere turpis ac sem. Phasellus vulputate"; String speech6 = "commodo lacus.\n Sed auctor. Aliquam venenatis"; String speech7 = "tellus eget dolor. Sed risus."; public void start(){ repaint(); } public void paint(Graphics gr){ gr.drawRoundRect(9, 9, 301, 151, 20, 20); gr.setColor(Color.CYAN); gr.fillRoundRect(10, 10, 300, 150, 20, 20); gr.setColor(Color.BLACK); gr.drawString(speech, 20, 25); gr.drawString(speech2, 20, 40); gr.drawString(speech3, 20, 55); gr.drawString(speech4, 20, 70); gr.drawString(speech5, 20, 85); gr.drawString(speech6, 20, 100); gr.drawString(speech7, 20, 115); gr.fillRect(40, 140, 200, 10); }}
  19. Does anyone have a tutorial on nested classes, I've been meaning to look into it.
  20. Check out my latest creation.... do you like it?Instructions:Install SDK: http://java.sun.comCreate new file: ExampleJFrame.javaInsert Code: import javax.swing.*;import java.awt.*;import java.awt.event.*;public class ExampleJFrame{ public static void main(String[] args) { JButton press = new JButton("Show"); JButton press2 = new JButton("Hide"); JButton press3 = new JButton("Clear"); final JFrame frame = new JFrame("Example"); JFrame frame2 = new JFrame("Menu"); frame.setSize(200, 200); frame.setResizable(false); frame.getContentPane().setLayout(new FlowLayout()); frame.show(); frame2.setLocation(200, 0); frame2.setResizable(false); frame2.addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e) { System.exit(0); } }); frame2.setSize(200, 200); frame2.getContentPane().setLayout(new FlowLayout()); frame2.getContentPane().add(press); frame2.getContentPane().add(press2); frame2.getContentPane().add(press3); frame2.show(); press.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { frame.setVisible(true); } }); press2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { frame.setVisible(false); frame.getContentPane().add(new JLabel("" + frame.getLocation())); } }); press3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { frame.setVisible(false); frame.getContentPane().removeAll(); frame.setVisible(true); } }); } } Command Prompt: OpenType commands:javac ExampleJFrame.javajava ExampleJFrame.javaWhat do you think?What it does:Use the "Menu" frame to either "Show", "Hide", or "Clear" the JFrame "frame2" of content. Content is added each time "frame2" is shown. It displays its current location (x,y) on the screen with the java.awt.Point class.somethings wrong with my PC so i can't supply a preview at the moment
  21. Sniffy

    Java Applets

    Yes, that's what i'm aiming for, a chat program when I complete basic and intermediate courses.StringBuffer[] msg = new StringBuffer[30]; for(int x = 0; x < msg.length; x++) msg[x] = new StringBuffer("");
  22. Sniffy

    JApplet Game

    Hello, I've been working on an applet that is supposed to be a "Catch the Clown" style game. When the user clicks on the button, a new random location is set and the score is incremented. Anyways, I can't get the setLocation() method to work for my JButton, any help?It might have something to do with the FlowLayout object because FlowLayout sorts Components in rows, but I don't know what other alternatives I can use. I just need to get to know JComponents and JApplets (methods) more so help would be appreciated. /** * @(#)appletGame.java * * * @author * @version 1.00 2007/3/3 */import java.awt.*;import java.awt.event.*;import javax.swing.*;public class appletGame extends JApplet implements ActionListener { Container con = getContentPane(); JButton press = new JButton("Press"); int score = 0; JLabel dispScore = new JLabel("Score:" + score); public void init() { con.add(dispScore); con.add(press); press.setLocation(10, 10); press.setLocation(100, 100); press.addActionListener(this); con.setLayout(new FlowLayout()); } public void actionPerformed(ActionEvent e) { int locationX = (int) Math.round(Math.random()*300); int locationY = (int) Math.round(Math.random()*300); score++; dispScore.setText("Score: " + score); press.setLocation(locationX, locationY); } }
  23. On the column where it shows all of the user entries, it would be great to say who it was submitted by.Test by Sniffy^^Something like that
  24. http://www.aspnetguy.com/portfolio.htmlI've noticed that when I press the "quote" slider button, the logo and navigation go slightly out of alignment.
×
×
  • Create New...