PHP - Find Url In Code
hello
I've some code and I want find and cut url from it using php. this url link between 1 - 5 link. this mean some times 1 URL in the code sometimes 2 url in the code and ... can anyone help me? Code: [Select] MB</div><br/> <br/> <br/> <b><br/> DOWNLOAD<br/> <br/> <a href="http://uploading.com/files/c2182562/LIBERO%252B24%252BLUGLIO%252B2010.pdf/" target="_blank" rel="nofollow">http://uploading.com/files/c2182562/LIBERO%2B24%2BLUGLIO%2B2010.pdf/</a><br/> <br/> <br/> <br/> <br/> <a href="http://rapidshare.com/files/408736098/LIBERO_24_LUGLIO_2010.pdf.html" target="_blank" rel="nofollow">http://rapidshare.com/files/408736098/LIBERO_24_LUGLIO_2010.pdf.html</a></b> </div> <table class='file-express' width='100%'> <tr> <td style='text-align: left; color: #B2AC94; font-size: 3'><br>titletm= LIBERO 24 LUGLIO 2010 LIBERO 24 LUGLIO 2010 :found<br><font color="blue">2</font>http://www.avaxhome.ws/magazines/everyday_practical_electronics_vol_33_no_5_2004.html<br>File exists.dllink'MB</div><br/> <br/> <br/> Similar TutorialsHey all, Basically I have this code which technically should work, but I have put an error in the logic somewhere and am really struggling to find it, I've been going over it for about an hour now :/ The error is that in the second part (// Enter them into the activities database if they're not already there), it won't enter them, and it won't show the word 'Randomevent1' either, so clearly somehow I have put in something to prevent it performing that step. Can anybody help me out? I'd be amazingly grateful, I have no clue how I've screwed it up. if(isset($_POST['submit'])){ $ownerid = $_SESSION['id']; // If completed = Y give an error $completeyn = "SELECT completed FROM activities WHERE playerno='$ownerid' AND activityno = '1'"; $completecheck=mysql_query($completeyn) or die(mysql_error()); while($row = mysql_fetch_array( $completecheck )) { if($row['completed'] == 'Y'){ echo 'Oops, you\'ve already done this twice today!';} else { // Enter them into the activities database if they're not already there $stepno2 = "SELECT playerno, timesdone FROM activities WHERE playerno='$ownerid' AND activityno = '1'"; $stepnoanswer2=mysql_query($stepno2) or die(mysql_error()); $num_rows2 = mysql_num_rows($stepnoanswer2); echo $num_rows2; if($num_rows2 == '0'){ $putintodb2 = mysql_query("INSERT INTO activities (playerno, activityno, timesdone) VALUES ('$ownerid', '1', '1')") or die("Error: ".mysql_error()); echo 'Randomevent1'; }else{ // If they are already there update their stepcount $updatestepcount2=("UPDATE activities SET timesdone=timesdone+'1' WHERE playerno='$ownerid' AND activityno = '1'"); $newstepcount2=mysql_query($updatestepcount2); echo 'Randomevent2';} // If this new stepcount is equal to 2, set completed to Y $checkstep = "SELECT timesdone FROM activities WHERE playerno='$ownerid' AND activityno = '1'"; $checkstepresult=mysql_query($checkstep) or die(mysql_error()); while($row = mysql_fetch_array( $checkstepresult )) { if($row['timesdone'] == '2'){ echo $row['timesdone']; $updatestepcount22=("UPDATE activities SET completed = 'Y' WHERE playerno='$ownerid' AND activityno = '1'"); $newstepcount22=mysql_query($updatestepcount22); } }}}} This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=306039.0 When clicking on the link "groups", there is no problem printing out the first level subgroups. But when clicking on any of the subgroup, the second level subgroups are not being displayed. I have or die(mysql_error()); after some queries but I can not see what is the error. It always gives the same message: Quote No Products Found. Sorry, but there are no products in this section at the moment. The products are constantly being updated, however. Please try again later or contact us. How would I find out which part of the code fails? The code: <?php include 'scrptz/functions.php'; // Page vars $thisPage=$getVars["page"]; if($thisPage<1)$thisPage=1; $firstGroup=($thisPage*16)-16; // Get group details and stick them into an array $qMain="SELECT * FROM PGroups WHERE PG = '".$getVars["prodg"]."'"; $result=mysql_query($qMain) or die(mysql_error()); $groupDetails=mysql_fetch_array($result); // Get all sub groups in current product group $qMain="SELECT * FROM SubG WHERE ProdG = '".$getVars["prodg"]."'"; $result=mysql_query($qMain) or die(mysql_error()); // Stick sub groups in a 2D associative array $j=0; while ($row=mysql_fetch_array($result)) { foreach($row as $i=>$data)$array[$j][$i]=$data; $j++; } // Calculate vars for navigation $totalGroups=$j; $totalPages=ceil($totalGroups/16); // Set page title (for bookmark) $pageTitle=$groupDetails["GPname"]; // Set top title if($totalGroups>0){$topTitle="VIEW PRODUCTS";}else{$topTitle="ERROR";} ?> <html> <head> <title>Lock-Tech® Hi-Specification Architectural Hardware</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="scrptz/styles.css" rel="stylesheet" type="text/css"> <script language="JavaScript" type="text/javascript">var theID="<?php echo $getVars['uid']; ?>";</script> <script language="JavaScript" src="scrptz/content.js" type="text/javascript"></script> <script language="JavaScript" src="scrptz/menu.js" type="text/javascript"></script> <script language="JavaScript" src="scrptz/scripts.js" type="text/javascript"></script> </head> <body background="imgz/bg.gif" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0"<?php echo $notify ?>> <?php include("top.php"); ?> <table width="952" height="509" border="0" cellpadding="0" cellspacing="0" class="maintext"> <?php if($sessions['accCode']){?><form action="http://www.lock-tech.co.uk/index.php" method="post" name="logout" target="_parent"><input name="account" type="hidden" value="<?php echo $sessions['accCode']; ?>"><input name="killSession" type="hidden" value="<?php echo $getVars['uid']; ?>"></form><?php }?> <tr> <td width="1" rowspan="5" bgcolor="#000000"></td> <td height="21" background="imgz/topbar.gif" bgcolor="#14359E"> </td> <td height="21" colspan="5" valign="middle" background="imgz/topbar.gif" bgcolor="#14359E" class="mainyellow"><?php include("scrptz/dd_menu.php"); ?></td> <td height="21" background="imgz/topbar.gif" bgcolor="#14359E"> </td> <td width="1" rowspan="5" bgcolor="#000000"></td> </tr> <tr> <td width="5" rowspan="3"> </td> <td width="306" height="30" valign="bottom" class="title2"><?php echo $groupDetails["GPname"] ?></td> <td width="11" rowspan="3"><img src="imgz/maindiv.gif" width="11" height="466"></td> <td width="306" height="30" align="center" valign="bottom" class="title2"><?php if($totalGroups>0){?><a href="g_view.php?pgroup=<?php echo $groupDetails["PG"] ?>&uid=<?php echo $getVars['uid']; ?>" class="link4" onmouseover="window.status='View List of all Products in <?php echo $groupDetails["GPname"] ?>'; return true">VIEW ALL</a> | <a href="g_browse.php?pgroup=<?php echo $groupDetails["PG"] ?>&uid=<?php echo $getVars['uid']; ?>" class="link4" onmouseover="window.status='Browse all Products in <?php echo $groupDetails["GPname"] ?>'; return true">BROWSE ALL</a><?php }?></td> <td width="11" rowspan="3"><img src="imgz/maindiv.gif" width="11" height="466"></td> <td width="306" height="30" align="center" valign="bottom"> </td> <td width="5" rowspan="3"> </td> </tr> <tr> <td height="20" valign="top" class="mainbold"></td> <td width="306" rowspan="2" valign="top" class="maintext"> <?php for($i=$firstGroup; $i<($firstGroup+8) && $i<$totalGroups; $i++){?> <a href="sub.php?PSubG=<?php echo $array[$i]["SPG"] ?>&uid=<?php echo $getVars['uid']; ?>" class="link1" onmouseover="window.status='View Products in <?php echo $array[$i]["SPGname"] ?>'; return true"><?php echo $array[$i]["SPGname"] ?></a><br> <?php // Get all subsubs in current sub group $qMain="SELECT * FROM SubSubG WHERE SPG = '".$array[$i]["SPG"]."'"; $result=mysql_query($qMain) or die(mysql_error()); // Print subsubs while ($row=mysql_fetch_array($result)) { ?> [<a href="subsub.php?PSubSubG=<?php echo $row["SSPG"]?>&uid=<?php echo $getVars['uid']; ?>" class="link3" onmouseover="window.status='View Products in <?php echo $row["SSPGName"]?>'; return true"><?php echo $row["SSPGName"]?></a>] <?php } ?> <br><br> <?php }?></td> <td width="306" rowspan="2" valign="top" class="maintext"> <?php for($i=$firstGroup+8; $i<($firstGroup+16) && $i<$totalGroups; $i++){ ?> <a href="sub.php?PSubG=<?php echo $array[$i]["SPG"] ?>&uid=<?php echo $getVars['uid']; ?>" class="link1" onmouseover="window.status='View Products in <?php echo $array[$i]["SPGname"] ?>'; return true"><?php echo $array[$i]["SPGname"] ?></a><br> <?php // Get all subsubs in current sub group $qMain="SELECT * FROM SubSubG WHERE SPG = '".$array[$i]["SPG"]."'"; $result=mysql_query($qMain) or die("<font color=\"#FF0000\">ERROR {9.4}! Please navigate to a <a href=\"main.php?uid=".$getVars['uid']."\">different page</a> and then try this page again.</font>"); // Print subsubs while ($row=mysql_fetch_array($result)) { ?> [<a href="subsub.php?PSubSubG=<?php echo $row["SSPG"]?>&uid=<?php echo $getVars['uid']; ?>" class="link3" onmouseover="window.status='View Products in <?php echo $row["SSPGName"]?>'; return true"><?php echo $row["SSPGName"]?></a>] <?php } ?> <br><br> <?php }?></td> </tr> <tr> <td height="416" valign="top" class="mainbold"> <?php if($totalGroups>0) { ?> <img src="grp_pics/<?php echo $groupDetails["PG"] ?>.jpg" alt="Group Picture" galleryimg="no"><br><img src="imgz/pixel.gif" width="306" height="5"><br> <?php echo $groupDetails["GPText"] ?><?php } else { ?> or die(mysql_error()); <p class="noresult">No Products Found.</p><p class="mainbold">Sorry, but there are no products in this section at the moment. The products are constantly being updated, however. Please try again later or <a href="mailto:sales@lock-tech.co.uk" class="link1" onmouseover="window.status='Send us an Email.'; return true">contact us</a>.</p><?php }?></td> </tr> <tr> <td width="5" height="22" background="imgz/btmbar.gif" bgcolor="#14359E"> </td> <td width="306" height="22" align="center" valign="top" background="imgz/btmbar.gif" bgcolor="#14359E"><a href="javascript:history.back()" onmouseover="prev_btn.src='imgz/prev2.gif';window.status='Previous Page'; return true" onmouseout="prev_btn.src='imgz/prev.gif'"><img name="prev_btn" src="imgz/prev.gif" width="124" height="16" border="0"></a></td> <td width="11" height="22" bgcolor="#14359E"><img src="imgz/btmdiv.gif" width="11" height="22"></td> <td width="306" height="22" align="center" background="imgz/btmbar.gif" bgcolor="#14359E" class="nav"><? include 'scrptz/nav.php' ?></td> <td width="11" height="22" bgcolor="#14359E"><img src="imgz/btmdiv.gif" width="11" height="22"></td> <td width="306" height="22" align="center" valign="top" background="imgz/btmbar.gif" bgcolor="#14359E"><a href="javascript:directLink('<?php echo $prodLink; ?>','<? echo $pageTitle ?>')" onmouseover="link_btn.src='imgz/link2.gif'; window.status='Direct Link to This Page'; return true" onmouseout="link_btn.src='imgz/link.gif'"><img name="link_btn" src="imgz/link.gif" alt="" width="182" height="16" border="0"></a></td> <td width="5" height="22" background="imgz/btmbar.gif" bgcolor="#14359E"> </td> </tr> </table> </body> </html> Here's a neat little script that you simply use by calling yourscript.php?microsoft (where microsoft is any keyword you want) and it returns 100 related keywords. It's pretty raw in it's form. I didn't write it. Purely for learning, I'm trying to figure out how to 1) issue a line break between each item in the elements of the arry? 2) return only the keywords and not the associated array info. Currently, it returns results like: Array ( => microsoft [1] => microsoft security essentials [2] => microsoft office [3] => microsoft templates [4] => microsoft updates [5] => microsoft silverlight [6] => microsoft word [7] => microsoft money [8] => microsoft office 2010 [9] => microsoft clip art [10] => microsoft [11] => microsoft security essentials [12] => microsoft office [13] => microsoft templates [14] => microsoft updates [15] => microsoft silverlight [16] => microsoft word [17] => microsoft money [18] => microsoft office 2010 [19] => microsoft clip art [20] => microsoft security essentials [21] => microsoft security essentials review [22] => microsoft security essentials alert [23] => microsoft security essentials update [24] => microsoft security essentials 2.0 I'm wanting to know how to make it return results like... microsoft microsoft security essential microsoft office microsoft templates etc.... Code: [Select] <?php function text_between($start,$end,$string) { if ($start != '') {$temp = explode($start,$string,2);} else {$temp = array('',$string);} $temp = explode($end,$temp[1],2); return $temp[0]; } function gsscrape($keyword) { $keyword=str_replace(" ","+",$keyword); global $kw; $data=file_get_contents('http://clients1.google.com/complete/search?hl=en&q='.$keyword); $data=explode('[',$data,3); $data=explode('],[',$data[2]); foreach($data as $temp) { $kw[]= text_between('"','"',$temp); } } #simple to use, just use yourscriptname.php?keywords if ($_SERVER['QUERY_STRING']!='') { gsscrape($_SERVER['QUERY_STRING']); foreach ($kw as $keyword) { gsscrape($keyword); } #all results are in array $kw... print_r($kw); } ?> Hi
I have a MySql database and wondered if there is a code to search a table field with a given string and display the number of unique occurrences.
The table is asterisk_cdr and would like to know how many calls received daily on a perticular channel.
Thanks
shmideo
Hello happy phpkkies, I search this forum for a sample php code on how to write a links scrapper that will recursively go through each page within a site and pull all the links. Then, I will save them to a database for analysis. I couldn't find something like that. Also, I was wondering if someone has or is selling a comments library in php. This is, a code or a set of functions that are related to commenting systems. For example; the library should have a function for blocking bad words or a function that will let people vote up or down comments made. Any ideas or links will be appreciated, thank you, V. Dear Members, I am a PHP developer and desisgning a WAP page for mobiles.I need some php code to find out the model of a mobile phone from where request is coming so that based on that information I can upload the proper CSS for my page.If you can give me some hints as well that would also help me to proceed further.Currently I am able to fetch user-agent of mobile but not able to find out the specific model of mobile. Hi, bit stuck on how to find and replace "<" and ">" with "<" and ">". I basically have a database record that outputs to screen and I need the code in the <code> tags to be rendered to the screen. I therefore need it to go through the whole array variable from the db and change the symbols just inside the code tags. Please be aware that the code tags might happen more than once here's an example below Code: [Select] <p>blah blah blah</p> <p>blah blah blah</p> <p>blah blah blah</p> <code> <h1>hello</h1> </code> <p>blah blah blah</p> <p>blah blah blah</p> <p>blah blah blah</p> <code> <h1>hello</h1> </code> the desired output would be: <p>blah blah blah</p> <p>blah blah blah</p> <p>blah blah blah</p> <code> <h1>hello</h1 </code> <p>blah blah blah</p> <p>blah blah blah</p> <p>blah blah blah</p> <code> <h1>hello</h1 </code> help on this would be great Cheers Rob Hey, What function / how would I find if a string has something? Say I have a string like: $string = 'Hello their! This is my post :) btw, my name is Justin.'; Say I wanted to find out if my name "Justin" is inside that string.. so: whateverfunction('Justin', $string) So I think you should get my idea now though Thanks a lot! The issue I'm having is that this query won't find a max value record if it has less than 5 votes. It'll only show the results of an entry has 5 or greater votes. Why is that? $contest_id = 5; $category_id = 8; $find_entries = $db->prepare("SELECT entry_id, user_id, votes FROM contest_entries WHERE contest_id = :contest_id AND category_id = :category_id AND e_status = :e_status AND votes = (SELECT MAX(votes) FROM contest_entries) LIMIT 1"); $find_entries->bindParam(':contest_id', $contest_id); $find_entries->bindParam(':category_id', $category_id); $find_entries->bindValue(':e_status', 0); $find_entries->execute(); $result_entries = $find_entries->fetchAll(PDO::FETCH_ASSOC); if(count($result_entries) > 0) { foreach($result_entries as $row) { $entry_id = $row['entry_id']; $user_id = $row['user_id']; $votes = $row['votes']; } echo $entry_id; } else { echo 'nothing'; } Edited June 26, 2019 by imgrooot Hi I downloaded a PHP script, copied at localhost and when I run it, it will not display all results instruction says that Globals should be off in PHP.ini and scripts should work while Globals are off. but I can't find php.ini in XAMPP. I tried xampp/apache/bin but I didn't find php.ini what should I do? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <?php // Connect to database================================================== include("connect_db.php"); // sending query =========================================================== $result = mysql_query("SELECT * FROM members Order By last") or die(mysql_error()); if (!$result) { die("Query to show fields from table failed"); } echo "<br />"; echo "<p>MEMBERS LIST</p>"; echo "<table border='10' cellpadding='3' cellspacing='2'>"; echo "<tr><th>First Name</th><th>Last Name</th>><th>Phone</th><th>Email</th></tr>"; // keeps getting the next row until there are no more to get ================ while($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table ========================== echo "<tr><td>"; echo $row['first']; echo "</td><td>"; echo $row['last']; echo "</td><td>"; echo $row['phone']; echo "</td><td>"; echo $row['email']; echo "</td></tr>"; } echo "</table>"; ?> </body> </html> This is the output. MEMBERS LIST > First Last Phone Email data data data data ect............................................................... I cannot find where the > (greater than) sign is coming from. There is a space after MEMBERS LIST but I could not get it to work in this display. Hi,
sorry if there already is a topic regarding my question.. I probably didn't find the right words to describe it properly.. would appreciate a link if anybody knows
I'm making a search form for an archive and my problem is that the labeling says e.g. "1400-3500 A-C".. Now i don't want to make thousands of entrys for 1 file.. How do i find that one file while searching for a number in between, like "1420" or "B"?
Thanks in advance!
Greetings localhobo
Edited by localhobo, 13 October 2014 - 01:28 PM. I have a long string of html, and what I want to do, if find all occurrences of: /static (anything after)... and replace with: http://www.mydomain.com/static (anything after). What is the best and fastest way to do this? Thanks. Hi There, I have ported my website over to another hosting provider and I cannot get this one thing working! We have images on our site, which this PHP Script should resize, but it can't find the Imagick.php script. I am convinced that it resides in a different path. Here is the error i get when trying to access one of the images : Warning: require_once(include/classes/Imagick.php) [function.require-once]: failed to open stream: No such file or directory in /hermes/bosweb/web128/b1282/ipg.accommodateruralcom/include/global.php on line 29 Fatal error: require_once() [function.require]: Failed opening required 'include/classes/Imagick.php' (include_path='.:/usr/local/lib/php-5.2.17/lib/php:/home/users/web/b1282/ipg.accommodateruralcom') in /hermes/bosweb/web128/b1282/ipg.accommodateruralcom/include/global.php on line 29 I contacted my hosting support about that and they said that the Imagick.php resides in the following directory : /usr/local/lib/ImageMagick I can appreciate that there may be references to this everywhere and anywhere. I have PHP files called imageResize, Global etc...just let me know which ones to post and ill do that. I really appreciate the help. [attachment deleted by admin] Anybody know why I'm getting "Please fill in all fields" error? I put comments in to make it easier Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Who's Missing?</title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <h2>Someone Missing?</h2> <?php require_once('appvars.php'); require_once('connectvars.php'); if (isset($_POST['submit'])) { // Grab the score data from the POST $name = $_POST['name']; $partner_name = $_POST['partner_name']; $state = $_POST['state']; $photo = $_FILES['photo']['partner_name']; $photo_type = $_FILES['photo']['type']; $photo_size = $_FILES['photo']['size']; if (!empty($name) && !empty($partner_name) && !empty($state) && !empty($photo)) { if ((($photo_type == 'image/gif') || ($photo_type == 'image/jpeg') || ($photo_type == 'image/pjpeg') || ($photo_type == 'image/png')) && ($photo_size > 0) && ($photo_size <= GW_MAXFILESIZE)) { if ($_FILES['photo']['error'] == 0) { // Move the file to temp $target = GW_UPLOADPATH . $photo; if (move_uploaded_file($_FILES['photo']['tmp_name'], $target)) { // Connect to the database $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); // Write to the database $query = "INSERT INTO guitarwars VALUES (0, NOW(), '$name', '$partner_name', '$state', '$photo')"; mysqli_query($dbc, $query); // Confirm success with the user echo '<p>Partner added. Enjoy!</p>'; echo '<p><strong>Name:</strong> ' . $name . '<br />'; echo '<strong>Partner:</strong> ' . $partner_name . '<br />'; echo '<strong>State:</strong> ' . $state . '<br />'; echo '<img src="' . GW_UPLOADPATH . $photo . '" alt="Score image" /></p>'; echo '<p><a href="guitar.php"><< Back to Partners page</a></p>'; // Clear the data to clear the form $name = ""; $partner_name = ""; $state = ""; $photo = ""; mysqli_close($dbc); } else { echo '<p class="error">Sorry, there was a problem uploading your partners photo.</p>'; } } } else { echo '<p class="error">The photo must be a GIF, JPEG, or PNG image file no greater than ' . (GW_MAXFILESIZE / 320768) . ' MB in size.</p>'; } // delete the temporary photo image file @unlink($_FILES['photo']['tmp_name']); } else { echo '<p class="error">Please fill in all fields.</p>'; } } ?> <hr /> <form enctype="multipart/form-data" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo GW_MAXFILESIZE; ?>" /> <label for="name">Name:</label> <input type="text" id="name" name="name" value="<?php if (!empty($name)) echo $name; ?>" /><br /> <label for="partner">Partner:</label> <input type="text" id="partner_name" name="partner_name" value="<?php if (!empty($partner_name)) echo $partner_name; ?>" /><br /> <label for="state">State:</label> <input type="text" id="state" name="state" value="<?php if (!empty($state)) echo $state; ?>" /><br /> <label for="photo">Photo:</label> <input type="file" id="photo" name="photo" /> <hr /> <input type="submit" value="Add Partner" name="submit" /> </form> </body> </html> i have the following code which should redirect the user to the index.php page, but instead it shows error 404 page not found....Please if anyone see the problem help me login.php <?php session_start(); ?> <html> <head> <title>Basic CMS | Admin area Login</title> </head> <body> <?php if (isset($_SESSION['user'])) { header("Location: index.php"); } else { ?> <form action="dologin.php method="post"> <table> <tr> <td><span>Username:</span></td> <td><input type="text" name="username" /></td> </tr> <tr> <td><span>Password:</span></td> <td><input type="password" name="password" /></td> </tr> <tr> <td colspan="2" align="right"><input type="submit" name="login" value="Login"/></td> </tr> </table> </form> <?php } ?> </body> </html> dologin.php <?php session_start(); ?> <html> <head> <title>Basic CMS | Admin area Login</title> </head> <body> <?php if (isset($_SESSION['user'])) { header("Location: index.php"); } else { ?> <form action="dologin.php method="post"> <table> <tr> <td><span>Username:</span></td> <td><input type="text" name="username" /></td> </tr> <tr> <td><span>Password:</span></td> <td><input type="password" name="password" /></td> </tr> <tr> <td colspan="2" align="right"><input type="submit" name="login" value="Login"/></td> </tr> </table> </form> <?php } ?> </body> </html> index.php <?php session_start(); if(isset($_SESSION['user'])) { ?> <html> <head> <title>Basic CMS | Admin area</title> </head> <body> </body> </html> <?php } else { header("Location: login.php"); } ?> The program found here http://www.myadtoolz.com/download/cpuid.zip shows a cpuid? I dont know what that is but it seems unique for every system, I feel this could be the way to have scripts that I sell verify with the user, how would I make a script to find that cpuid? thanks Hi, This piece of code below stops site loading, can't find the problem Please help. If i remove the whole of this the site loads but does not function correct. Code: [Select] if ( $_GET[sssess] ) { session_id( $_GET[sssess] ); } session_start( ); header( "cache-control: private" ); if ( isset( $_GET[redeempoints] ) && $_GET[redeempoints] == "Y" ) { $_SESSION[redeemer] = "Y"; } if ( $_POST[purchaseorder] ) { $_SESSION[po] = "{$_POST['purchaseorder']}"; } if ( !$_SESSION[loginemail] ) { $_SESSION[loginemail] = "noemail@site"; } if ( !$_SESSION[adminemail] ) { $_SESSION[adminemail] = "noadmin@site"; } if ( $_POST[discode] ) { $_SESSION[discode] = trim( "{$_POST['discode']}" ); } $auth_ok_check = md5( "{$_SESSION['loginemail']}.{$hash}" ); $admin_ok_check = md5( "{$_SESSION['adminemail']}.{$hash}" ); if ( isset( $_GET['oidref'] ) ) { $GLOBALS['_GET']['oidref'] = mysql_real_escape_string( $_GET['oidref'] ); $sql = "SELECT o_id FROM order_list WHERE ref='".$_GET['oidref']."' AND unh='{$_GET['oidref']}'"; if ( !( $result = @mysql_query( $sql, $connection ) ) ) { exit( "**COULD NOT GET COPYRIGHT KEYS**" ); } if ( $row = mysql_fetch_array( $result ) ) { $_SESSION['unh'] = $_GET['oidref']; header( "location: ".$sshopurl."orderdetails_os.php?o_id={$row['o_id']}" ); exit( ); } if ( $_SESSION['auth_ok'] == $auth_ok_check ) { header( "location: ".$sshopurl."secure/orders.php" ); exit( ); } header( "location: ".$sshopurl."secure/login.php?next=orders.php" ); exit( ); } if ( preg_match( "/secure/", "{$_SERVER['PHP_SELF']}" ) && !preg_match( "/doqreg.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/qreg.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/voicepaycallback.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/secpaysecpagecallback.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/vps_handle_protx_response.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/protx/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/protxformcallback.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/protxcallback.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/worldpaycallback.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/securetradingcallback.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/barclayscpicallback.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/paypalcallback.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/moneybookerscallback.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/nochexcallback.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/offlinecallback.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/doregister.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/register.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/doprereg.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/login.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/dologin.php/", "{$_SERVER['PHP_SELF']}" ) ) { if ( $auth_ok_check != $_SESSION[auth_ok] ) { header( "Location: ".$sshopurl."secure/login.php?next={$_GET['next']}&shk&p={$_SERVER['PHP_SELF']}" ); exit( ); } if ( preg_match( "/secure/", "{$_SERVER['PHP_SELF']}" ) ) { $isaccount = "1"; } } if ( preg_match( "/".$adminDir."/", "{$_SERVER['PHP_SELF']}" ) && !preg_match( "/adlogin.php/", "{$_SERVER['PHP_SELF']}" ) || !preg_match( "/forgetful.php/", "{$_SERVER['PHP_SELF']}" ) ) { if ( $admin_ok_check != $_SESSION[admin_ok] ) { header( "Location: ".$adminurl."adlogin.php" ); exit( ); } if ( preg_match( "/".$adminDir."/", "{$_SERVER['PHP_SELF']}" ) ) { $isadmin = "1"; } } $noadirs = count( $admin_dirs ); $i = 0; for ( ; $i <= $noadirs; ++$i ) { if ( !preg_match( "/admin\\/".$admin_dirs[$i]."/", "{$_SERVER['PHP_SELF']}" ) && preg_match( "/".$admin_dirs[$i]."/", "{$_SESSION['admin_type']}" ) ) { continue; } header( "Location: ".$adminurl."perms.php?noperm={$admin_dirs[$i]}" ); exit( ); } if ( !$_SESSION[shopper_type] ) { $_SESSION[shopper_type] = "1"; } if ( $_GET[setcurrency] == 1 ) { if ( $_GET[new_currency_id] ) { $GLOBALS['_POST'][new_currency_id] = $_GET[new_currency_id]; } $_SESSION['currency_id'] = $_POST[new_currency_id]; } if ( $_GET[clearptid] == Y ) { session_unregister( "ptid" ); } if ( $_GET[selectpostage] == 1 ) { if ( $_POST[selptid] == Free || $_POST[selptid] == free ) { session_unregister( "ptid" ); } else if ( isset( $_POST[selptid] ) ) { $_SESSION['ptid'] = $_POST[selptid]; } else { session_unregister( "ptid" ); } $GLOBALS['_POST'][selptid] = mysql_real_escape_string( $_POST[selptid] ); $sql1 = "UPDATE basket SET ptid='".$_POST['selptid']."' WHERE session_id='".session_id( )."'"; if ( !( $result1 = @mysql_query( $sql1, $connection ) ) ) { exit( "Couldn't execute request 1" ); } } |