Jump to content

azpaul

New Members
  • Posts

    6
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

azpaul's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Seriously? It is a login page to access game content with a code generated by the server? Check your PM for a copy of the email.
  2. Good Morning Forum, I write my own PHP when I need specific tasks done. It has been quite a while and since I have had the need to write anything so I am rusty as can be. I am needing some guidance and help and hope that I can acomplish what I am setting out to do with 2 hurdles I am trying to over come. I am trying to embed a trivia game web page that takes a 5 digit code that logs you into a current game. The site uses multiple logins and a database to retrieve and store data once logged in. A game session can have up to 1000 users and it does not matter what device is used as long as it has internet and a browser. I am successful in pulling their index.php file into mine with all pictuteres, links and format in tact. I have tried using JavaScript and iFrames but there is an issue with the cross domains and the permissions or security of some sort do not get passed properly using these two methods even though they keep the embeded site within my page. I have the company's permission to embed their main page into mine, actually it was their suggestion. The whole idea is to make it look like my site using their login and server with my information so the end users do not know the real source of the site where there are links on how to purchase from them on the pages used. Issues I have observed are with the JavaScript and iFrames are: When logged, in the server loses connection with the remote device and even though the game can be played, it does not up date the server. When logging out, the server keeps the connection active and even though the device logs out, the server app shows the client still logged in. When a wrong code is entered, the error message does not show up on the device trying to log in. Now this all goes away and the app works great running on their domain directly. I am also under the impression that I can manipulate certain elements with in the raw data. I am hoping that I can manipulate their contact us link to redirect to my contact information. But I believe this all has to stay within my site to pull that data. What I have accomplished is being able to load their main index.php into a basic page on my site with this code. I found it on another search earlier and it worked out of the chute. I do not quite understand curl. <? $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.theirsite.com"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $result = curl_exec($ch); curl_close($ch); $result = preg_replace("#(<\s*a\s+[^>]*href\s*=\s*[\"'])(?!http)([^\"'>]+)([\"'>]+)#",'$1http://theirsite.com/$2$3', $result); echo $result ?> I used a more simple PHP code as well but this also worked and it was the last I code snippet I tried. Once the page loads it is on my site in my domain. Once I enter the 5 digit code to join the game, it takes me from my site to theirsite.com and stays there. How do I keep it all embeded in my site? I have been researching this for about 8 hours now and this is as far as I have reached. Any help would be appreciated. I think PHP is the way to go with this. Thanks. I look forward to the your responses. Regards, Paul
  3. Hi, I am not that versed in PHP. I have been working with this snippet of code that I found on a tutorial site. It works like 97% and I get the format mostly like I need it. Except, I can not figure how to add an extra single node to the list. The code generates 20 random numbers and puts them into an array. The array is then used to create a numbers node in the xml file. It goes through and creates all the nodes. I can not seem to figure out how to put a single game numbernode at the top of all the numbers nodes. I am also not understanding how to write the output to create the actual xml file. I have written code in the past to write a string to a text file but I am not sure about this because it is in an array? The xml file will be appended every 5 minutes for data comparison down the road. I think I will need to add a routine that calls the data back in at the beginning of the script and looks for the last game number if it is there and add 1. The game number must increment each time it is appended. Any ideas on how to finish this up? The final out put will look like this. I only did a few lines instead of all 20 numbers to keep this short. <?xml version="1.0"> <Container> <gamenumber>10</gamenumber> <numbers>47</numbers> <numbers>10</numbers> <numbers>5</numbers> <numbers>27</numbers> </Container> My Script <?php $balls = range(1,80); shuffle($balls); $pick = array_slice($balls,1,20); //$drawn = implode(", ",$pick); $arraySize = sizeof($pick); // print ("Arraw is $drawn\n\n"); $doc = new DOMDocument(); $doc->formatOutput = true; $drawn = array(); $r = $doc->createElement( "Container" ); $doc->appendChild( $r ); for ($i=0; $i!= $arraySize; $i++){ $drawn [] = array( 'numbers' => $pick[$i], ); } foreach( $drawn as $draw ) { $numbers = $doc->createElement( "numbers" ); $numbers->appendChild( $doc->createTextNode( $draw['numbers'] ) ); $r->appendChild( $numbers); } echo $doc->saveXML(); ?> Thanks for your advise and help!!!
  4. I was able to get the last variable in to validate in an if statement. Thank you Corbin for giving me the idea to use all arrays... I was able to set all parameters up with a nested foreach using 1 if statement. Much more efficient and easier to read!! But, in order for the last variable in the data set to be read, I have to add another , delimiter??? So now there is really another empty field at the end make it 21 places instead of 20. That is what I do not understand. Any how, it is working and thanks again Corbin for the new thought! Here is the much cleaner code... I have the echos to see what was going on. I will be removing them... $number = 0; $counter = 0; //Compare Game Numbers with Ticket Numbers Using arrays. foreach ($drawn as $value) { $number++; $spot= 0; echo "Drawn Number = $number "; echo "Value = $value<br>"; //$value is that actual number for comparison and drawn number is the Nth number. //Ticket Array Numbers foreach ($ticketarray as $ticket) { $spot++; if ($ticket == $value) { $counter++; echo "HIT "; } else { echo "NO HIT "; } echo "SPOT $spot $ticket<br>"; } }
  5. Thanks for the input Corbin. $drawn is actually being read in from a text file. This file has the format of Game: 0> 67, 21, 74, 45, 19, 54, 41, 13, 29, 34, 73, 3, 63, 7, 22, 53, 49, 57, 36, 76 Game: 1> 31, 68, 56, 19, 28, 51, 2, 69, 6, 39, 7, 54, 48, 1, 46, 60, 75, 13, 62, 32 Game: 2> 60, 17, 68, 42, 46, 21, 22, 65, 15, 77, 32, 27, 62, 63, 58, 30, 56, 43, 34, 72 Game: 3> 11, 59, 60, 38, 48, 73, 32, 53, 25, 43, 68, 79, 62, 76, 80, 64, 45, 36, 49, 23 Game: 4> 69, 9, 20, 76, 54, 23, 41, 66, 59, 71, 29, 21, 38, 15, 46, 19, 5, 52, 31, 39 Game: 5> 33, 16, 50, 24, 71, 25, 58, 70, 53, 10, 13, 15, 4, 74, 30, 80, 9, 68, 54, 59 Game: 6> 62, 53, 28, 32, 60, 59, 10, 15, 65, 74, 42, 22, 8, 66, 48, 17, 11, 23, 37, 30 Game: 7> 51, 25, 18, 13, 20, 67, 27, 4, 26, 68, 54, 10, 55, 28, 66, 53, 52, 64, 78, 63 A search page allows the user to enter 2 - 10 numbers ranging from 1-80. These user numbers are assigned to $PickOne thru $PickTen. You can see a the development pages at www.101casinoparties.com/keno/keno_search.php. I like the idea of using all arrays but I am not knowledgeable enough to follow your script at this time. I am sorry. I have a lot to learn. Here is the entire script so far. Maybe this will help with understanding my logic. <?php $submit = $_POST['submit']; $GameNumber = $_POST['GameNumber']; $GameNumberSearch = "Game: ".$GameNumber; $PickOne = $_POST['PickOne']; $PickTwo = $_POST['PickTwo']; $PickThree = $_POST['PickThree']; $PickFour = $_POST['PickFour']; $PickFive = $_POST['PickFive']; $PickSix = $_POST['PickSix']; $PickSeven = $_POST['PickSeven']; $PickEight = $_POST['PickEight']; $PickNine = $_POST['PickNine']; $PickTen = $_POST['PickTen']; $Stake = $_POST['Stake'] ?> <?php $drawone = 12; $drawtwo = 45; $drawthree = 79; $drawnarray = array($drawone,$drawtwo,$drawthree); $comma_separated = implode(",", $drawnarray); //echo "Searching For $GameNumber <br>"; //Open File for Reading if(!$fp = fopen("gamedraw.txt","r")) { echo "cannot open the file"; } else { //while the file is not empty //echo "Passed Failure. Testing Further\n"; $i = 0; $counter = 0; while(!feof($fp)) { //read a line at a time to try and find a match $read_line = fgets($fp,255); $pieces = explode(">", $read_line); //echo "Game Variable $pieces[0]<br>"; if ($pieces[0] == $GameNumberSearch) $matched = "YES"; if ($pieces[0] == $GameNumberSearch) $game = $pieces[1]; $drawn = explode(",", $game); } if ($matched != "YES") echo "$GameNumberSearch --> NO SUCH GAME!<br>"; fclose($fp); } $number = 0; $counter = 0; echo "PickThree = $PickThree<br>"; foreach ($drawn as &$value) { $number++; echo "Number = $number "; echo "Value = $value<br>"; if ($value == $PickOne) { echo "$value Match 1st Spot<br>"; $counter++; } elseif ($value == $PickTwo) { echo "$value Matched Second Spot<br>"; $counter++; } elseif ($value == $PickThree) { echo "$value Matched Third Spot<br>"; $counter++; } elseif ($value == $PickFour) { echo "$value Matched Fourth Spot<br>"; $counter++; } elseif ($value == $PickFive) { echo "$value Matched Fifth Spot<br>"; $counter++; } elseif ($value == $PickSix) { echo "$value Matched Sixth Spot<br>"; $counter++; } elseif ($value == $PickSeven) { echo "$value Matched Seventh Spot<br>"; $counter++; } elseif ($value == $PickEight) { echo "$value Matched Eighth Spot<br>"; $counter++; } elseif ($value == $PickNine) { echo "$value Matched Nineth Spot<br>"; $counter++; } elseif ($value == $PickTen) { echo "$value Matched Tenth Spot<br>"; $counter++; } } echo "Total Hits $counter<br>"; //echo $drawn[0] .$drawn[1]. $drawn[2]. $drawn[3]. $drawn[4]. $drawn[5]. $drawn[6] //. $drawn[7]. $drawn[8]. $drawn[9]. $drawn[10]. $drawn[11]. $drawn[12]. $drawn[13] //. $drawn[14]. $drawn[15]. $drawn[16]. $drawn[17]. $drawn[18]. $drawn[19]. $drawn[20]; //$i=0; //$counter=0; // if ($drawn[0] == $PickOne Or $drawn[0] == $PickTwo Or $drawn[0] == $PickThree ) // echo "$drawn[0] is a HIT"; // else echo "No HITS"; ?>
  6. Hi, I am fairly new to PHP and I am able to stumble through most of what I need to do with the help of these forums and PHP.net. There are a lot of great support bulletins that cover a lot of issues. However, I have not been able to find one to help me with my issue. I am designing a Keno Game. I have a PHP script running in cron that generates a flat file database with 20 random numbers every X minutes. I have designed a PHP page that a person can enter in the Game Number and their picks up to 10 numbers using a post method. I am able to get all the information passed from the search page to the results page with no problem. I am able to read in the flat file and find the row with the proper game number and assign the 20 numbers into an array for criteria matching. I am able to display all the information to the screen correctly. Everything to this point is working perfect, although I am sure the code could be written cleaner. The part I am having a problem is counting the number of hits the player selected to that in the random number draw from the computer. I use a foreach loop to compare each number in the array to that number that was selected by the player. The problem is that the very last number is not checked in the loop or is ignored. I can echo the variables and they print correctly on the screen. Now all the other numbers in the array get check and pass the criteria if true. It is just that last number of the array that it breaks on. I can not see anywhere why this would not be checked by the if statement. The 20 number data set I am using is 63, 68, 64, 66, 14, 48, 25, 8, 67, 33, 6, 69, 36, 18, 16, 23, 24, 38, 57, 31 The Variables $PickOne through $PickTen is the data entered from the search screen for the numbers the player picked. The Variable $drawn is read in from another section from the flat file and is then made into an array with explode. 4 Numbers used in this order to test for matches 36 25 31 45 PickThree is the third number checked but could easily be PickFour or PickFive respectively. This is the last number in t he array, 31. Any help would greatly be appreciated. Thanks!! Echo Test Results PickThree = 31 Number = 1 Value = 63 Number = 2 Value = 68 Number = 3 Value = 64 Number = 4 Value = 66 Number = 5 Value = 14 Number = 6 Value = 48 Number = 7 Value = 25 25 Matched Second Spot Number = 8 Value = 8 Number = 9 Value = 67 Number = 10 Value = 33 Number = 11 Value = 6 Number = 12 Value = 69 Number = 13 Value = 36 36 Match 1st Spot Number = 14 Value = 18 Number = 15 Value = 16 Number = 16 Value = 23 Number = 17 Value = 24 Number = 18 Value = 38 Number = 19 Value = 57 Number = 20 Value = 31 Total Hits 2 Here is the snippet of code. $number = 0; // used to echo the array number $counter = 0; echo "PickThree = $PickThree<br>"; foreach ($drawn as &$value) { $number++; echo "Number = $number "; echo "Value = $value<br>"; if ($value == $PickOne) { echo "$value Match 1st Spot<br>"; $counter++; } elseif ($value == $PickTwo) { echo "$value Matched Second Spot<br>"; $counter++; } elseif ($value == $PickThree) { echo "$value Matched Third Spot<br>"; $counter++; } elseif ($value == $PickFour) { echo "$value Matched Fourth Spot<br>"; $counter++; } elseif ($value == $PickFive) { echo "$value Matched Fifth Spot<br>"; $counter++; } elseif ($value == $PickSix) { echo "$value Matched Sixth Spot<br>"; $counter++; } elseif ($value == $PickSeven) { echo "$value Matched Seventh Spot<br>"; $counter++; } elseif ($value == $PickEight) { echo "$value Matched Eighth Spot<br>"; $counter++; } elseif ($value == $PickNine) { echo "$value Matched Nineth Spot<br>"; $counter++; } elseif ($value == $PickTen) { echo "$value Matched Tenth Spot<br>"; $counter++; } } echo "Total Hits $counter<br>";
×
×
  • 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.