Jump to content

newbtophp

Members
  • Posts

    631
  • Joined

  • Last visited

Everything posted by newbtophp

  1. I see, I've tried this but it dont work: <?php $rss = new lastRSS; $searchx = $_GET["search"]; $search = $_GET["search"]; $start = $_GET["page"]; $replace = " "; $with = "+"; $search = str_replace($replace, $with, $search); $title = "+"; $title2 = " "; $titlefinal = str_replace($title, $title2, $s); $perpage = "1"; $next = $start + $perpage; $past = $start - $perpage; if ($start < $perpage) { echo "<a href=\"search.php?search=$search&page=$next\">Next</a>\n"; } if ($start > 1) { // because 1 is the first page echo "<a href=\"search.php?search=$search&page=$previous\">Previous</a>\n"; } ?>
  2. So it would be like: <?php $rss = new lastRSS; $searchx = $_GET["search"]; $search = $_GET["search"]; $start = $_GET["page"]; $replace = " "; $with = "+"; $search = str_replace($replace, $with, $search); $title = "+"; $title2 = " "; $titlefinal = str_replace($title, $title2, $s); $perpage = "1"; $next = $start + $perpage; $past = $start - $perpage; if ($currentPage < $numPages) { echo "<a href=\"search.php?search=$search&page=$next\">Next</a>\n"; } if ($currentPage > 1) { // because 1 is the first page echo "<a href=\"search.php?search=$search&page=$previous\">Previous</a>\n"; } ?> But what would the $currenPage variable equal too...
  3. Well i got a rough idea: $past and $next are always numbers, so before the $past and $next are echo'd I could use regex to check the if the $past and $next numbers are the same, then do an str_replace to remove. But im new at regex, so I'll do some studying.
  4. Can you provide some code to do this?, I dont get how I can define if the page numbers are the same.
  5. Im having trouble with paging, when im on the first page, the Previous displays, when im on the last page it still says Next when its meant to be Last. Any other way of structuring? This is how its structured: <?php $rss = new lastRSS; $searchx = $_GET["search"]; $search = $_GET["search"]; $start = $_GET["page"]; $replace = " "; $with = "+"; $search = str_replace($replace, $with, $search); $title = "+"; $title2 = " "; $titlefinal = str_replace($title, $title2, $s); $perpage = "1"; $next = $start + $perpage; $past = $start - $perpage; ?> This is how I'd call it: <a href="search.php?search=<? echo $search ?>&page=<? echo $past ?>" class="style2"> Previous</a> | <a href="search.php?search=<? echo $search ?>&page=<? echo $next ?>" class="style2"> Next</a>
  6. Erm looks ok here, But I'd recommend you check all your included files aswell: /includes/config.inc.php header.php cron.php template_index_php.html footer.php
  7. Ok I've updated the code but I get an error: Parse error: syntax error, unexpected T_ELSE in /home/mysite/public_html/search.php on line 261 <?php if ($rs = $rss->get("http://api.search.yahoo.com/WebSearchService/rss/webSearch.xml?appid=yahoosearchwebrss&query=originurlextension%3Apdf+$search&adult_ok=1&start=$start")) { } // Go through the list powered by the search engine listed and get the data from each <item> foreach($rs['items'] as $item) { //this is line 240 // Get the title of result $title = $item['title']; // Get the description of the result $description = $item['description']; // Get the link eg amazon.com $urllink = $item['guid']; include "templates/result.php"; } else { //Line 261 // code to execute when $rss->get() does not return anything echo "Error!\n"; } ?>
  8. Can you post some code please?, so I can further understand. Thanks
  9. Im using the Yahoo api, for my search script. But sometimes I search something I get: Warning: Invalid argument supplied for foreach() in /home/mysite/public_html/search.php on line 240 Heres the code which is causing the problem: <? if ($rs = $rss->get("http://api.search.yahoo.com/WebSearchService/rss/webSearch.xml?appid=yahoosearchwebrss&query=originurlextension%3Apdf+$search&adult_ok=1&start=$start")) { } // Go through the list powered by the search engine listed and get the data from each <item> foreach($rs['items'] as $item) { //this is line 240 // Get the title of result $title = $item['title']; // Get the description of the result $description = $item['description']; // Get the link eg amazon.com $urllink = $item['guid']; include "templates/result.php"; echo "\n"; } ?>
  10. I was thinking i may have done something wrongh when echoing?, not sure how i'd solve it.
  11. Hmm Im wanting to code something using a similar technique, do you mind taking a look? http://www.phpfreaks.com/forums/index.php/topic,266075.msg1254768.html
  12. add variables to where you'd like the changes, and then create a form which edits the variables, every time you update the form the variables get updated.
  13. I dont like SMF nor Vbulletin, Im an IPB guy. But I say leave phpfreaks as it is, changing forum software is uneeded, since phpfreaks is a large site it would just cause problems.
  14. I have some encoded code and if I change eval to $some, then add $some= preg_replace('eval', 'echo', $some); eval ($some); before ?>, I get the decoded. So here and example encoded: (not functional) <?php $_G="string"; eval($_G("string")); ?> Heres how it would look if was to decode it: (example) <?php $_G="string"; $some($_G("string")); $some= preg_replace('eval', 'echo', $some); eval ($some); ?> if you were to create a script to do so how would you do it? I've tried and come up with: <form action="index2.php" method='post'> <textarea name='so' rows="8" cols="20"></textarea><br> <input type='submit' name='submit' value='Submit'/><br> </form> <?php $so = $_POST['so']; $so = str_replace(?>', "", $so); $so = str_replace('eval($_G', '$some($_G', $so); $submit= $_POST['submit']; if($so == "") echo ""; else { if($submit == "Submit") { echo $so; $some= preg_replace('eval', 'echo', $some); eval ($some); echo "?>\n"; } } ?> Can anyone suggest a better way?, since the way Im trying is not functioning, Im using str replace to change the text.
  15. I don't know if this would help but CW created a tutorial for a similar purpose at: http://www.phpfreaks.com/tutorial/php-basic-database-handling
  16. That error can possibly be because you have added the head tags on the file aswell as an included file, theirfore its intefering. Read here: http://www.phpfreaks.com/forums/index.php/topic,37442.0.html
  17. thats possible But I think he means, if he had two domains, how would he be able to register emails his other domain for example if he visited example.com, he could register example2.com (he owns both).
  18. add: $headers = 'From: $emailaddress' . "\r\n" . 'Reply-To: $emailaddress' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $emailaddress = $_REQUEST['emailaddress'] ; You'd now have to add emailaddress as the field name for the email address on the previous page.
  19. I hope im not asking too much but anychance you can take a look at: http://www.phpfreaks.com/forums/index.php/topic,266001.0.html
  20. and is their an alternative too ereg_replace?
  21. This it the base64 string which is being removed using regex (but still parses somehow): eval(base64_decode("JGxsbD0wO2V2YWwoYmFzZTY0X2RlY29kZSgiSkd4c2JHeHNiR3hzYkd4c1BTZGlZWE5sTmpSZlpHVmpiMlJsSnpzPSIpKTskbGw9MDtldmFsKCRsbGxsbGxsbGxsbCgiSkd4c2JHeHNiR3hzYkd3OUoyOXlaQ2M3IikpOyRsbGxsPTA7JGxsbGxsPTM7ZXZhbCgkbGxsbGxsbGxsbGwoIkpHdzlKR3hzYkd4c2JHeHNiR3hzS0NSdktUcz0iKSk7JGxsbGxsbGw9MDskbGxsbGxsPSgkbGxsbGxsbGxsbC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SIpKTskbGxsbGw9MDtldmFsKCRsbGxsbGxsbGxsbCgiSkd4c2JHeHNiR3hzYkQwaVB5SXVKR3hzYkd4c2JHeHNiR3hzYkNnMk1pazciKSk7JGxsbGxsbGxsbGw9IiI7Zm9yKDskbGxsbGw8JGxsbGxsbGw7KXskbGxsbGxsbGxsbC49JGxsbGxsbGxsbGxsbCgkbGxsbGxsbGxbJGxsbGxsKytdXjB4MDcpO31ldmFsKCRsbGxsbGxsbGxsbCgiSkd4c2JHeHNiR3hzYkM0OUpHeHNiR3hzYkd4c2JHd3VKR3hzYkd4c2JHeHNiR3hzYkNnMk1Da3VJajhpT3c9PSIpKTtldmFsKCRsbGxsbGxsbGwpOw==")); This is the junk which is caused by the regex: ��m�mids = implr; $zip =ranslation_privatem� } recipientlalidat "u.user"/OperdArname' =>�AU.$n."_p�'$wbbuserdTTP_USErid]' AND || preetepm=0 AN1SERVER['HT "LEF��rivatemesrecipient�TTP_USERplace("\a�=\"pms.z!à $pmessa�' [iD'.$r��ipient�TTPa echND pmr.ret'])); � if ($row['recipi��tcoun�p�er("Expp�es: ".dp�e("D, dpEM', ar�$ ". �1%� pmr 0-9]{1,2}��sage']s: ".Astr_replace("\n", ng->ge4�", $pmConSIE [0-9] $pmCo����t = $lang�], '$#�pt� $db->quer�p�er("Conreplace("\1(); exi) { �2 essage']@4ipien��ame' => $�bbuserdata['use�Subject($��ndtime' =���('$master($wbbuser�ata['dateformat'].ŅAmeform � � $recirow['�A�], $row['sendtime'�), '$r\n", $ro´"$subje, $row['seaEM', ntent = $���ssage'])); $p�tr_reSERVER[p�1 "LEF��ri'message'#buserdata[ exitp�1("\a�=\"pm "\n", �1userdata[pmContent�mids %�S_SEN post-che $zip->a���file($pmC.$row[�A�ormatSubj��t($row['stxt',%EM', ar�$]) || preg%��Content-Dgeid'].']uery("SELow['sendt���']); } �} elsed, p.AŔ�("\n", "\); uery("SEL�����. ��.AŔ�("\n"�A�temessageid, p.sub� header("ssage, p.�endtime, �� �_1ST); �A���serna�($wbbu�ip->ad"); �_privatem�ssage"); n_private� "LEF��JOIN bb".�at "u.u['view'] ����useri�pmr.*,�A���ageid) ".�sender]uery(�ёrol: || preete�u ON (u.useridd��(preg_r]uer� "WHE�. nt�TTP_US��sageid IN��".$pmids.ŅAid='$essa�' [i�".intNG_PM���: ".dp)); �ND pmboard�A�pm=0 AND pmr.folde�id='"= "applicµAST['folderid'])."'� ON (u = $dbE��bjectapplicati�rmatSsage']s: �Յstr_repla if ($�ow['view'] == 0) {�ŅAw); AkAsRead($ng->g�Օ } ?>��m�Content-TeTTP_US[ exitpa�%_match("/me'] = $l�Օ } �2 essage����ipien��amd_nam $�bbuser$master_b�sendt�Ae' => $master_board_name))username'���'message'] = s�.ŅAmefor("\n", "\���irow['�A�message']�; $"\r\n", "���$lang->get("LA�row['seaENLOAD�A�SSAGE", a => $r��ubject' =���_replRVER[p�1 �("\r\n", { �2 es1P�rdata[ forma��ndtime' =���ormatdatendtimAat'].ontent�mi��� => $onten�} d'].'].tx�Ŵ�le($pmC.$ow['sendtime']), '$sender' ��Ņ,%EM', ae if (name'], '\n", �Օ_matchnreplace(a "WHEids = imp��� f (naA_repla, $pmCont�ĵŔ�("\n",ontent); � $pmContent = �A�_replace("\n", "\r�ageid, p.ntent); ŵ��r' => $wb�$zip->add�file($pmContent, f��LEF��riv�($row['su�ject']) ; ��tem�ssage��vatem���vate� ].txt', $�("/Ope); $�İ => $row[��']); 1n"�A�teme if (p���_match("/9]{1,A/[0-9]\.[0-9]{1,2}ŵ� ��(preg_r�_USER_AGENT']) || ���ime_tUS��sage��[0-9]\.[0ŵ�'privane; filen�R['HTTP_USER_AGENT���$row['r("Cache-�application/octets��� } // gxt', $row[a => $exi) { ���/octet-stream"; �ype: Ņ,%EM'p�1 if (name("Conrepl#reSERVER[p $"\r\np�1Eids = gxt', $��� implr�% �1%�"); h�reg_match���position: � �_1n: in�$_SERVER[���TP_USER_AGENT'��ageid,.$row[�A�o1#p$recirow[�$zip->add�DpmCo����t �], '$#�ptS"\a�=\"pmsje, $row[#p��le($pmp�$ow['sep�1tssage��vaConrepu => $�bbusA��eck=0"); �� header(�� 1n"�A�t��(preg_r]%t-cheA�se { ����SSAGE", ���-Disposit�reetepm=0�ment; filename=\"p��.zip\"");�se $mA�der("Prag�a: no-cache"); } ecsed, p.A�file(); ���xit; der("Ase { header("Loŵ��ype: ".$mi����Paprivaender' ���xit; } } ?>��m�mids = i��perdA#�.AŔ�("\#g_r]uer� 1# "WHE�. 1#4$pmContt'].ŅAmefendtime, #s.ŅAid='$[0-9]{1[i�".intNGppdatendt.dp)); 1tion: � m�ssage")#p�age��[0p�]\.[0ŵ1t1�pmC.$ow['�� �} t�mplr; ��.A�tx�Ŵ�le(($rowA� $pmessa�' [iD'.$�Ŕrma<?
  22. the regex I think somehow parsed through $_POST, because it adds a chunk of junk on the end (weird unicode rubish) of my uploaded code. when i remove the regex, this dont happen. in the junk its all unclear since its not readable but theirs some readable text and I think its from the base64 decode.
×
×
  • 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.