Jump to content

brmcdani

Members
  • Posts

    38
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

brmcdani's Achievements

Member

Member (2/5)

0

Reputation

  1. I have a simple image array that is being called to rotate images. I need to assign some ahref values to the images. How would I go about this? I would guess add the url to the array. Any ideas would be appreciated here is my code: <?php function randomImage ( $array ) { $total = count($array); $call = rand(0,$total-1); return $array[$call]; } $my_images = array ( "banners/1.jpg", "banners/2.jpg", "banners/3.jpg", "banners/4.jpg", "banners/5.jpg", "banners/6.jpg", ); echo '<img src="'.randomImage($my_images).'"; alt="Random Image" />'; ?>
  2. Thanks for the reply, where does the {remove} go??? On the very bottom? I made the changes and noticed the Remove on the post after.
  3. Thanks I got figured it out as soon as you posted. Here was my solution: $sql="select * from members,photos WHERE members.username=photos.username and YEAR(upldate) = YEAR(CURDATE()) AND MONTH(upldate) = MONTH(CURDATE()) and approved='Y' and active=1 order by photos.upldate";
  4. I am trying to create a mysql statment where the following records are pulled out based on which month it is. The following statment I have will pull out the latest photos and order them by the date. However I want it to pull out records only from the current month. Any ideas will be appreciated. Thanks $sql="select * from members,photos where members.username=photos.username and approved='Y' and active=1 order by photos.upldate";
  5. I am trying to create a login for my webstie but I keep getting the following errors: Warning: session_register() [function.session-register]: Cannot send session cookie - headers already sent by (output started at /home/mcdtech1/public_html/lubbockwebpro.com/checklogin.php:1) in /home/mcdtech1/public_html/lubbockwebpro.com/checklogin.php on line 26 Warning: session_register() [function.session-register]: Cannot send session cache limiter - headers already sent (output started at /home/mcdtech1/public_html/lubbockwebpro.com/checklogin.php:1) in /home/mcdtech1/public_html/lubbockwebpro.com/checklogin.php on line 26 Warning: Cannot modify header information - headers already sent by (output started at /home/mcdtech1/public_html/lubbockwebpro.com/checklogin.php:1) in /home/mcdtech1/public_html/lubbockwebpro.com/checklogin.php on line 28 I have looked at the lines it points out and am still having trouble here is my code: <?php ob_start(); $host="localhost"; // Host name $username="mcdtech1"; // Mysql username $password="l0608448533"; // Mysql password $db_name="mcdtech1_lakeAlanH"; // Database name $tbl_name="users"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // Define $myusername and $mypassword $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; // To protect MySQL injection (more detail about MySQL injection) $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" session_register("myusername"); session_register("mypassword"); header("location:login_success.php"); } else { echo "Wrong Username or Password"; } ob_end_flush(); ?> Any help would be appreciated. Thanks
  6. Anybody know of any good tutorials that show how to integrate PHP into a FLASH web site? The PHP will be a login/registration system. Thanks
  7. Iam currently working with a client who wants a members only area that will accomplish allowing for a permanent 10% discount on everything for sale on the site. How would I be able to apply a 10% discount option for the items for sale? Also the site is in FLASH how hard is it to implement PHP into FLASH? I am guessing it wouldn't be too hard. Let me know everyone's thoughts please. Thanks
  8. Great this worked. Thanks for your help happy new year!
  9. Still doesn't work! I dont know what else to try. This has to be done tonight and ready to go for a client tomorrow.
  10. Ok there are no extra spaces anywhere with the starting php line now I have this and am getting a header error message on line 17 which is the beginning of the header line. <?php $name = $_REQUEST['name']; $phone = $_REQUEST['phone']; $email = $_REQUEST['email']; $pref = $_REQUEST['pref']; $type = $_REQUEST['type']; $kind = $_REQUEST['kind']; $message = $_REQUEST['message']; $body = "Name: $name \nPhone Number: $phone \nEmail: $email \nContact Preference: $pref \nJob Type: $type \nInterested In: $kind \nDescription: $message \n\n"; mail("brett.mcdaniel@ttu.edu", "Contact Request", $body); header("Location: thankyou.htm"); ?>
  11. I am getting the following error message: Cannot modify header information - headers already sent by (output started at /home/content/s/a/g/sagates/html/contact.php:1) in /home/content/s/a/g/sagates/html/contact.php on line 17 Here is my code: <?php ob_start(); $name = $_REQUEST['name']; $phone = $_REQUEST['phone']; $email = $_REQUEST['email']; $pref = $_REQUEST['pref']; $type = $_REQUEST['type']; $kind = $_REQUEST['kind']; $message = $_REQUEST['message']; $body = "Name: $name \nPhone Number: $phone \nEmail: $email \nContact Preference: $pref \nJob Type: $type \nInterested In: $kind \nDescription: $message \n\n"; mail( "brett.mcdaniel@ttu.edu", "Contact Request", $body); header("Location: thankyou.htm"); ?> I think I need an ending ob_ statement just not sure which one. Can someone please help me out??? Thanks
  12. Ok I added the ob_start() should there be a a ob_flush() or something like that at the end? It says the error is on the last line of code now? Thanks again
  13. Okay this is really wearing me out! Now I get a Cannot Modify Header error at line 21 One more reply please! <?php $name = $_REQUEST['name'] ; $phone = $_REQUEST['phone'] ; $email = $_REQUEST['email'] ; $pref = $_REQUEST['pref'] ; $type = $_REQUEST['type'] ; $kind = $_REQUEST['kind'] ; $message = $_REQUEST['message']; $body = "Name: $name \nPhone Number: $phone \nEmail: $email \nContact Preference: $pref \nJob Type: $type \nInterested In: $kind \nDescription: $message \n\n"; mail( "brett.mcdaniel@ttu.edu", "Contact Request", $body); header( "Location: thankyou.htm" ); ?>
  14. Great thanks for your help! Now I am getting a parse error and don't get what the deal is on this I checked it over 3-4 times but I am tired! I know it is something simple someone please help! Thanks <?php $name = $_REQUEST['name'] ; $phone = $_REQUEST['phone'] ; $email = $_REQUEST['email'] ; $pref = $_REQUEST['pref'] ; $type = $_REQUEST['type'] ; $kind = $_REQUEST['kind'] ; $message = $_REQUEST['message'] ; $body = "Name: $name \nPhone Number: $phone \nEmail: $email \nContact Preference: $pref \nJob Type: $type \nInterested In: $kind \nDescription: $message \n\n" mail( "brett.mcdaniel@ttu.edu", "Contact Request", $body); header( "Location: thankyou.htm" ); ?>
  15. I am getting the following errors for my mail() code: Warning: mail() expects at most 5 parameters, 9 given in /home/content/s/a/g/sagates/html/contact.php on line 17 Warning: Cannot modify header information - headers already sent by (output started at /home/content/s/a/g/sagates/html/contact.php:17) in /home/content/s/a/g/sagates/html/contact.php on line 18 Here is my code <?php $name = $_REQUEST['name'] ; $phone = $_REQUEST['phone'] ; $email = $_REQUEST['email'] ; $pref = $_REQUEST['pref'] ; $type = $_REQUEST['type'] ; $kind = $_REQUEST['kind'] ; $message = $_REQUEST['message'] ; mail( "laaa4@sss.com", "Contact Request", "Name: $name", "Phone Number: $phone", "Email: $email", "Contact Preference: $pref", "Job Type: $type", "Interested in: $kind", "Description: $message"); header( "Location: thankyou.htm" ); ?> Can someone please help me out please?
×
×
  • 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.