Jump to content

alpine

Members
  • Posts

    759
  • Joined

  • Last visited

Everything posted by alpine

  1. put single quotes around $album --> '$album' inside the query
  2. mismatch in number of cols compared to variables in query - missing "passwordv" $sql = mysql_query("insert into users (userid, name, last, email, state, country, accname, password, [red]passwordv[/red], code, news, agreed) values ('$userid', '$name', '$last', '$email', '$state', '$country', '$accname', '$password', '$passwordv', '$code', '$news', '$agreed')") or die(mysql_error()); But if userid is auto incr primary key, you should also remove this
  3. First of all, dont surpress with @ when testing.... replace --> $rs = @mysql_query( $sql, $conn ); with --> $rs = mysql_query( $sql, $conn ) or die(mysql_error()); and see what it says..
  4. AJAX is your solution. But any help on third party scripts is not offered in this forum section, visit http://www.phpfreaks.com/forums/index.php/board,34.0.html
  5. The principal could be like this example, include title-php stuff above the html title tag: [code] <?php switch($_GET['page']) {   case 'home':   $title = "Welcome";   break;     case 'about':   $title = "About us";   break;     // etc etc } ?> <!-- html starts --> <head> <title><?php echo $title; ?></title> </head> [/code] So for example "index.php?page=about" would generate the title "About us" in this case. If you query for example mysql for articles and want the article title as html title, run query instead of the switch example and declare article title as $title.
  6. use mysql_num_rows() [code] if (mysql_num_rows($result) == "0") { $_GET['msg'] = "Sorry We Found No Matches For Your Search"; } [/code]
  7. onchange responds only if the field value is changed and at the time you take the focus away from the field again, not while typing.
  8. Thanks ober Well - problem is fixed and all forms running ok, i just outputted the text-result div above form and it's no problems. Strange enough the images-div is no problem inside form elements. Just very annoying when the cause of a small problem won't identify itself properly... and thats why i feel javascript as a harder language to learn than php.
  9. here is a re-created minimalistic live version, works a charm with result div above form. Here result div is placed below the captcha field. it is onkeyup on the captcha: ### REMOVED: testpage eventually was removed from location ### [quote]Also, it's kind of a bad idea to create the object and handle the response all within the same function.  You can't reuse the object and you can't easily trap errors from the calling function as you have it.[/quote] i am aware of that, but it feels easier for me to make a complete working script first and then split when its working - javascript is not my darkest belt *lol* and in lack of better tools i use mozilla's debugger for firefox, but this time i have only the lame error messages from IE. What a joke! I wasn't aware of the quotes on elementbyid as i dont get any errors on it - but one learns!
  10. if you are going to access it on the script right after you do submit (form action target), it will be accessable by $var=$_POST['form_fieldname']; or if you are storing everything in a session it is $var=$_SESSION['session_name']; I dont know if this was what you wanted to know... ?
  11. sure, here it goes: [code] function fieldctr(url, feltid, feltid2) { var AJAXObj = false; var varsel = 'msg'; var verdi = document.getElementById(feltid).value; if(feltid2) { var verdi2 = document.getElementById(feltid2).value; } else { var verdi2 = '0'; } if (window.XMLHttpRequest) { try { AJAXObj = new XMLHttpRequest(); } catch (e) { AJAXObj = false; } } else if (window.ActiveXObject) { try { AJAXObj = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { AJAXObj = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { AJAXObj = false; } } } else { AJAXObj = false; } if (AJAXObj) { AJAXObj.open("get", encodeURI(url + ".php?val=" + verdi + "&val2=" + verdi2 + "&field=" + feltid + "&rand=" + (Math.random() * Date.parse(new Date()))), true); AJAXObj.onreadystatechange = function () { if (AJAXObj.readyState == 4) { document.getElementById(varsel).innerHTML = AJAXObj.responseText; if(document.getElementById('err_' + feltid)) { document.getElementById(feltid).style.border = '1px solid'; document.getElementById(feltid).style.borderColor = '#ff0000'; } else { document.getElementById(feltid).style.border = '1px solid'; document.getElementById(feltid).style.borderColor = '#c0c0c0'; } } else { document.getElementById(varsel).innerHTML = ''; } } AJAXObj.send(null); } else { document.getElementById(varsel).innerHTML = ''; } } [/code]
  12. Hi, If i put the responsetext id inside the form, IE and Opera wont display results, IE warns an unexpected runtime error on this. With Firefox everything works fine, and Mozilla's debugger shows no errors either. Problem: ---------------------------------------- <form> <div id="msg"></div> <input type="text" onchange="ajaxcheck('blah');"> <input type="submit"> </form> -------------------------------------------------- OK :---------------------------------------------- <div id="msg"></div> <form> <input type="text" onchange="ajaxcheck('blah');"> <input type="submit"> </form> --------------------------------------------------- Any solutions or explanations out there ?? Obviously i would in some cases prefer to echo the result within the form elements when i only use ajax to verify captcha image and nothing else.
  13. is it multiple emails (hijacking) that is the problem ?? this is a very simplified function to snap up hijacking, run [u]EVERY[/u] variable posted on this before mail() [code] <?php function SpamCheck($string) { $forbidden = "/(%0A|%0D|\\n+|\\r+)(content-type:|mime-version:|cc:|bcc:)/i"; if(preg_match($forbidden, $string)) { die("sorry"); } else {   return true; } } ?> [/code] I'm sure someone else may have some thoughts aswell, however this works for me as a security barrier - in addition i have spam-reporting sendt to myself when hijack-attempt is detected. If you do, just make sure you filter all variables before you deside to email yourself a notice, else the spam-notice to your self will actually end up sending spam-emails afterall... get my point?
  14. When i first started making my own website it was because i wanted to make an informatic website about cars and especially my favourite brand. Very few such sites existed on the web then, especially in my language, so i wanted to share the passion so to speak. So i started learning basic html, copying and pasting javascript codes - assembling a website demanding html editing for new articles etc. *lol* , some really "hairy" appearances as i think back. Step by step i eventually got my own domain name - started learning php (i was uncontrollable when my first php-switch worked and i got the magic advansed url in my browser), eventually mysql and now lately ajax. Now my website application is fully home-made and have become very popular amongst other car-enthustiast such as myself here in Norway. BUT - now it is scripting and developing web applications that is the fun part - NOT maintaining the content on my hobby site *lol* - doh.. that is boring, scripting is the fun part !! Anyone else experienced this ?? ...it must be..
  15. $password=$_POST['password']; $rpassword=$_POST['password']; You are also using the same post on both variables, it will always match.......... rename the second password-field to rpassword or whatever and post declare it
  16. alpine

    if help

    Well, your actually setting the comparasor test to if(0 == "something") - always returning true This works, setting to false instead [color=blue]if ($output == "nothing") { $output = false; } if ($output == "something") { echo"< br >Hello"; }[/color] But if your purpose with this is to check if formfields are submitted empty or not, use [color=blue]if(!empty($field)) { // not empty } else { // empty }[/color]
  17. From the manual: For SELECT, SHOW, DESCRIBE or EXPLAIN statements, mysql_query() returns a resource on success, or FALSE on error. http://no.php.net/mysql_query $total = mysql_result(mysql_query("SELECT COUNT(*) FROM pictures WHERE picture_albumid = 1"),0);
  18. To prevent post warning on back-button, use method get in the form instead. But ofcourse, the warning is present for a purpose as you know - to prevent repeating (re-submit) something without users attention. As to the expired notice, do you have an expires meta tag in the header ?
  19. look at substr() to split string http://no.php.net/manual/en/function.substr.php and explode() to get each line by exploding \n (or \r) http://no.php.net/manual/en/function.explode.php
  20. This would be a typical AJAX task, google it at youll find plenty: http://www.google.com/search?q=ajax+progress+upload
  21. AJAX is not too hard, requires some javascript and a backend query script. Move to this forum section -> http://www.phpfreaks.com/forums/index.php/board,51.0.html <- and ask the spesific question and i'm sure someone will show you an example and help you on the way.
  22. I've been able to make a "complete" set of headers that works good and goes straight to inbox on hotmail (and all others i have tried). But then again, testing my "setup" from other hosts - hotmail sometimes takes it to junk... so server setup probably sets some limitations. I found that to use Outlook Express as a tool, sending messages to myself and explore the headers by properties->source i could read the x-spam status to determine a great deal and correct and improve the message headers. For example sending through smtp is a major advantage along with a valid message id. This is a header generated from one of my sites (*** out some parts though: [code] Return-Path: <system@*******.no> Received: from lakepoint.********.no (lakepoint.********.no [194.**.***.**]) by mx01.*******.no (8.13.8/8.13.8) with ESMTP id k8KG2Ej9026742 for <admin@*******.no>; Wed, 20 Sep 2006 18:02:14 +0200 Received: from astoria.********.no (astoria.*********.no [194.**.***.**]) by lakepoint.********.no (8.13.8/8.13.8) with ESMTP id k8KG2EP2019986 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT) for <admin@******.no>; Wed, 20 Sep 2006 18:02:14 +0200 Received: from ******** by astoria.*******.no with local (Exim 4.50) id 1GQ4Wc-0004WY-0u for admin@********.no; Wed, 20 Sep 2006 18:02:14 +0200 To: admin@*********.no Subject: Henvendelse X-Message-Key: IA== From: RenaultBiler System <system@*******.no> Reply-To: RenaultBiler System <system@*******.no> X-Mailer: PHP v5.1.5 Date: Wed, 20 Sep 2006 18:02:14 +0200 Message-ID: <20060920180214R58N1BP8OZQS@www.********.no> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: multipart/related; boundary="212620dda9563902b5b1ffe2d4644dd0" X-Spam-Status: No, hits=-0.5 required=4.0 X-Spam-Report: -0.5 hits, 4.0 required; * -0.5 ALL_TRUSTED            Passed through trusted hosts only via SMTP X-Virus-Scanned: by moam (http://www.moam.net/) X-Moam-Version: 0.93 [/code] So, either my site sends newsmail to hundreds containing html or text emails to users, they all work great.
  23. change [color=red]$toAddress=$result;[/color] to [color=blue]$toAddress=$row['email'];[/color]
  24. easiest way: put an empty index.html in the directory
  25. i assume you are typing in a textfield and want it to query db once you have finished typing ? If so you should head over to the ajax forum with the attribute onchange=" " in your mind.
×
×
  • 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.