Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

عبدالعزيز محي الدين الاه

Unable to detect error in code please help me out t on

Recommended Posts

<?php require_once('Connections/book.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "comming")) {
    if($_POST['coding'] == 19){
  $insertSQL = sprintf("INSERT INTO bcomments (id, bid, commentin, fname, mail) VALUES (1, %s, %s, %s, %s)",
                 GetSQLValueString($_POST['id'], "int"),
                       GetSQLValueString($_POST['bid'], "int"),
                       GetSQLValueString($_POST['comments'], "text"),
                       GetSQLValueString($_POST['fname'], "text"),
                       GetSQLValueString($_POST['mail'], "text"));

  mysql_select_db($database_book, $book);
  $Result1 = mysql_query($insertSQL, $book) or die(mysql_error());

  $insertGoTo = "books/".$_POST['url'];
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
    }else{
        
        $insertGoTo = "books/".$_POST['url']."/error";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
    }
}


$colname_authordetails = "-1";
if (isset($_GET['q'])) {
  $colname_authordetails = $_GET['q'];
}
mysql_select_db($database_book, $book);
$query_authordetails = sprintf("SELECT * FROM book WHERE url = %s", GetSQLValueString($colname_authordetails, "text"));
$authordetails = mysql_query($query_authordetails, $book) or die(mysql_error());
$row_authordetails = mysql_fetch_assoc($authordetails);
$totalRows_authordetails = mysql_num_rows($authordetails);

$colname_commenting = "-1";
if (isset($row_authordetails['id'])) {
  $colname_commenting = $row_authordetails['id'];
}
mysql_select_db($borders_db, $book);
$query_commenting = sprintf("SELECT * FROM bcomments WHERE id = %s ORDER BY id DESC", GetSQLValueString($colname_commenting, "int"));
$commenting = mysql_query($query_commenting, $book) or die(mysql_error());
$row_commenting = mysql_fetch_assoc($commenting);
$totalRows_commenting = mysql_num_rows($commenting);
?>
<!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>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-103795307-1"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-103795307-1');
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<meta name="description" content="Review of <?php echo $row_africanpublishedbooks['title']; ?> by Olatoun Williams" /> 
<title>Borders Literature Online | Review of <?php echo $row_africanpublishedbooks['title']; ?> by Olatoun Williams</title>
<link href="imaging/favicon.ico" rel="shortcut icon" />
<base href="http://<?php echo $_SERVER['HTTP_HOST']; ?>/" />
<link href="Scripting/normalize.css" rel="stylesheet" type="text/css" media="all" />
<link href="Scripting/getdevice.css" rel="stylesheet" type="text/css" media="all" />
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationTextarea.css" rel="stylesheet" type="text/css" />
<link href="jQuery/css/style.css" rel="stylesheet" type="text/css" />
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationTextarea.js" type="text/javascript"></script>
<script type="text/javascript">var switchTo5x=true;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher: "09a46005-f45b-400f-9230-7a1c97d221c2", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script>
<style>
#commentss {
    padding-top: 20px;
    border-top-width: 1px;
    border-top-style: solid;
    border-top-color: #CCC;
    margin-bottom: 30px;
}
#dcomment {
    margin-bottom: 15px;
    border-bottom-width: 1px;
    border-bottom-style: dotted;
    border-bottom-color: #CCC;
}
#dcomment span {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}
#tit{
    line-height:24px;
}
</style>
</head>

<body>
<div id="topdiv">
  <div class="wrapper">
  <a href="index.php"><img name="" src="imaging/border-logo.png" width="215" height="84" alt="" /></a>
  </div>
</div>
<div id="nav">
  <div class="wrapper">
    <div id="navbar">
  <ul>
   <li style="margin-left:0px;"><a href="/">Home</a></li>
    <li><a href="about">About Us</a></li>
    <li><a href="Book_Reviews_and_Podcasts">Book Reviews & Podcast</a></li>
    <li><a href="Book_Trade_Interviews">Book Trade Interviews</a></li>
    <li><a href="Africanist_and_Global">Africanist & Global</a></li>
