Jump to content

derekbelcher

Members
  • Posts

    70
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

derekbelcher's Achievements

Member

Member (2/5)

0

Reputation

  1. My apologies. The links now work. I forgot to upload the files. I am also posting the code below. The first code is for the page the user sees. The second is the page that makes it all work. I think. What I am hoping is that someone with experience can take a look and say "This is why your data isn't making it to the databse" I am not a programmer and really have no idea what I am looking at. Just hoping for a quick fix. Thanks <?php session_start(); if (!ISSET($_SESSION["uid"])) { header( 'LOCATION OF THE WEBSITE HOME PAGE' ) ; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Goshen Sparkling Jewelry - Princeton, WV | (304) 555-5555</title> <link href="/css/goshenMain.css" rel="stylesheet" type="text/css" /> <link href="/css/wt-rotator.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> function updateAlert() { var xmlhttp; var alerttext = document.getElementById("alerttext").value; var alerttype = document.getElementById("alerttype").value; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("alertarea").innerHTML = xmlhttp.responseText; alert("Alert Successfully Updated."); } } xmlhttp.open("POST","alertupdate.php",true); xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); xmlhttp.send("alert="+alerttext+"&alerttype="+alerttype); } function clearAlert() { document.getElementById("alerttext").value = ''; document.getElementById("alerttype").value = 1; updateAlert(); } </script> </head> <body> <div class="container"> <div class="navigation"> <div style="float:left"><a href="?pid=0"><img src="images/template/Logo.gif" border="0" width="398" /></a></div> <div style="float:left"><img src="images/template/logo_right.gif" height="145" width="602" border="0" /></div> </div> <div style="clear:both"></div> <!--Close Navigation--> <div class="content"> <div id="alertarea" class="mainText"> <?php $link = mysql_connect('localhost', 'USERNAME', 'PASSWORD'); if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db('DATABASE'); //First we need to check for an existing demographic record. $alert_result = mysql_query("SELECT * FROM alerts LIMIT 1"); while($row = mysql_fetch_array($alert_result)) { $alert = $row["content"]; $type = $row["type"]; } ?> <table width="799" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="#ffffff"> <tr> <td width="799" valign="top" style="background:#FFFFFF" align="center"><b>Promotion Alert Text</b><br></td> </tr> <tr> <td width="799" align="center" style="background:#FFFFFF" ></td> </tr> <tr> <td valign="middle" width="799" align="center" style="background:#FFFFFF" > <textarea name="alerttext" id="alerttext" cols="80" rows="5"><?php echo $alert; ?></textarea> </td> </tr> <tr> <td valign="middle" width="799" align="center" style="background:#FFFFFF" > </td> </tr> <tr> <td valign="middle" width="799" align="center" style="background:#FFFFFF" > Type of Promotion: <select id="alerttype" name="alerttype"> <? if ($type == 1) { print('<option selected value="1">% or $ off</option>'); } else { print('<option value="1">% or $ off</option>'); } if ($type == 2) { print('<option selected value="2">BOGO</option>'); } else { print('<option value="2">BOGO</option>'); } if ($type == 3) { print('<option selected value="3">Shipping</option>'); } else { print('<option value="3">Shipping</option>'); } ?> </select> </td> </tr> <tr> <td valign="middle" width="799" align="center" style="background:#FFFFFF" > </td> </tr> <tr> <td valign="middle" width="799" align="center" style="background:#FFFFFF" > <input type="button" name="updatebtn" id="updatebtn" value="Update Alert" onClick="updateAlert();"> <input type="button" name="clearbtn" id="clearbtn" value="Clear Alert" onClick="clearAlert();"> </td> </tr> </table> </div> </div><!--Close Content--> <div class="footer"> <div style="float:left"><img src="images/template/footer.gif" height="81" width="435" border="0" alt="footer"></div> <div style="float:left"><a href="?pid=1"><img src="images/template/footer_build.gif" border="0" alt="Build Your Own" /></a><a href="?pid=2"><img src="images/template/footer_premade.gif" border="0" alt="Premade Items" /></a><a href="?pid=3"><img src="images/template/footer_special.gif" border="0" alt="Special Deals" /></a><a href="?pid=4"><img src="images/template/footer_sitemap.gif" border="0" alt="Sitemap and FAQ" /></a><a href="?pid=5"><img src="images/template/footer_contact.gif" alt="Contact Us" border="0" /></a><a href="?pid=6"><img src="images/template/footer_terms.gif" border="0" alt="Terms and Conditions" /></a></div><div style="float:right"><img src="images/template/footer_linksBottom.gif" border="0" /><a href="/login.php"><img src="images/template/login.gif" /></a></div> <div style="clear:both"></div> </div><!--Close Footer--> </div><!--Close Main Container--> </body> </html> Second page: <? $alert = $_POST["alert"]; $alerttype = $_POST["alerttype"]; $link = mysql_connect('localhost', 'USERNAME', 'PASSWORD'); if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db('DB NAME'); mysql_query("UPDATE alerts SET content = '".$alert."', type=".$alerttype." WHERE id = 1"); //First we need to check for an existing demographic record. $alert_result = mysql_query("SELECT * FROM alerts LIMIT 1"); while($row = mysql_fetch_array($alert_result)) { $alert = $row["content"]; $type = $row["type"]; } ?> <table width="799" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="#ffffff"> <tr> <td width="799" valign="top" style="background:#FFFFFF" align="center"><b>Promotion Alert Text</b><br></td> </tr> <tr> <td width="799" align="center" style="background:#FFFFFF" ></td> </tr> <tr> <td valign="middle" width="799" align="center" style="background:#FFFFFF" > <textarea name="alerttext" id="alerttext" cols="80" rows="5"><?php echo $alert; ?></textarea> </td> </tr> <tr> <td valign="middle" width="799" align="center" style="background:#FFFFFF" > </td> </tr> <tr> <td valign="middle" width="799" align="center" style="background:#FFFFFF" > Type of Promotion: <select id="alerttype" name="alerttype"> <? if ($type == 1) { print('<option selected value="1">% or $ off</option>'); } else { print('<option value="1">% or $ off</option>'); } if ($type == 2) { print('<option selected value="2">BOGO</option>'); } else { print('<option value="2">BOGO</option>'); } if ($type == 3) { print('<option selected value="3">Shipping</option>'); } else { print('<option value="3">Shipping</option>'); } ?> </select> </td> </tr> <tr> <td valign="middle" width="799" align="center" style="background:#FFFFFF" > </td> </tr> <tr> <td valign="middle" width="799" align="center" style="background:#FFFFFF" > <input type="button" name="updatebtn" id="updatebtn" value="Update Alert" onClick="updateAlert();"> <input type="button" name="clearbtn" id="clearbtn" value="Clear Alert" onClick="clearAlert();"> </td> </tr> </table>
  2. Hey there. I have a website that has been "dumped" in my lap as my programmer has journeyed to greener pastures. We have a small form that collects a little data and supposedly inserts it into the database, but for some reason that data never makes it there. You can get the two pages that contain the code: http://dev.goshensparklingjewelry.com/page_1.txt is the page that the user goes to to insert the data, and http://dev.goshensparklingjewelry.com/page_2.txt is the magic page that makes it happen. Not sure what is going on. When you submit the data, you even get the success page as if it went through alright. There is also a place in there that reads and displays data that is already in there, and that part works as well. thanks!
  3. Thank you netaneledri! I appreciate you bailing me out here. We are working out an agreement with a new tech firm to manage this stuff, but I had a client in need in the interim. Total Lifesaver. I had a feeling it was something small, but just don't know how to read the code. Thanks again!
  4. I am in desperate need of assistance with an inherited script from a "no-longer-works-with-me" website desiger. Long story short, my web developer left for another job and I have a script that a client is having trouble with. This script allows the admin to upload a new member's name, title, and picture. The picture is inserted into a file on the server. The problem is that the file is inserted with a default permission of 600 which does not allow the pic to be viewed on the public facing website or the admin page. I have read that chmod may be my answer, but am not a programmer by any means and have no idea where to implement this fix. I have attached the code as a .txt file - its the full code that resides on this page. Any help is greatly appreciated. code.txt
×
×
  • 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.