PHP - Help Coding Problem
This is my site .www.nfspolicehq.com we have a coding problem .The person that made our site is not helping use no longer .I don't know what the hack I am doing .I really need some help or our site will never run agin . Could someone help me out . Please
Thanks
Chris
Similar TutorialsNot sure if or how I can do this properly without killing my page:
<?php $catquery = new WP_Query( 'cat=16&posts_per_page=1 ); while($catquery->have_posts()) : $catquery->the_post(); $ourspecials = " <ul> <li><h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3> <ul><li><?php the_content(); ?></li> </ul> </li> </ul>"; ?> <?php if(function_exists('stbHighlightText')) stbHighlightText($ourspecials, 'warning'); ?> The first thing I want to point out is that I am completely php illiterate. Now that we have that out of the way, here's my scenario. I built a web form using a program called PC Object Generator from their online site. Everything went fine. I uploaded all the files and ran the setup (as instructed). Here's where the problem comes in. When I go to www.b-binc.com/corb/setup it takes me to the POG setup. I then click on the 'pog me up' button and it tells me to re-check my database. I have emailed the website where I used the program. Very slow on resposne. I assume they too are busy with real php people. That's OK, except that I really need to get this form working. I contacted my IP and they emailed me back and said everything on their end is working and I have the right login data. I believe that the problem is in the configuration file. I have attached the file if anyone has the time to take a look at it and make some suggestions. I hope this makes any sense. Thanks Hi... I have three types of night premium and it only computed of the schedule is night shift I have this Night Premium Types: - NightPremiumRegular (Monday-Saturday) -NightPremiumSunday (Sunday) - NightPremiumHoliday I created table which has a listed of holidays date. Now I encountered problem in sum of hours in NightPremiumHoliday here is my code: Code: [Select] //===================Display Night Premium========================= $sql = "SELECT r.EMP_NO, r.LOGIN, DATE(LOGIN) AS DATE_LOGIN, DATE_FORMAT(LOGIN, '%W') AS SUNDAY, r.LOGOUT, sec_to_time(SUM(time_to_sec(Rendered))) AS Rendered FROM $PAYROLL.reg_att r, $ADODB_DB.employment em, $ADODB_DB.personal p WHERE time_to_sec(time(LOGIN)) BETWEEN time_to_sec('17:00:00') AND time_to_sec('22:35:00') AND time_to_sec(time(LOGOUT)) BETWEEN time_to_sec('05:35:00') AND time_to_sec('09:35:00') AND r.EMP_NO = em.EMP_NO AND em.EMP_ID = '$currentEmpID' AND p.EMP_ID = '$currentEmpID' AND DATE_FORMAT(LOGIN, '%W') = 'Sunday'"; $rsNPSun = $conn2->Execute($sql); $NPSunHours = $rsNPSun->fields['Rendered']; $NPSunDate = $rsNPSun->fields['SUNDAY']; $NPSunHours = substr($NPSunHours, 0, 5); $NPSunHours = str_replace(':', '.', $NPSunHours); $sql = "SELECT OP FROM ot WHERE Category = 'NightPremiumSunday'"; $rsOTCatSun = $conn2->Execute($sql); $NPSun_OP = $rsOTCatSun->fields['OP']; $NPSunAmt = (($Rate / 8 * 1.35 * $NPSun_OP) * $NPSunHours); $NPSunAmt = number_format($NPSunAmt, 2, '.', ''); $smarty->assign('NPSunHours', $NPSunHours); $smarty->assign('NPSunAmt', $NPSunAmt); //=================NP REG======= $sql = "SELECT r.EMP_NO, r.LOGIN, DATE(LOGIN) AS DATE_LOGIN, DATE_FORMAT(LOGIN, '%W') AS Week_Days, r.LOGOUT, sec_to_time(SUM(time_to_sec(Rendered))) AS Rendered FROM $PAYROLL.reg_att r, $ADODB_DB.employment em, $ADODB_DB.personal p WHERE time_to_sec(time(LOGIN)) BETWEEN time_to_sec('17:00:00') AND time_to_sec('22:35:00') AND time_to_sec(time(LOGOUT)) BETWEEN time_to_sec('05:35:00') AND time_to_sec('09:35:00') AND r.EMP_NO = em.EMP_NO AND em.EMP_ID = '$currentEmpID' AND p.EMP_ID = '$currentEmpID' AND DATE_FORMAT(LOGIN, '%W') IN ('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday')"; $rsNPReg = $conn2->Execute($sql); $NPRegHours = $rsNPReg->fields['Rendered']; $NPRegDate = $rsNPReg->fields['Week_Days']; $NPRegHours = substr($NPRegHours, 0, 5); $NPRegHours = str_replace(':', '.', $NPRegHours); $sql = "SELECT OP FROM ot WHERE Category = 'NightPremiumRegular'"; $rsOTCatSun = $conn2->Execute($sql); $NPReg_OP = $rsOTCatSun->fields['OP']; $NPRegAmt = (($Rate / 8 * $NPReg_OP) * $NPRegHours); $NPRegAmt = number_format($NPRegAmt, 2, '.', ''); $smarty->assign('NPRegHours', $NPRegHours); $smarty->assign('NPRegAmt', $NPRegAmt); //=======================Night Premium Holiday============== $sql = "SELECT r.EMP_NO, r.LOGIN, DATE(LOGIN) AS DATE_LOGIN, r.LOGOUT, sec_to_time(SUM(time_to_sec(Rendered))) AS Rendered FROM $PAYROLL.reg_att r, $ADODB_DB.employment em, $PAYROLL.holiday_date h WHERE time_to_sec(time(LOGIN)) BETWEEN time_to_sec('17:00:00') AND time_to_sec('22:35:00') AND time_to_sec(time(LOGOUT)) BETWEEN time_to_sec('05:35:00') AND time_to_sec('09:35:00') AND DATE(LOGIN) = h.holiday_date AND r.EMP_NO = em.EMP_NO AND em.EMP_ID = '$currentEmpID'"; $rsNPHol = $conn2->Execute($sql); $NPHolHours = $rsNPHol->fields['Rendered']; $NPHolHours = substr($NPHolHours, 0, 5); $NPHolHours = str_replace(':', '.', $NPHolHours); $sql = "SELECT OP FROM ot WHERE Category = 'NightPremiumHoliday'"; $rsOTCatSun = $conn2->Execute($sql); $NPHol_OP = $rsOTCatSun->fields['OP']; $NPHolAmt = (($Rate / 8 * 2.05 * $NPHol_OP) * $NPHolHours); $NPHolAmt = number_format($NPHolAmt, 2, '.', ''); $smarty->assign('NPHolHours', $NPHolHours); $smarty->assign('NPHolAmt', $NPHolAmt); $NPHours = ($NPRegHours + $NPSunHours + $NPHolHours); $NPHours = number_format($NPHours, 2, '.', ''); $NP_Amt = ($NPRegAmt + $NPSunAmt + $NPHolAmt); $NP_Amt = number_format($NP_Amt, 2, '.', ''); $smarty->assign('NP_Hours', $NPHours); $smarty->assign('NP_Amt', $NP_Amt); for example: I have attendance 2012-01-01 and it's sunday and it is also holiday.. And the rendered is 8 so the NightPremiumSunday and NightPremiumHolidays computed, but i got problem in computations of NPHours. I got NPHours = 16, supposively 8, but because it is sunday and holiday it sum the result of hours in Sunday and Holiday.. How can I only get 8 hours if my date is holiday? Thank you so much.. Any help is highly appreciated.. feel free to ask me if theirs a question. I am thining this will be pretty simple for someone to help me with, I have been hassling with it for several hours and really feel dumb that I can't get it to work. Here is the problem - I have one script wherein I have a form that passes a variable using Post method. I have previously assigned a value "A" to a variable $rtn the input is: <input name="Rtn" type="hidden" value="<?php echo $rtn; ?> /> In the script that I am calling I first get the value of the variable: $rtn = (_POST['Rtn']); then there is other stuff goin on and I come to an if stmt: if ($rtn == "A" { do some stuff } else { echo $rtn; } It will never get into the do some stuff - it always falls through to the else the output is \'A\' I have tried to use double quotes, single quotes, used stripslasches and addslashes funtions, trim, and various combination of all of these. Nothing I do seem to get me into the first part of the if stmt, to do some stuff. Hi... I have a problemand I tried to resolved it but still I failed.. I need to add a code in a php file where I'm not the one who code, now I need to add code on that file, and the problem is the one who the owner of code is not here. I need to add code : Code: [Select] $sub_lotcode = substr($lotCode, 9, 4); $sql = "SELECT k.PCODE, k.kanban, p.Compounds, p.Max_Lot FROM kanban_checker k, param_settings p WHERE k.kanban = p.Max_Lot AND k.PCODE = '$sub_lotcode' AND p.Compounds = '$sub_lotcode'"; $result = mysql_query($sql, $con); $total = mysql_num_rows($result); if ($total <= 0) { notify that PCODE reach the maximum } else{ echo "continue"; } here is the code where I need to add this condition: Code: [Select] <?php error_reporting(0); $con = mysql_connect('localhost', 'root',''); if (!$con) { echo 'failed'; die(); } mysql_select_db("mes", $con); $lotCode = mysql_real_escape_string($_GET['normal']); $lotCodeDownGrade = mysql_real_escape_string($_GET['downgrade']); $terminalNo = mysql_real_escape_string($_GET['n']); $downMode = mysql_real_escape_string($_GET['down']); //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> if ($terminalNo == "1") { if ($lotCode != "") { $sql = "SELECT BARCODE FROM LEGALCODES WHERE BARCODE='$lotCode'"; $result = mysql_query($sql, $con); $total = mysql_num_rows($result); if ($total <= 0) { echo "X"; // X - for non existent in the mes table } else { //do this if code exist in the database: // //code exist in the database $sql = "SELECT LOT_CODE, TERMINAL_ID, ACTIVE FROM DEPENDENCY WHERE LOT_CODE='$lotCode' AND TERMINAL_ID='1' AND ACTIVE=TRUE"; $result = mysql_query($sql, $con); $total = mysql_num_rows($result); if ($total <= 0) { echo "0"; // continue to transact } else { // query the last terminal it was used $sql = "SELECT LOT_CODE, TERMINAL_ID, ACTIVE FROM DEPENDENCY WHERE LOT_CODE='$lotCode' AND ACTIVE=TRUE ORDER BY DATE_ENTRY DESC LIMIT 1"; $result = mysql_query($sql, $con); $row = mysql_fetch_array($result); $total = mysql_num_rows($result); echo $row['TERMINAL_ID'] ; // already used here - me nakita // GET THE LAST TERMINAL NUMBER ACTIVE ADD 1 HERE TO DISPLAY WHICH TERMINAL TO GO } } } } //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> elseif ($terminalNo == "4") { if ($lotCode != "") { $sql = "SELECT BARCODE FROM LEGALCODES WHERE BARCODE='$lotCode'"; $result = mysql_query($sql, $con); $total = mysql_num_rows($result); if ($total <= 0) { echo "X"; // X - for non existent in the mes table } else { //if downgrade is checked do this : if ($downMode == "true") { $advanceTerminal = ((integer)($terminalNo) + 1); $advanceTerminal = (string)($advanceTerminal); $preTerminal = ((integer)($terminalNo) - 1); $preTerminal = (string)($preTerminal); //query if the lot code exist in advance terminal .. $sql = "SELECT LOT_CODE, TERMINAL_ID, ACTIVE FROM DEPENDENCY WHERE LOT_CODE='$lotCode' AND TERMINAL_ID='$advanceTerminal' AND ACTIVE=TRUE"; $result = mysql_query($sql, $con); $total = mysql_num_rows($result); if ($total <= 0) { // check naman kung wala sa naunang terminal $sql = "SELECT LOT_CODE, TERMINAL_ID, ACTIVE FROM DEPENDENCY WHERE LOT_CODE='$lotCode' AND TERMINAL_ID='$preTerminal' AND ACTIVE=TRUE"; $result = mysql_query($sql, $con); $total = mysql_num_rows($result); if ($total <= 0) { $sql = "SELECT LOT_CODE, TERMINAL_ID, ACTIVE FROM DEPENDENCY WHERE LOT_CODE='$lotCode' AND ACTIVE= TRUE ORDER BY TERMINAL_ID DESC LIMIT 1"; $result = mysql_query($sql, $con); $row = mysql_fetch_array($result); $total = mysql_num_rows($result); if ($total <= 0) { // NO RECORDS FOUND GO TO TERMINAL 1 == optional echo "notran"; } else { echo $row['TERMINAL_ID'] ; } } else { $sql = "SELECT LOT_CODE, TERMINAL_ID, ACTIVE FROM DEPENDENCY WHERE LOT_CODE='$lotCode' AND TERMINAL_ID='$terminalNo' AND ACTIVE=TRUE"; $result = mysql_query($sql, $con); $total = mysql_num_rows($result); if ($total <= 0 || $total >= 0) { echo "G"; } } } else { $sql = "SELECT LOT_CODE, TERMINAL_ID, ACTIVE FROM DEPENDENCY WHERE LOT_CODE='$lotCode' AND ACTIVE= TRUE ORDER BY TERMINAL_ID DESC LIMIT 1"; $result = mysql_query($sql, $con); $row = mysql_fetch_array($result); $total = mysql_num_rows($result); echo $row['TERMINAL_ID'] ; } } else { //query if the lot code exist in this terminal .. $sql = "SELECT LOT_CODE, TERMINAL_ID, ACTIVE FROM DEPENDENCY WHERE LOT_CODE='$lotCode' AND TERMINAL_ID='$terminalNo' AND ACTIVE=TRUE"; $result = mysql_query($sql, $con); $total = mysql_num_rows($result); if ($total <= 0) { // wala nakita - then tsek if nag exist sa terminal na sinundan $preTerminal = ((integer)($terminalNo) - 1); $preTerminal = (string)($preTerminal); //then tsek if nag exist sa terminal na sinundan $sql = "SELECT LOT_CODE, TERMINAL_ID, ACTIVE FROM DEPENDENCY WHERE LOT_CODE='$lotCode' AND TERMINAL_ID='$preTerminal' AND ACTIVE=TRUE"; $result = mysql_query($sql, $con); $total = mysql_num_rows($result); if ($total <= 0) { // walang nakita sa mga naunang terminal // do this if no previous transaction with pre requisite process // query the last terminal it was used $sql = "SELECT LOT_CODE, TERMINAL_ID, ACTIVE FROM DEPENDENCY WHERE LOT_CODE='$lotCode' AND ACTIVE= TRUE ORDER BY TERMINAL_ID DESC LIMIT 1"; $result = mysql_query($sql, $con); $row = mysql_fetch_array($result); $total = mysql_num_rows($result); // $row = mysql_fetch_array($result); if ($total <= 0) { // NO RECORDS FOUND GO TO TERMINAL 1 == optional echo "notran"; } else { echo $row['TERMINAL_ID']; // GET THE LAST TERMINAL NUMBER ACTIVE ADD 1 HERE TO DISPLAY WHICH TERMINAL TO GO } } else { echo "G"; } } else { //me record na nakita sa terminal na pinag transakan // query the last terminal it was used $sql = "SELECT LOT_CODE, TERMINAL_ID, ACTIVE FROM DEPENDENCY WHERE LOT_CODE='$lotCode' AND ACTIVE=TRUE ORDER BY TERMINAL_ID DESC LIMIT 1"; $result = mysql_query($sql, $con); $row = mysql_fetch_array($result); $total = mysql_num_rows($result); echo $row['TERMINAL_ID'] ; // already used here - me nakita // GET THE LAST TERMINAL NUMBER ACTIVE ADD 1 HERE TO DISPLAY WHICH TERMINAL TO GO } } // here is the terminator of else in downgrade } } //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> if ($lotCodeDownGrade != "") { $sql = "SELECT BARCODE FROM LEGALCODES WHERE BARCODE='$lotCodeDownGrade'"; $result = mysql_query($sql, $con); $total = mysql_num_rows($result); if ($total <= 0) { echo "X"; // X - for non existent in the mes table } else { //do this if code exist in the database: // //code exist in the database $sql = "SELECT LOT_CODE, TERMINAL_ID, ACTIVE FROM DEPENDENCY WHERE LOT_CODE='$lotCodeDownGrade' AND ACTIVE=TRUE"; $result = mysql_query($sql, $con); $total = mysql_num_rows($result); if ($total <= 0) { echo "0"; // continue to transact } else { // query the last terminal it was used $sql = "SELECT LOT_CODE, TERMINAL_ID, ACTIVE FROM DEPENDENCY WHERE LOT_CODE='$lotCodeDownGrade' AND ACTIVE=TRUE ORDER BY TERMINAL_ID DESC LIMIT 1"; $result = mysql_query($sql, $con); $row = mysql_fetch_array($result); $total = mysql_num_rows($result); echo $row['TERMINAL_ID'] ; // already used here - me nakita // GET THE LAST TERMINAL NUMBER ACTIVE ADD 1 HERE TO DISPLAY WHICH TERMINAL TO GO } } } } //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> else { if ($lotCode != "") { $sql = "SELECT BARCODE FROM LEGALCODES WHERE BARCODE='$lotCode'"; $result = mysql_query($sql, $con); $total = mysql_num_rows($result); if ($total <= 0) { echo "X"; // X - for non existent in the mes table } else { //query if the lot code exist in this terminal .. $sql = "SELECT LOT_CODE, TERMINAL_ID, ACTIVE FROM DEPENDENCY WHERE LOT_CODE='$lotCode' AND TERMINAL_ID='$terminalNo' AND ACTIVE=TRUE"; $result = mysql_query($sql, $con); $total = mysql_num_rows($result); if ($total <= 0) { // wala nakita - then tsek if nag exist sa terminal na sinundan $preTerminal = ((integer)($terminalNo) - 1); $preTerminal = (string)($preTerminal); //then tsek if nag exist sa terminal na sinundan $sql = "SELECT LOT_CODE, TERMINAL_ID, ACTIVE FROM DEPENDENCY WHERE LOT_CODE='$lotCode' AND TERMINAL_ID='$preTerminal' AND ACTIVE=TRUE"; $result = mysql_query($sql, $con); $total = mysql_num_rows($result); if ($total <= 0) { // walang nakita sa mga naunang terminal // do this if no previous transaction with pre requisite process // query the last terminal it was used $sql = "SELECT LOT_CODE, TERMINAL_ID, ACTIVE FROM DEPENDENCY WHERE LOT_CODE='$lotCode' AND ACTIVE=TRUE ORDER BY TERMINAL_ID DESC LIMIT 1"; $result = mysql_query($sql, $con); $row = mysql_fetch_array($result); $total = mysql_num_rows($result); if ($total <= 0) { // NO RECORDS FOUND GO TO TERMINAL 1 == optional echo "notran"; } else { echo $row['TERMINAL_ID']; // GET THE LAST TERMINAL NUMBER ACTIVE ADD 1 HERE TO DISPLAY WHICH TERMINAL TO GO } } else { echo "G"; } } else { //me record na nakita sa terminal na pinag transakan // query the last terminal it was used $sql = "SELECT LOT_CODE, TERMINAL_ID, ACTIVE FROM DEPENDENCY WHERE LOT_CODE='$lotCode' AND ACTIVE= TRUE ORDER BY TERMINAL_ID DESC LIMIT 1"; $result = mysql_query($sql, $con); $row = mysql_fetch_array($result); $total = mysql_num_rows($result); echo $row['TERMINAL_ID'] ; // already used here - me nakita // GET THE LAST TERMINAL NUMBER ACTIVE ADD 1 HERE TO DISPLAY WHICH TERMINAL TO GO } } } } mysql_close($con); ?> Code: [Select] function unUsedLotId(txtElemID){ var txtElemID_Active = txtElemID; //alert("VV" + txtElemID_Active.value + "VV" ); responsePHP = "no_reply"; changeFocus = false; var termNo = terminalNo(); ajaxRequest = remoteRequestObject(); ajaxRequest.onreadystatechange = function(){ if (ajaxRequest.readyState==4 && ajaxRequest.status==200) { // var result = ajaxRequest.responseText; responsePHP = ajaxRequest.responseText; //alert(responsePHP) // if (result=="1") { result = "Already used Tag";} // if (result=="0") { result = "Tag ok";} // if (result=="G") { result = "Tag ok";} // if (result=="B") { result = "Incomplete Process";} // var resultStr = (result=="1") ? 'Tag used or incomplete prerequisites' : 'Tag unused'; if (responsePHP == "failed") { txtElemID_Active.disabled = false; txtElemID_Active.value = ""; txtElemID_Active.focus(); notify("Report to MIS<br /> Please scan again."); } //------------------------------added by rhoda for integration-------------------------------------------------- /* else if (responsePHP == "C"){ notify("CCCC"); if (txtElemID_Active.disabled) { txtElemID_Active.disabled = false; } txtElemID_Active.value = ""; txtElemID_Active.focus(); } */ //-------------------------------------------------------------------------------- else if (responsePHP == "X") { //result = "Lot ID invalid."; //responsePHP = "Lot ID invalid."; notify("Lot ID invalid. Scan Again."); if (txtElemID_Active.disabled) { txtElemID_Active.disabled = false; } txtElemID_Active.value = ""; txtElemID_Active.focus(); } //-------------------------------------------------------------------------------- else if (responsePHP =="0" || responsePHP =="G"){ if (txtElemID_Name == "txtLotCode") { window.LotID = (txtElemID_Active.value) } if (txtElemID_Name == "txtLotCodeDownGrade") { window.LotID_Down = (txtElemID_Active.value) } strip(txtElemID_Active) if (termNo == "1") { isSelected('txtLotCode', 'selWeight_MachineID'); } if (termNo == "2" || termNo == "3") { isSelected('txtLotCode', 'txtKitWeight'); } if (termNo == "4" || termNo == "5" || termNo == "6" || termNo == "7") { //////////////////////////////// downgrade modification /////////////////////////////////////// if (termNo == "4") { //alert(termNo) var chkDownGrade = document.getElementById('chkDownGrade') if (chkDownGrade.checked == 1) { //alert("here") if (txtElemID_Name == 'txtLotCode') { isSelected('txtLotCode', 'txtLotCodeDownGrade'); } if (txtElemID_Name == 'txtLotCodeDownGrade') { isSelected('txtLotCodeDownGrade', 'selMachineID'); } } else { //alert("here") if (txtElemID_Name == 'txtLotCode') { isSelected('txtLotCode', 'selMachineID'); } } } else { isSelected('txtLotCode', 'selMachineID'); } //////////////////////////////////////////////////////////////////////////////////////// } if (document.getElementById('notice')!== null) { document.getElementsByTagName('body')[0].removeChild(document.getElementById('notice')) //>> clear the box } } //-------------------------------------------------------------------------------- else if (responsePHP == "notran") { var mensahe1 = "Please return to<br /><span style='font-size:30px;'>Chemical Weighing<br /> or Supervisor</span>"; notify(mensahe1); if (txtElemID_Active.disabled) { txtElemID_Active.disabled = false; } txtElemID_Active.value = ""; txtElemID_Active.focus(); } //-------------------------------------------------------------------------------- else { /* responsePHP == "1" || responsePHP == "B") { do this if tag is used in this terminal if (responsePHP == "1") { result = "Already used Lot ID"; responsePHP = "Already used Lot ID"; notify("Already used Lot ID.<br />Scan again."); } else if (responsePHP == "B") { // result = "Incomplete Transaction Process"; // responsePHP = "Incomplete Transaction Process"; notify("Incomplete Transaction Process.<br />Scan again."); } */ var mensahe1 = "Last Process: <span style='font-size:30px;'> Terminal " + responsePHP + "</span><br /><br />"; var mensahe2 = "Pls. Proceed: <span style='font-size:30px;'> Terminal " + (parseInt(responsePHP) + 1) + "</span>"; notify(mensahe1 + mensahe2); // notify("Incomplete Transaction Process.<br />Scan again."); if (txtElemID_Active.disabled) { txtElemID_Active.disabled = false; } txtElemID_Active.value = ""; txtElemID_Active.focus(); } //-------------------------------------------------------------------------------- } } var txtElemID_Name = txtElemID_Active.id; if (termNo == "4") { var downGrade = document.getElementById('chkDownGrade').checked; var str = txtElemID_Active.value + "&n=" + termNo + "&down=" + downGrade; } else { var str = txtElemID_Active.value + "&n=" + termNo; } if (txtElemID_Name == "txtLotCode") { //alert(txtElemID_Name) var url = "verifyLotId.php?normal=" + str; } if (txtElemID_Name == "txtLotCodeDownGrade") { //alert(txtElemID_Name) var url = "verifyLotId.php?downgrade=" + str; } ajaxRequest.open("GET", url, true); // force i.e. not to cache ajaxRequest.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"); //-------------------------------------------------- ajaxRequest.send(null); ajaxTimeOut = window.setTimeout("timeOut('" + txtElemID_Name + "');", 6000); } Hi. I have a database named 'Forums' with a table named 'forumlist'. The fields in the table are 'id', 'name', 'link', and 'keys'. I am trying to search the database in either the 'name' or 'keys' field and display the matches. I am getting this error: Parse error: syntax error, unexpected T_STRING, expecting ']' in C:\xampp\htdocs\search3.php on line 51 (The define fields) <html> <head> <title>My Forum Search</title> <style type="text/css"> table { background-color: #CCC } th { width: 150px; text-align: left; } </style> </head> <body> <h1>Forum Search</h1> <form method="post" action="search3.php"> <input type="hidden" name="submitted" value="true" /> <label>Search Category: <select name="category"> <option value="keys">Keyword</option> <option value="name">Name</option> </select> </label> <label><input type="text" name="criteria" /></label> <input type="submit" /> </form> <?php if (isset($_POST['submitted])) { DEFINE ('DB_USER', 'root'); DEFINE ('DB_PSWD', '******'); DEFINE ('DB_HOST', 'localhost'); DEFINE ('DB_NAME', 'Forums'); $dbcon = mysqli_connect(DB_HOST, DB_USER, DB_PSWD, DB_NAME); $category = $_POST['category']; $criteria = $_POST['criteria']; $query = "SELECT * FROM forumlist WHERE $category LIKE '$criteria'"; $result = mysqli_query($dbcon, $query) or die ('Error retrieving data') echo "<table>"; echo "<tr> <th>Name</th><th>Link</th> </tr>"; while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { echo "<tr><td>"; echo $row['name']; echo "</td><td>"; echo $row['link']; echo "</td></tr>"; } echo "</table>"; } // end of main if state ?> </body> </html> Thanks in advance Hi all - I am a novice when it comes to PHP, but I have managed to use it successfully many times. I have an issue where I can not get a variable to echo when I am calling it from within a file that is using SSI. Here is a basic example that should explain it better. In the /index.php file: Code: [Select] <?php $photo1="photo1.jpg"; $photo2="photo2.jpg"; ?> <?php include('http://www.DOMAIN.com/includes/header.php'); ?> In the /header.php file: <img src="http://www.DOMAIN.com/photos/<?php echo $photo1; ?>"> When I try to echo $photo1 from within the /header.php file it simply does nothing, even though the variable is declared before the call for the include file. If I try to do the echo with the IMG tag from within the /index.php file, it works no problem -but that wont work without a MAJOR site redesign with how things are configured. Question is, why does this not work, and how can I fix it? Huge thanks from this Newb! Hey, I would there be a way i could create a form in which upon entering a domain name/URL it will tell you how many connections there are to the site and how many (if any) MySQL queries are running? If I add this line to a wordpress footer it displays the number of sql queries. Code: [Select] <?php echo get_num_queries(); ?> queries in <?php timer_stop(1); ?> seconds. Any help is greatly appreciated. Thanks. I have 4 files like attached.... if i clicked on index.php content-1 link... that open templet.php and body load with content-1.txt please helpme I have a sql statement w/c suppose to output only those records w/c has a name of seller. But, it keeps showing all the records. Code: [Select] <?php session_start(); if(isset($_SESSION['name']) || ($_SESSION['contact']) || ($_SESSION['address']) ) { ini_set('display_errors', 0); $name = $_SESSION['name']; $contact = $_SESSION['contact']; $address = $_SESSION['address']; ?> <div id="apDiv1"> <?php echo "Name : $name"; echo "</br>"; echo "Name : $contact"; echo "</br>"; echo "Name : $address"; ?> <div id="apDiv2"> <?php $host="localhost"; $username="root"; $password=""; $db_name="feedbackdb"; mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * FROM Feedbacks WHERE Seller = $name"; $result=mysql_query($sql); echo "<table border=\"5\" width=\"600\" >"; echo "<tr><th>Feedbacks</th><th>From</th><th> To </th>"; if(mysql_num_rows($result)) { while($row = mysql_fetch_assoc($result)) { echo "<tr><td>"; echo "" .$row['Feedback']."<br></td>"; echo "<td>".$row['From']."<br></td>"; echo "<td>".$row['Seller']."<br></td>"; echo "</tr>"; } } else { echo "<tr><td align=\"center\"> No Feedback</td></tr>"; } ?></div> </div> <?php } else { header("location:loginpage.php");; } ?> Is there a way i can make a php code for making a lesson then upload to my made system? Im newbie here. so basically, i need to make an e-learning system that lets the user make a lesson then upload it so that other user can view their made lesson.. Someone help me pls. this doesn't work. Please help fix this. $result1=mysql_query("SELECT * FROM applicants WHERE username = '$user' AND status = 'PendingXCD'"); if(mysql_num_rows($result1)) { $login = "&err=In progress."; echo($login); } else { $result=mysql_query("SELECT * FROM comp WHERE username = '$user' AND password ='$pass'"); if(mysql_num_rows ($result) == 0) { $login = "&err=Please retry."; echo($login); } else { $row = mysql_fetch_array($result); $user=$row['user']; $pass=$row['pass']; $login = "$user=" . $user . "$pass=" . $pass . "&err=Successful."; echo($login); } ?> So I put this in the wrong place so ill try again, I need to write a code to add the price of five items with a subtotal, with tax, and then a grand total. What is the best way to do this? Every way I have tried isnt working PLEASEEEEEE HELP!!! Using crimson editor I have a small mp3 script and its running accurately ...i want to check the mp3 URL before playing it whether the mp3 link active or broken ....how to check the link is active or broken in php thanks I'm trying to update a field in my MySQL but instead of updating this makes the field BLANK. my code: $SomeVar = $_POST['finco']; mysql_query("UPDATE c_applicants SET streetz='$cts' WHERE username = '".$SomeVar."'"); $result = mysql_query($query); How can I get it so the following work: echo utf8_decode($xml->healings[0]->$xmla[0]->descrip[0]); // NOT work echo utf8_decode($xmlb); // NOT work <?php $xml = simplexml_load_file('extra.xml'); $xmla = "test"; $xmlb = "$xml->healings[0]->".$xmla."[0]->descrip[0]"; echo utf8_decode($xml->healings[0]->test[0]->descrip[0]); // works echo utf8_decode($xml->healings[0]->$xmla[0]->descrip[0]); // NOT work echo utf8_decode($xmlb); // NOT work ?> I'm unable to update the table. Could someone tell me why? $dfield1 = mysql_real_escape_string($field1); $dfield2 = mysql_real_escape_string($field2); $dfield3 = mysql_real_escape_string($field3); $dfield4 = mysql_real_escape_string($field4); $result =sprintf("SELECT * FROM db1 WHERE username ='%s'", $dfield1); $resultf = mysql_query($result); if (mysql_num_rows ($resultf) > 0){ $register = "&err=Not Available. Retry."; echo($register); } else { mysql_query("INSERT INTO db1 (name, birthday, street, phone) VALUES ('$dfield1', '$dfield2', '$dfield3', '$dfield4')"); $register = "Successful."; echo($register); } I am self taught and am trying very hard to get a log in page to work. The way i want it to work is that when they log in it uses a url stored in the database for their account. But i am having some much trouble working out a code that works and this is all i got: <?php include ('connection.php'); $username=$_POST['username5']; $password=$_POST['password5']; $query="SELECT password FROM merchants WHERE username = '$_POST(username5)'"; if ($password == $query) { $url = "SELECT url FROM merchants WHERE username = '$_POST(username5)'"; header("Location: $url"); } else { echo urgh } ?> Hai everbody; I am finishing my site to open for public but before i have a small problem! Actually I am using SMF forum software! I need this help very urgently ! Just need to add login (logout) & register in the template menu!! Please guys try to help me out !! I will join the index_template.php file for you to make the correction ! (sorry for my bad english) Thank You a LOT in advance Daya I know this form doesn't really work, but the FTP part *should* work. I select a file, and click upload, Chrome shows the file is uploading and gets to 100% then fails. I'm getting "File Upload Failed!" on line 112 every time, but I can't seem to figure out why. I'm hoping a pair of expert eyes can spot it quickly. Code: [Select] Upload A File: <form enctype="multipart/form-data" action="File_Upload.php" method="POST"> <table> <tr><td>Song Title:</td><td><input></input></td></tr> <tr><td>Singer/Group:</td><td><input></input></td></tr> <tr><td>Album Name:</td><td><input></input></td></tr> <tr><td>Video Link:</td><td><input></input></td></tr> <tr><td>Category:</td><td><input></input></td></tr> <tr><td>Choose a file to upload:</td><td><input name="uploadedfile" type="file" /></td></tr> <tr><td><input type="submit" value="Upload File" /></td></tr> </table> </form> <?php //********************************************************************************************** echo "Please wait while we attempt to upload your file...<br><br>"; //********************************************************************************************** $target_path = "temp_uploads/"; $flag = 0; // Safety net, if this gets to 1 at any point in the process, we don't upload. $filename = $_FILES['uploadedfile']['name']; $filesize = $_FILES['uploadedfile']['size']; $mimetype = $_FILES['uploadedfile']['type']; $filename = htmlentities($filename); $filesize = htmlentities($filesize); $mimetype = htmlentities($mimetype); $target_path = $target_path . basename( $filename ); if($filename != ""){ echo "Beginning upload process for file named: ".$filename."<br>"; echo "Filesize: ".$filesize."<br>"; echo "Type: ".$mimetype."<br><br>"; } //First generate a MD5 hash of what the new file name will be //Force a MP3 extention on the file we are uploading $hashedfilename = md5($filename); $hashedfilename = $hashedfilename.".mp3"; //Check for empty fileif($filename == ""){$error = "No File Exists!"; $flag = $flag + 1; //Now we check that the file doesn't already exist. $existname = "temp_uploads/".$hashedfilename; if(file_exists($existname)){ if($flag == 0){ $error = "Your file already exists on the server! Please choose another file to upload or rename the file on your computer and try uploading it again!"; } $flag = $flag + 1; } //Whitelisted files - Only allow files with MP3 extention onto server... $whitelist = array(".mp3"); foreach ($whitelist as $ending) { if(substr($filename, -(strlen($ending))) != $ending) { $error = "The file type or extention you are trying to upload is not allowed! You can only upload MP3 files to the server!"; $flag++; } } //Now we check the filesize. If it is too big or too small then we reject it //MP3 files should be at least 1MB and no more than 25 MB if($filesize > 26214400){ //File is too large if($flag == 0){ $error = "The file you are trying to upload is too large! Your file can be up to 25 MB in size only. Please upload a smaller MP3 file or encode your file with a lower bitrate."; } $flag = $flag + 1; } if($filesize < 1048600){ //File is too small if($flag == 0){ $error = "The file you are trying to upload is too small!Your file has been marked as suspicious because our system has determined that it is too small to be a valid MP3 file.Valid MP3 files must be bigger than 1 MB and smaller than 25 MB."; } $flag = $flag + 1; } //Check the mimetype of the file if($mimetype != "audio/x-mp3" and $mimetype != "audio/mpeg"){ if($flag == 0){ $error = "The file you are trying to upload does not contain expected data.Are you sure that the file is an MP3?"; }$flag = $flag + 1; } //Check that the file really is an MP3 file by reading the first few characters of the file $f = @fopen($_FILES['uploadedfile']['tmp_name'],'r'); $s = @fread($f,3); @fclose($f); if($s != "ID3"){if($flag == 0){ $error = "The file you are attempting to upload does not appear to be a valid MP3 file.";}$flag++; } //All checks are done, actually move the file... if($flag == 0){ if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { //Change the filename to MD5 hash and FORCE a MP3 extention. if(@file_exists("../music/".$filename)){ //Rename the file to an MD5 version rename("uploads/".$filename, "uploads/".$hashedfilename); echo "The file ".basename( $filename )." has been uploaded. Your file is <a href='uploads/$hashedfilename'>here</a>."; } else{ echo "There was an error uploading the file, please try again! (1)"; } } else{ echo "There was an error uploading the file, please try again! (2)"; } } else { echo "File Upload Failed!<br>"; if($error != ""){ echo $error; } } ?> |