HoTDaWg Posted January 3, 2007 Author Share Posted January 3, 2007 its showing that. Quote Link to comment https://forums.phpfreaks.com/topic/32492-solved-hmmmwonder-where-i-went-wrong/page/2/#findComment-151800 Share on other sites More sharing options...
Philip Posted January 3, 2007 Share Posted January 3, 2007 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] Quote Link to comment https://forums.phpfreaks.com/topic/32492-solved-hmmmwonder-where-i-went-wrong/page/2/#findComment-151804 Share on other sites More sharing options...
HoTDaWg Posted January 3, 2007 Author Share Posted January 3, 2007 your brilliant my man, it now says no results for ip. Quote Link to comment https://forums.phpfreaks.com/topic/32492-solved-hmmmwonder-where-i-went-wrong/page/2/#findComment-151828 Share on other sites More sharing options...
HoTDaWg Posted January 3, 2007 Author Share Posted January 3, 2007 so now i wonder what i have to do, to fix or deal with this...wait is it a problem? lol. Quote Link to comment https://forums.phpfreaks.com/topic/32492-solved-hmmmwonder-where-i-went-wrong/page/2/#findComment-151830 Share on other sites More sharing options...
HoTDaWg Posted January 3, 2007 Author Share Posted January 3, 2007 alright i changed the code a bit. The only problem is it still does absouletly nothing! ???1. i changed it so that in select the (dollar sign)ip variable inside the select comand would not have quotes, cuz in a previous topic i made the reason that php didnt read my script was because it doesnt read variables inside of quotes. so here is the sccript:[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>'; } elseif ($row['ip'] == ""){ 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 "problem with database"; }}beginthework();?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/32492-solved-hmmmwonder-where-i-went-wrong/page/2/#findComment-151836 Share on other sites More sharing options...
corbin Posted January 3, 2007 Share Posted January 3, 2007 And does this script work? Quote Link to comment https://forums.phpfreaks.com/topic/32492-solved-hmmmwonder-where-i-went-wrong/page/2/#findComment-151854 Share on other sites More sharing options...
HoTDaWg Posted January 3, 2007 Author Share Posted January 3, 2007 Any ideas? sorry, no it does not, it shows nothing but the ip and it also says server problem Quote Link to comment https://forums.phpfreaks.com/topic/32492-solved-hmmmwonder-where-i-went-wrong/page/2/#findComment-151871 Share on other sites More sharing options...
Philip Posted January 3, 2007 Share Posted January 3, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/32492-solved-hmmmwonder-where-i-went-wrong/page/2/#findComment-151878 Share on other sites More sharing options...
HoTDaWg Posted January 3, 2007 Author Share Posted January 3, 2007 KingPhilip, THANKS SO MUCH!!!!!!!!!!!!! WAHOOO!!!!!!!!!!!!!!!!!! So far so good, im gonna label this topic solved hopefully it will be done for good. thanks to all who helped out. Quote Link to comment https://forums.phpfreaks.com/topic/32492-solved-hmmmwonder-where-i-went-wrong/page/2/#findComment-151938 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.