Jump to content

new_php85

Members
  • Posts

    56
  • Joined

  • Last visited

Everything posted by new_php85

  1. Hi everyone.... I have some issue... There is document which is VBA word 2010. When someone open / click the document, some information (ip address, computer detail. hash code etc..) should be consume by php. I have no idea how php can help. anyone have idea. thanks in advance... Here is some code for VBA Dim appWord As New appWord Private Sub Document_Open() Set appWord.appWord = Word.Application Set appWord.appWord = Word.Application Call FirstTime Call Show Call Test("1") Call DisableCopy Call PrepareHistory Call TrySendPastData End Sub Private Sub Document_Close() Call Test("2") Call Hide ActiveDocument.Save End Sub Private Sub Register_Event_Handler() Set appWord.appWord = Word.Application End Sub Private Sub Test(activity As String) On Error GoTo SkipTest Dim result As String Dim myURL As String, postData As String Dim winHttpReq As Object Dim sHostName As String Dim sUserName As String Dim ldap As String Dim md5 As String Dim p As String Dim rw As String rw = "" 'Cw.GetBssid sHostName = Environ$("userdomain") sUserName = SafeString(Application.UserName & "|" & Environ$("username")) Set winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1") ldap = Inpho.GetLDAPUserName() & "|" & Inpho.GetLocalDomainUserName() md5 = Evaluate(Inpho.GetCleanName() & ldap & sHostName & sUserName) myURL = "http://localhost/test2.php" postData = "key=" & ActiveDocument.Variables("documentid") & "&a=" & activity & "&info=" & SafeString(Inpho.GetCleanName()) & "&d=" & sHostName & "&u=" & sUserName & "&i=" & SafeString(md5) & "&p=" & SafeString(Inpho.GetSerial()) & "&w=" & SafeString(rw) winHttpReq.SetTimeouts 2000, 2000, 2000, 2000 winHttpReq.Open "POST", myURL, False winHttpReq.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded" winHttpReq.Send (postData) If winHttpReq.Status = "404" Then Call HisStory(md5, activity) Exit Sub End If SkipTest: Call AddToDataId(postData) Call HisStory(md5, activity) End Sub
  2. Hye experts! Good day to you. I have refer to many references but still got same error. one of my reference is http://www.phpfreaks.com/forums/index.php?topic=180250.msg803886#msg803886 here is my code <?php session_start(); include 'includes/db_connect.php'; include 'phpmailer/class.phpmailer.php'; include 'phpmailer/class.smtp.php'; $title="Application for Venue Change"; $subject=$title; $name=$_REQUEST["name"]; $to="xxxx@xxxxx.edu.my";//my office email $content="This is to inform you that ".$name." has send Application for Venue Change."; $content=$content."\n\nSTUDENT INFORMATION :-"; $content=$content."\n\nName : ".$name; $content=$content."\nStudent No.: ".$_REQUEST["student_no"]; $content=$content."\nClass : ".$_REQUEST["classes"]; $content=$content."\n\nPlease go to http://xxx.xx.xxx.xx/AVC_VT/default.php for necessary action."; $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = "smtp.gmail.com"; $mail->AddAddress($to); $mail->From = $_REQUEST["name"]; $mail->FromName =$name; $mail->Subject =$subject; $mail->Body = $content; $mail->WordWrap = 1000; if(!$mail->Send()){echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit;} else{echo "<script language='JavaScript'> alert('success.');</script>";} ?> Based on information above which is Language folder, I also include them into my server. (Download php mailer and put them into server) I only change class.phpmailer.php and class.smtp.php to configure my : 1. host 2. port 3. username 4. password my path for php mailer is AVC_VT/phpmailer did i miss something. thank you
  3. HI guys i got. its because of permission. i just right click the folder at ftp and give full permission on that.. that to all of u..really appreciate
  4. ya...not success it came out with this "File failed to upload". why ya??
  5. here is my path for upload folder var/www/crm_VT/upload that why i put double slashes. $result=move_uploaded_file($_FILES["file"]["tmp_name"], "upload//" . $_FILES["file"]["name"]); however i, change also my code into these $result=move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); and $result=move_uploaded_file($_FILES["file"]["tmp_name"], "upload" . $_FILES["file"]["name"]); and $result=move_uploaded_file($_FILES["file"]["tmp_name"], $_FILES["file"]["name"]); all not works. but success at localhost
  6. Its from JS function here the code <script language="javascript"> function addEdit() { var file=document.form1.file.value; var remarks=document.form1.remarks.value; var do_done=""; if(file=="" || remarks=="") { alert("Please fill in all field remarked (*)."); do_done='N'; } else { var x=document.getElementById("form1"); x.action="attachment.php?xtvt=addEdit"; x.target="_self"; x.submit(); } } </script> All sql are works except this part $result=move_uploaded_file($_FILES["file"]["tmp_name"], "upload//" . $_FILES["file"]["name"]); if (!$result) { echo "Error uploading file"; }
  7. Here is my form <form name="form1" id="form1" action="" method="post" enctype="multipart/form-data"> <table width="625" border="0"> <tr> <td width="78">Select File <span class="style1">*</span></td> <td width="5">:</td> <td width="539"><input type="file" name="file" id="file"/></td> </tr> <tr> <td>Remarks <span class="style1">*</span></td> <td>:</td> <td><pre><textarea name="remarks" id="remarks" cols="45" rows="3"></textarea></pre></td> </tr> <tr> <td> </td> <td> </td> <td><input type="reset" id="bttnReset" name="bttnReset" value="Reset" onclick="Reset()"/> <input type="button" id="bttnAdd" name="bttnAdd" value="Add" onclick="addEdit()"/></td> </tr> </table> </form>
  8. What do you means by that? Actually I don't know how to check either that folder give me full access or not because it located at linux server. i don't have any experience on that. please advice. and
  9. Sorry, missed out to explain. there are no file uploaded into folder upload.
  10. Hi Guys I don't why it happen. probably i missed out something. Here is my code. <?php if($_REQUEST["xtvt"]=="addEdit") { $sql02="INSERT INTO attachment (remarks, attached_by, attached_date) VALUES('".$_REQUEST["remarks"]."', '".$_SESSION["SESSION_ID"]."', now())"; $res02=mysql_query($sql02); //--------- attach file ---------------------------- $name = $_FILES["file"]["name"]; if ($name != "") { $selectDB="SELECT max(id) AS id FROM attachment"; $qryDB= @$res1=mysql_query($selectDB); $fetchDB=mysql_fetch_array($qryDB); $maxid=$fetchDB[0]; $result=move_uploaded_file($_FILES["file"]["tmp_name"], "upload//" . $_FILES["file"]["name"]); if (!$result) { echo "Error uploading file"; } $update_faultLog = "UPDATE attachment SET attachment='$name' WHERE id='$maxid'"; $res1=mysql_query($update_faultLog); } } ?> <table width="625" border="0"> <tr> <td width="78">Select File <span class="style1">*</span></td> <td width="5">:</td> <td width="539"><input type="file" name="file" id="file"/></td> </tr> <tr> <td>Remarks <span class="style1">*</span></td> <td>:</td> <td><pre><textarea name="remarks" id="remarks" cols="45" rows="3"></textarea></pre></td> </tr> <tr> <td> </td> <td> </td> <td><input type="reset" id="bttnReset" name="bttnReset" value="Reset" onclick="Reset()"/> <input type="button" id="bttnAdd" name="bttnAdd" value="Add" onclick="addEdit()"/></td> </tr> </table> Its work at localhost but not when i put at server... please help me... Thank You
  11. Actually once i go direct to the page I set $_SESSSION["SESSION_CURSOR"]=""; when page start works on JS which is at onblur="checkAvaib()" i update $_SESSSION["SESSION_CURSOR"]=1; on html its look like :- <input type="text" name="location" id="location" maxlength="10" value="<?php echo $_REQUEST["location"];?>" tabindex="<?php if($_SESSSION["SESSION_CURSOR"]==1){echo "14";} else {echo "false";}?>"/> <input type="text" name="user_id" id="user_id" maxlength="10" value="<?php echo $_REQUEST["user_id"];?>" onblur="checkAvaib()" tabindex="15"/> <input type="text" name="name" id="name" value="<?php echo $_REQUEST["name"];?>" tabindex="16"/> Before this, after page refresh, the tab going to the location but now its going to the name. This not a really good solution. its better do in Ajax. for me its takes time to change the whole code into ajax but i i'll change it next time.
  12. Actually its more on cursor position. but usually when i works on data entry i use TAB at keyboard to move the cursor. thats y i call tab position. Sorry if this post confusing u. actually i got one solution. but i thinks is not a good solution. By using $_SESSION the cursor position remain to the next field/tab. If i hv better solution, please be free to share. thank you...
  13. Hi guys.. sorry if I wrong placed the topic. I'm not sure is it under HTML or JS. I have problem with my tab position after refresh my page. Here is JS function checkAvaib() { var x=document.getElementById("form"); x.action="student_new.php"; x.target="_self"; x.submit(); } Here is HTML <input type="text" name="user_id" id="user_id" maxlength="10" value="<?php echo $_REQUEST["user_id"];?>" onblur="checkAvaib()" tabindex="15"/> <input type="text" name="name" id="name" value="<?php echo $_REQUEST["name"];?>" tabindex="16"/> When I start enter at user_id field and then tab to the next field(name). It will refresh the page and tab position going to the first tab. Is it possible to point the tab to the next tab after refresh? Thanks in advance.
  14. i got the problem it suppose like this if($_REQUEST["rFormat"]=="2") { header("Content-Type: application/x-msexcel"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Disposition: attachment; filename=email_sms_export.xls");// i missed out this link } now its works on IE/FF/Google Chrome
  15. Basically, i using this code to generate excel file if($_REQUEST["rFormat"]=="2") { header("Content-Type: application/x-msexcel"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); } and it works at IE and FF. Only google chrome not work.
  16. Hi Guys.... I need to export data into excel file. So far its works on IE and Firefox. But if i using Google Chrome it download only php file. Eg(suppose file test.xls but it goes to test.php). Why it happen??
  17. hye everybody... here i have problem to share with u... can u guys help me to solve that problem... i want update but field date cannot be update why??? u guys got an idea??? here some code taht you can refer... <?php $value_K=$_POST['id_cemas']; $inputDate1K=$_REQUEST["tmula1_K"]; $split1K = explode("-", $inputDate1K); $NewDate1K= "" . $split1K[2] . "-" .$split1K[1]. "-" .$split1K[0] ; $i=$_REQUEST["a"]; $sqlK1=mysql_query("update t_pinjaman set tarikh_mula_potong='$NewDate1K[$i]' where id_t_pinjaman='$value_K[$i]'",$link); ?> <table width="759" border="1" align="center"> <!--DWLayoutTable--> <?php $sql7=mysql_query("select id_pinjaman,jumlah_diluluskan,jumlah_pinjaman,tempoh_pinjaman,potongan_sebulan, date_format(tarikh_mula_potong,'%d-%m-%Y') as tarikh_mula,date_format(tarikh_kemaskini_proses,'%m') as bulan, id_t_pinjaman from t_pinjaman where no_ahli='".$_REQUEST["no_ahli"]."' and date_format(tarikh_kemaskini_proses,'%Y')='".$_REQUEST["tahun"]."' and date_format(tarikh_kemaskini_proses,'%m')='".$_REQUEST["bulan"]."' and status_permohonan !='0' and id_pinjaman='K'",$link); $bil_K=0; while(list($pinjaman,$jumlah,$jum_pjm,$tempoh,$potongan,$tarikh_mula,$tarikh,$id_t_pinjam)=mysql_fetch_row($sql7)) { if($tarikh==$_REQUEST["bulan"]) { $P1_1pengguna=$pinjaman; $P1_1tmula=$tarikh_mula; $id_cemas=$id_t_pinjam; } ?> <tr><th bordercolor="#000000" class="style49"><input name="tmula1_K[]" type="text" id="tmula1_K[]" size="10" value="<?php echo $P1_1tmula; ?>" /> <a href="javascript:NewCal('tmula1_K[]','ddmmyyyy')"><img src="images/cal.gif" alt="Pilih Tarikh" name="tarikh" width="19" height="16" border="0" id="tarikh" /></a> </th> <th bordercolor="#000000" class="style49"><input name="id_cemas[]" type="text" id="id_cemas[]" value="<?php echo $id_cemas; ?>" size="10" /> <a href="javascript:update(<? echo $bil_K;?>)" ><img src="images/edit.gif" alt="Edit Rekod" width="18" height="16" border="0"></a></th></tr> <?php $bi_K++; } </table>
  18. hye friends.. i have some problem... when i run query statement, error '..........on clause' occur. what the meaning for that error???? help me...
  19. i have modified my code like this.but it still not working.when i select destination which domestic. only name will insert in data base but not destination. but when i select destination for international it can b insert in database. why this happen??? <?php include 'includes/db_connect.php'; include 'includes/css.php'; if (isset($_POST['bttnAdd'])) { $id = $_POST['id']; $name = $_POST['name']; $dest = $_POST['dest']; $data = 1; $query = "INSERT INTO artis(name, dest) VALUES('$name','$dest')"; mysql_query($query) or die('Query failed. ' . mysql_error()); echo "<script language='JavaScript'> alert('The record is successfully added');</script>"; echo "<script language='JavaScript'> window.location ='rodiobttn4.php';</script>"; } ?> <html> <head> <title>MEC</title> <script type="text/javascript"> function validDate(add_dest) { var prob=false; if(add_dest.name.value=="") { alert("Please enter name"); prob=true; } if(prob) { return false; } else { return true; } } </script> <body> <form name="add_dest" action="rodiobttn4.php" method='post' onSubmit="return validDate(this);"> Name: <input name = "name" maxlength = "100" size = "50"><br> <b>Destination</b> <p> <input type="radio" name="domestic" value="domestic" <?php if(isset($_POST['dest']) && ($_POST['dest'] == 'domestic') )echo ' checked="checked"'; ?>/> Domestic => <select name="dest"> <option value="" selected>Choose Destination</option> <option value="SZB">SZB-Shah Alam</option> <option value="MEL">MEL-Melaka</option> <option value="KCH">KCH-Kuching</option> <option value="KTN">KTN-Kuantan</option> </select> </p> <input type="radio" name="international" value="international" <?php if(isset($_POST['dest']) && ($_POST['dest'] == 'international') )echo ' checked="checked"'; ?>/> International => <select name="dest"> <option value="" selected>Choose Destination</option> <option value="JHB">JHB-Johor Bahru</option> <option value="BKI">BKI-Sabah</option> <option value="SBW">SBW-Sibu</option> <option value="MYY">MYY-Miri</option> <option value="KBR">KBR-Kota Bahru</option> <option value="IPH">IPH-Ipoh</option> <option value="AOR">AOR-Alor Setar</option> <option value="TGG">TGG-Terengganu</option> <option value="PEN">PEN-Pulau Pinang</option> <option value="BTL">BTL-Bintulu</option> <option value="SARIKEI">SARIKEI</option> </select> </p> <input type="submit" name="bttnAdd" value="SUBMIT"/> </form> </body> </html> plz help me ??? ??? ???
  20. i... i want insert data using radio button but it not succes...im not familiar insert data using radio button.here some coding that i have made. <?php include 'includes/db_connect.php'; include 'includes/css.php'; if (isset($_POST['bttnAdd'])) { $id = $_POST['id']; $name = $_POST['name']; $dest = $_POST['dest']; $data = 1; $query = "INSERT INTO artis(name, dest) VALUES('$name','$dest')"; mysql_query($query) or die('Query failed. ' . mysql_error()); echo "<script language='JavaScript'> alert('The record is successfully added');</script>"; echo "<script language='JavaScript'> window.location ='add_dest.php';</script>"; } ?> <html> <head> <title>MEC</title> <script type="text/javascript"> function validDate(add_dest) { var prob=false; if(add_dest.name.value=="") { alert("Please enter name"); prob=true; } if(add_dest.dest.value=="") { alert("Please choose dest"); prob=true; } if(prob) { return false; } else { return true; } } </script> <body> <form name="add_dest" action="rodiobttn.php" onSubmit="return validDate(this);"> Name: <input name = "name" maxlength = "100" size = "50"><br> <b>Destination</b> <p> <input type="radio" name="dest" value="domestic" <?php if(isset($_POST['dest']) && ($_POST['dest'] == 'domestic') )echo ' checked="checked"'; ?>/> Domestic => <select name="dest"> <option value="" selected>Choose Destination <option value="SZB">SZB-Shah Alam <option value="MEL">MEL-Melaka <option value="KCH">KCH-Kuching <option value="KTN">KTN-Kuantan </select> </p> <input type="radio" name="dest" value="international" <?php if(isset($_POST['dest']) && ($_POST['dest'] == 'international') )echo ' checked="checked"'; ?>/> International => <select name="select"> <option value="" selected>Choose Destination <option value="JHB">JHB-Johor Bahru <option value="BKI">BKI-Sabah <option value="SBW">SBW-Sibu <option value="MYY">MYY-Miri <option value="KBR">KBR-Kota Bahru <option value="IPH">IPH-Ipoh <option value="AOR">AOR-Alor Setar <option value="TGG">TGG-Terengganu <option value="PEN">PEN-Pulau Pinang <option value="BTL">BTL-Bintulu <option value="SARIKEI">SARIKEI </select> </p> <input type="submit" name="bttnAdd" value="SUBMIT"/> </form> </body> </html> when i press button submit, it do not show error information but it not sucsess. why ??? plz help me..... ??? ???
  21. hai.. i new in js... i need some helps from other resoures to read value in field using javascript can do like this example: me.date_me.value me is form name date_me is field name but if i do like that it will read the whole field.how come if i want only read the 7 character from the field? plzz help me....
  22. why when i clik Edit link, the next page is empty... this is my example coding for Edit link page.. <?php session_start(); include 'includes/db_connect.php'; include 'includes/css.php'; if(isset($_GET['logout'])) { $_SESSION['logged_in']=0; session_destroy(); } $q = "SELECT dd, mm, yy FROM date_control"; $result = mysql_query($q) or die('Query failed. ' . mysql_error()); ?> <html> <head> <title>MEC</title> <script type="text/javascript"> function Back() { window.location ='listStaff.php'; } </script> </head> <body bgcolor="#9999FF"> <form name="vc" action='view_closing_date.php' method = "post"> <table width="207" align="center"> <th class="header2" bgcolor="#C0C0C0" width="24"><div align="center">No.</div></th> <th class="header2" bgcolor="#C0C0C0" colspan="3"><div align="center">Duration</div></th> <th class="header2" bgcolor="#C0C0C0" width="209"><div align="center">Edit</div></th> <?php $y=1; while($row = mysql_fetch_assoc($result)) { ?> <tr> <td class="list2"><div align="center"><?php echo $y;?></div></td> <td width="37" class="list2"><div align="right"><?php echo $row['mm']?></div></td> <td width="30" class="list2"><div align="center">/</div></td> <td width="34" class="list2"><div align="left"><?php echo $row['yy']?></div></td> <td class="list2"><div align="center"><a href="editVs.php?vs_id=<?php echo $row['vs_id']?>">Edit</a></div></td> </tr> <?php $y++; } ?> <tr> <td colspan="4"></td> <td><div align="right"> <input class="button" type = "button" name = "bttnBack" value = "Back" onClick="Back()"></div></td> </tr> </table> </form> </body> </html> this is my next page after click link edit <?php session_start(); include 'includes/db_connect.php'; include 'includes/css.php'; $query_dd = "SELECT * FROM days"; $result_dd = mysql_query($query_dd) or die('Query failed. ' . mysql_error()); $query_mm = "SELECT * FROM month"; $result_mm = mysql_query($query_mm) or die('Query failed. ' . mysql_error()); $query_yy = "SELECT * FROM year"; $result_yy = mysql_query($query_yy) or die('Query failed. ' . mysql_error()); if(isset($_GET['logout'])) { $_SESSION['logged_in']=0; session_destroy(); } if (isset($_POST['bttnEdit'])) { $vs_id = $_POST['vs_id']; $dd = $_POST['dd']; $mm = $_POST['mm']; $yy = $_POST['yy']; $data = 1; $query = "UPDATE date_control SET dd='$dd', mm='$mm', yy='$yy' WHERE vs_id='$vs_id'"; mysql_query($query) or die('Query failed. ' . mysql_error()); echo "<script language='JavaScript'> alert('The record is successfully edited');</script>"; echo "<script language='JavaScript'> window.location ='view_closing_date.php';</script>"; } ?> <html> <head> <title>MEC</title> <SCRIPT language="JavaScript1.2" src="gen_validation.js"></SCRIPT> <SCRIPT language="JavaScript1.2"> var arrFormValidation= [ [//id ], [//Start Date ["minlen=1", "Please enter date"] ], [//Closing Date ["minlen=1", "Please enter date"] ], [//Viewing Date ], ]; </SCRIPT> <script type="text/javascript"> function Back() { window.location ='view_closing_date.php'; } </script> </head> <body bgcolor="#9999FF"> <form name="eventC" action = "editVs.php" method = "post" onSubmit="return validateForm(this,arrFormValidation);"> <?php if (isset($_GET['vs_id'])) { $vs_id = $_GET['vs_id']; } else if (isset($_POST['vs_id'])) { $vs_id = $_POST['vs_id']; } else { $vs_id = 0; } $query2 = "SELECT * FROM date_control WHERE vs_id = '$vs_id'"; $result = mysql_query($query2) or die('Query failed. ' . mysql_error()); while($row = mysql_fetch_assoc($result)) { ?> <table width="358" align="center"> <tr> <td width="99">Id</td> <td width="247">: <input class="special" type = "text" name = "vs_id" maxlength = "200" value = "<?php echo $row['vs_id']?>" size = "10"ReadOnly></td> </tr> <tr> <td>Duration</td> <td>: <select class="special" name="dd"> <option value="">DD</option> <?php while($row_dd = mysql_fetch_assoc($result_dd)) { ?> <option value="<?php echo $row_dd['days']; ?>"><?php echo $row_dd['days']; ?></option> <?php } ?> </select> <select class="special" name="mm"> <option value="">MM</option> <?php while($row_mm = mysql_fetch_assoc($result_mm)) { ?> <option value="<?php echo $row_mm['month']; ?>"><?php echo $row_mm['month']; ?></option> <?php } ?> </select> <select class="special" name="yy"> <option value="">YY</option> <?php while($row_yy = mysql_fetch_assoc($result_yy)) { ?> <option value="<?php echo $row_yy['year']; ?>"><?php echo $row_yy['year']; ?></option> <?php } ?> </select></td> </tr> <tr> <td> </td> <td> <div align="left"> <input class="button" type = "button" name = "bttnBack" value = "Back" onClick="Back()"> <input class="button" type = "submit" name = "bttnEdit" value = "Edit"> </div></td> </tr> </table> <?php } include "includes/db_close.php"; ?> </form> </body> </html> why nothing appear at secod page.....plzz help me
  23. corbin i got what u said. it should like this $current_month = date("Y-m"); thank you ya...
×
×
  • 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.