Jump to content


  • Content Count

  • Joined

  • Last visited

Posts posted by houssam_ballout

  1. Hello,i had the following scenario in which I need your help: I had a drop down box: <option value="client-all.php">1</option><option value="supplier-all.php">2</option><option value="koshofat.php">3</option> <input type="button" onClick="location=document.koshofat.URL.options[document.koshofat.URL.selectedIndex].value;" value="go" class="button2"> its good for 1, 2 , but I need to show 2 textboxes when the user select 3 and hide them when user select different than 3 (After that when he click submit, I will get the values through POST variables), I need your help in scripting my issue? Thanks in advance

  2. Here it is, problem now, is that when I write 4-5 or 4-5- I need to autocomple the year with the current year: var dtCh= "-";var minYear=1900;var maxYear=2100;function isInteger(s){ var i; for (i = 0; i < s.length; i++){ // Check that current character is number. var c = s.charAt(i); if (((c < "0") || (c > "9"))) return false; } // All characters are numbers. return true;}function stripCharsInBag(s, bag){ var i; var returnString = ""; // Search through string's characters one by one. // If character is not in bag, append to returnString. for (i = 0; i < s.length; i++){ var c = s.charAt(i); if (bag.indexOf© == -1) returnString += c; } return returnString;}function daysInFebruary (year){ // February has 29 days in any year evenly divisible by four, // EXCEPT for centurial years which are not also divisible by 400. return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );}function DaysArray(n) { for (var i = 1; i <= n; i++) { this = 31 if (i==4 || i==6 || i==9 || i==11) {this = 30} if (i==2) {this = 29} } return this}function isDate(dtStr){ var daysInMonth = DaysArray(12) var pos1=dtStr.indexOf(dtCh) var pos2=dtStr.indexOf(dtCh,pos1+1) var strDay=dtStr.substring(0,pos1) var strMonth=dtStr.substring(pos1+1,pos2) var strYear=dtStr.substring(pos2+1) strYr=strYear if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1) if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1) for (var i = 1; i <= 3; i++) { if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1) } month=parseInt(strMonth) day=parseInt(strDay) year=parseInt(strYr) if (pos1==-1 || pos2==-1){ alert("The date format should be : dd-mm-yyyy") return false } if (strMonth.length<1 || month<1 || month>12){ alert("Please enter a valid month") return false } if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){ alert("Please enter a valid day") return false } if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){ alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear) return false } if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){ alert("Please enter a valid date") return false }return true}function ValidateForm(){ var dt=document.getElementById("ADate");var currentTime4 = new Date()var month4 = currentTime4.getMonth() + 1var day4 = currentTime4.getDate()var year4 = currentTime4.getFullYear()var finalDate4 = ( day4 + "-" + month4 + "-" + year4 );if(dt.value == ''){ dt.value = finalDate4; }if (isDate(dt.value)==false) { dt.focus() return false } return true}/*function ValidateForm(){ var dt=document.frmSample.txtDate if (isDate(dt.value)==false){ dt.focus() return false } return true }*/

  3. Hello,I need the help on the following in order to validate date on my form (validation is onBlur): - validation on form date format: dd-mm-yyyy , when I go to next field, if the date field is empty, it will be filled with today's date, and I write 9-3 and go to next field it will automatically write 9-3-2013 (where is 2013 is the current year), finally, if the date is not valid then user can't go to another field, focus must be go back to date field. Help is much appreciated. Thanks in advance

  4. Hello,I had this case:Text is stored in mysql table in the means of html, i.e. it contains <p> ,<br /> .... I want to display it on a php page, I had 2 questions: I want to display the first 400 characters, then the second 300 each on different <div> , so I need to save them each on different variable? and what about html tags?Thanks

  5. Hello,I need help with the following:I had a dynamic variable in this form:XXXX-Y-A-B (which is called ID) XXXX is always fixed (character)Y is also a single characterA is an integerB is an integer I am quering a database that had list of that IDs , and I need to know the value of A each time (A could be 1, 2, 3, 11, 200....)Any help?Thanks

  6. Look at this example under confirm:http://labs.abeautifulsite.net/archived/jquery-alerts/demo/I need help in making it in <a href=""></a>also, my current code makes look from the database, so in the current code, with the <input type="button" id="confirm_button"> it will work with on button only.Thanks

  7. Hello all,I was searching for a javascript in which I can change the confirm box title, I had found this http://www.abeautifulsite.net/blog/2008/12/jquery-alert-dialogs/but I need help how to make it on a hyperlink, as in my page, I had <a href="test.php?action=del&id=1>Delete</a>the above link works perfect with button, how can I make it work on a href so that when I click on the Delete text, I get the confirmation with Yes , Cancel option, when clicked Cancel, it will do nothing and Yes will delete the record

  8. Hello all,I am using this script to upload file to FTP through php code, but its giving me FTP upload has failed!Can you help?Thanks <html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head> <body><form action="upload.php" method="post" enctype="multipart/form-data" name="form1" ><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="14%">server name </td><td width="75%"><input name="server" type="text" id="server">Write in the format "ftp.servername.com" </td><td width="11%"> </td></tr><tr><td>user name </td><td><input name="username" type="text" id="username"></td><td> </td></tr><tr><td>password</td><td><input name="password" type="password" id="password"></td><td> </td></tr><tr><td>File name </td><td><input type="file" name="file"></td><td> </td></tr><tr><td><input type="submit" name="Submit" value="Upload"></td><td> </td><td> </td></tr></table></form></body></html> "upload.php" <html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head> <body><?php$ftp_server=$_POST['server'];$ftp_user_name=$_POST['username'];$ftp_user_pass=$_POST['password'];$source_file=$_FILES['file']['name'];// retrieve name of the file to be uploaded$destination_file=$source_file;// make a connection to the ftp server$conn_id = ftp_connect($ftp_server); // login with username and password$login_result = ftp_login($conn_id , $ftp_user_name , $ftp_user_pass); // check connectionif((!$conn_id)||(!$login_result)){echo "FTP connection has failed!" ;echo "Attempted to connect to $ftp_server for user $ftp_user_name" ;exit;}else{echo "Connected to $ftp_server, for user $ftp_user_name" ;} // upload the file$upload = ftp_put($conn_id,$destination_file,$source_file,FTP_ASCII ); // check upload statusif(!$upload){echo "FTP upload has failed!" ;}else{echo "Uploaded $source_file to $ftp_server as $destination_file" ;} // close the FTP streamftp_close($conn_id);?></body></html>

  9. Hello,I had this issue:I had users which had trial users 10 days, so after 10 days passed, I don't want the user to login. So I was thinking of doing a php file which will query for the expired users, send them an email & disable access to login.my question is: Am I thinking right? If yes, how can I enable running of php files daily. If no, then how should I go for this?Thanks in advance

  10. Just as I suspected. You're making Javascript send values. Encode the values before using them. This should be in your reload2() function:var val = encodeURIComponent( form.tag.options[form.tag.options.selectedIndex].value );var val2 = encodeURIComponent( form.product.options[form.product.options.selectedIndex].value );Your login system has an error. A warning appears in the source code right after logging in:
    <b>Warning</b>:  mysql_fetch_array(): supplied argument is not a valid MySQL result resource in <b>/home/metrolb/public_html/vendor/order.php</b> on line <b>417</b><br />

    Thanks it worked :)
  11. Hello all,I had a php script that list content of a folder. I am working with WAMP, the script is at : wamp/www/scriptwell, if I put the images in this folder, it will work perfect, but I need to put the pics in C:\myFolder\picshow can I call that directory from within a php?Thanks in advance

  • Create New...