Jump to content
xisto Community

Rigaudon

Members
  • Content Count

    105
  • Joined

  • Last visited

Everything posted by Rigaudon

  1. Hi all,After searching relentlessly through the internet, I've finally decided that no completely free subdomain is problem-free. Therefore, I've decided to try my luck here, where the subdomains are "free", but not free ( )A little bit about myself:I'm a self-taught programmer in HTML, JavaScript, CSS, PHP, AJAX, MySQL, Java, and some other basic languages.I moved to this forum/subdomain-giver (whatever it is you call it here) because I have always experienced problems with other subdomains. I made a JavaScript and PHP based (AJAX, really) RPG from scratch, and I need a place to host it where the server-client-database interaction doesn't take forever.My pet peeves: People who can't spellPeople who don't use proper grammarPeople who make up their own wordsScript KiddiesLifeAnyways, I look forward to having an active community and fair relationship with the people here.
  2. Let's say, for example, that I used this and got 3 subdomains. Would I get 3 databases and 300Mb bandwidth, or is it constant regardless of the amount of subdomains?
  3. I'm not completely sure I understand what you're trying to do, but here's my interpretation: If there's a picture, load it, otherwise keep it the same if it's being written. Right?If that's the case, you'd need AJAX. Make your basic AJAX functions and set the intervals at 1 second each. In the PHP file, check to see if there is a file with file_exists() and that name.I'm not completely sure if file_exists() returns true when it's being rewritten, but my best guess is that it does. I can post the code if you need me to. Good luck!
  4. If you still need a good hit counter, you could always just add a table in your mySQL database or hold it in a text file and edit it with PHP. The advantage with this is that you can decide what counts as a hit and what doesn't (reloading pages for example). I can give you the code to do this if you need to.
  5. Here's some some more simple code that accomplishes the same thing: <input type="text" id="myID" /><input type="button" value="Go" onclick="document.location.href=document.getElementById('myID').value;" />
  6. At this point, there is no way for the Senate to reject Obama's universal health care bill. However, the topic of healthcare is not just whether sick people should be treated. Here's the way I see it:There are many reasons to reject the bill. Out of all the working classes, the middle class would suffer the most (yearly income of 42k-250k). The upper class's tax would not vary. The government also proposes that everyone who does not have healthcare must pay a fine. Let's look at this from a lower class point of view: You never originally had enough to pay for healthcare in the first place. The great government comes along stating that they will provide healthcare for everyone. You are still too poor to afford health and you get a bill from the government later. Presently, in the United States, if you are sick and make a doctor's appointment, it will usually take about a week to a month. Now, imagine that the majority of the people have healthcare with the same amount of doctors. The situation would be much like in Canada: you must wait about 8 months for an appointment. The wages of most, if not all, of the people working in the medical field's salaries would go down.There are also many reasons for accepting the bill, but I was wondering what everyone else thought about this delicate and complex topic.
  7. Rigaudon

    Why?

    I don't get it. If you have the ability to pick and choose from the Bible, then why pick and choose at all? Live by the morals, but not necessarily believing in the words in an old book that says that the Earth is less than 10,000 years old and where animals could talk, and where people could fly bodily up into heaven (even though they have all been disproved by carbon dating, paleontology, and space travel). Science is exact to the point that anything can be exact to. I won't go off on a tangent on all the fallacies of God, but the way I see it, religion is a failed hypothesis of an early scientific experiment. Imagine back in the 1500s, where the sun rose every day at the same time with no given explanation. The only answer was God, and if I had lived in that time, I would have believed it too. Yet, now, science has proved that the sun is a giant thermal nuclear reactor floating in space, not some chariot pulled along in the sky. Hypothesis, experiment, result. Why is it so hard to let go? I think this reverts back to the simple matter of fear of death.
  8. Hide your files completely!Hi guys, In this short text tutorial, I'm going to show you how to completely hide your "important" files from anyone else who uses your computer.1) Hiding files inside blank archives Easy and simple. Get a compressing type of program (7z or Winrar prefered) and compress the files. Set a password (ctr+P) and put that archive inside ANOTHER archive. Remove the file extension (the ending of the file like .rar or .7z) on the archive so that it becomes an ordinary file. If you cannot see the file extension, go to tools>folder options>View and uncheck "Hide file extensions for known types". To get your file, replace the file extension and enter the password. Simple. This is basically the first step to hiding your files in the most secure way possible.2) Hiding files inside pictures This is a very efficient way of hiding your files as long as they are small enough to not be very suspicious when you put them in a picture (imagine a picture that is 4gigs and only around 300x300 pixels!). First, go to My Computer and go to your C: drive. Right click and make a new folder(name this whatever you want). For the purpose of this activity, we will call it X. This will make things easier when you get started. Now, find a picture, any picture (bmp or jpg format prefered). Place it inside the folder you've just created along with any file you want (if you did step 1, place the file in the folder instead). We will call the picture a.jpg and the archive b or b.rar (depending on if you removed the file extension or if you used another type of compression). Now, open your Command Prompt. If you cannot locate this, go to start>run and type cmd. When you have it open, type cd\. Note that the slash is a backslash, the one above your enter key. It should say C:\>. Type cd X (or whatever you named your folder). It should say C:\X>. Now type:Copy b/ a.jpg + b.rar x.jpg Replace the files with whatever you named yours. You MUST include file extensions. The x.jpg will be the name of the new file. Again, you can name it whatever you want, but it is prefered that you keep the same file extension. The slash in b/ is a normal slash, not a backslash. If you have followed this correctly, your Command Prompt should say 1 File copied. If you look in your folder, you will see a new file that is the size of both your image file and your hidden file(s) combined. To extract the file, open winrar, winzip, 7zip, or whatever, go to browse, and select the image file. The hidden file should come up. 3) Invisible Folder This is probably the most popular and most useful out of all of the above. First, make a new folder anywhere. Right click on it, and select properties. Go under the Customize tab and click "Change Icon". If you are using Windows XP +, then you should see many icons appear. Click the rightbrowsing arrow once and you should see some gaps. Click on a gap and select Apply. Now, close the folder properties, right click on the folder, and select "Rename". Delete the current name, hold down Alt, and type (on your number pad) 0160, release alt, and press enter. If done correctly, no one can see the folder unless they know where it is, highlight it, or use the detailed view. Otherwise, your folder will be completely invisible. Store as many files in here as you want. 5) Readonly/hidden Extremely simple. Simply right click on the file, go to "properties", and check "hidden". If you can still see it, go to (in explorer) organize(vista) and find folder options.There should be 3 tabs: general, view, and search. Go under view and scroll down until you find "Show hidden files/folders". Uncheck to hide, recheck to see again.4) Mix it up! Now that you know the main ways to hide your files, mix it up a little! For example, I personally like to put my image file with my other hidden files inside an invisible folder, put that in an archive, set a password on the archive, remove the file extension, and put that inside anotherpicture. The possibilities are endless, and if you're really paranoid about protecting your files, then you can do this as many times as you want! (Ofcourse, it would take you a long time to find the actual file again). Enjoy your new hidden folder/files!
  9. Hi, In this tutorial I will cover the simple concept of making a global shoutbox in a website. This tutorial covers basics and some nice features. Let's go over the method we have in mind first, so you're not completely lost when doing this for yourself. We are going to use AJAX and MySQL. For those of you who don't know, AJAX (Asynchronous JavaScript and XML) is JavaScript + PHP or ASP. I will be using PHP. MySQL- databases. Yes, we are going to store all of these messages in a database. DATABASE Let's start with the database. You need to make a new table that holds all the shoutbox information. For mine, I will use four simple parameters (you can add more to yours if you feel like it's necessary): ID - Primary key. Integer of (default) 11 digits. You can make this smaller or larger if you want. Auto-increments. Poster - Who was the message posted by? I use a varchar of 20 characters. Time - The time of the post. This is going to be a timestamp. The default syntax is YYYY-MM-DD HH:MM:SS. You can parse this yourself later, if you want. Message - text. The message itself. So, the MySQL would look something like this: CREATE TABLE `shoutbox` (`id` INT NOT NULL AUTO_INCREMENT ,`poster` VARCHAR( 20 ) NOT NULL ,`message` TEXT NOT NULL ,`time` TIMESTAMP NOT NULL ,PRIMARY KEY ( `id` )) The HTML Let's put together a simple HTML form, assuming the user is already logged in and can post. <html><head><title>Shoutbox</title></head><body onload="updateShoutbox()"><div id="shoutbox"></div>Message:<input type="text" id="message" /><input type="button" onclick="postMsg()" /></body></html>Simple, you can add some styles or whatever to make it more interesting. Notice I call two JavaScript functions. We're going to make those presently. OK, easy part done. Now, let's talk about the method of actually making the shoutbox work. Since there is no way (as of yet) to get something to a browser as soon as it is written in, we need to check to see if there are any new posts every so often. This is quite ineffective, really (if you imagine going to the post office every hour to check your mail instead of the mailman bringing it to you, its kinda like that), but there's no other way to do it. You want an increment that is low enough so that users can actually have a chat, but not so much that it slows down and crashes the browser. This varies from domain to domain, we we'll worry about this later. CLIENT SIDE SCRIPT Now for the AJAX functions. You're going to need just 2, and that is to just check updates and post it. There are actually a few ways to do this, and you can pick which one would be more efficient for your needs. You can: a) Check to see if any NEW posts were made (involve much checking) and only post NEW posts. Post everything regardless up to a certain amount of posts. I'm going to do B, since it won't slow down the browser and I don't have to make code for checking time. NOTE: These functions should go in the head. OK, here's the basic function for getting the XMLHttp Object: <script type="text/javascript">function GetXmlHttpObject(){ if (window.XMLHttpRequest){ // code for IE7+, Firefox, Chrome, Opera, Safari return new XMLHttpRequest(); } if (window.ActiveXObject){// code for IE6, IE5 return new ActiveXObject("Microsoft.XMLHTTP"); } return null;}</script>Now, let's make the update shoutbox function. } </script> linenums:0'><script type="text/javascript">var xmlhttp1;function updateShoutbox(){xmlhttp1=GetXmlHttpObject(); if (xmlhttp1==null){ alert ("Browser does not support HTTP Request"); return; } var url="update.php"; xmlhttp1.onreadystatechange=function(){ if(xmlhttp1.readyState==4){ document.getElementById("shoutbox").innerHTML=xmlhttp1.responseText; } }; xmlhttp1.open("GET",url,true); xmlhttp1.send(null); var x = setTimeout(function(){ updateShoutbox(); },1000); //Checks for new posts every second. Remember, it's in milliseconds. Change as necessary.}</script> And finally, the script for posting. <script type="text/javascript">var xmlhttp2;var username = "Some guy"; //Replace this with username by using PHP.function postMsg(){xmlhttp2=GetXmlHttpObject(); if (xmlhttp2==null){ alert ("Browser does not support HTTP Request"); return; } var url="post.php?user="+username+"&msg="+document.getElementById("message").value; xmlhttp2.open("GET",url,true); xmlhttp2.send(null); }</script>Notice for the username I put in "Some guy". You're supposed to replace this with the username by using PHP, like: var username = "<?php echo $username; ?>"; And that's all the client side script we need. SERVER SIDE SCRIPT We need 2 different PHP scripts, post.php and update.php. Let's start with update. We need to get up to a certain amount of posts. Let's just say its 20. Your script should look something like: Note: I'm assuming you've already connected to your database. <?php//Connect to your database first.$query = "SELECT COUNT(*) FROM shoutbox";$q = mysql_query($query); //Get the total amount of posts. EVAR.$total = mysql_fetch_row($q);$total = $total[0];$posts_returned = 20; //alter as you see fit.//use a loop to get the posts.for($i=($total-$posts_returned);$i<=$total;$i++){$query = "SELECT * FROM shoutbox WHERE id=".$i; //Get the corresponding message.$q = mysql_query($query);$msg = mysql_fetch_array($q);//Format as you see fit.echo "<span style='color:gray;font-weight:bold'>";echo $msg['poster'];echo "</span>";echo $msg['message'];echo "(Posted at ".$msg['time'].")";echo "<br />";}?> You can add whatever you want to here, make it fancier, yeah yeah. Moving on to post.php, which is going to take 2 parameters: the user who posted it, and the message. $poster = $_GET['user']; $message = $_GET['msg']; $query = "INSERT INTO shoutbox (poster,message) VALUES ('".$poster."','".$message."')"; //We only need to deal with these two. The others will fill themselves in. //Important linenums:0'>//Again, assuming you've already connected to the database.$poster = $_GET['user'];$message = $_GET['msg'];$query = "INSERT INTO shoutbox (poster,message) VALUES ('".$poster."','".$message."')"; //We only need to deal with these two. The others will fill themselves in.//Important: remember the single quotes around poster and message. mysql_query($query); And that should be it. Note: this was written by me, but not tested. Please post any problems you may have, and enjoy!
  10. It doesn't matter which you use to validate form, because you can get a special character into an HTML element without actually typing it in (Javascript injecting), and therefore you'd need to validate the form in PHP anyways- especially if the user's JS is turned off. Save yourself the trouble and just validate it in PHP.
  11. Java is all object-oriented. I suggest you learn object-oriented programming with PHP first, if you haven't already, before moving on to Java. You might also want to learn a bit of JavaScript, since they have some of the same built-in classes, such as Math. In any case, Java is extremely difficult if you don't know OOP.
  12. It's rather impossible to create a genuine login without the use of PHP or MySQL. You could, in theory, use javascript, but it would be insanely insecure since the usernames/passwords could be read openly in the source code. Otherwise, you're out of luck. If you want to host a site that's not available to the public, you'd need apache. I personally don't see any reason why you'd need to, since you don't use PHP and therefore can be viewed on your personal computer with just a browser. Anyways, I just installed wampserver, which has PHP, MySQL, PHPmyadmin, and some other stuff. Link: http://www.wampserver.com/en/ Good luck on your school project.
  13. Hi, I believe this is what you're looking for: http://www.ajaxload.info/ Custom AJAX loading images. Simply put, have an HTML element that you can address with the DOM easily, such as: <div id="myDiv"></div> In this div or span or whatever element you've named it, put the image in assuming you've already uploaded it of course. <div id="myDiv"><img src="ajax-loader.gif" /></div> Or wherever your loader image is located. To make it disappear when the page has loaded is simple enough. Write some AJAX and have the responseText fill in the innerHTML of the selected element. xmlhttp.onreadystatechange=function(){ if(xmlhttp.readyState==4){ document.getElementById('myDiv').innerHTML=xmlhttp.responseText; } }; xmlhttp.open("GET",url,true); xmlhttp.send(null); } </script> linenums:0'><script type="text/javascript">function GetXmlHttpObject(){ if (window.XMLHttpRequest){ // code for IE7+, Firefox, Chrome, Opera, Safari return new XMLHttpRequest(); } if (window.ActiveXObject){// code for IE6, IE5 return new ActiveXObject("Microsoft.XMLHTTP"); } return null;}function ajaxFunction(){ var xmlhttp=GetXmlHttpObject(); if (xmlhttp==null){ alert ("Browser does not support HTTP Request"); return; } var url="url.php"; document.getElementById('myDiv').innerHTML="Loading... <img src='images/ajax-loader2.gif'>"; //You don't need to do this if you've already put in the image. xmlhttp.onreadystatechange=function(){ if(xmlhttp.readyState==4){ document.getElementById('myDiv').innerHTML=xmlhttp.responseText; } }; xmlhttp.open("GET",url,true); xmlhttp.send(null); }</script> Plain and simple.
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.