Jump to content

SEVIZ

Members
  • Posts

    93
  • Joined

  • Last visited

    Never

Everything posted by SEVIZ

  1. Thanks. No the amount is pulled from the database on load. And then edited when the page is submitted. The issue is the amount to spend is pulled into the page in a form field. So when they hit back button nothing is executing and its just showing the page as how it was before they left with the form field already showing the number. If I use http refer can I use it so that the page only displays in full if refer = x.php. And if its anything else it shows a message? Would it work like this: <?php $referer = $_SERVER['HTTP_REFERER']; if ($referer == 'http://55.55.55.55/uniform/index.php') { header('Location: http://55.55.55.55/uniform/order.php'); } else { header('Location: http://55.55.55.55/uniform/nono.php'); } ?>
  2. Here is my problem. Hopefully you all can help me figure out a solution. I have a php page that a user logins to and it pulls from a database a number. This number is an amount of money to spend. Once the user fills out the form on the page it then on submit does an UPDATE query and changes the amount to minus what they just spent. The problem I am having is that on the next page the person is hitting the Back button and the previous page shows with the original amount and allows them to submit again. How can I make that page not be able to be seen from the back button? Does this make sense? Is there a way in php that if page referrer = x.php display: no no? Thanks for any help.
  3. Here is my code <?php include('mobile_device_detect.php'); mobile_device_detect(true,true,true,true,true,true,'mobile.php',false); ?> <?php session_start();?> <?php $password = "hellothere"; // Modify Password to suit for access, Max 10 Char. ?> <!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 content="en-us" http-equiv="Content-Language" /> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Text Tool</title> <style type="text/css"> .style1 { background-image: url('bg.jpg'); } .style2 { background-image: url('t_bg.jpg'); } .style3 { background-color: #FFFFFF; } .style4 { text-align: center; } .style5 { text-align: left; font-family: Arial, Helvetica, sans-serif; font-size: Large; font-weight: bold; } .style9 { text-align: left; font-family: Arial, Helvetica, sans-serif; font-size: Medium; font-weight: bold; color: red; } .style7 { font-family: Arial, Helvetica, sans-serif; font-size: small; } .hint { text-align: center; margin-top: 2px; border: 1px solid #a1a1a1; padding: 10px 10px; background-color: #e2e2e2; width: 98%; } .box { border: 1px solid #dcdbdb; padding: 2px 2px; background-color: #f0f0f0; text-align: left; font-family: Arial, Helvetica, sans-serif; font-size: Medium; } </style> </head> <body style="margin: 0; background-color: #000000"> <?php if(isset($_SESSION['errors'])) { echo $_SESSION['errors']; unset($_SESSION['errors']); } // output form ?> <?php // If password is valid let the user get access if (isset($_POST["password"]) && ($_POST["password"]=="$password") || ($_SESSION['login'])) { ?> <!-- START OF HIDDEN HTML - PLACE YOUR CONTENT HERE --> <form action="send.php" method="post"> <table width="98%" border="0" cellspacing="0" cellpadding="4" align="center"> <tr> <td valign="top" class="style5"> Who do you want to text?<br /></td></tr> <tr> <td valign="top"> <select name="recip" class="box"> <option value="none">--- General ---</option> <option value="all">All North and South</option> <option value="sl">All Sups and Leads</option> </select> </td> </tr> <tr> <td class="style5">What do you want to say?<br /></td></tr><tr><td class="style5"><textarea name=message wrap=physical" cols="47" rows="6" id="comment" maxlength="142" class="box"></textarea></td></tr><tr><td class="style7" align="right">Characters Remaining: <input readonly type=text name=remLen size=3 maxlength=3 value="142" /> </td> </tr> <tr> <td> <!-- Reply to email (If applicable):<br /> --><input name="email" type="hidden" id="email" size="20" value="sys@sys.com"></td> </tr> <tr> <td valign="top" align="center"><input type="submit" name="Submit" value="Send Your Text!"></td> </tr> </table> <!-- END OF HIDDEN HTML --> <?php } else { // Wrong password or no password entered display this message if (isset($_POST['password']) || $password == "") { print "<p align=\"center\"><font color=\"red\"><b>Enter Password</b><br>Please enter the correct password</font></p>";} print "<form method=\"post\"><p align=\"center\">Please enter your password for access<br>"; print "<input name=\"password\" type=\"password\" size=\"25\" maxlength=\"10\"><input value=\"Login\" type=\"submit\"></p></form>"; } ?> </form> </body> </html> When the user logs in it lets them fill out a form which submits to a second page. That page then auto reloads back to this page. When it does that it currently asks for the login again. I want it to know its the user and to not have them login again. Someone tried to offer some help with sessions but the code does not work. It doesn't even keep you logged in. Any help is appreciated.
  4. Ok I am using this code <?php // If password is valid let the user get access if (isset($_POST["password"]) && ($_POST["password"]=="$password") || ($_SESSION['login'])) { ?> The above says if the password is right or session login is there let them in. But where do I start the session login? It seems like I should start it in the same place since the session should be started when they are logged in. Any help is appreciated
  5. Your post in my other thread helped already. Thank you for your help.
  6. Any links to how sessions work? I am extremely new to this and have no knowledge of these. Thanks for any tips!
  7. Currently my Submit button loads to a second page. Is that a problem for these helpful examples?
  8. I am using this simple code for a password protect on a php page. <?php // If password is valid let the user get access if (isset($_POST["password"]) && ($_POST["password"]=="$password")) { ?> After the above it displays the content or a login depending on if they entered the password. How can I edit the if statement to also allowed access if the user is coming from a certain address? The reason is that this password gains access to a form that on submit goes to a second page that actually does the query and such. Once done that page redirects back to the form. Currently it then asks for the password again. I want it to just display the content since they are coming from that link. Thanks for any ideas.
  9. I have a dropdown with choices. Inside I have titles for sections with a value of "none". Is there a way via php that if value = none it errors on submit? Most importantly is there a way to do this WITHOUT javascript? Thanks
  10. And that was it. Thank you Andy for spotlighting the obvious.
  11. Andy> Yes I am using nl2br on the message. Like this: $MESSAGE_BODY = nl2br($_POST["message"]);
  12. Maybe I am not explaining this right. The user is typing a message into a messagebox form. THEY are hitting enter for a new line and in the message that is sent it is inserting <br> all by itself. I cannot edit the code as I did not code that in.
  13. I can try that but I do not know how I could do that. Nowhere in the code did I set it to use <br> it is doing it by itself. Is there a way in the code to tell it to use /n instead of <br>?
  14. Hey guys. I have a script I made that emails a message to peoples phones via text. Its very simple and just emails using normal php mail command. Everything is awesome except for one detail. I cannot hit enter in the message or else in the text you actually see "<br>". Is this a flaw in my code somehow? Obviously it is using html by adding the <br> and the phone cannot display an html message. How can I get it to insert a break when enter is hit without showing as <br> in the code? Or is there simply no way? Thanks I would post my code but its just a messagebox and submit. Let me know if you need it though.
  15. I have two numbers in a php script. They are called into my process php file via post. Inside the process php file I need to subtract the one from the other like this: $_POST["MAXAMOUNT"] - $_POST["TOTAL"] = Number here Once the math is done I want to run a query to a database to insert that value into a row depending on the ID that submitted the form. So in all here is what I am trying to do in basic terms. $_POST["MAXAMOUNT"] - $_POST["TOTAL"] = Number here Number here = $number $_POST["ID"] = $id $query="INSERT INTO orderform (balance) WHERE id='$id' VALUES ('$number')"; Is that kinda right? Am I on the right path? Any help is appreciated!
  16. Ok fine. New question: How do I split up over 200 current rows of first and last names into two rows?
  17. I have a row in my table with peoples names. Right now it is last name first and then first name. Is there a query I could run to reverse these two words in all the rows? Currently looks like this: Murphy Peter Kovac Walter Want it to be: Peter Murphy Walter Kovac Thanks for any ideas.
  18. Ok heres what I got. I can now see the num rows result but the if statement does not work. If less than 0 it still shows blank. <?php $con = mysql_connect("-----","--------","----------"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("-------------", $con); $id=$_POST['id']; $result = mysql_query("SELECT * FROM sprint WHERE id LIKE '%$id%'"); $num_rows = mysql_num_rows($result); echo "<table border='0' CELLPADDING=5 STYLE='font-size:13px'>"; echo "<tr> <td><H3>Tech ID</h3></td> <td><H3>Name</H3></td> <td><H3>Phone Number</H3></td><td><H3>Team</H3></td></tr>"; while($row = mysql_fetch_array($result)) { if ($num_rows > 0){ echo "<tr><td>"; echo $row['id']; echo "</td><td>"; echo $row['name']; echo "</td><td>"; echo $row['num']; echo "</td><td>"; echo $row['sup']; echo "</td></tr>"; }else{ echo "<tr colspan=4><td>NO DATA</td></tr>"; } } echo "</table>"; echo $num_rows; echo " Rows"; ?> <br /><br /> <form action="techdbid.php" method="post"> Tech: <input type="text" name="id"><br> <input type="Submit"> </form>
  19. Im dumb I already see the error. Forgot the _ in the variable.
  20. Thats my problem. I must be doing something wrong because the function returns no answer. <?php $con = mysql_connect("-------","---------","---------------"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("------", $con); $id=$_POST['id']; $result = mysql_query("SELECT * FROM sprint WHERE id LIKE '%$id%'"); $num_rows = mysql_num_rows($result); echo "<table border='0' CELLPADDING=5 STYLE='font-size:13px'>"; echo "<tr> <td><H3>Tech ID</h3></td> <td><H3>Name</H3></td> <td><H3>Phone Number</H3></td><td><H3>Team</H3></td></tr>"; while($row = mysql_fetch_array($result)) { echo "<tr><td>"; echo $row['id']; echo "</td><td>"; echo $row['name']; echo "</td><td>"; echo $row['num']; echo "</td><td>"; echo $row['sup']; echo "</td></tr>"; } echo "</table>"; echo $numrows; echo "Rows"; ?> <br /><br /> <form action="techdbid.php" method="post"> Tech: <input type="text" name="id"><br> <input type="Submit"> </form> The page goes through and there is no data there. Its just "Rows". With no number.
  21. I looked at that but I do not understand it. Can I just do an if statement like, " if $result = nothing display error" ?
  22. Here is my simple code. It is a simple query to search a row for data. <?php $con = mysql_connect("--------","-----------","------------"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("----------", $con); $id=$_POST['id']; $result = mysql_query("SELECT * FROM sprint WHERE id LIKE '%$id%'"); echo "<table border='0' CELLPADDING=5 STYLE='font-size:13px'>"; echo "<tr> <td><H3>Tech ID</h3></td> <td><H3>Name</H3></td> <td><H3>Phone Number</H3></td><td><H3>Team</H3></td></tr>"; while($row = mysql_fetch_array($result)) { echo "<tr><td>"; echo $row['id']; echo "</td><td>"; echo $row['name']; echo "</td><td>"; echo $row['num']; echo "</td><td>"; echo $row['sup']; echo "</td></tr>"; } echo "</table>"; ?> <br /><br /> <form action="techdbid.php" method="post"> Tech: <input type="text" name="id"><br /> <input type="Submit"> </form> What can I do so that if there is no results for the query it display an error message? "No ID found". Thank you.
  23. Yea I know that. That is what I am currently doing. But was just curious if there was a way via php itself to just grab the data from mysql and sort it in a table. No biggy. Thanks
  24. Is there a way to display a queries data in a table without using html? Like some kind of php? Here is my code: <?php $con = mysql_connect("--------","---------","----------"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("sevizcom-1", $con); $id=$_POST['id']; $result = mysql_query("SELECT * FROM sprint WHERE id LIKE '%$id%'"); while($row = mysql_fetch_array($result)) { echo $row['id'] . " " . $row['name'] . " " . $row['num'] . " " . $row['sup']; } ?> <br /><br /> <form action="techdbid.php" method="post"> Tech: <input type="text" name="id"><br /> <input type="Submit"> </form> Right now the data is just one long string of the data. How can I break it all up into a table with cells? Thanks!
×
×
  • 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.