<li><a href="Independent_Comment_About_Borders">Comment About Borders</a></li>
    <li><a href="contact">Contact Us</a></li>
    <li><a href="links">Links</a></li>
    <li><a href="faq">Faq</a></li>
  </ul>
  <div class="clr"></div>
    </div>
  </div>
</div>
<div class="wrapper">
<div style="background-color:#FFF; margin-top:2%;"">
        <div id="scon">
      <h3><?php echo $row_authordetails['title']; ?></h3>
      <div id="navin">
        <a href="/">Home /  </a><a href="Book_Reviews_and_Podcasts">Book Reviews & Podcast </a><span><?php echo $row_africanpublishedbooks['title']; ?></span>
        </ul>
        <div class="clr"></div>
      </div>
      <span style="display:block; padding:10px; font-size:16px; margin-bottom:25px; background-color:#E7E7E7"><strong>By </strong><a href="authors/<?php echo "".$row_authordetails['author']; ?>"><?php echo $row_authordetails['name']; ?></a> | <strong>Reviewed by:</strong> <?php echo $row_authordetails['reviewed']; ?> | <span class='st_facebook' displayText='Facebook'></span>
<span class='st_twitter' displayText='Tweet'></span>
<span class='st_linkedin' displayText='LinkedIn'></span>
<span class='st_googleplus' displayText='Google +'></span>
<span class='st_email' displayText='Email'></span></span></span>
      <div style="font-size:16px; line-height:23px;"><img name="" src="uploads/<?php echo $row_authordetails['img']; ?>" alt="" style="float:left; margin-right:20px; padding:1px; border:solid 1px #999" /><?php echo $row_authordetails['details']; ?>
      <div class="clr"></div>
      <div style="margin-top:20px; border-top:solid 1px #CCC; padding-top:2px">
      <div id="commentss">
      <span class="sfont"><?php echo $totalRows_commenting; ?> Comment(s) </span>
      <div class="uling">
        <?php 
        if($totalRows_commenting == 0){
            
            echo "No Comments";
        }else{
        
        do { ?>
          <div id="dcomment">
            <span>Posted by <?php echo $row_commenting['fname']; ?> | <?php $ddate = strtotime($row_commenting['adate']);
                        echo date("d.F.Y G:i:s", $ddate); ?></span>
            <?php echo $row_commenting['commentin']; ?>
            
          </div>
          <?php } while ($row_commenting = mysql_fetch_assoc($commenting));  } ?>
      </div>
      </div>
      <div id="addcomment">
      <h3 class="font1">Add A Comment</h3>
      <div>
      <form id="comming" name="comming" method="POST" action="<?php echo $editFormAction; ?>">
      <table width="100%" cellpadding="10" cellspacing="0">
      <tr>
    <td colspan="2" align="center" style="color:#900"><?php if(isset($_GET['err'])){ echo "Please Fill in all fields and make sure the secret code is correct";  } ?></td>
    </tr>
  <tr>
    <td width="36%"><strong>Preferred Display Name:</strong></td>
    <td width="64%">
      <span id="sprytextfield1">
        <input name="fname" type="text" class="txt" id="fname" />
        <span class="textfieldRequiredMsg">*</span></span>
    </td>
  </tr>
  <tr>
    <td><strong>Email Address:</strong></td>
    <td><span id="sprytextfield2">
    <label for="mail"></label>
    <input name="mail" type="text" class="txt" id="mail" />
    <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">Invalid email.</span></span></td>
  </tr>
  <tr>
    <td valign="top"><strong>Your Comment:</strong></td>
    <td><span id="sprytextarea1">
      <label for="comments"></label>
      <textarea name="comments" cols="45" rows="5" class="txt" id="comments"></textarea>
      <span class="textareaRequiredMsg">*</span></span></td>
  </tr>
  <tr>
    <td valign="top">Please add up this figures.</td>
    <td><img name="" src="imaging/barcode.jpg" width="150" height="40" alt="" /><br />
