Jump to content

Please help me! Urgent Matter.


Recommended Posts

Guest davidbugeja

Just today (and I did not edit any code whatsoever) if I type a link that starts with http:/ as a question or as an answer I get Page Cannot Be Displayed error.

 

What might be the cause?

 

If it type:

 

gttp://

htttp://

httt://

 

All are accepted except http:/ . Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/200996-please-help-me-urgent-matter/
Share on other sites

Guest davidbugeja

Here is the code for the Post Question Page. It will not work if I post an http:/ in Additional Details Text Area:

 

<?php

session_start();

if($_SESSION['Username'] == '' && !isset($_SESSION['Username'])) {

	header("location:login.php");

}

require_once("includes/configuration.php");

require_once('includes/classes/class.inputfilter.php');

require_once('includes/functions.php');

require_once("includes/classes/class.database.php");

require_once("includes/classes/class.category.php");

require_once("includes/classes/class.question.php");

require_once("includes/classes/class.filter.php");		

require_once('includes/captcha/recaptchalib.php');



$publickey = '6LeH9QcAAAAAAMk-nGsju2zL3131jcbvRkTIkU8I';

$privatekey = '6LeH9QcAAAAAACZvLUlE4AAgo8On2Dfbf2CcCy_8';

# the response from reCAPTCHA

$resp = null;

# the error code from reCAPTCHA, if any

$error = null;



$objCategory = new category();

$objQuestion = new question();

$objFilter = new filter();



if ($_POST['cmdAdd']) { 

        $resp = recaptcha_check_answer ($privatekey,

                                        $_SERVER["REMOTE_ADDR"],

                                        getParameter($_POST, "recaptcha_challenge_field", ''),

                                        getParameter($_POST, "recaptcha_response_field", ''));



	if ($resp->is_valid) { 



		$rsFilter = $objFilter->GetList(array(array('filterid','!=','')),'',true);

		$wordFound=false;

		for ($i=0;$i<sizeof($rsFilter);$i++) { 

			if (strpos(strtolower($_POST['question']), strtolower($rsFilter[$i]->word))!==FALSE || strpos(strtolower($_POST['title']), strtolower($rsFilter[$i]->word))!==FALSE) { 

				$wordFound=true;

				break;

			}

		}



if(getParameter($_POST, "question", '')==""){

$_POST["question"] =" ";

}

		if (!$wordFound) {

			$objQuestion->questionId = '';

			$objQuestion->langid = '1';

			$objQuestion->question_text = $_POST['question'];

			$objQuestion->userid = $_SESSION['userid'];

			$objQuestion->categoryid = $_POST['level'];

			$objQuestion->date1 = date("d/m/Y",time());

			$objQuestion->status ='Active';

			$objQuestion->abuse = 'No';

			$objQuestion->title = $_POST['title'];



			$id = $objQuestion->Save();



								//////////////////////////////////////////////////



$myFile = "Watcher.txt";

$fh = fopen($myFile, 'a');



$ip = $_SERVER['REMOTE_ADDR'];

$date = date ("l dS \of F Y h:i:s A"); // required escape backslash

$id = $_SESSION['userid'];



$myFile = "Watcher.txt";

$fh = fopen($myFile, 'a');

$stringData = "Question Posted By User: $id  |  IP Address: $ip  |  Date: $date \n\n";

fwrite($fh, $stringData);

fclose($fh);

				//////////////////////////////////////////////////



echo "<script>location.href='confirmation.php'</script>";



			exit();

		} else {

			$msg = 'You question contains vulgar language. Please be respectful.';

		}

	} else {

		$error = $resp->error;

		$msg = 'Incorrect Captcha Words. Please Try Again.';

	}

}

?>



<!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">



<head>

<title>Saqsi.com - Ask A New Question</title>



<meta name="Title" content="Saqsi.com - Ask A New Question" />



<meta name="description" content="Any sort of question is allowed on Saqsi.com, except those that violate our community guidelines." />



<?php include("includes/toptitle.php");?>



<script>

var newwindow;

function poptastic(url)

{

newwindow=window.open(url,'name','height=450,width=480');

if (window.focus) {newwindow.focus()}

}

</script>



<?php include("includes/search.php");?>

