Jump to content

byrne86

Members
  • Posts

    23
  • Joined

  • Last visited

    Never

Everything posted by byrne86

  1. All I want to do is upload an image to my images folder, which is on the site root, so mysite.com/images here is my code: <form action="uploadimage.php" method="post" enctype="multipart/form-data" name="form1" id="form1"> <p> <label>Choose image to upload <input type="file" name="image" id="image" /> </label> </p> <p> <label> <input type="submit" name="imageupload" id="imageupload" value="Upload Image" /> </label> </p> </form> <?php $imagename = "1testimage"; if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/png"))) move_uploaded_file ($_FILES["file"]["tmp_name"],"images/" . $imagename.".gif"); ?> Cn anyone see why this is not working/ I have chenged the permissions on my hosting account to read and write...
  2. Neve mind, I have solved this problem now, with a few simple lines of code, I can't believe it took me so long to figure out
  3. Wow... I don't even now where to begin with that code, where exactly would I put this code?
  4. I know how to use a session to check the previous page, but I need the page in my link to never be accessed unless the user clicks the link, the link is not always on my site, so I dont want people just typing the name of the page in and accessing the form whenever they want. I had code to set the session variable, but the user could just go to page1, then type the url of page2 because page1 had set the session variable. Would something like this work... <?php include "myphpfile1"; session_start(); if ($variable1(from myphpfile1) = x) $_SESSION['access']=1; ?> What this would do is check the same variable that makes the link appear on my page, and if that link has appeared then the session would be set... I cant really test this at the minute, because my site is live, and I cant really go messing about with it, and to set up all the stuff with this one link would be a pain, but if no one knows for sure whether this would work then I will test it.
  5. I have asked this before, but I didnt have any code to show, so here is what I have: <!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" /> <title>Main Page</title> <link href="newstyle.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-19675449-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script</head>> <body> <div id="top-bar"> <div class="bar-content"><a href="index.php">HOME</a> | <a href="howitworks.php">HOW IT WORKS</a> | <a href="advertisingopportunities.php">ADVERTISE HERE</a> | <a href="about.php">ABOUT US</a> | <a href="contactus.php">CONTACT US</a></div> </div> <?php include "system/buttonimage.php"; ?> <div class="main"> <div class="topad"> <div class="jackpot"> <div class="addthis_toolbox addthis_32x32_style addthis_default_style"> <table width="55" border="0"> <tr> <td width="19"><a class="addthis_button_facebook"></a></td> <td width="26"><a class="addthis_button_twitter"></a></td> </tr> <tr> <td><a class="addthis_button_google"></a></td> <td><a class="addthis_button_compact"></a></td> </tr> </table> </div> </div> <div class="adbannertop"><a href="howitworks.php"><img src="images/mainbanner.gif" width="728" height="90" /></a></div> <div align="center"></div> </div> <div class="buttondiv"> <?php echo $buttonimage ?> <div class="leftad"> <div align="left"> <table width="247" border="0"> <tr> <td width="120" height="161"> </td> <td width="117"> </td> </tr> </table> </div> </div> <div class="rightad"> <div align="right"> <table width="247" border="0"> <tr> <td width="120" height="171"> </td> <td width="117"> </td> </tr> </table> </div> </div> </div> </div> <div align="center"> <p>Copyright © 2010 TwistFire Ltd. All Rights Reserved</p> <p><a href="termsandconditions.php">Terms and Conditions</a> - <a href="privacypolicy.php">Privacy Policy</a></p> <p> <!-- Begin W3Counter Tracking Code --> <script type="text/javascript" src="http://www.w3counter.com/tracker.js"></script> <script type="text/javascript"> w3counter(45635); </script> <noscript> <div><a href="http://www.w3counter.com"><img src="http://www.w3counter.com/tracker.php?id=45635" style="border: 0" alt="W3Counter" /></a></div> </noscript> <!-- End W3Counter Tracking Code--></p> </div> </body> <!--Copyright © 2010 TwistFire Ltd. All Rights Reserved--> </html> The above code is the main page and the line "echo $buttonimage" is the line used to get my image depending what it shud be, and the code used to get the image for $buttonimage is here: <?php include "ccn.php"; $sql1l = mysql_result(mysql_query('SELECT time FROM db1 WHERE id = 1'), 0); $sql2 = mysql_result(mysql_query('SELECT minute FROM db1 WHERE id = 1'), 0); $var1 = $sql2l+2; $buttonoffpic = "<img src=\"images/buttonoff.png\" width=\"398\" height=\"398\" />"; $buttononpic = "<a href=\"entryform.php\"><img src=\"images/buttonon.png\" width=\"398\" height=\"398\" BORDER=0/></a>"; if ($sql1 == date(H)) $buttonimage = $buttononpic; else $buttonimage = $buttonoffpic; //<!--Copyright © 2010 TwistFire Ltd. All Rights Reserved--> ?> And here is the page that I want the access to be limited to via the link, and not allow people direct access, I have some session code that someone gave me, and that does work, its just getting the session to allow people on the pge when they click the image "buttonon.png". <?php session_start(); if(!isset($_SESSION['access']) || $_SESSION['access'] != 1) { exit('You cannot access this page directly'); } ?> <!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" /> <title>Good Luck...</title> <link href="newstyle.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-19675449-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body> <div id="top-bar"> <div class="bar-content"><a href="index.php">HOME</a> | <a href="howitworks.php">HOW IT WORKS</a> | <a href="advertisingopportunities.php">ADVERTISE HERE</a> | <a href="about.php">ABOUT US</a> | <a href="contactus.php">CONTACT US</a></div> </div> <div class="main2" id="main2"> <p> </p> <h2><img src="images/thanksforplaying.gif" width="500" height="200" /></h2> <form action="formverification.php" method="post"> <p>Please fill in the form to register your entry</p> <div align="center"> <table width="389" border="0"> <tr> <td width="235">First Name</td> <td width="144"><input type="text" name="firstname" id="firstname" /></td> </tr> <tr> <td>Second Name</td> <td><input type="text" name="surname" id="surname" /></td> </tr> <tr> <td>Email Address</td> <td><input type="text" name="email" id="email" /></td> </tr> <tr> <td> </td> <td><img src="CaptchaSecurityImages.php?width=100&height=40&characters=5" /></td> </tr> <tr> <td>Security Code</td> <td><input id="security_code" name="security_code" type="text" /></td> </tr> </table> </div> <div align="center"></div> <p>By clicking the button below, you are agreeing to the <a href="termsandconditions.php">terms and conditions</a> of this website</p> <p> <input type="submit" name="submit" value="I have read and accept the terms and consitions of this website - Submit" /> </p> </form> </div> <div align="center"> <p>Copyright © 2010 TwistFire Ltd. All Rights Reserved </p> <p> <!-- Begin W3Counter Tracking Code --> <script type="text/javascript" src="http://www.w3counter.com/tracker.js"></script> <script type="text/javascript"> w3counter(45635); </script> <noscript> <div><a href="http://www.w3counter.com"><img src="http://www.w3counter.com/tracker.php?id=45635" style="border: 0" alt="W3Counter" /></a></div> </noscript> <!-- End W3Counter Tracking Code--></p> </div> </body> <!--Copyright © 2010 TwistFire Ltd. All Rights Reserved--> </html> <?php $_SESSION['access'] = NULL; unset($_SESSION['access']); ?> I need to be able to click the image and go to the page, but not be able to access t directly. Thanks C.Byrne
  6. I will look into that, I do use godaddys service to check statistics, but my company has other directors and I would like something a bit more simple for them, as they do not know anything about this kind of thing, so something like a hit counter on an admin page would be perfect for us.
  7. How can I use a hit counter to count the hits of my main page, but put the hit counter on a seperate page? I want the counter to obviously see how many hits Im getting, but I think they look terrible, so I want to put it on a password protected page that only I can see. For instance I want the counter to count hits on www.mysite.com, but I want the hit counter to be on www.mysite.com/admin Can those free hit counters be placed on a different page than the page I want hits counted on? I did try one, and it didnt work at all, but there might be one that does.
  8. I have a main div, and 2 side divs, the right and left divs are floating left and right, and the layout is fine in Firefox and Chrome, but the side divs are pushed below the main div in IE, is there a way to fix this?
  9. Forget that problem, I have sorted it out, I do have a new problem though. I am trying to automatically insert a datetime into a field on a table from a web form, everything I have tried has just returned 0000-00-00 00:00:00, I want to use the SQL datetime, and not the php timestamp, so I can sort it better in my database
  10. I have a cron job that creates a table once a day, the problem I am having is, I need the name of the table to be todays date, I have tried using a php variable, but I couldnt get the CREATE to have a php variable as the tablename. What is the best way to make the tablename being created todays date? Also, what is the best way to get 10 entries from 1 table on a database and insert them into a different table on a different database using php? Thanks
  11. I am, but because I am doing it on the hour I am waiting until the hour hits, and I should have done it half an hour ago, but I missed it lol. I was just asking to see if anyone can see a flaw in the code.
  12. I have this code that changes an image on the hour, of a random hour and stays changed for 2 minutes, regardless of refreshes etc etc, and it has to be the exact same hour and 2 minutes for everyone. I know at the minute it is going to change at 4pm, it is only for testing purposes, I am doind the random time bit later. <?php $minute = date(i); $hour = 16; if ($hour == date(H) && $minute < 3) $buttonimage = "buttonon.png"; else $buttonimage = "buttonoff.png"; ?> <table width="200" border="1"> <tr> <td><img src="<?php echo($buttonimage); ?>" /></td> </tr> </table>
  13. I've put all that code into my site as suggested, I can no longer access the page directly, but the image is no longer a link to the page, I have changed the code and put in the name of the image etc etc, but it didn't work. I already have a session on the page with the image on it for logging in, I have put the session for the image link underneath that, will the 2 sessions conflict with each other? Or can there be 2 sessions running simultaneously? Thanks for the help, the code is mostly working, I'm guessing it's a small error on mypart as to why it isn;t fully working
  14. iv never used that, are there ay examples about I can look at?
  15. the missing ' cant believe i missed that..... thanks
  16. I have a site, and there is an image with a link to another page, how can I make it so this is the only way to get to that page is by clicking on that image, and not by typing www.mywebsite.com/page.php into the address bar in a browser?
  17. OK, so iv got a form on a website, it inserts data into an SQL database,it was working until I added some more info to be put in - here is the php and error etc... $firstname = $_POST['firstname']; $surname = $_POST['surname']; $email = $_POST['email']; $thisday = date(d); $thismonth = date(F); $thisyear = date(Y); $thishour = date(H); $thisminute = date(i); $thissecond = date(s); $thismicrosecond = date(u); $query = "INSERT INTO mydb (id, firstname, surname, email, day, month, year, hour, minute, second, microsecond) VALUES ('$Guid', '$firstname', '$surname', '$email', '$thisday', $thismonth', '$thisyear', '$thishour', '$thisminute', '$thissecond', '$thismicrosecond')"; // execute query $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); That is the php getting the data to put into the SQL database Error in query: INSERT INTO mydb (id, firstname, surname, email, day, month, year, hour, minute, second, microsecond) VALUES ('7DD39B65-C369-7750-F77B-DB4904CCB5DE', 'skjdfhsk', 'sndhofsdi', 'oisdfosos', '28', October', '2010', '17', '10', '18', '000000'). You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '', '2010', '17', '10', '18', '000000')' at line 1 That is the error I am getting... Can anyone tell me whatis wrong with this please. As I said, it was working, but when I added everything from $thisday to $thismicrosecond inclusive this error was showing when I was trying to enter data into the DB
  18. I have a site where I need to have lets call it image1 displayed, then I want to change this image based on a php if statement, for instance: if $var == $var2 change the image ....blah blah so I was also going to have the names of my images stored in my database, i.e. image1.jpg and image2.jpg in my database. the image is in its own div tag set as the background image of the div tag if that makes any diference. Thanks
  19. It turns our I can easily use cron jobs with GoDaddy, so I can sort that out.In regards to the random time, I found this website: http://sqa.fyicenter.com/Online_Test_Tools/Random_Date_Time_Value_Generator.php but it doesnt explain how they get the random times very well.
  20. OK, I understand most of that, but what is a cronjob? I know how to generate random numbers, but how would I generate a random time? Thanks for the help btw.
  21. Yeah, basically, I forgot to mention though, that the time of day when the page displays image #1 is completely random. I don't even know where to begin on this task...
  22. Hi, I haven't used any php for a while, but i am making a website, and i need some advice on how to do the following: I want the website to change an image once every 24 hours, the image will revert back to the original image after 2 minutes. Does anyone have an idea how I could start doing this?
×
×
  • 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.