Jump to content

chriscloyd

Members
  • Posts

    488
  • Joined

  • Last visited

Everything posted by chriscloyd

  1. when you echo your info back from the database you can use <?php //act like this is the string from your db $string = "Hi I\'m Chris, please don\'t kill me!"; echo stripslashes($string); ?>
  2. Rating systems are simple, once you get the hang of it you will be like really. It was that easy!
  3. just add the information to the url <?php echo "Rate this seller: "; echo "<a href=\"{$_SERVER['PHP_SELF']}?usr={$member}&mode=vote&voted=1&id={$rating['usr']}\">Vote 1</a> | "; echo "<a href=\"{$_SERVER['PHP_SELF']}?usr={$member}&mode=vote&voted=2&id={$rating['usr']}\">Vote 2</a> | "; echo "<a href=\"{$_SERVER['PHP_SELF']}?usr={$member}&mode=vote&voted=3&id={$rating['usr']}\">Vote 3</a> | "; echo "<a href=\"{$_SERVER['PHP_SELF']}?usr={$member}&mode vote&voted=4&id={$rating['usr']}\">Vote 4</a> | "; echo "<a href=\"{$_SERVER['PHP_SELF']}?usr={$member}&mode=vote&voted=5&id={$rating['usr']}\">Vote 5</a><p>"; ?>
  4. <?php $query = "SELECT user_id,f_name FROM user_profile"; $result = mysql_query($query); echo $result; $results = array(); while ($row = mysql_fetch_array($result)) { $results[$row['f_name']] = $row['user_id'] ; } ?>
  5. does this help at all? <?php // Connects to your Database include ('db.php'); //First Query $Sql = "SELECT * FROM `pokemon` WHERE `owner_id` = '{$id}' and `slot` = '1'"; $Query = mysql_query($Sql); $Rows = mysql_fetch_array($Query); //Second Query $Sql2 = "SELECT * FROM `pokemon` WHERE `owner_id` = '{$id}' and `slot` = '1'"; $Query2 = mysql_query($Sql2); $Grab = mysql_fetch_array($Query2); //Third Query $Sql3 = "SELECT * FROM `pokedex` WHERE `id` = '{$rows['pokedex_id']}'"; $Query3 = mysql_query($Sql3); $FetchThis = mysql_fetch_array($Query3); //Num Of Pokemon Per User $NumOfPokemon = mysql_num_rows($Query2); //check number if ($NumOfPokemon == 0) { echo "No pokemon!"; } else { if ($Grab['name'] != "Normal") { echo "{$Grab['name']}"; } echo "{$FetchThis['name']}"; echo "<img src=images/Pokemon/"; echo $Grab['name']; echo "/"; echo $FetchThis['name']; echo ".png"; echo ">"; } <?php if($typename== Normal) { echo ""; } else { echo $typename; } echo $pokedexname; ?></b> <?php ?>
  6. Can you show us your form that you use for them to select the information?
  7. Okay, thanks for the help! I really appreciated it. How do I make it to where they only play for ten weeks?
  8. I am working on my admin panel for a client and i am having a problem with creating an automatic scheduler. The problem I am having is that if the teams already played its not redoing the for loop how can i make it do the for loop again? <?php //Automatic Scheduler for leagues and such //Load custom mysql class for this project include("class.mysql.php"); //start MySql instance $my = new MySql; //get the number of teams $num = $my->getNum("SELECT id FROM teams"); //if number of teams are odd add a dummy team for a BYE week if ($num%2 != 0) { //create dummy team called BYE $my->insert('Teams',array("Name" => "BYE")); } //do the necessary calculations $number_of_teams = $num; $number_of_weeks = $number_of_teams * 2 - 2; $number_of_matches_per_week = $number_of_teams/2; $total_number_of_matches = $number_of_weeks * $number_of_matches_per_week; //start the week for statment for ($i = 1; $i <= $number_of_weeks; $i++) { //get all the teams in an array $teams = $my->getArray("SELECT id,name FROM teams"); shuffle($teams); for ($b = 1; $b <= $number_of_matches_per_week; $b++) { //get random teams $aid = array_rand($teams); $hid = array_rand($teams); //check to see if the teams have played each other if they have it will return FALSE if ($my->checkTeams($aid,$hid)) { //create match $my->createMatch($aid,$hid,$i); } else { //do it again $b--; } } } ?>
  9. well it depends you can do a permissions system
  10. here is all the code i used <?php if(isset($_POST['destination'])) { //i like creating arrays to keep things clearner $Array = array( "Barcelona" => array("875.00","85.00"), "Cairo" => array("950.00","98.00"), "Rome" => array("875.00","110.00"), "Santiago" => array("820.00","85.00"), "Tokyo" => array("1575.00","240.00") ); $destination = $_POST['destination']; $numTravelers = $_POST['numTravelers']; $numNights = $_POST['numNights']; $airFare = $_POST['airFare']; $hotel = $_POST['hotel']; $airFare = $Array[$destination][0]; $perNight = $Array[$destination][1]; $discount = ($destination == "Tokyo" && $numNights >= 5 ? "200" : "0"); //above change discount to whatever you need it to be $tickets = $numTravelers * $airFare; $hotel = $numTravelers * $numNights * $perNight; $totalCost = $tickets + $hotel + $discount; //I do not know where u want the discount added, to the totalcost or what print("<p>Destination: $destination<br />"); print("Number of people: $numTravelers<br />"); print("Number of nights: $numNights<br />"); print("Airline Tickets: $".number_format($tickets, 2)."<br />"); print("Hotel Charges: $".number_format($hotel, 2)."<br />"); if ($discount != 0) { print("Discount: $".number_format($discount, 2)."</p>"); } print("<p><strong>TOTAL COST: $".number_format($totalCost, 2)."</strong></p>"); } ?> <html> <head> <title>Travel</title> <link rel ="stylesheet" type="text/css" href="sample.css" /> </head> <body> <h1>Travel Reservation Form</h1> <p> <form action="" method="post" > <table> <tr><td>Select your vacation destination</td> <td><select name = "destination" /> <option>Barcelona</option> <option>Cairo</option> <option>Rome</option> <option>Santiago</option> <option>Tokyo</option> </select></td></tr> <tr><td>How many people are traveling?</td> <td><input type = "text" size = "5" name = "numTravelers" /></td> </tr><tr><td>How many nights will you be staying?</td> <td><input type = "text" size = "5" name = "numNights" /></td></tr> </table> <p><input type = "submit" value = "Submit Your Reservation" /></p> </form> </body> </html>
  11. What is happening when you run this code? <?php $query10 = "SELECT `points` FROM `ffa_rankings` WHERE playerid = '{$playeridcheck}' and gameid = '{$gametype}' and typeid = '{$matchtype}'"; $result10 = mysql_query($query10); $row10 = mysql_fetch_array($result10); if ($row10) { // } else { // }
  12. okay i put up a test one at http://cloydprojects.com
  13. Do you have an form i could see so I can test it for you?
  14. how about this? <?php //i like creating arrays to keep things clearner $Array = array( "Barcelona" => array("875.00","85.00"), "Cairo" => array("950.00","98.00"), "Rome" => array("875.00","110.00"), "Santiago" => array("820.00","85.00"), "Tokyo" => array("1575.00","240.00") ); $destination = $_POST['destination']; $numTravelers = $_POST['numTravelers']; $numNights = $_POST['numNights']; $airFare = $_POST['airFare']; $hotel = $_POST['hotel']; $airFare = $Array[$destination][0]; $perNight = $Array[$destination][1]; $discount = ($destination == "Tokyo" && $numNights >= 5 ? "200" : "0"; //above change discount to whatever you need it to be $tickets = $numTravelers * $airFare; $hotel = $numTravelers * $numNights * $perNight; $totalCost = $tickets + $hotel + $discount; //I do not know where u want the discount added, to the totalcost or what print("<p>Destination: $destination<br />"); print("Number of people: $numTravelers<br />"); print("Number of nights: $numNights<br />"); print("Airline Tickets: $".number_format($tickets, 2)."<br />"); print("Hotel Charges: $".number_format($hotel, 2)."</p>"); print("<p><strong>TOTAL COST: $".number_format($totalCost, 2)."</strong></p>");
  15. are you actually trying to store an image in the database or just a link to the image its self?
  16. do a javascript command or ajax. onwindows load do initpage function or something for example <script type="javascript/text"> window.onload = pageChecker; function pageChecker() { document.getElementById['submit'].onSubmit = do the function of sending the form with javascript } </script> For the message you can put a hidden value in the form that sends the same message all the time
  17. Well this is php help, and we ususally help you with your own coding problems. There is a section in the forums where it might be more suitable... http://www.phpfreaks.com/forums/index.php?board=34.0
  18. yo can use ajax <script type="text/javascript"><!-- function ajaxRequest(){ var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"] //activeX versions to check for in IE if (window.ActiveXObject){ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken) for (var i=0; i<activexmodes.length; i++){ try{ return new ActiveXObject(activexmodes[i]) } catch(e){ //suppress error } } } else if (window.XMLHttpRequest) // if Mozilla, Safari etc return new XMLHttpRequest() else return false } var mygetrequest=new ajaxRequest() mygetrequest.onreadystatechange=function(){ if (mygetrequest.readyState==4){ if (mygetrequest.status==200 || window.location.href.indexOf("http")==-1){ document.getElementById("result").innerHTML=mygetrequest.responseText } else{ alert("An error has occured making the request") } } } var mobilevalue=encodeURIComponent(document.getElementById("mobile").value) var textvalue=encodeURIComponent(document.getElementById("message").value) mygetrequest.open("GET", "http://www.bbnsms.com/bulksms/bulksms.php?username=drogba@bbnsms.com&passwo rd=mypasswd&message="+textvalue+"&mobile="+mobilevalue+"&sender=Kemi", true) mygetrequest.send(null) --></script> Question how will he be defining the message?
  19. Cant, I think the best way would be to run the statement before the echo and then add the variable. Also if you are using echo ""; you can add a var easy if you do echo "{$varname}"; instead of the ". $var ."
  20. chriscloyd

    Regex

    try this <?php function getName($url) { $input = trim($url, '/'); $urlParts = parse_url($input); $domain = preg_replace('/^www\./', '', $urlParts['host']); $parts = explode('.', $domain); return $parts[0]; } $d = 'http://www.google.com'; $tld = getName($d); echo $tld; ?>
  21. heres a form <html> <body> <h1>My SMS form</h1> <form method=post action='sendsms.php'> <table border=0> <tr> <td>Recipient</td> <td><input type='text' name='recipient'></td> </tr> <tr> <td> </td> <td><input type=submit name=submit value=Send></td> </tr> </table> </form> </body> </html> easiest way is to have it mail it for example if you are wanting to send it to a verizon customer send the mail to 6024804454@vtext.com it all depends on what you want to do, but without buying a sms gateway you are going to want to mail them
  22. here i found this awhile back and i used it and it worked <?php // Domain Logon Details $username=""; $password=""; // Domain details $domain="www.xxxxx.com"; $theme="xxxxx";//eg "fantastico_bluelagoon"; // Parameters to parse $eEmail=""; $eDomain="xxxxx.com"; $ePassword=""; $eQuota=""; // eg"10"; // Put post fields variable together $postfields = "email=$eEmail&domain=$eDomain&password=$ePassword&quota=$eQuota"; // initialise Curl $popPost = curl_init(); // Set Curl Option: URL $url="http://$domain:2082/frontend/$theme/mail/doaddpop.html"; curl_setopt($popPost, CURLOPT_URL, $url); // Set Curl Option: Username:Password curl_setopt($popPost, CURLOPT_USERPWD, "$username:$password"); // Set Curl Option: Post style request = true curl_setopt($popPost, CURLOPT_POST, 1); // Set Curl Option: Collect result from script curl_setopt($popPost, CURLOPT_RETURNTRANSFER, 1); // Set Curl Option: Set timeout to 15 seconds curl_setopt($popPost, CURLOPT_TIMEOUT, 15); // Set Curl Option: Post data curl_setopt($popPost, CURLOPT_POSTFIELDS, $postfields); // Execute Request, and store result in $tb_post $popPost_result = curl_exec ($popPost); // Close Curl curl_close ($popPost); //output results $start = strpos($popPost_result, '<b>Account'); $end = strpos($popPost_result, 'created.'); $subset = substr($popPost_result, $start, $end+8-$start); $subset = str_replace('login ', "login<br>", $subset); //for neatness //$subset=str_replace("<!",'<-',$subset); //see the comments if (preg_match ('/Sorry/i', "$subset")) { print "<br><b> Sorry that account already exists.</b><br><br>"; //print ($subset); } elseif(preg_match ('/You must specify/i', "$subset")) { print "<br><b>You must specify a password.</b><br><br>"; } else { print ($subset); print "<br><br>You may now use <b>mail.$domain</b> as your POP3 setting in your mail client or access <b>WebMail</b> by selecting <a href=http://$domain/webmail>Here</a>. <center> <br><a href=javascript:history.go(-1)>Go Back</a> </center>"; } ?> [/code[
  23. here try this <?php $submit = $_POST["submit"]; //If form is submitted, call the function and save all data into the array $_SESSION['form'] if($submit = "Buy"){setSessionVars();} function setSessionVars() { $item = array(); foreach($_POST as $fieldname => $fieldvalue) { $item[$fieldname] = $fieldvalue; } $_SESSION['cart'] = $item; echo "<table> <tr> <td> <img src=\"images/{$item['item']}.jpg\" /><td/> <td> {$item['item']}</td> <td> <input type=\"text(30)\" name=\"value\" value=\"1\" /> <input type=\"submit\" name=\"puchasednum\" value=\"Update This One Item\" /> </td> </tr> </table>"; } ?>
  24. My best guess would be that there is no challenge started in the table...?
×
×
  • 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.