<div class=home id=y-body-green-knowledge-search>

  <div id=content>

    <?php include("includes/left.php");?>

    <div id=middle>

      <DIV id=ks-homepage-heading>Ask A New Question</DIV>

      <DIV class=silk_hp_open id=ks-homepage-questions>

    <form name="frmQuestion" id="frmQuestion" method="post" action="">

        <table width="100%" cellpadding="3" cellspacing="0" border="0">

          <tr>

            <td align="center" height="13px"><p><b><?=$msg?></b></p></td>

          </tr>

          <tr>

            <td><table width="100%" cellpadding="2" cellspacing="2" border="0">

                  <input type="hidden" id="questionid" name="questionid" value="<?php echo getParameter($_POST, "questionid", '')?>" />

                  <tr>

                    <td align="right"><p><b>Your Question:</b></p></td>

                    <td align="left"><input style="font-weight:bold;width:355px;" type="text" maxlength="200" value="<?=getParameter($_POST, "title", '')?>" name="title" onkeyup="updateButton()"></td>

                  </tr>

			  <tr>

			    <td align="right"><b><p>Quick Hint:</b></p></td>

                    <td align="left"><p>Please write your question in full. Properly formatted questions will get you more answers. <b>Correct:</b> Where can I buy designer clothes? <b>Incorrect:</b> Designer clothes.</p><td>

                  </tr>

                  <tr>

                    <td align="right"><p>Question Category:</p></td>

                    <td align="left"><select name="level" style="width:357px;" onchange="updateButton()">

                        <option value="">Please Select A Suitable Category For Your Question</option>

                        <?php for($i=0;$i<sizeof($rsCategory);$i++) {

												?>

                        <option value="<?php echo $rsCategory[$i]->categoryId; ?>" <?php if(getParameter($_POST, "level", '') == $rsCategory[$i]->categoryId) {?> selected="selected" <?php } ?>><?php echo $rsCategory[$i]->category_name; ?></option>

                        <?php

												 }

												 ?>

                      </select></td>

                  </tr>

                  <tr>

                    <td width="24%" align="right"><p>Additional Details (Optional)</p></td>

                    <td width="76%" align="left"><p>

                        <textarea style="width:355px;" cols="40" rows="9" name="question" id="question"><?=getParameter($_POST, "question", '')?></textarea>

                      </p></td>

                  </tr>

			  <tr>

			    <td align="right"><b><p>Quick Hint:</b></p></td>

                    <td align="left"><p>It is important that you let the others users understand exactly what you wish to know. Be as specific as possible (list any technical information, etc) in order to get precise and suitable answers.</p><td>

                  </tr>

                  <tr>

                    <td width="50%"><p>Anti-Spam: <br /> <a href="javascript:poptastic('http://recaptcha.net/popuphelp/');">(Get Instructions)</a></p></td>

                <td width="50%"><?=recaptcha_get_html($publickey, $error);?></td>

                  </tr>

                  <tr>

                    <td colspan="2" align="left"></td>

                  </tr>

                  <tr>

                    <td> </td>

                    <td><input type="submit" name="cmdAdd" id="cmdAdd" value="Ask This Question" <?php if($_POST['act'] == 'edit') {?>disabled="disabled"<?php } ?>/>

                       </td>

                  </tr>

              </table>

		  </td>

          </tr>

        </table>

       </form>		

      </DIV>

      <DIV class=dotted-line></DIV>

    </DIV>

  </DIV>

</DIV>

<?php include("includes/bottom.php");?>

<script language="javascript">

function updateButton() { 

	if (document.frmQuestion.title.value=="" || document.frmQuestion.level.options.selectedIndex==0) { 

		document.frmQuestion.cmdAdd.disabled=true;

		document.frmQuestion.cmdAdd.value='Please Fill In All The Needed Information';

	} 

	else { 

		document.frmQuestion.cmdAdd.disabled=false;

		document.frmQuestion.cmdAdd.value='Ask This Question';



	}

}

updateButton();

</script>

Guest davidbugeja

I am not an expert at all in PHP  :-[ What is bothering me is that I have changed nothing all and today walla it is not working.

 

The Problem: All text is accepted in the form however if i type a link or anything that contains http:/ the page gives me a Page Cannot Be Displayed when I press Ask This Question.

 

I have tried everything I could think of such as remove parts of the code to see where it gets stuck but no success!

Guest davidbugeja

This part of the code:

 

<textarea style="width:355px;" cols="40" rows="9" name="question" id="question"><?=getParameter($_POST, "question", '')?></textarea>

 

Does not accept any text begining with ftp:// or http://. All other text gets accepted. It is like the code is filtering these protocols.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.