
byrne86
Members-
Posts
23 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
byrne86's Achievements

Member (2/5)
0
Reputation
-
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...
-
Getting image link to be the only way to access a page
byrne86 replied to byrne86's topic in PHP Coding Help
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 -
Getting image link to be the only way to access a page
byrne86 replied to byrne86's topic in PHP Coding Help
Wow... I don't even now where to begin with that code, where exactly would I put this code? -
Getting image link to be the only way to access a page
byrne86 replied to byrne86's topic in PHP Coding Help
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. -
Getting image link to be the only way to access a page
byrne86 replied to byrne86's topic in PHP Coding Help
Anyone got any idea how to fix this? -
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
-
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.
-
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.
-
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?
-
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
-
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
-
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.
-
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>
-
Make a link the only way to access a certain page
byrne86 replied to byrne86's topic in PHP Coding Help
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 -
iv never used that, are there ay examples about I can look at?