Jump to content

spamoom

Members
  • Posts

    56
  • Joined

  • Last visited

    Never

Everything posted by spamoom

  1. EDIT: I can verify that the script refreshes for some reason. The problem I had was passing the var I needed on. I had to set a global var on my page in order to pass it the script.
  2. I know this has already been asked multiple times and I am sorry to post it again, but I feel that I can learn more if it is code that I've been working with. Well, here it goes. I have been making a little shout box script for my website, using Ajax to show the last 5 messages and to post messages via a text box all without loading the page. Seems simple enough. In my main page I have the following, <div id="shoutBox"><a href="javascript: viewShout(<?php echo $corpID; ?>)">Click To Start Chat</a></div> <input type="text" id="chatText" /> <input type="submit" Value="Send" onclick="postShout(document.getElementById('chatText').value);" /> When I click on 'Click to start chat' It does as I would have wanted to and displays the last 5 results, but no refreshing happening. Here is the javascript function createRequestObject() { var req; if(window.XMLHttpRequest){ // Firefox, Safari, Opera... req = new XMLHttpRequest(); } else if(window.ActiveXObject) { // Internet Explorer 5+ req = new ActiveXObject("Microsoft.XMLHTTP"); } else { // There is an error creating the object, // just as an old browser is being used. alert('There was a problem creating the XMLHttpRequest object'); } return req; } // Make the XMLHttpRequest object var http = createRequestObject(); function sendShoutRequest(act) { // Open PHP script for requests http.open('get', 'ajax.php?shoutCheck='+act); http.onreadystatechange = handleShoutResponse; http.send(null); } function handleShoutResponse(act) { if(http.readyState == 4 && http.status == 200){ // Text returned FROM PHP script var response = http.responseText; if(response) { // UPDATE ajaxTest content document.getElementById("shoutBox").innerHTML = response; setTimeout(viewShout,2000); } } } function viewShout(act) { sendShoutRequest(act); } Some of you may notice that I learnt this from the tutorial on this site =D. Anyway, as I said it doesn't refresh, now even stranger. I woke up this morning and clicking on the link shows the results, then disappears after my time out time. Ie if I set my timeout to 1000, my content disappears after 1 second.
  3. I hate fixing my own problems I had too enable the apache module ^^
  4. I installed wamp and it works just as I want it too. However I recently wanted to use mod_rewrite on it. I was told to put this here(comments taken out to make smaller) <Directory "C:/Users/SpaM!/Desktop/localhost"> Options ExecCGI FollowSymLinks Includes MultiViews AllowOverride all Order Allow,Deny Allow from all </Directory> I restart apache and it seems to be ok =/. I went on and made a .htaccess in my website root dir next to index.php. That also allows the page to load, but as soon as I enter anything into that file and save it I get Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, webmaster@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Weather it is RewriteEngine On RewriteRule ^tutorials/(.*)/(.*).php /tutorials.php?req=tutorial&tut_id=$1&page=$2 RewriteEngine On or even a If i take a look @ the apache log file I can find this everytime [Tue Sep 04 12:05:17 2007] [alert] [client 127.0.0.1] C:/Users/SpaM!/Desktop/localhost/rewritetest/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration I really don't know whats wrong here and would appreciate any help. Thanks
  5. Thanks for the replys guys I recieved this nice error after removing the @'s Fatal error: Call to a member function query() on a non-object in C:\Users\SpaM!\Desktop\localhost\therevisionshop\app\framework\functions.php on line 44 So in otherwords... I forgot this global $db; stupid me
  6. The mysql works fine, I have a login & logout script working. It is just that the script never reaches the insert statment. I have even tried putting echo "AKDSOAWKDPAWKPDKAWJDAWJODJPWJPJ"; and it does not show at all anywhere in the script expect at the beginning =/
  7. I have this function, it shows when i have errors but for some reason is never able to reach the insert query.. here is the code. I suspect it is a typo, please could you have a look for me as I have been searching for over an hour and cant find anything <?php function register($username, $password, $password_conf, $email, $email_conf) { if (eregi('^[[:alnum:]\.\'\-]{4,30}$', stripslashes(trim($username))) ) { $query = "SELECT member_username FROM member WHERE member_username = '$username'"; $result = @$db->query($query); $num = @$db->count($result); if ($num> 0) { $errors[] = '<font color="red">The username you have chosen has already been taken, please try again.</font>'; } } else { $errors[] = '<font color="red">Please provide a valid username between 4 and 30 characters.</font>'; } if (!empty($email)) { if ($email != $email_conf) { $errors[] = '<font color="red">The email addresses you have entered do not match.</font>'; } if (!eregi('^[a-zA-Z]+[a-zA-Z0-9_-]*@([a-zA-Z0-9]+){1}(\.[a-zA-Z0-9]+){1,2}', stripslashes(trim($email)) )) { $errors[] = '<font color="red">Please provide a valid email address.</font>'; } } else { $errors[] = '<font color="red">Please provide an email.</font>'; } if (!empty($password)) { if ($password != $password_conf) { $errors[] = '<font color="red">The passwords you have entered do not match.</font>'; } else { $password = md5($password); } } else { $errors[] = '<font color="red">Please provide a password.</font>'; } if (!isset($errors)) { $query = "INSERT INTO member (member_username, member_email, member_password, member_joindate) VALUES ('$username', '$email', '$password', '".date('d-m-Y')."')"; echo $query; $result = @mysql_query($query); if (mysql_affected_rows() == 1) { // Send the E-Mail $body = "Thank You for registering on The Revision Shop:\n\n"; $body .= "http://".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']."?p=activate&a=" . mysql_insert_id() . "&b=$password"; mail($email, 'Registration Confirmation On The Revision Shop', $body, 'From: noreply@therevisionshop.co.uk'); // Show thank you message return 'Sucessfully Registered, Please check your mail box for the activation email'; } else { return '<font color="red">You could not be registered, please contact sam@samjordan.co.uk for help.</font>'; } } else { $err = '<h3>Error!</h3> The following error(s) occured:<br />'; foreach ($errors as $msg) { $err .= " - <font color='red'>$msg</font><br />\n"; } return $err; } } ?>
  8. Ok, I did what you said, (i think :-\) I have this.. for some reason it seems to be reloading the page when I submit the form.(it still doesnt work ) And yeah I know thats for firefox only, but thats all I am using to test it <html> <head> <title>Ajax Test</title> <script> http = new XMLHttpRequest(); function updateData(param) { var myurl = "cap.php"; http.open("GET", myurl + "?n=" + escape(param), true); http.onreadystatechange = useHttpResponse; http.send(null); } function useHttpResponse() { if (http.readyState == 4) { var textout = http.responseText; document.write(textout); } } </script> </head> <body bgcolor="#FFFFFF"> <form name="question"> <input type="text" name="stuff"> <input type="submit" OnClick="OnClick="updateData(this.form.stuff.value); return false;"" value="Captilase"> </form> </body> </html> Thankies
  9. I have never ventured into ajax or javascript really and thought I'd give it a go.. After 20minutes of messing around, i counjured up a small script but not to my suprise... it doesn't work. Please could someone point out the mistake that I have made in my code and explain why it needs to be that. index.html <html> <head> <title>Ajax Test</title> <script> http = new XMLHttpRequest(); function updateData(param) { var myurl = cap.php; http.open("GET", myurl + "?n=" + escape(param), true); http.onreadystatechange = useHttpResponse; http.send(null); } function useHttpResponse() { if (http.readyState == 4) { var textout = http.responseText; document.write.textout; } } </script> </head> <body bgcolor="#FFFFFF"> <form name="question"> <input type="text" name="text"> <input type="submit" OnClick="javascript: updateData(document.question.text.value)" value="Captilase"> </form> <br /><br /> --><script>useHttpResponse()</script><-- </body> </html> and cap.php... <?php echo ucfirst($_GET['n']); ?> Thanks in advance!!
  10. i use background-image: url("logo.gif");
  11. I have all of these problems with ie aswell If you are using divs check the measurements, cause if you 1 pixel out ie screams and adds random spaces everywhere!
  12. Yeah sorry, I just am trying to figure out the concept of relative and absolute and why they differ from firefox to ie. for example.... <html> <!-- header stuff !--> <body> <div id="wrapper"> <div id="logo"><img src="template/{THEME_NAME}/images/logo.gif" /><br /></div> <table class="menu" width="415" cellspacing="0" cellpadding="0" border="0"> <tr height="40"> <td width="11"><img src="template/{THEME_NAME}/images/yellow_big_left.gif" /></td> <td colspan="9" class="big_yellow"> Welcome back Rich! </td> <td width="11"><img src="template/{THEME_NAME}/images/yellow_big_right.gif" /></td> </tr> <tr height="33"> <td width="11"><img src="template/{THEME_NAME}/images/white_left.gif" /></td> <td class="white" width="45">Home</td> <td class="white" width="3"><img src="template/{THEME_NAME}/images/white_seperator.gif" /></td> <td class="white" width="98"> Browse Store</td> <td class="white" width="3"><img src="template/{THEME_NAME}/images/white_seperator.gif" /></td> <td class="white" width="95"> Start Trading</td> <td class="white" width="3"><img src="template/{THEME_NAME}/images/white_seperator.gif" /></td> <td class="white" width="65"> Account</td> <td class="white" width="3"><img src="template/{THEME_NAME}/images/white_seperator.gif" /></td> <td class="white" width="78"> Assistance</td> <td width="11"><img src="template/{THEME_NAME}/images/white_right.gif" /></td> </tr> </table> <!-- the above works fine! !--> <table class="floatmiddle" width="95%" border="0" cellspacing="3" cellpadding="5"> <tr> <td width="197" valign="top"> <div class="smalllefttop"> <div class="smalllefttexttitle"> Search The Revision Shop </div> </div> <div class="smallleftbg"> <div class="smalllefttext"> <input type="text" > </div> </div> <div class="smallleftbottom"></div> </td> <td rowspan="2" valign="top"> <table border="0" width="580" cellpadding="0" cellspacing="0"> <tr height="32"> <td width="11"><img src="template/{THEME_NAME}/images/yellow_left.gif" /></td> <td width="100%" class="yellow"></td> <td width="11"><img src="template/{THEME_NAME}/images/yellow_right.gif" /></td> </tr> <tr> <td colspan="3"><img src="template/{THEME_NAME}/images/testad.gif" /></td> </tr> </table> </td> </tr> <tr> <td valign="top"> <div class="smalllefttop"> <div class="smalllefttexttitle"> Catagories </div> </div> <div class="smallleftbg"> <div class="smalllefttext"> <ul> <li>lol <li>test <li>books <li>videos </ul> </div> </div> <div class="smallleftbottom"></div> </td> </td> </tr> </table> </div> </body> </html> this is some of the stylesheet .floatmiddle { top: 50px; left: 20px; } #wrapper { width: 800px; height: auto; } #logo { padding-left: 20px; border: 0px; } In this code there are dramatic differences seen in this screenie...
  13. I am using simple javascript to make a div appear when i hover.... The problem is that the thing that it is hovering over a floating div already so if I use Relative it will float to the right but move the origional menu, wheras if I use absolute float: right does not work! please help... I'm not sure if this makes sense, send a reply if it doesn't. Thanks in advance! ps here is my css code at the moment .menu { float: right; position: relative; top: -50px; z-index: 1; } #menupopup { background-color: #333333; width: 415px; height: 100px; position: static; float: right; clear: both; z-index: 50; }
  14. Thanks Very much guys Managed to solve it with $filepath = dirname($_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']);
  15. I have a file called index.php (localhost/blabla/index.php), and my mind has just gone blank and I cant remember how to get the file path without the file info... for example I need to get localhost/blabla/ I am sure it is using $_SERVER but which argument =/ Thanks SpaM
  16. Well, i still haven't got the IE include working, but somehow I fixed it =/
  17. Ok, I've made an ie only sheet, but it does not seem to be including it in internet explorer. I know this for a fact as I have put vibrant colors and no change. Here is a snippet <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="Description" content="<? echo $neaura->getvar("meta_description"); ?>" /> <meta name="Keywords" content="<? echo $neaura->getvar("meta_tags"); ?>" /> <!--[if lt ie 7]><link rel="stylesheet" type="text/css" media="screen,projection" href="themes/<? echo THEME; ?>/ie-only.css" /><![endif]--> <title><? echo $neaura->getvar("site_name")." - Powered By Neaura"; ?></title> Am I doing something wrong? Thanks in advance
  18. Looks fine in Firefox and Opera, deforms in IE Here is the link I am talking about http://vaguely-imaginary.co.uk/ Can anyone see anything wrong with my source code please?
  19. Thanks very much. Had no idea that was needed .
  20. Please could you tell me how I could get it to send html emails? as Don't really help
  21. I have made a simple newsletter for one of my customers, and have recently found out that it does not allow html. I am sure it should... here is the code <?php } else { $title = $_POST['title']; $message = $_POST['message']; $query = $db->query("SELECT * FROM newsletter"); $fetch = $db->fetch($query); while ($fetch) { mail ($fetch['email'], $title, $message, 'From: webmaster@example.com'); echo "Sent to ".$fetch['email']."\n"; $fetch = $db->fetch($query); } } ?> Any Ideas?
  22. I've installed php 5 and it works fine... I then downloaded mysql 5 and the obdc driver, installed them and added the data sources which connects as it should. Problem is that mysql is not appearing in the php_info() but obdc is. It is enabled in the php.ini file. Any Ideas??
×
×
  • 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.