Jump to content

INeedAGig

Members
  • Posts

    112
  • Joined

  • Last visited

    Never

Everything posted by INeedAGig

  1. Alrighty, I have been working on a simple hit counter and I can't quite get it to work, I am having trouble getting the system to actually display the amount of hits, here is the code for review. This code below is located within the file I call 'count_processor.php' <?php $myfile = "counter/hits.txt"; if(file_exists($myfile)) //Check for file { $var = fopen('$myfile,\'r+\''); //opens in read and write mode our file $visits = fread($var,filesize($myfile)); //puts the content of the file for its whole lenght rewind( $var ); //resets the file position indicator to the beginning $visits++; //increments the actual number of vists by 1 fwrite($var, $visits); //writes in the variable the actual (incremented) value fclose($var);//closes our file reference } else { print "File $myfile doesn't exist..."; Die(); //if the file doesn't exist prompts a warning and kills the script } $message = sprintf("%s recent visitors",$visits); //saves our visits message in a variable ($message) that will be used as output print $message; ?> Now, this small snippet of code is located on the page I want to count hits for, which is the index.php file. This calls upon the above code and in turn renders the data onto the page, but all that is showing up on the index.php page is 'recent visitors' which is the text after the numerical value of visitors is displayed, i.e. "137 recent visitors" <?php include 'counter/count_processor.php'; ?> Any ideas? Thanks! Also, you will notice I am using a flat-file system (.txt), no MySQL database.
  2. Alrighty, I have an idea, but I am not quite sure where to start with it. I have been programming in HTML/PHP etc for many years, but I am wanting to expand my PHP form system/processor a bit. I have a system I programmed for a client of mine that is basically a lead capturing form, the user fills out the form and the data is sent to where it needs to go (his email by request). I have done a little bit of work in VB, and this is where my idea comes in. I am as well as he is wanting to have better control of the 'leads' that come in. I am possibly wanting to create a management system in VB, this way he can message the lead directly from the system, delete data, move data, edit data, etc. What would be the best way to go about doing this? How would I go about getting the form on the internet talk to the program? I know this project will take some time, especially with me not having a ton of VB experience, but I am trying to find a good starting ground to start working a custom program into it. Thanks!
  3. Hey there guys, I'm in need of a little bit of help. What would be the best way to have a new window/tab open upon a user clicking the exit button for the window/tab they are in? Thanks in advance!
  4. This is the exact result I was going for, just had my code a little jumbled. Thanks for your help Xtopolis!
  5. Sorry, me again. I don't think I am formatting the info in the correct spot, here is a code example, which is returning a server error. $time = $_SERVER['REQUEST_TIME'] date("F j, Y, g:i a"); Thanks!
  6. Oh okay, so I missed a step I guess. Thanks for your reply!
  7. Okay, I have this form system/processor I have programmed and I am having a minor issue. When the form data is sent via email I want the date/time the user submitted the information included in the email, mainly for records. Now, I thought using $_SERVER['REQUEST_TIME'] would work, but it is returning a value of "1320019222" in the email, any tips on how to fix this?? Thanks!!
  8. Actually, it appears that I got it working now. I had the submit button input type set to "image" so I can use an image as the submit button, and once I changed it over to a regular "submit" input type, it works....odd...
  9. Which part would you like to see?
  10. It only seems to be happening in IE.
  11. Hey guys, how are you. I have an odd problem and I am not sure what is causing it. I recently finished my form system, with PHP validation that sends the inputted information via email. Now, everything is working fine on my end with absolutely no issues, but it is not working on any other computers, even though my computer is in no way hosting the files. Now, the issue other computers are getting is when the form is filled out it doesn't redirect to the success page, it redirects back to the form page with nothing filled out and it doesn't display the errors on the page. Any idea on what might be causing this? Again, EVERYTHING works flawlessly on my end, that being, the display of any errors, the proper redirect, everything. Thanks!!!
  12. Thank you for your reply. All is working fine now.
  13. Okay, I am writing a new form validation script that also keeps the data so it can re-populate the fields the user already filled out if there is an error on the page so they do not have to fill it out again. Here is an example of the code I am using in the HTML part of the form input elements. <input name="name" type="text" id="name" value="<?php=$fields['name']?>"> Now, the problem I am getting is the <?php=$fields['name']?> code is being physically displayed within the form field at all times. How would I go about having it not display this line of code in the field? Thanks!!
  14. Apologies. This is the code I have written that displays the results. Using the suggestions you provided to change the sort order makes it so the page doesn't display any of the data in the tables like it normally does without the sort order coding in place. I have attached the snippet of coding below that I wrote to display the data in the database. <th bgcolor="#01337f"><font face="Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">Name</font></th> <th bgcolor="#01337f"><font face="Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">E-Mail</font></th> <th bgcolor="#01337f"><font face="Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">Age</font></th> <th bgcolor="#01337f"><font face="Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">Gender</font></th> <th bgcolor="#01337f"><font face="Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">Location</font></th> <th bgcolor="#01337f"><font face="Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">Home Phone</font></th> <th bgcolor="#01337f"><font face="Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">Other Phone</font></th> <th bgcolor="#01337f"><font face="Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">Best Time to Reach</font></th> <th bgcolor="#01337f"><font face="Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">Referrer</font></th> <th bgcolor="#01337f"><font face="Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">--- Options ---</font></th> </tr> </div> <div id="footer"> <div class="footer_content"> <font class="footer_header"> Data removed from here for this post </div> </div> <?php $i=0; while ($i < $num) { $id=mysql_result($result,$i,"id"); //Unique ID Field $name=mysql_result($result,$i,"name"); //Name $email=mysql_result($result,$i,"email"); //EMail Address $age=mysql_result($result,$i,"age"); //Age $gender=mysql_result($result,$i,"gender"); //Gender $location=mysql_result($result,$i,"location"); //City of Residence $homephone=mysql_result($result,$i,"homephone"); //Home Phone Number $otherphone=mysql_result($result,$i,"otherphone"); //Secondary Phone Number $besttime=mysql_result($result,$i,"besttime"); //Best Time to Reach $referrer=mysql_result($result,$i,"referrer"); //Referrer ?> <tr> <td align="center" bgcolor="#ebf4fb"><font class="lead_txt"><? echo $name; ?></font></td> <td align="center" bgcolor="#ebf4fb"><font face="Arial, Helvetica, sans-serif" size="2" class="lead_txt"><? echo $email; ?></font></td> <td align="center" bgcolor="#ebf4fb"><font face="Arial, Helvetica, sans-serif" size="2" class="lead_txt"><? echo $age; ?></font></td> <td align="center" bgcolor="#ebf4fb"><font face="Arial, Helvetica, sans-serif" size="2" class="lead_txt"><? echo $gender; ?></font></td> <td align="center" bgcolor="#ebf4fb"><font face="Arial, Helvetica, sans-serif" size="2" class="lead_txt"><? echo $location; ?></font></td> <td align="center" bgcolor="#ebf4fb"><font face="Arial, Helvetica, sans-serif" size="2" class="lead_txt"><? echo $homephone; ?></font></td> <td align="center" bgcolor="#ebf4fb"><font face="Arial, Helvetica, sans-serif" size="2" class="lead_txt"><? echo $otherphone; ?></font></td> <td align="center" bgcolor="#ebf4fb"><font face="Arial, Helvetica, sans-serif" size="2" class="lead_txt"><? echo $besttime; ?></font></td> <td align="center" bgcolor="#ebf4fb"><font face="Arial, Helvetica, sans-serif" size="2" class="lead_txt"><? echo $referrer; ?></font></td> <td bgcolor="#01337f""><a href="db_edit.php?id=<?php echo $id; ?>"><img src="images/edit.png" border="0" width="25" height="25" alt="Edit"></a> <a href="db_remove.php?id=<?php echo $id; ?>"><img src="images/delete.png" border="0" width="25" height="25" alt="Delete"></a> <a href="email_lead.php?id=<?php echo $name, $email; ?>"><img src="images/email.png" border="0" width="25" height="25" alt="E-Mail"></a></td> </tr> </center> </font> </body> </html> <?php $i++; } echo "</table>"; ?>
  15. Thank you for your response MJ, it's much appreciated. I made changes using your suggestions but now none of the data is being displayed...
  16. Okay, I have a small issue. The database page is automatically refreshing when one of the options is selected and echoing the selected option properly in the address bar after the url as well but it is not physically changing the order in which the database is displayed, it is just staying with the main sort order I programmed to begin with. I have attached some code snippets from my main database page to help you help me. These are the first PHP functions before the html aspect of displaying the database <?php session_start(); if (!isset($_SESSION['username']) || (trim($_SESSION['username'])=='')) { header("location: login.php"); exit(); } //Connect to Database $db_username="removed_for_this_post"; $password="removed_for_this_post"; $database="removed_for_this_post"; mysql_connect("removed_for_this_post",$db_username,$password); //Connection to Database @mysql_select_db($database) or die("ALERT! Database not found!"); //Selection of Database $query="SELECT * FROM leads ORDER by id DESC"; //This is my default sort order from my table 'leads' $result=mysql_query($query); $num=mysql_numrows($result); if ($_GET['name']){//This is to order it by the name field in the database $orderby="SELECT * FROM leads ORDER by name DESC"; } if ($_GET['age']){//This is to order it by the age field in the database $orderby="SELECT * FROM leads ORDER by age DESC"; } mysql_close(); ?> This is the Javascript for the select box control <head> <link href="css/db_style.css" rel="stylesheet" type="text/css" media="screen" /> <script language="javascript" type="text/javascript"> function reload(form) { var val=form.sort.options[form.sort.options.selectedIndex].value; self.location='mypd_interface.php?sort=' + val ; } </script> </head> This is the code for the select box <form method="get" name="sort"> <select name="sort" id="sort" onchange="reload(this.form)"> <option value="">--Select--</option> <option value='Name'>Name</option> <option value='Age'>Age</option> </select> </form> Thanks guys!
  17. Alright, cool. I forgot about the onChange event handler...didnt' even think about that... Thanks for your replies guys, I am going to test out your suggestions and see how it plays out. I appreciate your help!
  18. What would I apply to the actual options in the select box? (code wise) so it automatically changes when you select one of the options without having to hit a submit button... thanks!!
  19. Hey guys, I am having trouble figuring this out. I currently have a database that automatically sorts itself by the id of the data. But, I am wanting the user to be able to change the sort order via a select box. I already have the select box programmed with the options, but I am not sure how to go about coding the options to change the sort order of the displayed data. What would the best way to go about programming this be? Thank you very much ahead of time!!
  20. Nevermind, I narrowed it down, its the Javascript validation. If it is turned off in the browser, the user can hit the submit button and bypass the validation and thus, it returns a blank form. One question though, is there any type of PHP validation anyone can recommend? That way I don't have to worry about the validation having a back door....
  21. Okay, minor issue, but not sure how to resolve. I have a form that processes through PHP and has it's fields validated with JS and sends the data to an e-mail address and a database. It works fine, but there are random times where a submitted entry will show up blank in the e-mail and not be in the database at all, any ideas on what might be causing this? 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.