Jump to content

siabanie

Members
  • Posts

    76
  • Joined

  • Last visited

    Never

Everything posted by siabanie

  1. Thanks Adam, it is quite difficult to imagine without an example...but thanks. One question though; do you know how AJAX works in term of check validation (CAPTCHA)?
  2. Thanks all, I sort of figured this out - I am not 100% sure but by change the permission to 777 does the job "for now" - but it is still not 100% output all the recent data when say someone add a new record or delete the exist record. Will have to find out another way I guess. But thanks! ^^
  3. Hi ZulfadlyAshBurn, I am using JavaScript to validate the form e;g: $(document).ready(function(){ $('#btn_submit').click(function() { var error_num = 0; var error_mesg = ""; //alert("in"); $('[name=name]').parent().removeClass('error'); if($('[name=name]').val()==""){ error_num++; error_mesg += "Please Enter Your Name。\n"; $('[name=name]').parent().addClass('error'); } $('[name=captcha_code]').parent().removeClass('error'); if($('[name=captcha_code]').val()==""){ error_num++; error_mesg += "Please enter the image verification\n"; $('[name=captcha_code]').parent().addClass('error'); } if(error_num>0){ alert(error_mesg); }else if(error_num==0){ $('#present_form').submit(); } return false; }); }); </script> But the problem is; whenever I press "back" button all the values that I have just filled in gone then I have to fill it again which is annoying -- Plus How I can validate the securimage CAPTCHA (http://www.phpcaptcha.org/) using AJAX? I cannot seem able to show the error message on the same page but able to do it for the next page (If user clicked submit form and entered a wrong code)
  4. Hi Adam, Thanks for your feedback, I have tried as you suggested as: .. .. <tr> <td width="20%">Name</td> <td width="80%"><input name="name" value="<?php if (isset($_POST['name'])) echo htmlspecialchars($_POST['name']); ?>" type="text" id="name" size="30" /></td> </tr> <tr> .. .. I filled the form etc then submit it, when I press back button or click the back link (I use Javascript script to go back e.g: Please go <a href='javascript:history.go(-1)'>back</a> and try again) - The field name is empty? Am I missing something here? -- And yes I have put the session_start(); at the top of every page. Any idea what I did wrong?
  5. Hi all, I would like to know how we can retrieve all the values / data that we filled in the form so when we press the button "back" it is not disappear? I have three pages which are, checkForm.php, processForm.php and thankyouForm.php Where I should put the SESSION code? Here is the snippets of my checkForm.php: .. .. <table width="100%" border="0" cellspacing="5" cellpadding="0"> <tr> <td width="20%">Name</td> <td width="80%"><input name="name" type="text" id="name" size="30" /></td> </tr> <tr> <td>Tel</td> <td><input name="tel" type="text" id="tel" size="30" /></td> </tr> <tr> <td>E-mail</td> <td><input name="email" type="text" id="email" size="30" /></td> </tr> </table> .... Thanks.
  6. The problem is; my sitemap.html still not showing the values I have in convertsitemap.php. I wonder if you saying that: I have to save this code in PHP or HTML extension? as the sitemap is in HTML not PHP - all my PHP works done in conversitemap.php. $fh=fopen('sitemap.html', 'w'); fwrite($fh, $html2write); fclose($fh); If you said it might be the permission issue: How I can solve this? Basically my sitemap.html is just a HTML code no PHP code in it.. I do not think I should have those code you suggested put in my sitemap.html do you, what you think?
  7. So you are saying..I have to put this code: $fh=fopen('sitemap.html', 'w'); fwrite($fh, $html2write); fclose($fh); in sitemap.html? As you notice and look carefully -- I already have those code line adminSitemap.php Thanks.
  8. echo $html2write;??? I mean in e.g. sitemap.html --- How I can "extract or output" all the code in convertsitemap.php to my "html"? I cannot just write echo $html2write; and then save it in sitemap.html - That is a "PHP" code. Plus I do not need PHP code in my "html" any more as all I need is the output of the PHP code -- I already have my PHP code in convertsitemap.php so I need to know how to output them in HTML.
  9. Ok sorry for the lack of explanation; I try again. Basically all I want is -- "PHP code output to HTML" - I want to convert the output of PHP code (conversitemap.PHP) to sitemap.HTML. Here are the snippets of my code: adminSitemap.php <?php function sitemapFunk() { global $host, $sqlUser, $sqlPass, $database; mysql_connect ($host, $sqlUser, $sqlPass) or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ($database); $result = mysql_query("select * from cer_galleryInfo where display!='No' order by second, first ") or die (mysql_error()); .. .. .. $sitemapHTML .= "<li><a href='artistInfo/entry_".$row['keynum'].".html'>".ucfirst($row['first'])." ".ucfirst($row['second'])."</a></li>\n" ; } $html2write .= "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"; $html2write .= "<html>\n"; $html2write .= "<head>\n"; .. .. .. $html2write .= " <h2>Exhibitor Gallery</h2>\n"; $html2write .= " <UL TYPE=\"circle\">\n"; $html2write .= "$sitemapHTML"; $html2write .= " </UL>\n"; .. .. $html2write .= "</html>\n"; $write = fopen("../sitemap.html","w"); fwrite($write,$html2write); } } ?> How can I just displaying the output that I have created in PHP in my HTML site (sitemap.html)?
  10. Hi all, I wonder if anyone could help me out; I have this page say sitemap.html and I like to covert my covertsitemap.php code output to HTML (sitemap.html) Can anyone assist me please how this can be done? Thanks alot!
  11. Hello, does anyone can help me how I can validate CAPTCHA using AJAX? I have a form that check all the field error msges using jQuery but I don't know how I can do this using AJAX. <?php session_start(); require("include/application_top.php"); include_once $_SERVER['DOCUMENT_ROOT'] . '/securimage/securimage.php'; $securimage = new Securimage(); if ($securimage->check($_POST['captcha_code']) == false) { echo "The security code entered was incorrect.<br /><br />"; //exit; //} ?> This snippets will displayed if field is empty $('[name=captcha_code]').parent().removeClass('error'); if($('[name=captcha_code]').val()==""){ error_num++; error_mesg += "Please enter the image verification\n"; $('[name=captcha_code]').parent().addClass('error'); } This snippets (not working) will displayed if code entered is not match the code...but I think I need to add AJAX script somewhere which I need help. $('[name=captcha_code]').parent().removeClass('error'); if ($securimage->check($_POST['captcha_code']) == false){ error_num++; error_mesg += " The security code entered was incorrect \n"; $('[name=captcha_code]').parent().addClass('error'); } Anyone?
  12. You mean this code: if ($securimage->check($_POST['captcha_code']) == false) { echo "The security code entered was incorrect.<br /><br />"; exit; } should be inside HTML form?
  13. If I did not commented out the "exit" the page will display "The security code entered was incorrect" before I fill in the form.
  14. Hi all, I wonder if anyone could help me out; I have a PHP form that need to put a secure image to prevent spam. I have use this code provided in this page http://www.phpcaptcha.org/ - It works fine but the problem was when user entered an incorrect code it form still proceed which it not right. My form involved some PHP and Javascript to handle the error messages - I wonder if I need AJAX script for this as well? I use this Javascript to validate if the form has been enter blank or not: .. .. $('[name=captcha_code]').parent().removeClass('error'); if($('[name=captcha_code]').val()==""){ error_num++; error_mesg += "Please enter the image verification\n"; $('[name=captcha_code]').parent().addClass('error'); } .. .. And I need to put this code for matching code to verify if the code incorrect or correct. If incorrect a error message will display together. if ($securimage->check($_POST['captcha_code']) == false) { // the code was incorrect // you should handle the error so that the form processor doesn't continue // or you can use the following code if there is no validation or you do not know how echo "The security code entered was incorrect.<br /><br />"; //echo "Please go <a href='javascript:history.go(-1)'>back</a> and try again."; //exit; } Can someone please assist me about this. Thanks in advance.
  15. Thanks fugix, But could you explain more how this counter work? Do I not need to create a program from scratch or what would be the best way? Cheers...
  16. Hi all, I would like to know if anyone know how to create a affiliate Banner tracking program? The program should be able to track at least how many people go to the website (Client's website) through 'my' banner on my websites, plus a form page to count an actual ticket sale? Can anyone tell me or know any open source for this kind of program? Thanks.
  17. Hi guys, Can anyone help me about please. I tried to google free open source for "Banner Affiliate Code Tracking" to put on my website but I can't find any. Can anyone suggest or tell me how I can do this? Cheers, siabanie
  18. Here are some the codes: The folder includes contains: application_top.php, connection.php, global.php, cookie.php, autologin.php application_top.php require 'connection.php'; require 'global.php'; require 'cookie.php'; cookie.php $cookie_name = 'siteAuth'; $cookie_expire = (3600 * 24 * 30); // 30 days connection.php session_start(); //All the connection to DB global.php if (!isset($_SESSION['authuser'])){ header ("location: login.php"); exit(); } login.php require 'includes/connection.php'; require 'includes/autologin.php'; require 'includes/cookie.php'; $error_msg = ""; if (!empty($_POST)) { //If variable `username` and `password` are set do the following if(!empty($_POST['username']) && (!empty($_POST['password']))){ $_POST['password'] = md5($_POST['password']); $query = "SELECT `username`, `admin` FROM `user` WHERE `username` = '".$_POST['username']."' AND `password` = '".$_POST ['password']."'"; // Send a MySQL query $result = mysql_query($query); //Get number of rows in result $num_rows = mysql_num_rows($result); if ($num_rows == 1) { //Any record? $row = mysql_fetch_array($result); //session_start(); $_SESSION['username'] = $_POST['username']; $_SESSION['authuser'] =0; if ( isset($_POST['rememberme']) && $_POST['rememberme'] == "on" ) { setcookie ($cookie_name, 'usr=' . $_POST['username'] . '&hash='.$_POST['password'], time() + $cookie_expire); } if ( $row['admin'] == 1 ) { $_SESSION['authuser'] =1; } header ("Location: indexlist.php"); exit(); } else { $error_msg = "Invalid username/password combination!"; } } else { $error_msg = "Please enter your username and password to view this page!"; } } ?> [html FORM CODE] autologin.php <?php if(isset($cookie_name)) { // Check if the cookie exists if(isset($_COOKIE[$cookie_name])) { parse_str($_COOKIE[$cookie_name]); $query = "SELECT `username`, `admin` FROM `usar` WHERE `username` = '". $usr ."' AND `password` = '". $hash . "'"; // Send a MySQL query $result = mysql_query($query); //Get number of rows in result $num_rows = mysql_num_rows($result); if ($num_rows == 1) { $row = mysql_fetch_array($result); $_SESSION['authuser'] =0; // Register the session $_SESSION['username'] = $row['username']; //$_SESSION['username'] = $_POST['username']; if ( $row['admin'] == 1 ) { $_SESSION['authuser'] =1; } header ("Location: indexlist.php"); exit; } } echo "cookie is not set"; } ?> logout.php <?php session_start(); session_destroy(); $cookie_name = 'siteAuth'; $cookie_expire = (3600 * 24 * 30); // 30 days if(isset($_COOKIE[$cookie_name])) { setcookie ($cookie_name, '', time() - $cookie_expire); } header("Location: login.php"); exit(); ?>
  19. Hi all, I wonder if any of you have this problem before.. I have a login page with "checked box remember me" - It is working fine in my localhost machine I can see the COOKIE in my browser's option setting (Firefox). But now the problem is: When I run the script in my test server; and do exactly the same thing..the COOKIE did not seem know. When I logged in as an admin and checked the box. And closed all the browser. Then, open the browser (Firefox)and go to the index page (landing page) then it redirect me to the login page instead. I looked the at COOKIE setting in my Firefox and I can it is stored there. Any ideas whats wrong?
  20. Thanks for the reply; here is the codes. Thanks.. login.php <?php session_start(); require 'includes/connection.php'; require 'includes/autologin.php'; $error_msg = ""; if (!empty($_POST)) { if(!empty($_POST['username']) && (!empty($_POST['password']))){ $_POST['password'] = md5($_POST['password']); $query = "SELECT `username`, `admin` FROM `users` WHERE `username` = '".$_POST['username']."' AND `password` = '". $_POST['password']."'"; $result = mysql_query($query); $num_rows = mysql_num_rows($result); if ($num_rows == 1) { $row = mysql_fetch_array($result); session_start(); $_SESSION['username'] = $_POST['username']; $_SESSION['authuser'] =0; if ( isset($_POST['rememberme']) && $_POST['rememberme'] == "on" ) { setcookie ($cookie_name, 'usr=' . $_POST['username'] . '&hash='.$_POST['password'], time() + $cookie_time); } if ( $row['admin'] == 1 ) { $_SESSION['authuser'] =1; } header ("Location: indexlist.php"); exit(); } else { $error_msg = "Invalid username/password combination!"; } } else { $error_msg = "Please enter your username and password to view this page!"; } } ?> <!--HTML CODE WHERE THE FORM ARE--> autologin.php <?php if(isset($cookie_name)) { // Check if the cookie exists if(isset($_COOKIE[$cookie_name])) { parse_str($_COOKIE[$cookie_name]); // The code here should look familiar. $query = "SELECT `username`, `admin` FROM `users` WHERE `username` = '". $usr ."' AND `password` = '". $hash . "'"; // Send a MySQL query $result = mysql_query($query); //Get number of rows in result $num_rows = mysql_num_rows($result); if ($num_rows == 1) { $row = mysql_fetch_array($result); $_SESSION['authuser'] =0; // Register the session $_SESSION['username'] = $row['username']; if ( $row['admin'] == 1 ) { $_SESSION['authuser'] =1; } header ("Location: indexlist.php"); exit; } } } ?> logout.php <?php session_start(); session_destroy(); $cookie_name = 'siteAuth'; $cookie_time = (3600 * 24 * 30); // 30 days if(isset($_COOKIE[$cookie_name])) { // remove 'siteAuth' cookie setcookie ($cookie_name, '', time() - $cookie_time); } header("Location: login.php"); ?>
  21. Hi guys, I wonder if any if you could help me: I have created a login page with "remember me" function... The page will redirect either to Admin Page or User Page depends their 'level'. But when I logged in as Admin and checked the box "remember me" and close all the browser to see IF the "remember me" work. When I open a new browser - and go to the index page - it is okay, I can view the page.... but it redirect me to the USER page NOT Admin page. Does anyone know why this happens?
  22. Hi MrXHellboy, I am not sure if I got your instruction correctly.. But I have created a new user on the argosoft mail server providing all the info e.g User Name:test Real Name:test Password:test123 Forward Address:test@localhost Return Address:test@localhost And on the outlook I just created: Incoming mail server:localhost Outgoing mail server:localhost But it is still not working...I think I did not get it correct. Any idea?
  23. I have Microsoft outlook but I didnt use them. I am using Window live mail.
  24. I have installed the ArGoSoft Mail Server. And create a new user. I don't really know how it works but I fill in all the information e.g but not sure what I did is correct? Forward Address: test@localhost Return Address: another@localhost Do I have to changed in php.ini or where?
×
×
  • 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.