Philip
Staff Alumni-
Posts
4,665 -
Joined
-
Last visited
-
Days Won
20
Everything posted by Philip
-
I take that as it doesnt. The problem is, there arent any IPs (that match) in the DB. Try: [code]<?php error_reporting(E_ALL); define('inStereo',true); $ip = $_SERVER["REMOTE_ADDR"]; echo $ip; include "config.php"; $limit = 3; function beginthework(){ global $ip, $limit; $sql = "SELECT * FROM users WHERE ip=$ip"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result) > 0) { $row = mysql_fetch_assoc($result); if ($row['voted'] > $limit) { echo "Our records show that you have already voted three times. As much as we hate to say it, access denied."; } else { define('morethanonce',true); echo 'You have voted before.<form name="request" action="request.php"> Artist Name:<input type="text" name="artist">song name:<input type="text" name="song"><br><br> <br><br><input type="submit" value="Submit!"></form>'; } } } else { define('firsttime',true); echo 'this is your first time voting.<form name="request" action="request.php"> Artist Name:<input type="text" name="artist">song name:<input type="text" name="song"><br><br> <input type="submit" value="Submit!"></form>'; } } beginthework(); ?>[/code] That should work.
-
No problem, I'll try to think of more suggestions ;)
-
Try: [code]<?php error_reporting(E_ALL); define('inStereo',true); $ip = $_SERVER["REMOTE_ADDR"]; echo $ip; include "config.php"; $limit = 3; function beginthework(){ global $ip, $limit; $sql = "SELECT * FROM users WHERE ip='$ip'"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result) > 0) { $row = mysql_fetch_assoc($result); if ($row['voted'] > $limit) { echo "Our records show that you have already voted three times. As much as we hate to say it, access denied."; } elseif ($row['voted'] == 0) { define('firsttime',true); echo 'this is your first time voting.<form name="request" action="request.php"> Artist Name:<input type="text" name="artist">song name:<input type="text" name="song"><br><br> <input type="submit" value="Submit!"></form>'; } else { define('morethanonce',true); echo 'You have voted before.<form name="request" action="request.php"> Artist Name:<input type="text" name="artist">song name:<input type="text" name="song"><br><br> <br><br><input type="submit" value="Submit!"></form>'; } } else { echo "no results for this IP"; } } else { echo "problem with database"; } } beginthework(); ?>[/code]
-
Well, yeah that could be a problem. Just curious: why didn't you install it in a folder? You have some options: [list][*]rename index.php to something else and change all the links [*]move all the forum to a folder [*]have a meta refresh on index.html[/list] I cant think of anymore, too tired, sorry :P
-
I Need Help Understanding Some Strange PHP code!
Philip replied to mmtalon's topic in PHP Coding Help
Okay, are you wanting to make functionName a function or a variable? because right now you have it set as a variable, but then checks to see if it is a function. -
It's pretty important. People can easily read your information stored in the database if you're not careful. Try reading about it here. I know there are plenty of other topics about this on the forum. http://www.phpfreaks.com/forums/index.php/topic,110976.0.html -- And for the other thing what I meant (I wasnt clear, sorry) was to replace $password = $_POST['password']; with $password = base64_encode($_POST['password']); That will make $password the encrypted password.
-
It's not even showing your IP?
-
I could be wrong, but I think here's your problem: [quote]I put an include file at the spot in the index.html page I wanted this to appear.[/quote] Since you have some PHP in your code, you need to save it as index.php instead of index.html
-
Make sure to clean your variables so you dont have SQL injections. You're probably going to want to do this after you clean the variables: $password = base64_encode($_POST['password']);
-
Im doing session_destroy(); with my logout script and running php5 & ff, and it works fine. Have you tried just plain old: unset($_SESSION['variable']); ?
-
You want to make sure you have that space,and a closing tag for JS (otherwise some browsers wont see it) <script src="#.js" language="text/javascript"> </script>
-
Okay :) I think its the height (the menu buttons, not the Home button) It just seems like there is a bounce or something, going past the spot its supposed to stop, then correcting itself.
-
I'm running an extension in FF2.0 that is looking at your source (all in base.css): Line 10: Error in parsing value for property 'width' Line 13: Error in parsing value for property 'width' Line 64, 65, 78, 79: Unknown property 'filter' You should be able to look at that on any FF at Tools - Error Console. However, I also have IE7B (7.0.5346.5 Beta 2), because the damn thing won't let me install the newest updated version. I'm having a lot of problems with the styling on the "home" link. The rest of the menu displays just fine, but the home link for some reason creates the box on the right side instead of the left side. Now, this was probably fixed in the newest version of IE7, but I wouldn't know. Also, just a side note: it seems like the menu is very jerky. Is there a way that you could make it run a little smoother (getting rid of the bounce would help)
-
PHP is a [b]server sided[/b] script. You have to have access to FTP or a control panel to view the source.
-
You can include it on any form :)
-
[quote author=obsidian link=topic=112560.msg493242#msg493242 date=1167415657] [quote author=KingPhilip link=topic=112560.msg493237#msg493237 date=1167415282] [quote author=AXiSS link=topic=112560.msg493189#msg493189 date=1167410292] I love IE7 [/quote] ... I don't see how. Have you tried Friefox 2, with any extensions? They are quite a few really really nice ones out there. [/quote] Actually, IE7 is quite the nice browser, in and of itself. The part I don't understand is the hatred of firefox. They are both quite nice, and working with them together, you can definitely improve your creation process immensely. [/quote] Hmm, well I guess it's just mine. I had the Beta version of it, but it won't let me install the new version of it, and it takes about 20 seconds to load up the first page (plus more if i have multiple tabs on startup) It is better than the other IEs though
-
[quote author=AXiSS link=topic=112560.msg493189#msg493189 date=1167410292] I love IE7 [/quote] ... I don't see how. Have you tried Friefox 2, with any extensions? They are quite a few really really nice ones out there.
-
Happy xmas to all php helpers all the best redarrow.
Philip replied to redarrow's topic in Miscellaneous
[quote author=onlyican link=topic=119856.msg491294#msg491294 date=1167043891] If anyone posts one New Years at around midnight in there country, they need to seek help [/quote] Agreed :D -
[SOLVED] Stopping script and echoing on same page.
Philip replied to Eiolon's topic in PHP Coding Help
You could do something like I do: [code]<?php // Confirm that the passwords match. if ($_POST['password'] != $_POST['password2']) { $error['password'] = true; } if(isset($error)) { /*show errors & form*/ } else { /*continue on with script*/ } ?>[/code] You could do that for all of the form variables you want checked. Then, in the form: [code]<?php if($error['password'] == true) { echo "<b>Your passwords did not match</b>";} /*show form*/ ?>[/code] -
[quote author=neylitalo link=topic=119164.msg490403#msg490403 date=1166832338] My "formal schooling" in programming was little - two semesters in high school of copying code out of a book, the principal knew more about the subject matter than the teacher, and the instructor didn't know how to type. He just wasn't cut out for the programming world. :| [/quote] Yeah, sounds about right. Our "webmastering" class (which I have not taken, why waste time there?) is basically "Here's how to do Basic HTML..." for the first few weeks then, they move onto WYSIWYG programs, and design stuff in there. - I was self-taught, motivation came from an idea that my friend and I had thought up, and I wanted to expand on it. So, I learned the basics, started getting the hang of it, learned stuff the hard way (the best way IMO) and yeah, came out where I am now. Although, I did get a lot of help starting out from friends and such. I wouldn't mind sitting in on a PHP class in college, just to see what its like. :)
-
@businessman332211: From what I can tell, on IE7, still have to click on it (like if you were clicking on one of the items) and it will activate it. @dragonusthei: Very professional, keep up the great work =D
-
You need the breaks in the switch: [code]<?php switch ($_GET["c"]) { case "g": $theme = "default.css"; break; case "b": $theme = "blue.css"; break; case "p": $theme = "pink.css"; break; case "o": $theme = "orange.css"; break; default: $theme = "default.css"; break; } echo '<link rel="stylesheet" type="text/css" href="'.$theme.'" media="screen"/>'; ?>[/code]
-
http://www.chami.com/html-kit/ (HTML-Kit) http://www.chami.com/html-kit/plugins/ (Plugins for HTML-Kit -- very useful :D)
-
Ha, $25 gift card? Wow, that's pretty sad.
-
Yup, provide a link and I can try :)