Fluoresce Posted October 4, 2008 Share Posted October 4, 2008 Will the following code work? I can't test it for various reasons. It must, must work first time round, so please be thorough with your evaluations. Basically, I want to count how many clicks my links get. I've put my links in a database. When someone clicks a link on my site (which look like this: goto.php?id=1), they are sent to goto.php, which: gets the ID connects to the database updates the Count column of the link table selects the real link (note: this has a variable appended to it: http://www.whatever.com?=$var) redirects the visitor to the location What I am particularly worried about are the variables appended to the links in the database. Will they be echoed properly? <?php $id = intval($_GET['id']); $conn = mysql_connect('localhost','root') or trigger_error("SQL", E_USER_ERROR); mysql_select_db('ctyi', $conn) or trigger_error("SQL", E_USER_ERROR); mysql_query("UPDATE table SET count = count+1 WHERE id=$id"); $href = "SELECT url FROM table WHERE id=$id"; $qry = mysql_query($href); list($href)=mysql_fetch_row($qry); // list() because an array is returned eval("\$href = \"$href\";"); header("Location:$href"); mysql_close($conn); ?> Link to comment https://forums.phpfreaks.com/topic/127041-solved-please-check-this-code-for-me-will-it-work/ Share on other sites More sharing options...
AndyB Posted October 4, 2008 Share Posted October 4, 2008 Will the following code work? I can't test it for various reasons. It must, must work first time round, so please be thorough with your evaluations. If you can't or won't test it, how thorough do you expect us to be? Link to comment https://forums.phpfreaks.com/topic/127041-solved-please-check-this-code-for-me-will-it-work/#findComment-657156 Share on other sites More sharing options...
Fluoresce Posted October 4, 2008 Author Share Posted October 4, 2008 If you can't or won't test it, how thorough do you expect us to be? Did you understand what I asked? ??? I just simply need a pro to look over my work for any obvious errors. Is that OK with you? Link to comment https://forums.phpfreaks.com/topic/127041-solved-please-check-this-code-for-me-will-it-work/#findComment-657160 Share on other sites More sharing options...
dropfaith Posted October 4, 2008 Share Posted October 4, 2008 why cant this be tested? theres always the option of resetting the db results as it adds or building a mock db to test in Link to comment https://forums.phpfreaks.com/topic/127041-solved-please-check-this-code-for-me-will-it-work/#findComment-657167 Share on other sites More sharing options...
AndyB Posted October 4, 2008 Share Posted October 4, 2008 Did you understand what I asked? Yes. You expected people here to create a small database, populate it, write a script, etc. and test it 'thoroughly' all for free because you can't test it for reasons you don't disclose. And, in effect, you expected the testers to guarantee it would work. And in return, you offered what? Nothing. That's not the nature of help this forum provides. Our time is at least as important as yours. Link to comment https://forums.phpfreaks.com/topic/127041-solved-please-check-this-code-for-me-will-it-work/#findComment-657173 Share on other sites More sharing options...
Fluoresce Posted October 4, 2008 Author Share Posted October 4, 2008 why cant this be tested? The only way will be to enter my site from an external site, click on a link which directs to an online store, and buy something from that store to see if the value of the appended variable appears in my affiliate network account. All I want, therefore, is someone to simply look over my code for any obvious errors. Can you see any? Link to comment https://forums.phpfreaks.com/topic/127041-solved-please-check-this-code-for-me-will-it-work/#findComment-657176 Share on other sites More sharing options...
Fluoresce Posted October 4, 2008 Author Share Posted October 4, 2008 Did you understand what I asked? Yes. You expected people here to create a small database, populate it, write a script, etc. and test it 'thoroughly' all for free because you can't test it for reasons you don't disclose. And, in effect, you expected the testers to guarantee it would work. And in return, you offered what? Nothing. That's not the nature of help this forum provides. Our time is at least as important as yours. What?! ??? Dude, I didn't ask you for anything. All I wanted was for someone to look over my code - which is only a few lines long - and to tell me if there were any obvious errors. You've practically accused me of murder! ??? Link to comment https://forums.phpfreaks.com/topic/127041-solved-please-check-this-code-for-me-will-it-work/#findComment-657178 Share on other sites More sharing options...
Lee-Bartlett Posted October 4, 2008 Share Posted October 4, 2008 Did you understand what I asked? Yes. You expected people here to create a small database, populate it, write a script, etc. and test it 'thoroughly' all for free because you can't test it for reasons you don't disclose. And, in effect, you expected the testers to guarantee it would work. And in return, you offered what? Nothing. That's not the nature of help this forum provides. Our time is at least as important as yours. What?! ??? Dude, I didn't ask you for anything. All I wanted was for someone to look over my code - which is only a few lines long - and to tell me if there were any obvious errors. You've practically accused me of murder! ??? I may be wrong, but he no one can gaurente if it will work because we dont have the database etc...Also why cant you test it your self that intrests me. Link to comment https://forums.phpfreaks.com/topic/127041-solved-please-check-this-code-for-me-will-it-work/#findComment-657179 Share on other sites More sharing options...
Fluoresce Posted October 4, 2008 Author Share Posted October 4, 2008 I may be wrong, but he no one can gaurente if it will work because we dont have the database etc...Also why cant you test it your self that intrests me. As I said above, the only way for me to test it would be to enter my site from an external site, click on a link which directs to an online store, and buy something from that store to see if the value of the appended variable appears in my affiliate network account. I thought, therefore, that I should just simply ask in a forum if any professionals can see any obvious errors. Apparently, it wasn't the best idea: people are accusing me of world hunger, famine and just about every other problem! ??? Link to comment https://forums.phpfreaks.com/topic/127041-solved-please-check-this-code-for-me-will-it-work/#findComment-657188 Share on other sites More sharing options...
Lee-Bartlett Posted October 4, 2008 Share Posted October 4, 2008 So you cant use localhost to test this? Link to comment https://forums.phpfreaks.com/topic/127041-solved-please-check-this-code-for-me-will-it-work/#findComment-657190 Share on other sites More sharing options...
Fluoresce Posted October 4, 2008 Author Share Posted October 4, 2008 So you cant use localhost to test this? Sure, but only if I buy something through my own affiliate link - which is not allowed. Link to comment https://forums.phpfreaks.com/topic/127041-solved-please-check-this-code-for-me-will-it-work/#findComment-657193 Share on other sites More sharing options...
Lee-Bartlett Posted October 4, 2008 Share Posted October 4, 2008 Local host is a offline thing tho? download xampp and ur good to go, you dont need to buy xampp Link to comment https://forums.phpfreaks.com/topic/127041-solved-please-check-this-code-for-me-will-it-work/#findComment-657195 Share on other sites More sharing options...
Fluoresce Posted October 4, 2008 Author Share Posted October 4, 2008 Local host is a offline thing tho? download xampp and ur good to go, you dont need to buy xampp I'm already using XAMPP. The code seems to work perfectly, but I don't know if the variable appended to the links is being passed on. The only way to find out would be to buy something through one of my own links, which, as I said, isn't allowed. This leaves me with a problem . . . I can either get someone to buy something through one of my links, or ask in a forum for clarification. Can you see any obvious errors in the code? Link to comment https://forums.phpfreaks.com/topic/127041-solved-please-check-this-code-for-me-will-it-work/#findComment-657198 Share on other sites More sharing options...
Lee-Bartlett Posted October 4, 2008 Share Posted October 4, 2008 Your theory must be wrong here, i am pretty postive you can test this stuff with out having to buy somthing. Because, well, it will be flat out idiotic if no one in the world designed somthing to suit this. And no i cant see any error, but im new so, might not wanna take my word for it. Link to comment https://forums.phpfreaks.com/topic/127041-solved-please-check-this-code-for-me-will-it-work/#findComment-657199 Share on other sites More sharing options...
dropfaith Posted October 4, 2008 Share Posted October 4, 2008 i see no errors but without testing it you can never be sure it does what you need it to do Link to comment https://forums.phpfreaks.com/topic/127041-solved-please-check-this-code-for-me-will-it-work/#findComment-657203 Share on other sites More sharing options...
nrg_alpha Posted October 4, 2008 Share Posted October 4, 2008 Fluoresce, I think what people are trying to tell you is that there is always a way to test these things. Put another way, do you think all these e-commerce sites go live without testing first? In hoping that there is no serious issues? This is not proper development practices. Despite what is 'not allowed' with regards to your affiliates, I'm sure your affiliates would certainly not appreciate going live without testing and having everything come crashing down. While I don't develop e-commerce sites, there must be ways to test locally. I would look into professional e-commerce practices with regards to testing. Dig around a little. One way or another, I'm going to fathom a guess that e-commerce sites don't blindly launch (because they were not allowed to test locally) and hope for the best. This is a fast receipy for disaster. No one in their right minds should ever consider launching without thorough local testing first. Cheers, NRG P.S No one is accusing you of murder, famine nor world hunger (let's not be dramatic about this in a childish manner). Just due your due diligence as you have a responsibility to not only your affiliates, but most importantly, the users who *risk* purchasing something from an online store you built. If you are not experienced enough, then perhaps this alone is a red-flag sign that this is better suited for someone else with greater experience / expertise. I mean no offense to you by any of this.. it's just common sense. Be very careful when dealing with e-commercing.. very serious stuff. Link to comment https://forums.phpfreaks.com/topic/127041-solved-please-check-this-code-for-me-will-it-work/#findComment-657245 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.