Jump to content

jmr3460

Members
  • Posts

    289
  • Joined

  • Last visited

Everything posted by jmr3460

  1. Are you trying to remove all the files that do not have a matching name in your database?
  2. Hello All, I am looking for knowledge on some things in my php.ini file. My hosting company turns off the safe mode, is that usual? What happens if I turn on the Safe Mode? What happens if I turn it On? Somehow, someone inserted a bit of code on one of my files. It was a passthru() and it showed a list of folders and files inside the folder the passthru() was in. Can someone help me with some security information? Thanks for any help, jmr3460
  3. When I delete a row of information the row number sometimes is used again. Say I delete the information on row 5. If the total number of rows say is 15 less the row number 5 sometimes when I insert new information mysql will use row 5 again.
  4. Is there a way to direct mysql to not use rows that were deleted? I have a calendar database that has rows deleted, sometimes 1 row, sometimes 3 rows. When I insert new rows of data mysql uses some of those deleted rows to insert new data on. Can I stop this from happening? This could cause problems when I find duplicates and delete them.
  5. OK again, I have gotten this far now. <html> <form id="aform"> <select id="mymenu" size="1"> <option value="nothing" selected="selected">Select a site</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> </select> </form> <script type="text/javascript"> var selectmenu=document.getElementById("mymenu") selectmenu.onchange=function(){ //run some code when "onchange" event fires var chosenoption=this.options[this.selectedIndex] //this refers to "selectmenu" if (chosenoption.value!="nothing"){ document.write("you have chosen "); document.write(chosenoption.value); document.write("<br />"); for(i=0;i<chosenoption.value;i++){ document.write("<select name=\"t"); document.write(i+1); document.write("_size\">"); document.write("<option value=\"S\">Small</option>\n"); document.write("<option value=\"M\">Medium</option>\n"); document.write("<option value=\"L\">Large</option>\n"); document.write("<option value=\"XL\">X Large</option>\n"); document.write("<option value=\"XXL\">XX Large</option>\n"); document.write("<option value=\"XXXL\">XXX Large</option>\n"); document.write("</select>"); document.write("<br /><br />"); } } } </script> </html> Everything works except my original select list disappears and my browser seems to be looking for something else. I really don't want my original select list to disappear. Browser only stops running when I click my stop or big X button. Is that normal?
  6. OK I have gotten this far. I can get this to print hello world how every many times I select in my select menu. It will not give me the number of select menus I am going for and the original select option box disappears as well. <html> <form id="aform"> <select id="mymenu" size="1"> <option value="nothing" selected="selected">Select a site</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> </select> </form> <script type="text/javascript"> var selectmenu=document.getElementById("mymenu") selectmenu.onchange=function(){ //run some code when "onchange" event fires var chosenoption=this.options[this.selectedIndex] //this refers to "selectmenu" if (chosenoption.value!="nothing"){ for(i=0;i<chosenoption.value;i++){ var myString; myString = "<select name=\"t".i."_size\"> " + "<option value=\"small\">Small</option>" + "<option value=\"medium\">Medium</option>" + "<option value=\"large\">Large</option>" + "<option value=\"Xlarge\">Xlarge</option>" + "</select>"; document.write(myString); } } } </script> </html> Is there anyone that can help me.
  7. After doing more research I see that it would be harder to convert javascript to php. So now I am looking to (document.write) a select option box the number of times chosen with values rainging from 1 to the number selected from the first selected value.
  8. OK this is what I have found so far.I need to find out how to convert javascript var to php $var <html> <form id="aform"> <select id="num_tshirts" size="1"> <option value="nothing" selected="selected">Number of T-shirts</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> </select> </form> <script type="text/javascript"> var selectmenu=document.getElementById("num_tshirts") selectmenu.onchange=function(){ //run some code when "onchange" event fires var chosenoption=this.options[this.selectedIndex] //this refers to "selectmenu" if (chosenoption.value!="nothing"){ //window.open(chosenoption.value, "", "") //open target site (based on option's value attr) in new window //This is where I think I need some help //I need to convert javascript ( var chosenoption=this.options[this.selectedIndex] ) into a php variable $var // I may have to look at my for(code)again <?php for(n=1;n<$var;n++){ echo "<select name=\"size".$var."\"> <option value=\"small\">small</option> <option value=\"medium\">medium</option> <option value=\"large\">large</option> <option value=\"Xlarge\">Xlarge</option> </select>"; } } </script> </html>
  9. I have been reading through some of the postings from this site and some others. I have never really written any Javascript or AJAX but I know that I will need to learn. I am a little rushed for time or I would blindly search for solutions today, but I really need to get a simple solution (if there is one) and implement it today. I have a form that is for t-shirts selecting 1 - 10. What ever number they select I want that number of select option boxes to appear below the number of t-shirt box with the sizes in them. I just want the same select option boxes with different values though. If there is a place where I can find this information please link me to it. Simply putting the question, if they pick 6 for number of t-shirts then 6 select option boxes will appear. The main problem that is happening is at this time I have select option box with 6 in it and 6 select boxes below that one but people will fill out 3 t-shirts then will fill in more or less that the number that they selected and it is throwing off my database totals. Thanks for any help that anyone can provide. Mark
  10. Thanks for the reply, All of the events are the same, just different addresses. (I am getting the location from the users profile.) I created two new tables (event, open_close). This is the information for the tables I have now. CREATE TABLE IF NOT EXISTS `event` ( `event_id` int(3) unsigned NOT NULL AUTO_INCREMENT, `user_id` int(3) NOT NULL, `date_start` date NOT NULL, `date_end` date NOT NULL, PRIMARY KEY (`event_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `open_close` ( `open_id` int(3) unsigned NOT NULL AUTO_INCREMENT, `event_id` int(3) NOT NULL, `day` date NOT NULL, `open_time` time NOT NULL, `close_time` time NOT NULL, PRIMARY KEY (`open_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; I have in the past had a little trouble converting mysql time to php time but I will see what it takes and conform. I do want to do it the best way. I am going to do this in a two step process, but that is probably a php thing so I will bring that up their if I have any problems with that. Thanks for any and all of your help.
  11. I am working on a site that will allow users to schedule events for one week at a time. Each day they can schedule an opening and closing time. My current table is structured like this: `event_id` int(3) unsigned NOT NULL AUTO_INCREMENT, `user_id` int(3) NOT NULL, `date_start` varchar(10) NOT NULL, `day1_open` varchar(10) NOT NULL, `day1_close` varchar(10) NOT NULL, `day2_open` varchar(10) NOT NULL, `day2_close` varchar(10) NOT NULL, `day3_open` varchar(10) NOT NULL, `day3_close` varchar(10) NOT NULL, `day4_open` varchar(10) NOT NULL, `day4_close` varchar(10) NOT NULL, `day5_open` varchar(10) NOT NULL, `day_5close` varchar(10) NOT NULL, `day6_open` varchar(10) NOT NULL, `day6_close` varchar(10) NOT NULL, `day7_open` varchar(10) NOT NULL, `day7_close` varchar(10) NOT NULL, After looking at scripting from this table it is looking a little difficult. My question is, "Can anyone suggest a more simpler structure?" Thanks for any ideas.
  12. Thank you very much. I guess I need to not only try and learn about php functions but if I am going to use mysql maybe it would be beneficial to learn some mysql functions. I am truly Grateful.
  13. I have a table that has different values on each row and I need to add the values from each row from one field column. I have tried using a while loop to loop through all the rows and everything echos but I am not sure how to add the values of each row together. Can someone point me in the right direction?
  14. Thanks for trying. I was not sure what you were saying hooked to. I used strtotime() and did a little different math. $timed = strtotime($clean); $cutoff = strtotime("17 September, 2010"); $diff = ($timed - $cutoff); if($diff > 0){ $registration_money = 30; } else { $registration_money = 25; } Thanks again
  15. I have two dates if first date is less that second date then $variable is 'a', else $variable is 'b'.
  16. I am trying to use an if (){}else{} with time(). $clean = $month."-".$day."-2010"; $time = time($clean); $number = 1284706800; if($time <= $number){ $registration_money = 30; } else { $registration_money = 25; } The hope is if the $time which is defined by a date selector is less than 1284706800 (which is the time for a specific date at midnight) then the value of $registration = 30 else it will be = 25.
  17. I have built and am using a dB on domain 1 that I would like to use some data on domain 2 for display only. I have created username and added username to the database and only given that user select permissions only. I keep getting the following errors: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'arscnaor_tana'@'23-241.bluehost.com' (using password: YES) in /home3/simplic5/public_html/texarkana/meetings/test_meetings.php on line 7 Notice: Access denied for user 'arscnaor_tana'@'23-241.bluehost.com' (using password: YES) in /home3/simplic5/public_html/texarkana/meetings/test_meetings.php on line 7 Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home3/simplic5/public_html/texarkana/meetings/test_meetings.php on line 8 Access denied for user 'arscnaor_tana'@'23-241.bluehost.com' (using password: YES) First question is Can I display data from one domain on a page in another domain? Second if so where am I going wrong? Here is my code: <?php ini_set ("display_errors", "1"); error_reporting(E_ALL); session_start(); //connect to server and select database $db_name = "arscnaor_meetings"; $connection = mysql_connect("arscna.org", "user", "pass") or trigger_error(mysql_error()); $db = mysql_select_db($db_name, $connection) or die(mysql_error()); ?>
  18. I found it. The else statement in the if of the foreach loop was stopping it. Thanks for looking.
  19. Hello All, I am developing a download counter. The only thing I am not sure why the array_key_exists() stops after the first false or first key that does not return true. The manual says: "array_key_exists() returns TRUE if the given key is set in the array. key can be any value possible for an array index." I have moved my array values around and if my $_GET link is ?id=whicheverfirst it works. Here is my php: <?php session_start(); ini_set ("display_errors", "1"); error_reporting(E_ALL); include('in_db.php'); $database = ''; $needle = $_GET['id']; $ip = $_SERVER['REMOTE_ADDR']; $date = date("Y-m-d G:i:s", time()+3600); $download_array = array('minutes' => 'minutes.pdf', 'meetings' => 'meetings.pdf'); if(array_key_exists($needle, $download_array)){ foreach($download_array as $key => $value){ if($needle == $key){ header("Location: http://www.web.org/downloads/".$value); exit(); } else { exit(); } } } ?> Can anyone tell me why it stops after the first false? Thanks
  20. Doing some more checking I think that that the issue is happening where I am checking if my $_SESSIONS["$page"] is set. if(isset($_SESSIONS["$page"])){ //do something here} Is this the right way to check if sessions are set?
  21. Hello All, I am trying to get my counter script working. The $count is inserting into DB and setting $SESSIONS correctly. What seems to be happening is even when $_SESSIONS are set it should only retrieve the existing count in DB without increasing the $count value. I am trying to count only one for each page for each session. I have three files I am working with. Can someone tell me what I am not seeing? This is count.php: <?php $table = 'counter'; $browser = $_SERVER['HTTP_USER_AGENT']; $date = date("M-d-Y G:i:s", time()+3600); $bots = array("/Robozilla/i","/SurveyBot/i","/W3C_Validator/i","/VoilaBot/i","/spider/i", "/Slurp/i","/Yandex/i","/LinkWalker/i","/Googlebot/i","/Exabot/i","/Java/i", "/msnbot/i","/Crawler/i","/Bot/i","/oozbot/i","/nutch/i","/Xenu/i","/Wget/i","/Jeeves/i"); foreach($bots as $bot){ if(preg_match($bot, $browser)){exit();} }//This ends browser check //This starts count check if(isset($_SESSIONS["$page"])){ //This if $_SESSIONS['count'] is set should check page_name for $_SESSIONS if($_SESSIONS["$page"] == $page){ mysql_connect($host, $user, $pass); mysql_select_db($database) or die(mysql_error()); $sql = "SELECT * FROM $table WHERE page_name = '$page'"; $query = mysql_query($sql) or trigger_error(mysql_error()); $result = mysql_fetch_array($query); $count = $result['count']; } else { $_SESSIONS["$page"] = $page; mysql_connect($host, $user, $pass); mysql_select_db($database) or trigger_error(mysql_error()); $sql = "SELECT * FROM $table WHERE page_name = '$page'"; $get_count = mysql_query($sql) or trigger_error(mysql_error()); $result_count = mysql_fetch_array($get_count); $pre_count = $result_count['count']; $add_count = $pre_count + 1; $add_sql = "UPDATE $table SET count = '$add_count' WHERE page_name = '$page'"; $add_query = mysql_query($add_sql) or trigger_error(mysql_error()); $count = $add_count; echo "First else"; } } else{ //This should set $_SESSIONS['count'] if not set //and add one to DB $_SESSIONS["$page"] = $page; mysql_connect($host, $user, $pass); mysql_select_db($database) or trigger_error(mysql_error()); $sql = "SELECT * FROM $table WHERE page_name = '$page'"; $get_count = mysql_query($sql) or trigger_error(mysql_error()); $result_count = mysql_fetch_array($get_count); $pre_count = $result_count['count']; $add_count = $pre_count + 1; $add_sql = "UPDATE $table SET count = '$add_count' WHERE page_name = '$page'"; $add_query = mysql_query($add_sql) or trigger_error(mysql_error()); $count = $add_count; echo "Second else"; } ?> These files are what I want to insert on any page that I want to be counted: <?php session_start(); $page = 'count1'; include('in_db.php'); include('count.php'); echo "Number: ".$count."<br />".$browser; if(isset($_SESSIONS["$page"])){ echo "<br />".$_SESSIONS["$page"]; } ?> <?php session_start(); $page = 'count2'; include('in_db.php'); include('count.php'); echo "Number: ".$count."<br />".$browser; if(isset($_SESSIONS["$page"])){ echo "<br />".$_SESSIONS["$page"]; } ?> Thanks for any help.
  22. I believe your form checkboxes should have the same name like name="order" and your value should define the value of the checkbox, value="fries". <form method="post" action="do_form.php> <input type="checkbox" name="order[]" value="fries"> Fries <input type="checkbox" name="order[]" value="hamburger"> Hamburger <input type="checkbox" name="order[]" value="coke"> Coke <input type="submit" name="submit" value="SUBMIT ORDER"> This form is very simple html. Then you should create a php script that would process the order searching a database table for the field of fries, then selecting a field in that row which would have the price of that product. See if this gets you started in the right direction. Good Luck.
  23. OK I have the form working now and reading through my notes I see where the article mentioned double-barreled extensions. As I am checking for extension and mime-type of file. The process renames the file. Should this take care of the double-barrel extension?
  24. OK I tried to combine and I am having trouble with the pub ext: <?php ini_set ("display_errors", "1"); error_reporting(E_ALL); session_start(); if(isset($_POST['submit'])){ $acceptable_ext = array('pdf' => 'application/pdf', 'doc' => 'application/msword', 'docx' => 'application/msword', 'pub' => 'application/x-mspublisher', 'pub' => 'application/vnd.mspublisher'); if(isset($_FILES['test_file']['tmp_name'])){ $type = $_FILES['test_file']['type']; $ext = pathinfo($_FILES['test_file']['name'], PATHINFO_EXTENSION); if(in_array($type, array_values($acceptable_ext))){ //process form if(in_array($ext, array_keys($acceptable_ext))){ //process form echo "Upload: " . $_FILES["test_file"]["name"] . "<br />"; echo "Type: " . $_FILES["test_file"]["type"] . "<br />"; echo "Size: " . ($_FILES["test_file"]["size"] / 1024) . " Kb<br />"; echo "Stored in: " . $_FILES["test_file"]["tmp_name"]; } } else { echo "Wrong Extension"; } } } else { ?> <html> <form method="post" action="text_upload.php" enctype="multipart/form-data"> <input type="file" name="test_file"> <input type="submit" name="submit" value="SUBMIT"> </form></html> <?php } ?> This works for doc and pdf but not for pub, Why?
×
×
  • 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.