<span id="sprytextfield3">
      <label for="coding"></label>
      <input type="text" name="coding" id="coding" />
      <span class="textfieldRequiredMsg">*</span></span></td>
  </tr>
  <tr>
    <td><input name="id" type="hidden" value="<?php echo $row_authordetails['id']; ?>" />
      <input type="hidden" name="urls" id="" value="<?php echo $row_authordetails['urls']; ?>" /></td>
    <td><input name="button" type="submit" class="btn" id="button" value="Submit" /></td>
  </tr>
</table>
      <input type="hidden" name="MM_insert" value="comming" />
      </form>
</div>
      </div>
      </div>
      </div>       

 

Compartilhar este post


Link para o post
Compartilhar em outros sites

Seja bem-vindo ao fórum iMasters. É importante que você nos traga a sua dúvida em português. Além disso, você precisa nos fornecer mais informações sobre o problema.

Compartilhar este post


Link para o post
Compartilhar em outros sites

  • Conteúdo Similar

    • Por Rafael_Ferreira
      Não consigo carregar a imagem do captcha do meu formulário. Foi testado com o xampp e easyphp. Também não carregou a imagem de outros captcha. 
       
       
    • Por luiz monteiro
      Olá, tudo bem?
       
      Estou melhorando meu conhecimento em php e mysql e, me deparei com o seguinte. A tabela da base de dados tem um campo do tipo varchar(8) o qual armazena números. Eu não posso alterar o tipo desse campo. O que preciso é fazer um select para retornar o números que contenham zeros a direita ou a esquerda.
      O que tentei até agora
       
      Ex1
      $busca = $conexao->prepare("select campo form tabela where (campo = :campo) ");
      $busca->bindParam('campo', $_REQUEST['campo_form']);
       
      Se a direita da string $_REQUEST['campo_form'] termina ou inicia com zero ou zeros, a busca retorna vazio.
      Inseri dados numéricos, da seguinte maneira para testar: 01234567;  12345670: 12345678: 12340000... entre outros nessa coluna. Todos os valores que não terminam ou não iniciam com zero ou zeros, o select funciona.
       
       
      Ex2
      $busca = $conexao->prepare("select campo form tabela where (campo = 0340000) ");
      Esse número está cadastrado, mas não retorna.
       
      Ex3
      $busca = $conexao->prepare("select campo form tabela where (campo = '02340001' ) ");
      Esse número está cadastrado, mas não retorna.
       
       
      Ex4
      $busca = $conexao->prepare("select campo form tabela where (campo like 2340000) ");
      Esse número está cadastrado, mas não retorna.
       
      Ex5
      $busca = $conexao->prepare("select campo form tabela where (campo like '12340000') ");
      Esse número está cadastrado, mas não retorna.
       
      Ex6
      $busca = $conexao->prepare("select campo form tabela where (campo like '"12340000"' ) ");
      Esse número está cadastrado, mas não retorna.
       
       
      Ex7
      $busca = $conexao->prepare("select campo form tabela where (campo like :campo) ");
      $busca->bindParam('campo', $_REQUEST['campo_form'])
      Não retorna dados.
       
      O  $_REQUEST['campo_form'] é envio via AJAX de um formulário. 
      Usei o gettype para verificar o post, e ele retorna string.
      Fiz uma busca com número 12345678 para verificar o que o select retorna, e também retrona como string.
       
      Esse tipo de varchar foi usado porque os números que serão gravados nesse campo,  terão zeros a direita ou na esquerda. Os tipos number do mysql não gravam zeros, então estou usando esse. O problema é a busca.
      Agradeço desde já.
       
       
    • Por daemon
      Boa tarde,
       
      Eu tenho uma rotina que faz uma leitura do arquivo .xml de vários sites.

      Eu consigo pegar o tópico e a descrição, e mostrar a imagem que esta na pagina do link.
      Para isso utilizo esta função:
      function getPreviewImage($url) { // Obter o conteúdo da página $html = file_get_contents($url); // Criar um novo objeto DOMDocument $doc = new DOMDocument(); @$doc->loadHTML($html); // Procurar pela tag meta og:image $tags = $doc->getElementsByTagName('meta'); foreach ($tags as $tag) { if ($tag->getAttribute('property') == 'og:image') { return $tag->getAttribute('content'); } } // Se não encontrar og:image, procurar pela primeira imagem na página $tags = $doc->getElementsByTagName('img'); if ($tags->length > 0) { return $tags->item(0)->getAttribute('src'); } // Se não encontrar nenhuma imagem, retornar null return null; } // Uso: $url = "https://example.com/article"; $imageUrl = getPreviewImage($url); if ($imageUrl) { echo "<img src='$imageUrl' alt='Preview'>"; } else { echo "Nenhuma imagem encontrada"; }  
      Mas estou com um problema, esta funcão funciona quando coloco em uma pagina de teste.php. Preciso mostrar em uma página inicial diversas fotos de todos os links. (No caso acima só funciona 1).
    • Por violin101
      Caros amigos, saudações.
       
      Por favor, me permita tirar uma dúvida com os amigos.

      Tenho um Formulário onde o Usuário digita todos os Dados necessários.

      Minha dúvida:
      --> como faço após o usuário digitar os dados e salvar, o Sistema chamar uma Modal ou mensagem perguntando se deseja imprimir agora ?

      Grato,
       
      Cesar
    • Por Carcleo
      Tenho uma abela de usuarios e uma tabela de administradores e clientes.
      Gostaria de uma ajuda para implementar um cadastro
       
      users -> name, login, passord (pronta) admins -> user_id, registratiom, etc.. client -> user_id, registratiom, etc...
      Queria ajuda para extender de user as classes Admin e Client
      Olhem como estáAdmin
      <?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Admin extends User {     use HasFactory;            protected $fillable = [         'name',         'email',         'password',         'registration'     ];      private string $registration;     public function create(         string $name,          string $email,          string $password,         string $registration     )     {         //parent::create(['name'=>$name, 'email'=>$email, 'password'=>$password]);         parent::$name = $name;         parent::$email = $email;         parent::$password = $password;         $this->registration = $registration;     } } User
      <?php namespace App\Models; // use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; use Illuminate\Database\Eloquent\Relations\BelongsToMany; class User extends Authenticatable {     /** @use HasFactory<\Database\Factories\UserFactory> */     use HasFactory, Notifiable;     static string $name;     static string $email;     static string $password;     /**      * The attributes that are mass assignable.      *      * @var list<string>      */     protected $fillable = [         'name',         'email',         'password',     ];          /**      * The attributes that should be hidden for serialization.      *      * @var list<string>      */     protected $hidden = [         'remember_token',     ];     /**      * Get the attributes that should be cast.      *      * @return array<string, string>      */     protected function casts(): array     {         return [             'email_verified_at' => 'datetime',             'password' => 'hashed',         ];     }          public function roles() : BelongsToMany {         return $this->belongsToMany(Role::class);     }       public function hasHole(Array $roleName): bool     {                 foreach ($this->roles as $role) {             if ($role->name === $roleName) {                 return true;             }         }         return false;     }         public function hasHoles(Array $rolesName): bool     {                 foreach ($this->roles as $role) {             foreach ($rolesName as $rolee) {             if ($role->name === $rolee) {                 return true;             }          }         }         return false;     }         public function hasAbility(string $ability): bool     {         foreach ($this->roles as $role) {             if ($role->abilities->contains('name', $ability)) {                 return true;             }         }         return false;     }     } Como gravar um Admin na tabela admins sendo que ele é um User por extensão?
      Tentei assim mas é claro que está errado...
      public function store(Request $request, Admin $adminModel) {         $dados = $request->validate([             "name" => "required",             "email" => "required|email",             "password" => "required",             "registration" => "required"         ]);         $dados["password"] =  Hash::make($dados["password"]);                  $admin = Admin::where("registration",  $dados["registration"])->first();                  if ($admin)              return                    redirect()->route("admin.new")                             ->withErrors([                                 'fail' => 'Administrador já cadastrados<br>, favor verificar!'                   ]);                            $newAdmin = $adminModel->create(                                    $dados['name'],                                    $dados['email'],                                    $dados['password'],                                    $dados['registration']                                 );         dd($newAdmin);         $adminModel->save();         //$adminModel::create($admin);                  return redirect()->route("admin.new")->with("success",'Cadastrado com sucesso');     }  
×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.