Jump to content

jhecht

Members
  • Posts

    608
  • Joined

  • Last visited

Posts posted by jhecht

  1. jesh pretty much nailed it on the head,if you need to you could set the cookie witht he unix timestamp of the time they visited and then use Js's DATE object to get the variables from there, but hey your choice.

  2. are you saying that you have a text box, and when you type something into it and hit submit the text is inputted into javascript and it then redirects to a seperate page depending on what you type, or does it redirect you to a part of the page you are already on?and if you want javascript to submit when a button is clicked:

    <input type="button" onclick="jsFunction(document.formname.fieldname.value)" value="Submit"/>

  3. use stripslashes() instead of addslashes...addslashes escapes characters that would normally not be printed out to the browser. So addslashing a slash, means that the slash originally there would be echoed instead of just the punctation mark.And opendir is nice, but kinda long. use glob();

    <?php$globText = "directoryName/*;foreach(glob($globText) as $value){echo $value."<br/>\n";}This will find every file under the directory "directoryName';?>

  4. in reply to the characters not being able to store more than 255 bytes in a database, you can just use text and alter the table to a FULLTEXT (means it just stores what you put in it pretty much, just in case you have some REALLLY LOOOOOONG posts)

  5. I dont have a problem about javascript(at the moment), im just writting down some functions i use as bases when i use an AJAX program so that others can use it as well and aren't so lost when all of us on here talk about AJAX coding and so on

    Javascript file<script type="text/javascript"><!--function createRequestObject() {	var ro;	var browser = navigator.appName;	if(browser == "Microsoft Internet Explorer"){		ro = new ActiveXObject("Microsoft.XMLHTTP");	}else{		ro = new XMLHttpRequest();	}	return ro;}var updateId = createRequestObject();function ajax(argument) {   updateId.open('GET', "show.php?argument="+argument);   updateId.onreadystatechange = handleConts;   updateId.send('');}function handleConts() {	if(updateId.readyState == 4){	 	 document.getElementById("div_id").innerHTML=updateid.responseText;	 	}}//--></script>

    show.php<?phpif(isset($_GET['argument'])){//Same name as the thing after the ? in the javascript, right? $arg = (int)$_GET['argument']; $sql = "SELECT * FROM table WHERE user_id=$arg"; $ans= mysql_query($sql) or die(mysql_error()); while($res = mysql_fetch_array($ans)){ echo " Welcome ."$res['user_name']." ! <br/>\n"; } }else{echo "Argument Variable not set.<br/>\n";}?>This echoes out a username from a database given by a user_id passed through the argument variable in show.php. Added by request.

    By changing the script around a little bit you can suit this to do anything you need pretty much.

  6. use quotes around this:

    //var seedDay = new Date(2006,8,23);//This should bevar seedDay = new Date("08/23/2006 00:00:00");

    Also you could juse compare the UNIX timestamp from the seeded day and the current day, and then just divide by 100 multiplied by 60*60*24(60 seconds multiplied by 60 minutes in one hour multiplied by 24 hours in one day), which would give you how many days until the next day, or FROM the next day(you may have to doa check if the returned value is negative and accomadate the text for that)If you want i can show you a real quick script for it.

  7. Dude do me a favor and put your CSS into one file... i had to spend a few minutes reading through all of your CSS on the page...your Javascript is very complex. at least for a simple AJAX request...Also i think this can be simplifiedif(test!=(-1)) {s = inHl.replace(/\[hide\]/g,"\<div class='hid'\>");s = s.replace(/\[.hide\]/g,"\<\/div\>");}if(test!==-1){s = inHl.replace(/\[hide\].\[\/hide\]/,"<div class=\"hid\">\\1</div>")//Mind you i dont know how javascript does its call back for matching }But yeah... im not sure your Javascript seems overly complex for something so simple...

  8. Uhm... What exactly would be the point in all fo this because i am so not seeing anything that you would need to do in this...htmlentities, htmlspecialchars, those may be the ones you want to look up on php.net...Other than that, i have no idea what ur talking about.

  9. Cookies in PHP cannot be defined the first run through because they have to be parsed header information. basically if you have a cookie being set in a page, and in the same page the cookie to be displayed, you need to refresh it and then it should work.

    <?phpsetcookie("cookieName","My name is Bob the hobo",time()+(60*60));//60 seconds multiplied by 60 minutes?>

    this is the basic syntax to set up a cookie. What you need to do from here is do a header("location:otherpage.php") and then have it print out cookies there. And its also quite possible that the variable $user is being defined somewhere else....

  10. <input type="file" name="fileB"/><br/><input type="submit" name="submit" value="upload"/>look up move_uploaded_file on php.net

  11. You should NOT use vbscript. Its pointless and a basic rip off of javascript

    <script type="text/javascript" language="javascript">//Scripting code goes here for javascript</script><script type="text/vbscript" language="vbscript">VBcode goes here.</script>

×
×
  • Create New...