Jump to content

dual_alliance

Members
  • Posts

    140
  • Joined

  • Last visited

    Never

Everything posted by dual_alliance

  1. It's quite simply really, you just set it in the array. For example: $data['ftitle'] = array('name'=>'title', 'size' => 30, 'value' => set_value('title') ); $data['fauthor'] = array('name'=>'author', 'size' => 30, 'value' => set_value('author') ); And so on...
  2. $teamname = GET_("team_name"); $teamcaptain = GET_("team_captain"); $teamphone = GET_("team_number"); $teamemail = GET_("team_address"); to $teamname = $_POST['player_name']; $teamcaptain = $_POST['phone_number']; $teamphone = $_POST['player_email']; $_GET is only used if you are passing variables via a URL e.g. index.php?act=index To refer to this, you would then use $_GET['act'].
  3. I can't test it at the moment, but from what l can see you need to do something like below <?php // variable n is equal to the id of number on PrimeNumber.html $PrimeNum = $_GET['number']; // Checks to see if the number entered is between 1-1000 // Make sure it also checks to see if the number is less then 0 if ( $PrimeNum <= 0 || $PrimeNum >= 1000) { echo "<p>The number must between 1 and 999. Please try again.</p>"; echo "<p><a href='PrimeNumber.html'>Go Back.</a></p>" ; die(); // Make it so the script stops here and doesn't continue running } // Calculates to check and see if a number is prime. If it is not prime it displays an error message. for($i = 2; $i < sqrt($PrimeNum); $i = $i + 2){ if ($PrimeNum % $i == 0){ echo "<p>The number you entered was not a prime number.</p>" ; echo "<p><a href='PrimeNumber.html'>Go Back.</a></p>" ; die(); //Like before, we know its not a prime number so there is no reason to continue processing }else{ echo "<p>The number you entered is prime!</p>"; echo "<p><a href='PrimeNumber.html'>Go Back.</a></p>" ; die(); // like before, except we know now that this is a prime number } } ?> Hopefully it works...
  4. <?php $myvar1 = $_GET['myfn']; $myvar2 = $_GET['mymt']; header('Content-disposition: attachment; filename=' && $myvar1); header('Content-type: ' && $myvar2); readfile($myvar1); ?> I'm not sure why you are using the operator && (and) in the header function, you will probably have more luck with the code below <?php $myvar1 = $_GET['myfn']; $myvar2 = $_GET['mymt']; header('Content-disposition: attachment; filename='.$myvar1); header('Content-type: '.$myvar2); readfile($myvar1); ?>
  5. I've ran your script on my local computer, it works fine. Is there any other PHP in addnotices.php that you did not show? As this might be causing the script not to display for you.
  6. This is just a guess as l can't test this at the moment, but try: td.middle { vertical-align: top; height: 400px; width: 100%; <----- padding: 4px; }
  7. O.O, but there are other support options Google.com <- Your best friend when you have a problem to solve. php.net <- Go to the manual and you can find information about all the functions in php and what they do with examples This forum. There really is no need for phone line support!
  8. Also it helps if you post the error you are receiving. From just looking at the code, here is what l see that needs to be fixed. <?php echo "<p>".$e->getMessage(),"</p>"; // To echo "<p>".$e->getMessage()."</p>"; ?> Can't really help you more until you give the exact error that is happening.
  9. Thanks 448191 thats exactly the kick in the right direction l needed!
  10. It's not exactly what l'm trying to acheive, as when it comes to a mysqli database that would be of no use as l want to use it in a way like this: $db = new database('w.e', 'w.e', 'w.e', w.e'); $db->query()... That way, if l switch to a server that has mysqli and no mysql all l have to do is edit the config file and the database.php will enable me to use the functions from mysqli.database.php (which l havent made yet) Thanks for trying to help
  11. Hello, While learning OOP l've hit a snag. I wish to be able to switch between two different database types mysqli and mysql. To do that l've setup the following... database.php mysql.database.php mysqli.database.php In database.php, it will eventually select from the config file what type of database to use. However, l still cant grasp the concept of how do achieve this. This is what l have so far. database.php include('mysql.database.php'); interface database { function connect($host, $db, $user, $pass) { $this->host = $host; $this->db = $db; $this->user = $user; $this->pass = $pass; } mysql.database.php class MySQL implements database { function connect() { mysql_connect($this-host,$this->user,$this->pass); mysql_select_db($this->db); echo 'working?'; } } I've changed the code many times from idea's l've found on the internet while trying to find out how to do this. I know the code above wont work properly, but l really would appreciate a kick in the right direction Thanks for your help.
  12. The design is nice, you should probably centre it though to make it look better as l dont think it looks good currently being aligned to the left. And lastly, like others have said before me get rid of the tables and use div's with css.
  13. I dont think it is a wise idea for any user to see the information that is being submitted to the database, such as a registration script this is why l consider $_POST to be more secure.
  14. You should use $_POST instead of $_GET as it is more secure. But if you still want to use $_GET you should make it so that the script checks to see if the user via $_SESSION has permission then delete's a record. Also it would also be wise to filter $_GET with htmlspecialchars()
  15. Yeah a better option would be downloading WAMP. Its a bundle that already has mysql, apache (web server) and php already setup to work with each other. You can download it from http://www.wampserver.com/en/
  16. No problem happy to help. One last thing for you <?php if( ($day == 13) || ($day == 22) ) // This way it would only appear on two certain days, "||" means OR { // special image here.... } // rest of code would follow like above ?>
  17. Yeah you could do something like.... <?php // Get the month as a digit 1-12 $month = date("n"); // Get the day as a digit 1-31 $day = date("j"); switch($month) // Choose which image to display for which month by using a switch more info can be found here(http://au3.php.net/manual/en/control-structures.switch.php) { case $month == 1: if($day == 23) { echo '<img src="specialImage.jpg" alt="" />'; } else { echo '<img src="normalImage.jpg" alt="" />'; } break; case $month == 2: if($day == 13) { echo '<img src="specialImage.jpg" alt="" />'; } else { echo '<img src="normalImage.jpg" alt="" />'; } break; // etc.... } ?> Probably a more productive way of doing it, but it should help you
  18. Say if you wanted different pictures for different months, you would so something like this.... for more information have about the php data function (http://au3.php.net/date) <?php // Get the month as a digit 0-12 $month = date("n"); switch($month) // Choose which image to display for which month by using a switch more info can be found here(http://au3.php.net/manual/en/control-structures.switch.php) { case $month == 1: echo '<img src="january.jpg" alt="" />'; break; case $month == 2: echo '<img src="february.jpg" alt="" />'; break; // etc.... } ?> Hopefully this helps!
  19. So I'm at the point where I've been learning PHP for 3 years now and wondering whether or not to become a full time programmer. I've been searching the Internet for business' looking for programmers, out of many l've looked at only a very small few require a computer science degree (which would be needed to become a system's administrator anyway) Except I'm one that doesn't really enjoy school and the homework that comes with it. What qualifications do you have? Would you recommend to stick with school and get the computer science degree or quit school and do specific courses related to programming? Your advice is greatly appreciated. Thanks.
  20. Sorry to have wasted your time, but it seems that now the code is working again.
  21. I did as you said and this is where it gets really weird. Because the result returns nothing at all. Just to make sure, l did: echo "test1"; // add this line. die($groupid.$status); echo "test2"; Result: test1 Another test to make sure echo "test1"; // add this line. die("test3"."test4"); echo "test2"; Result: test1test3test4 So the die is defiantly working, l just cant understand why $groupid and $status have no data in them!
  22. Thanks l didn't know about that, should save me some time in the future . However that isnt the problem, its the fact that $groupid and $status don't have any data inside of them so the result is always 0
  23. Hey, I've been trying to figure this out for a while, the function returns a result but its not the result l want. I've tried to debug the function and it seems that $groupid and $status aren't being set as when l echo'ed them out they both had no data in them. If l set the variables data inside the function the code executes perfectly, so l cant understand why it isnt working. What l need the code to do is check to see if the member logging in is an admin (group id or a root admin (group id 9) and if the game is offline (status 1) to only only admin and root admin. However is the game is offline but status is set to 2, then only root admin can login. If the game is offline, normal members are not allowed to login. Clearance is there so l can check to see whether or not to allow them pass or stop them from logging in. My code is as follows: function offlineCheck($groupid,$status) { if($status > 0){ if($groupid > 7){ return $clearance = 0; }else{ return $clearance = 1; } }elseif($status > 1){ if($groupid > { return $clearance = 0; }else{ return $clearance = 1; } }else{ return $clearance = 0; } } And what l have currently checking it is: if(offlineCheck(4,2) > 0){ echo "it worked!"; die(); } Your help is greatly appreciated, dual_alliance
  24. LOL ok. Tried to make it clear, l have no idea when it comes to using foreach() // Do they want to delete the selected? if($_GET['act'] == "delsel"){ // Clean the posted variable $eid = Clean($_POST['eid']); if (!is_array($eid)) { die('This is not an array!'); } // Not sure if this is really nessasary for the foreach command, but get the event id from where it is for the member $query = mysql_query("SELECT `e_id` from `events` WHERE `e_for` = '$memberid'"); $row = mysql_fetch_array($query); // Not sure about this bit either, but make the gotten results into the variable $eid2 $eid2 = $row['e_id']; // you set this here but is over-written in the foreach foreach ($eid as $eid2) { // Delete the row where the eid = $eid $query4 = "DELETE FROM `events` WHERE `e_id` = '$eid'"; // you are setting the value to be "array" because $eid should be an array? $result4 = mysql_query($query4) or die("Query Failed"); } // Tell the user what has happened echo '<br /><br /><center>Event\'s Succesfully Deleted<br /><br /> <a href="events.php">Back</a></center>'; }
×
×
  • 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.