|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Still having problems with my script!
Sorry to post again, but...
I have a PHP script that searches for availability of a domain and returns the results with the cost etc... A user then checks the checkboxes on my form for each domain they wish to purchase and this works fine. My problem is this... Once the user selects the required domains, they are directed to another page in the script asking which hosting packages they wish to purchase, but I am unable to carry the cost of the domains through to this page. The last page in my script, should add together the cost of the domains and the hosting scripts and give a total cost for each domain. the hosting costs work fine. So bascially, I am unable to carry the cost of the domains through to pages after the search results. I need to use the foreach command on this page to create the correct number of rows in my table. Can anyone help. This may not be too clear, but if you want to check the actual page out, please go to http://www.test.2tech-solutions.co.uk - domain registration. Alternatively I can post the script up here or email it. Many Thanks |
|
#2
|
|||
|
|||
|
RE: Still having problems with my script!
Yes please post up your script. What would be even nicer than posting it here is to host it on your domain and use highlight_file() to show the source. That way we don't have to deal with any of the funky formatting of the forum.....
|
|
#3
|
|||
|
|||
|
RE: Still having problems with my script!
Matt - I thought it would be easier to email the part of the script I am struggling with so I have done so. I hope that is ok.
It was the quickest way for me to get it accross for you. Cheers |
|
#4
|
|||
|
|||
|
RE: Still having problems with my script!
Matt,
Sorry to bug you, but I was if you had managed to salvage anything from the script I sent you? In case anyone else fancies taking a look, here is the script... function whois_results() { $unavailable = "<img src='http://www.2tech-solutions.co.uk/main/images/unavail.gif'>"; global $domain, $idomain, $itld, $idomprice, $iwhois, $idomava, $register_dom, $dom_cost, $domain_to_buy, $domain_name, $extension; $domext = "co.uk,ltd.uk,net.uk,org.uk,plc.uk,com,net,org,biz, info,uk.co,ws,eu.com,gb.com,gb.net,uk.com,uk.net,m e.uk"; $domwhois = "whois.nic.uk,whois.nic.uk,whois.nic.uk,whois.nic.u k,whois.nic.uk,whois.internic.net,whois.internic.n et,whois.internic.net,whois.biz,whois.afilias.info ,whois.uk.co,whois.website.ws,whois.centralnic.net ,whois.centralnic.net,whois.centralnic.net,whois.c entralnic.net,whois.centralnic.net,whois.nic.uk"; $domava = "No match,No match,No match,No match,No match,No match,No match,No match,Not found,NOT FOUND,NO MATCH,No match,No match,No match,No match,No match,No match,No match"; $domprice = "5.99,5.99,5.99,5.99,5.99,11.99,11.99,11.99,21.99,2 1.99,21.99,41.99,45.99,47.99,47.99,47.99,47.99,88. 99"; $domext_split = split (",", $domext); $domwhois_split = split (",", $domwhois); $domava_split = split (",", $domava); $domprice_split = split (",", $domprice); $domain_split = split (".", $domain); print ("<form method='post' action='$PHP_SELF'> <input type='hidden' name='action' value='buy_domains'> <p align='center'><font face='verdana' size='2'>Searching WHOIS databases for availabilty of domain <strong>$domain</strong>. Please be patient as this will take a few moments...</font></p> <div align='center'><table border='1' valign='middle' width='90%' bordercolor='#3399CC' cellspacing='0' font='times' size='3'> <tr> <td width='33%'><p align='center'><font face='verdana' size='2'><b>Price</b></font></p></td> <td width='33%'><p align='center'><font face='verdana' size='2'><b>Domain</b></font></p></td> <td width='33%'><p align='center'><font face='verdana' size='2'><b>Purchase?</b></font></p></td> </tr>"); $x = ""; $i = "0"; while (!$x) { if ($domext_split[$i] && $domwhois_split[$i] && $domava_split[$i]) { $itld = escapeshellcmd ($domext_split[$i]); $idomain = escapeshellcmd ($domain_split[0]); $iwhois = escapeshellcmd ($domwhois_split[$i]); $idomava = escapeshellcmd ($domava_split[$i]); $idomprice = escapeshellcmd ($domprice_split[$i]); $run = "/usr/bin/whois -h $iwhois $idomain"."."."$itld"; exec ($run, $output); $output = join($output,"n"); if (ereg($idomava, $output)) { print ("<tr><td width='33%'><p align='center'><font face='verdana' size='2'><input type='hidden' name='dom_cost[]' value='$idomprice'>£$idomprice per year</p></font></td> <td width='33%'><p align='center'><font face='verdana' size='2'><input type='hidden' name='domain_name[]' value='$idomain'>$idomain.$itld<input type ='hidden' name='extension[]' value='$itld'></p></font></td> <td width='33%'><p align='center'><font face='verdana' size='2'><input type='checkbox' name='register_dom[]' value='$idomain.$itld' tabindex='0'></p></font></td></tr>"); } elseif ($output == "This domain has no whois server." || $output == "connect: No route to host") { print ("<tr><td width='33%'><p align='center'><font face='verdana' size='2'> </p></font></td> <td width='33%'><p align='center'><font face='verdana' size='2'>$idomain.$itld</p></font></td> <td width='33%'><p align='center'><font face='verdana' size='2' color='#FF0000'><input type='hidden' name='dom_cost[]' value='$idomprice'>Domain Database Not Available</p></font></td></tr>"); } else { print ("<tr><td width='33%'><p align='center'><font face='verdana' size='2'> n</p></font></td> <td width='33%'><p align='center'><font face='verdana' size='2'><strike>$idomain.$itld</strike><br>n</p></font></td> <td width='33%'><p align='center'><font face='verdana' size='2' color='#FF0000'><input type='hidden' name='dom_cost[]' value='$idomprice'>$unavailable<br>n</p></font></td></tr>"); } $i++; } else { $x = 1; } } print ("</table></div><p align='center'><font face='verdana' size='1'>Please note: All domain registrations are for a minimum period of 2 years.</font></p> <p align='center'><font face='verdana' size='2'>To search for another domain enter it below, or to purchase your chosen domains click </font> <input type='submit' value='Continue' name='donedomains' class='input' tabindex='0'></p> </form>"); ?> <form method="post" action="<?php echo $PHP_SELF ?>"> <input type="hidden" name="action" value="whois"> <div align="center"> <table border="0" width="90"> <tr><td width=45%"><p align="right"><INPUT type="text" name="domain" class="input" size="20" tabindex="0" STYLE="height: 21px; width: 200; font-size: 9pt; font-family: verdana;" VALUE=""> <td width="45%"><input type="submit" value="Go!" class="input" name="GetDomains" tabindex="0"></td></tr> </table></div></form> <?php } function domain_hosting() { global $domain, $domain_name, $extension, $idomain, $itld, $idomprice, $iwhois, $idomava, $register_dom, $reg_cost, $reg_domains; $host = " <option>Domain Parking</option> <option>Web Forwarding</option> <option>Email Only</option> <option>Home Basic</option> <option>Home Advanced</option> <option>Small Business</option> <option>Medium Business</option> <option>Large Business</option> <option>Corporate Enterprise</option>"; print ("<p align='center'><font face='verdana' size='2'>Your chosen domain(s) are listed below. Please select a hosting package to accompany your domain(s).</font> <FORM method='post' action='$PHP_SELF'> <input type='hidden' name='action' value='mail_form'> <div align='center'> <table border='0' width='75%'> <tr> <th width='50%' bgcolor='#3399CC' align='center'><font face='verdana' size='2' color='#000000'><b>Domain(s) Purchased</b></font></th> <th width='50%' bgcolor='#3399CC' align='center'><font face='verdana' size='2' color='#000000'><b>Hosting Package</b></font></th> </tr>"); foreach ($register_dom as $iregister_dom) { list ($r, $idomain_name) = each($domain_name); list ($s, $iextension) = each($extension); if ($iextension == "co.uk") { $reg_cost = "5.99"; } if ($iextension == "ltd.uk") { $reg_cost = "5.99"; } if ($iextension == "plc.uk") { $reg_cost = "5.99"; } if ($iextension == "net.uk") { $reg_cost = "5.99"; } if ($iextension == "org.uk") { $reg_cost = "5.99"; } if ($iextension == "com") { $reg_cost = "11.99"; } if ($iextension == "net") { $reg_cost = "11.99"; } if ($iextension == "org") { $reg_cost = "11.99"; } if ($iextension == "uk.co") { $reg_cost = "21.99"; } if ($iextension == "biz") { $reg_cost = "21.99"; } if ($iextension == "info") { $reg_cost = "21.99"; } if ($iextension =="uk.com") { $reg_cost = "47.99"; } if ($iextension == "uk.net") { $reg_cost = "47.99"; } if ($iextension == "gb.com") { $reg_cost = "47.99"; } if ($iextension == "gb.net") { $reg_cost = "47.99"; } if ($iextension == "ws") { $reg_cost = "41.99"; } if ($iextension == "eu.com") { $reg_cost = "45.99"; } if ($iextension == "me.uk") { $reg_cost = "88.99"; } print ("<tr> <td width='50%' bgcolor='#3399CC' align='center'><font face='verdana' size='2' color='#FFFFFF'><input type='hidden' name='dom_price[]' value='$reg_cost'>$iregister_dom<input type='hidden' name='reg_domains[]' value='$iregister_dom'></font></td> <td width='50%' bgcolor='#3399CC' align='center'><font face='verdana' size='2' color='#FFFFFF'><select size ='1' name='domain_host[]' class='input'>$host</select></font></td> </tr>"); } print ("</table></div> <p align='center'><font class='bodyfont' size='2'>Once you have chosen the Hosting packages for your domain names, click <input type='submit' name='purchase_domain_host' value='Purchase' class='input'></font></p> </form> <p align='center'><font class='bodyfont' size='2'><a font class='bodyfont' href='../prices/hosts/' target='_blank'>To check the prices of our hosting packages click here. Don't worry, your order will not be affected.</a></font></p>"); } function details_form() { global $reg_domains, $extension, $iextension, $domain, $idomains, $reg_domains, $ireg_domains, $domain_host, $ihost, $dom_cost, $dom_price, $reg_cost, $ireg_cost; print ("<p align='justify'><font class='bodyfont' size='2'>Finally, please enter the details necessary to complete your order.</font></p> <p align='justify'><font class='bodyfont' size='2'>Remember to enter the forwarding URL and Email details if you requested the Web Forwarding or Email Only hosting packages.</font></p> <form method='post' action='$PHP_SELF'> <input type='hidden' name='action' value='process_order'> <div align='center'><table border='0' valign='middle' width='80%' bordercolor='#3399CC' cellspacing='0' font='times' size='3'> <tr> <td colspan='4' align='center'><font class='bodyfont' size='4'><b>Registration Details</b></font></td> </tr> <tr> <td colspan='4'> </td> </tr> <tr> <td bordercolor='#3399CC' style='border-right: 1 solid #3399CC; border-bottom: 1 solid #3399CC'><p align='center'><font face='verdana' size='2'><b>Domain(s)</b></font></p></td> <td bordercolor='#3399CC' style='border-right: 1 solid #3399CC; border-bottom: 1 solid #3399CC'><p align='center'><font face='verdana' size='2'><b>Host Package(s)</b></font></p></td> <td bordercolor='#3399CC' style='border-right: 1 solid #3399CC; border-bottom: 1 solid #3399CC'><p align='center'><font face='verdana' size='2'><b>Price</b></font></td> <td bordercolor='#3399CC' style='border-bottom: 1 solid #3399CC'><p align='center'><font face='verdana' size='2'><b>Additional Info</b></font></td> </tr>"); foreach ($reg_domains as $ireg_domains) { list ($x, $ireg_cost) = each($dom_price); list ($v, $ihost) = each($domain_host); if (ereg("Domain Parking",$ihost)) { $ihost_cost = "0.00"; } if (ereg("Web Forwarding",$ihost)) { $ihost_cost = "1.99"; } if (ereg("Email Only",$ihost)) { $ihost_cost = "5.99"; } if (ereg("Home Basic",$ihost)) { $ihost_cost = "7.99"; } if (ereg("Home Advanced",$ihost)) { $ihost_cost = "15.99"; } if (ereg("Small Business",$ihost)) { $ihost_cost = "30.99"; } if (ereg("Medium Business",$ihost)) { $ihost_cost = "57.99"; } if (ereg("Large Business",$ihost)) { $ihost_cost = "89.99"; } if (ereg("Corporate Enterprise",$ihost)) { $ihost_cost = "175.99"; } $total_cost = $ihost_cost + $ireg_cost; if ($ihost == "Web Forwarding") { print ("<tr> <td bordercolor='#3399CC' style='border-right: 1 solid #3399CC; border-bottom: 1 solid #3399CC' align='center'><font class='bodyfont' size='2'><input type='hidden' name='gotdomains[]' value='$ireg_domains'>$ireg_domains</font></td> <td bordercolor='#3399CC' style='border-right: 1 solid #3399CC; border-bottom: 1 solid #3399CC' align='center'><font class='bodyfont' size='2'><input type='hidden' name='gothosts[]' value='$ihost'>$ihost</font></td> <td bordercolor='#3399CC' style='border-right: 1 solid #3399CC; border-bottom: 1 solid #3399CC' align='center'><font class='bodyfont' size='2'><input type='hidden' name='cost[]' value='$total_cost'>£$total_cost</font></td> <td bordercolor='#3399CC' align='center' style='border-bottom: 1 solid #3399CC'><p align='center'><font class='bodyfont' size='2'><input type='text' name='add_info[]' value='www.forwardURL.com' class='input' size='20' style='font-size: 8pt'></font></td> </tr>"); } elseif ($ihost == "Email Only") { print ("<tr> <td bordercolor='#3399CC' style='border-right: 1 solid #3399CC; border-bottom: 1 solid #3399CC' align='center'><font class='bodyfont' size='2'><input type='hidden' name='gotdomains[]' value='$ireg_domains'>$ireg_domains</font></td> <td bordercolor='#3399CC' style='border-right: 1 solid #3399CC; border-bottom: 1 solid #3399CC' align='center'><font class='bodyfont' size='2'><input type='hidden' name='gothosts[]' value='$ihost'>$ihost</font></td> <td bordercolor='#3399CC' style='border-right: 1 solid #3399CC; border-bottom: 1 solid #3399CC' align='center'><font class='bodyfont' size='2'><input type='hidden' name='cost[]' value='$total_cost'>£$total_cost</font></td> <td bordercolor='#3399CC' align='center' style='border-bottom: 1 solid #3399CC'><p align='center'><font class='bodyfont' size='2'><input type='text' name='add_info[]' value='yourname@yourdomain.com' class='input' size='20' style='font-size: 8pt'></font></td> </tr>"); } else { print ("<tr> <td bordercolor='#3399CC' style='border-right: 1 solid #3399CC; border-bottom: 1 solid #3399CC' align='center'><font class='bodyfont' size='2'><input type='hidden' name='gotdomains[]' value='$ireg_domains'>$ireg_domains</font></td> <td bordercolor='#3399CC' style='border-right: 1 solid #3399CC; border-bottom: 1 solid #3399CC' align='center'><font class='bodyfont' size='2'><input type='hidden' name='gothosts[]' value='$ihost'>$ihost</font></td> <td bordercolor='#3399CC' style='border-right: 1 solid #3399CC; border-bottom: 1 solid #3399CC' align='center'><font class='bodyfont' size='2'><input type='hidden' name='cost[]' value='$total_cost'>£$total_cost</font></td> <td bordercolor='#3399CC' align='center' style='border-bottom: 1 solid #3399CC'><p align='center'><font class='bodyfont' size='2'><input type='hidden' name='add_info[]' value='n/a'>n/a</font></td> </tr>"); } } print ("</table></div> <hr width='75%'> <table border='0' width='100%'><tr> <td colspan='4' align='center'><font class='bodyfont' size='4'><b>Your Details</b></font></td> </tr> <tr> <td align='right'><font class='bodyfont' size='2'>Title : </font></td> <td><p><select size='1' class='input' name='title' value='$title'> <option>----select----</option> <option>Mr</option> <option>Miss</option> <option>Mrs</option> <option>Ms</option> </select><font face='verdana' size='2' color='#FF0000'>*</font></p></td> <td align='right'></td> <td></td> </tr> <tr> <td align='right'><font class='bodyfont' size='2'>First Name : </font></td> <td><p><input type='text' name='first_name' value='$first_name' size='25' class='input'><font face='verdana' size='2' color='#FF0000'>*</font></p></td> <td align='right'><font class='bodyfont' size='2'>Surname :</font></td> <td><input type='text' name='surname' value='$surname' size='25' class='input'><font face='verdana' size='2' color='#FF0000'>*</font></td> </tr> <tr> <td align='right'><font class='bodyfont' size='2'>Company Name : </font></td> <td><input type='text' name='company_name' value='$company_name' size='25' class='input'></td> <td align='right'><font class='bodyfont' size='2'>Contact : </font></td> <td><input type='text' name='contact_name' value='$conact_name' size='25' class='input'></td> </tr> <tr> <td align='right'><font class='bodyfont' size='2'>Company Reg. No : </font></td> <td><input type='text' name='company_reg' value='$company_reg' size='25' class='input'></td> <td></td> <td></td> </tr> <tr> <td colspan='4'><hr width='75%'></td> </tr> <tr> <td align='right'><font class='bodyfont' size='2'>Address Line 1 : </font></td> <td colspan='3'><input type='text' name='address1' value='$address1' size='35' class='input'><font face='verdana' size='2' color='#FF0000'>*</font></td> </tr> <tr> <td align='right'><font class='bodyfont' size='2'>Address Line 2 : </font></td> <td colspan='3'><input type='text' name='address2' value='$address2' size='35' class='input'></td> </tr> <tr> <td align='right'><font class='bodyfont' size='2'>Town / City : </font></td> <td colspan='3'><input type='text' name='town_city' value='$town_city' size='35' class='input'><font face='verdana' size='2' color='#FF0000'>*</font></td> </tr> <tr> <td align='right'><font class='bodyfont' size='2'>County : </font></td> <td colspan='3'><input type='text' name='county' value='$county' size='35' class='input'><font face='verdana' size='2' color='#FF0000'>*</font></td> </tr> <tr> <td align='right'><font class='bodyfont' size='2'>Postal Code : </font></td> <td colspan='3'><input type='text' name='postal_code' value='$postal_code' size='35' class='input'><font face='verdana' size='2' color='#FF0000'>*</font></td> </tr> <tr> <td align='right'><font class='bodyfont' size='2'>Country : </font></td> <td colspan='3'><input type='text' name='country' value='$country' size='35' class='input'><font face='verdana' size='2' color='#FF0000'>*</font></td> </tr> <tr> <td align='right'><font class='bodyfont' size='2'>Email Address : </font></td> <td colspan='3'><input type='text' name='email' value='$email' size='50' class='input'><font face='verdana' size='2' color='#FF0000'>*</font></td> </tr> <tr> <td align='right'><font class='bodyfont' size='2'>Telephone : </font></td> <td><input type='text' name='telephone' value='$telephone' size='20' class='input'><font face='verdana' size='2' color='#FF0000'>*</font></td> <td><p align='right'><font class='bodyfont' size='2'>Mobile : </font></td> <td><input type='text' name='mobile' value='$mobile' size='20' class='input'></td> </tr> <tr> <td colspan='4'><font face='verdana' size='2' color='#FF0000'><blockquote><blockquote><blockquote><blockquote>* = Required Field</font></td> </tr> </table> <table border='0' width='100%'><tr> <td align='center'><hr width='75%'></td> </tr> <tr> <td align='center'><b><font class='bodyfont' size='3'><b>ONLY AMEND THE FOLLOWING IF YOU KNOW WHAT YOU ARE DOING</font></b></td> </tr> <tr> <td align='center'> <table border='0' width='40%'> <tr> <td width='50%'> <p align='right'><font class='bodyfont' size='2'>Primary DNS Server : </font></td> <td width='50%'> <p align='left'><input type='text' name='pri_dns_name' value='ALBERT.VENTFORTH.NET' size='25' class='input'></td> </tr> <tr> <td width='50%'> <p align='right'><font class='bodyfont' size='2'>Primary DNS Server IP : </font></td> <td width='50%'> <p align='left'><input type='text' name='pri_dns_ip' value='212.84.179.98' size='25' class='input'></td> </tr> <tr> <td width='50%'> <p align='right'><font class='bodyfont' size='2'>Secondary DNS Server : </font></td> <td width='50%' align='left'><input type='text' name='sec_dns_name' value='IVO.VENTFORTH.NET' size='25' class='input'></td> </tr> <tr> <td width='50%'> <p align='right'><font class='bodyfont' size='2'>Secondary DNS Server IP : </font></td> <td width='50%' align='left'><input type='text' name='pri_dns_ip' value='212.84.179.165' size='25' class='input'></td> </tr> </table> </td> </tr> </table> <table border='0' width='100%'> <tr> <td><p align='center'><input type='submit' value='Purchase' name='purchase_package' class='input'></td> <td><p align='center'><input type='reset' value='Clear Form' name='reset' class='input'></td> </tr> </table> </form>"); } cheers mike |
|
#5
|
|||
|
|||
|
RE: Still having problems with my script!
Whoah.
Put all of those tables into a database table, or at least an array, and do lookups. Fifty different if statements is a bit much. |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > Still having problems with my script! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|