Jump to content

foevah

Members
  • Posts

    162
  • Joined

  • Last visited

    Never

Everything posted by foevah

  1. Hi I found this tutorial: I edited the code (see below) and when it gets t evening the evening.css stylesheet doesnt load.. I have adjusted my time locally to check - morning and afternoon work but evening doesnt it displays default.css.. Can someone tell me why evening doesnt work? <?php // Get the current hour (24-hr clock) $time = date('H'); // check to see if theme is passed in the URL and, if not, // set it based on the current hour if(!isset($_GET['theme'])) { if($time >= '04' and $time < '12') { $css = 'css/morning.css'; } elseif($time >= '12' and $time < '19') { $css = 'css/afternoon.css'; } elseif($time >= '19' and $time < '04') { $css = 'css/evening.css'; } else { $css = 'css/default.css'; } } else { // if the theme is passed in the URL, specify a list of // valid theme names $themes = array('morning', 'afternoon', 'evening'); // if the theme is passed in the URL and the theme name // is in the $themes array, set the theme; otherwise, throw an error if($_GET['theme'] and in_array($_GET['theme'], $themes)) { $css = 'css/' . $_GET['theme'] . '.css'; } else { $error = TRUE; echo 'You have specified an invalid theme.'; } } ?>
  2. i am using jquery in the code i pasted above I have it attached in the head. The "thank you" message fades out using jquery's .hide do you mean this plugin http://malsup.com/jquery/form/ ? if so please can you help me merge it with my current code?
  3. Hi I was wondering how I can turn a PHP form I am using into an AJAX form so the page doesn't refresh when the submit button has been pressed? Right now the form successfully posts data into a MySql db and once submitted a valid email it says thank you! Below is the code I am using, if someone can help me make it work without refresh but keep all the validation and thank you message would be great! <!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=utf-8" /> <script type="text/javascript" src="js/jquery.1.2.6.js"></script> <script> $(document).ready(function() { $("#thankyou").hide(8000); }); </script> </head> <body> <?php /* keep functions at the top of the page and together - keeps it tidy NOTE: merged the two functions together */ function clean_data($string) { if (get_magic_quotes_gpc()) { $string = stripslashes($string); } $string = htmlentities($string); $headers = array( "/to\:/i", "/from\:/i", "/bcc\:/i", "/cc\:/i", "/Content\-Transfer\-Encoding\:/i", "/Content\-Type\:/i", "/Mime\-Version\:/i" ); $string = preg_replace($headers, '', $string); return mysql_real_escape_string($string); } /* Open database connection */ $conn = mysql_connect('localhost', 'root', 'password'); mysql_select_db('submissions'); /* empty error message that will be filled later on */ $errorMsg = ''; /* if the form has been sent.... ** only process if the hidden field 'formSend' is present in the POST Array ** Using hidden fields means the user can hit enter or click the submit button */ if(isset($_POST['formSend'])) { /* assign simple variables to the POST array add in you data cleansing functions here */ $email = clean_data($_POST['email']); /* start doing checks for data authenticity and values */ /* check the email is valid */ if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { $errorMsg .= '<span>Please enter a Valid email address</span>'; } /* if the $errorMsg variable is still empty then carry on with the processing */ if($errorMsg == '') { /* start constructing the email message */ $to = 'myemail@address.com'; $subject = "New message: $topic"; $message = "$name said: $comments"; $headers = 'From: '. $email . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); if(mail($to,$subject,$message, $headers)) { echo ("<span id='thankyou'>Thank you</span>"); } /* Insert data into the database table after it has been cleaned */ $query = " INSERT INTO submissions (email) VALUES ('$email')"; mysql_query($query) or die(mysql_error()); // Close connection mysql_close($conn); } else { /* could do something else here ** */ } } /* end if isset SUBMIT */ /* if the errorMsg variable isn't empty echo it */ if($errorMsg != '') { echo $errorMsg; } ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"><fieldset><legend></legend> <table border="0" cellspacing="0" cellpadding="0" style="margin:0 0 0 50px;"> <tr> <th><label for="email">Email address:</label></th> <td><input type="text" id="email" name="email" value="<?php echo $_POST['email']; ?>" /></td> </tr> <tr> <td><?php echo($errorMsg); ?> </td> <td align="right"> <input type="hidden" name="formSend" value="1" /> <input type="submit" name="formSend" value="submit" /> </td> </tr> </table> </fieldset> </form> </body> </html>
  4. I still cant fix this problem. I have installed an older version of PHP (5.2.6) and this hasnt changed a thing.
  5. in the .htaccess file I have this: RewriteRule ^news$ /news/ [R] RewriteRule ^news/$ /index.php?content=pages&id=news&template=$2 I get a browser error message if I go to: http://minicms.local/news but if i go to the long url: http://minicms.local/index.php?content=pages&id=news&template=$2 the page displays correctly showing all news entries. wth is going on? why cant my computer figure out the url rewrite?
  6. using this in my apache vhost file: <VirtualHost *:80> DocumentRoot "M:\web\websites\minicms" ServerName minicms.local <Directory "M:\web\websites\minicms"> AllowOverride all </Directory> </VirtualHost> I get this browser message: When I delete the .htaccess file I can view the landing page (not get that browser message above) but when I click on a link to another page in this site I got this browser message: Im not sure what the culprit is..
  7. For some strange reason when I click on a link that goes to a form it works.. Example: http://minicms.local/forms/contact/ I guess this is because the contact form actually exists in that location the url is not being rewritten..
  8. I also have rewrite_module enabled in my apache http.conf file: LoadModule rewrite_module modules/mod_rewrite.so I installed PHP, MySQL, phpmyadmin and apache yesterday and all of these are the most current download version. I am running on XP 64bit and the only official 64bit download was for MySQL for I downloaded MySQL 64bit and the rest are 32bit. Do you think this may cause some problems? This CMS I installed works on older versions of the PHP, MySQL and Apache. I dont want to uninstall everything and try older version and have the same problem. Any more ideas people? Please help thanks
  9. # # Virtual Hosts # # If you want to maintain multiple domains/hostnames on your # machine you can setup VirtualHost containers for them. Most configurations # use only name-based virtual hosts so the server doesn't need to worry about # IP addresses. This is indicated by the asterisks in the directives below. # # Please see the documentation at # <URL:http://httpd.apache.org/docs/2.2/vhosts/> # for further details before you try to setup virtual hosts. # # You may use the command line option '-S' to verify your virtual host # configuration. # # Use name-based virtual hosting. # NameVirtualHost *:80 # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for all requests that do not # match a ServerName or ServerAlias in any <VirtualHost> block. # <VirtualHost *:80> ServerAdmin webmaster@dummy-host.localhost DocumentRoot "M:/work/web/tools/apache/docs/dummy-host.localhost" ServerName dummy-host.localhost ServerAlias www.dummy-host.localhost ErrorLog "logs/dummy-host.localhost-error.log" CustomLog "logs/dummy-host.localhost-access.log" common </VirtualHost> <VirtualHost *:80> DocumentRoot "M:\web\websites\minicms" ServerName minicms.local </VirtualHost>
  10. in the .htaccess i already have this at the top: RewriteEngine on I have <Directory> in apache\conf\httpd.conf but its in a commented line? # If you include a trailing / on /webpath then the server will # require it to be present in the URL. You will also likely # need to provide a <Directory> section to allow access to # the filesystem path. thats the only time its mentioned? how do i apply the override rights? and I dont see a <Directory> tag in the http-vhosts.conf file found in apache\conf\extra\http-vhosts.conf I just added: AllowOverride All to the .htaccess of minicms.local and it didnt change anything ?
  11. I just installed a mini cms and I have added this site to my virtual host files. The base url is: minicms.local When I go to minicms.local in the browser I see the homepage correctly but when i click on a link thats past the index.php i got this browser message: wth is going on? I think it may have something to do with the .htaccess file in this site? because in the .htaccess file there is this: RewriteRule ^whatson$ /whatson/ [R] RewriteRule ^whatson/(template=([a-zA-Z]+))?$ /index.php?content=whatson&template=$2 If i go to the long url it works but the shorterned version doesnt? basically this should work but doesnt: minicms.local/whatson instead i get this: and for some strange reason this link works and shows me the webpage correctly: minicms.local/index.php?content=whatson&template=$2 If anyone has any ideas why the minicms.local/whatson/ doesnt work please let me know!?
  12. fixed in cmd i needed to type M: then paste the sql dump line
  13. I am having trouble importing a large SQL file into MySQL. I am pasting this into start run cmd: cd M:\MySQL\MySQL Server 5.1\bin mysql -h localhost -u root -p db_name < db_data.sql and I get this message: The system cannot find the file specified. I have one disk drive that is partioned. The CMD window starts on the C drive but MySQL is installed on my M drive. I have tried changing drives by entering: cd M:\ but nothing happens it stays on the C drive. I think is this part of the problem? Can someone help me fix this please? This SQL file is a beast. It is at 7000kb
  14. hm slight problem.. when you click view main courses it doesn't move to the tandoori dishes page.. It is being confused with the id tandoori being in two places. There is an id tandoori on the tandoori page so the anchor knows which page to slide to.. Is there a way to add the class selected to the relevant item on the left hand menu when either <<previous or next>> arrows are clicked in the content area? I have uploaded the changed to the link above and heres a break down of whats going on at present: <script> jQuery(function( $ ){ $('a.next').click(function() { $("'" + $(this).attr('href') + "'").toggleClass("selected") }); }); </script> <li><a href="#tandoori" class="next">View Main Courses >></a></li>[i]// click view main courses and it takes you too tandoori page (this is inside starts.php include same as below)[/i] // this is the tandoori page that it should show after click view main courses note id="tandoori" <ul id="tandoori" style="position:relative;" class="section mp"> <?php include('menu/tandoori.php'); ?> [i]//inside this include is content and another one of these like above <li> <a href="#chief" class="next" style="position:absolute; top:290px;">Chief Specialities >></a></li>[/i] </ul> <li class="main_courses"><a href="#tandoori" id="tandoori">Tandoori dishes</a></li>[i]//this is the new id="tandoori" that has been added to the left hand menu. It needs to highlight once clicked on view main courses and the same should happen on all >> and << arrows in all content areas to view the previous and next pages..[/i]
  15. but i dont just want tandoori to highlight when you click view main courses >> after clicking view main courses you will see Chief Specialities >> and so when you click Chief Specialities I want Chief Specialities to highlight on the left menu.. You will also see << Starters in the Tandoori page so when you click << Starters I want the Starters link on the left menu to highlight..
  16. Click this link to see what I am trying to do: http://www.gulaab.co.uk/test/menu.php When you click View Main Courses >> <a href="#tandoori" class="next">View Main Courses >></a> it makes all of the menu on the left red.. I just want the next item on the menu to highlight (Tandoori dishes) <li class="main_courses"><a href="#tandoori" class="selected">Tandoori dishes</a></li> This is the jQuery that makes everything red: jQuery(function( $ ){ $('a.next').click(function(){ $('#gulaab_menu ul li a').removeClass('selected'); $('#gulaab_menu ul li a').toggleClass('selected'); }); }); Any ideas how to get this working so only Tandoori dishes is highlighted and not the whole menu?
  17. email is in the form: <label for="email">Email</label> <input name="email" id="email" style="width:360px" value="<?php echo $_POST['email']; ?>" /> samshel - your solution while only show sales in the subject.. if the user selects test2 from the drop down then i want test2 to be in the subject
  18. Ok when I submit this contact form this is what the subject says: Enquiry for: Array What I want the subject to say is: Enquiry for: test1 I used to have switch ($_POST but this put the email in the subject and not the value This is the code: $recipients = array( 'recipient_1' => 'test1@example.com', 'recipient_2' => 'test2@example.com', 'recipient_3' => 'test3@example.com' ); $my_email = $recipients[$_REQUEST['recipient']]; $subject = 'Enquiry for: '. $recipients . "\r\n"; $message = 'From: '. $email . "\r\n" . $headers = 'From: Site contact form - '. $recipients . "\r\n" . 'Reply-To: '. $email . "\r\n" . 'X-Mailer: PHP/' . phpversion(); if(mail($my_email, $subject, $message, $headers)){ echo "<br /><span style='font-weight:bold;color:#51236D'>Thank you for your enquiry, \nwe will review it and contact you as soon as possible.</span><br /><br />"; } } } Form: <select name="recipient" id="recipient" style="width:360px"> <option value="sales">Sales, Marketing & Media</option> <option value="recipient_1">test1</option> <option value="recipient_2">test2</option> <option value="recipient_3">test3</option> </select>
  19. the form entries did submit into my gmail inbox but I did not get a text message on my mobile I found this info http://www.ozeki.hu/index.php?owpn=669: United Kingdom T-Mobile (former One 2 One) APN: general.t-mobile.uk User ID: user Password: one2one WAP Gateway IP: 149.254.211.010 MMS Server URL: mmsc.t-mobile.co.uk:8002/ $to = '999999999@general.t-mobile.uk'; //add phone number as email here 999999 = my mobile number I have replaced general.t-mobile.uk with all the options from the list above and none of them send a text to my mobile
  20. I just finished the tutorial and I did not receive a text message.. Does anyone know how to get this to work?
  21. cool thanks. I did use google but I did not come across that page you found. Are you sure this is for UK T-Mobile? I guess there is only one way in finding out..
  22. Ok I have some PHP that gets data the database contact_table: <?php $query = "SELECT name, subject, message FROM contact_table"; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "Name :{$row['name']} <br>" . "Subject : {$row['subject']} <br>" . "Message : {$row['message']} <br><br>"; } ?> How do I echo this info using <?php echo $variable_name; ?> ?
×
×
  • 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.