Jump to content

cybernet

Members
  • Posts

    88
  • Joined

  • Last visited

Posts posted by cybernet

  1. 1st of all i'm sorry for the ironic title

    i would've name it " i need help with this $statement ", the only problem is that i don't know the name cause i would've  :rtfm:

     

    so let's cut to the chase

     

    i have this if and else statement

     

    $status = '';
    if ( !isset($_POST[ $x ]) || empty($message) || empty($email) )
    	$status = $lang['error'];
    
      else  {
    		$status = $lang['success'];
    		mail($to, $subject, $body, $headers);
    	}

    the i have this

    $no_p = '';
    $yes_p = "<p style='color:red'>".$status."<br /></p>";
    $show_status = (isset($status)) ? $no_p : $yes_p; // this is the function i don't know the name of it // this ? and : sign;

     

    what i'm trying to do is

     

    1st of all if and else statement are executed only if the html form is submitted due to a swich case function

    in the html part i have the $show_status variable which i want to show NULL if the form wasn't submitted

    and if the form was submitted i want that $show_status to show either $lang['error'] OR $lang['success']

     

    this is the only function i know to do this job, but the problem is that i got stuck :shrug:

     

    this is how i arranged the code

    switch ($pageID) 
    {
    
        case 'submit':
    foreach( array('lastname','firstname','email', 'message', 'phone') as $x )
        	{
          ${$x} = $_POST[ $x ];
        	}
    
    if ( !isset($_POST[ $x ]) || empty($message) || empty($email) )
    	$status = $lang['error'];
    
      else  {
    		$status = $lang['success'];
    		mail($to, $subject, $body, $headers);
    	}
    $no_p = '';
    $yes_p = "<p style='color:red'>".$status."<br /></p>";
    $show_status = (isset($status)) ? $no_p : $yes_p;
            break;
    }

  2. every site on the server has

    include /etc/nginx/fastcgi_params;

    and the file contains

    fastcgi_param	QUERY_STRING		$query_string;
    fastcgi_param	REQUEST_METHOD		$request_method;
    fastcgi_param	CONTENT_TYPE		$content_type;
    fastcgi_param	CONTENT_LENGTH		$content_length;
    
    fastcgi_param	SCRIPT_FILENAME		$request_filename;
    fastcgi_param	SCRIPT_NAME		$fastcgi_script_name;
    fastcgi_param	REQUEST_URI		$request_uri;
    fastcgi_param	DOCUMENT_URI		$document_uri;
    fastcgi_param	DOCUMENT_ROOT		$document_root;
    fastcgi_param	SERVER_PROTOCOL		$server_protocol;
    
    fastcgi_param	GATEWAY_INTERFACE	CGI/1.1;
    fastcgi_param	SERVER_SOFTWARE		nginx/$nginx_version;
    
    fastcgi_param	REMOTE_ADDR		$remote_addr;
    fastcgi_param	REMOTE_PORT		$remote_port;
    fastcgi_param	SERVER_ADDR		$server_addr;
    fastcgi_param	SERVER_PORT		$server_port;
    fastcgi_param	SERVER_NAME		$server_name;
    
    fastcgi_param	HTTPS			$server_https;
    
    # PHP only, required if PHP was built with --enable-force-cgi-redirect
    fastcgi_param	REDIRECT_STATUS		200;

  3. You likely have a .htaccess rewrite rule that is not passing the get parameters. What is in any .htaccess files that are present?

     

    nginx as webserver so .htaccess is useless even if it existed ( but doesn't )

     

    Ara you sure that your comp is free of malicious software?

     

     

    i use centos 6  :D

     

    Notice: Undefined index: id in /home/postlist/x/view_post.php on line 12
    :confused:

     

    line 12

    $id = intval($_GET['id']);

  4. url

    /view_post.php?post_id=88

     

    full source

    <?php
    
    // plm
    
    // require_once (dirname(__FILE__) . "/inc/main.php");
    
    // $lang = load_language('view_post');
    echo '<pre>' . print_r($_GET,true) . '</pre>';
    if(!isset($_GET["post_id"])) echo "1/id is not set\n";
    $post_id = intval($_GET['post_id']);
    if ( $post_id >= 1 ) {
    echo "2/yo good";
    }
    else {
    echo "$post_id\n";
    die ("3/no id specified");
    }
    ?>

     

    output

    Array

    (

    )

    1/id is not set 0 3/no id specified

  5. full source

    <?php
    
    // plm
    
    // require_once (dirname(__FILE__) . "/inc/main.php");
    
    // $lang = load_language('view_post');
    if(!isset($_GET["post_id"])) echo "1/id is not set\n";
    $post_id = intval($_GET['post_id']);
    if ( $post_id >= 1 ) {
    echo "2/yo good";
    }
    else {
    echo "$post_id\n";
    die ("3/no id specified");
    }
    ?>

     

    output

    1/id is not set 0 3/no id specified

     

    error.log

    2012/01/25 17:16:16 [error] 24454#0: *11049871 FastCGI sent in stderr: "PHP Notice:  Undefined index: post_id in /home/postlist/x/view_post.php on line 9" while reading response header from upstream, client: 127.0.0.1, server: google.ro, request: "GET /view_post.php?post_id=88 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fastcgi/php-fastcgi.socket:", host: "google.ro"
  6. <?php
    
    // plm
    
    require_once (dirname(__FILE__) . "/inc/main.php");
    
    $lang = load_language('view_post');
    
    $id = intval($_GET['id']);
    if ( $id >= 1 ) {
    dbconn();
    // la la la
    }
    else {
    echo "$id\n"; // for debugging
    die ("no id specified");
    }
    ?>

    when it's executed of curse i get "0 no id specified"

    1. i dont get why i get 0 as a result even if the url is /x.php?id=204

    2. in error.log i get

    PHP Notice:  Undefined index: id in x.php

     

    i intend to inform that formerly the script was running smoothly on lighttpd webserver, now i use nginx

    :wtf: ( so i wont use words )

    i know that are people with more complicated things around here ... but still i'm struggling for 1 hour with this xxx

    thanks in advance 8)

    btw : php version 5.3.x

  7. $postlist = new Smarty;
    ...
    case 'submit':
    foreach(explode(":","desc:title") as $v) {
    
          if (!isset($_POST[$v]))
    
            $postlist->display('no_posted_data.tpl');
    
        }
    

     

    post.tpl

    <form action="post.php?action=submit" method="post">
    <legend>..title..</legend>
      <table border="1">
        <tr>
          <td>{$post_form.title}:</td>
          <td>
            <input type="text" name="title" size="40">
          </td>
        </tr>
        <tr>
          <td valign="top">{$post_form.desc}:</td>
          <td><textarea name="desc" cols="80" rows="10"></textarea></td>
        </tr>
        <tr>
          <td colspan="2" align="center">
            <input type="submit" value="Submit">
          </td>
        </tr>
      </table>
    

     

    the only problem is that if i submit the form empty is still get processed

     

    any help please ? :D

     

    i have even tried in a template

    {if !isset($_POST['title']) }
       die?
    {/if}
    

  8. i would like to create a posting page just like this form i'm writing now

    including return ( <br/> ) pagination, and language codes ( php mysql c++ c# ... etc  without affecting site security )

     

    are there any good tutorials i can follow or any advice ?

    i'm very new to smarty and i have only basic php knowledge

     

    to prove that i'm not lazy and i read the documentation this is what i got so far

     

    <?php
    
    
    require('../dev0_inc/smarty/Smarty.class.php');
    require('../dev0_inc/config/ride_mysql.php');
    
    
    $smarty = new Smarty;
    $smarty->error_reporting = E_ALL & ~E_NOTICE;
    
    // $smarty->debugging = true;
    $smarty->caching = false;
    $smarty->cache_lifetime = 120;
    // setConfig for *.conf files
    $smarty->setConfigDir('../dev0_inc/config');
    
    // $smarty->
    
    // sqL
    
    $result = mysql_query("SELECT * FROM posts ORDER BY `id` DESC LIMIT 0 , 50") or die(mysql_error());
    // For each result that we got from the Database
    while ($line = mysql_fetch_assoc($result))
    {
    $value[] = $line;
    }
    
    // Assign this array to smarty...
    $smarty->assign('posts', $value);
    
    $config['cyber_date'] = '%d %b %y, %T';
    
    $smarty->assign('config', $config);
    
    
    $smarty->display('index.tpl');
    
    ?>

     

    and i'm using phpmyadmin to insert data

     

    so far i read from documentation that i have to escape the assign values, but i don't know if it's secure :shy:

    using smarty 3.1.1, thanks for reading - cybernet

  9. i don't think you understood me

    index.php is flawless ( i think )

    if on index.php i select Bauturi alcoolice on post page i wanna get Bauturi alcoolice

     

    this code is good

    <?php 
    error_reporting(E_ALL);
    
    $drop = $_REQUEST['bauturi']; 
    echo $drop;
    ?>

    but as result i get bauturi_alcoolice instead of the value that is equal with it

  10. i have two pages

    form and submit page

    index.php

    <?php 
    error_reporting(E_ALL);
    $bauturi = array('bauturi_alcoolice'=>'Bauturi alcoolice','sucuri'=>'Sucuri','bauturi_racoritoare'=>'Bauturi racoritoare'); 
    echo '<form action="post.php" method="post">';
    
    echo'<select name="bauturi">'; 
    
    foreach($bauturi as $let=>$word){ 
        echo'<option value="'.$let.'">'.$word.'</option>'; 
    } 
    echo'</select>';
    echo '<INPUT type="submit" value="show me money">
    
    </form>';
    ?> 

    post.php

    <?php 
    error_reporting(E_ALL);
    
    $drop = $_REQUEST['bauturi']; 
    echo $drop;
    ?>

    if i select Bauturi alcoolice on post.php page i get bauturi_alcoolice

    but i want to get Bauturi alcoolice as result

     

    i tried to use foreach like this

    <?php 
    error_reporting(E_ALL);
    
    $drop = $_REQUEST['bauturi']; 
    $bauturi = array('bauturi_alcoolice'=>'Bauturi alcoolice','sucuri'=>'Sucuri','bauturi_racoritoare'=>'Bauturi racoritoare'); 
    foreach($bauturi as $drop=>$word){ 
    echo $word;
    echo "<br/>";
    unset($word);
    }
    ?>

     

    but i get all the values in the form

    i only want to show the selected value from the form in post.php page

     

    thanks in advance

  11. thanks for the reply

    this is the output of the mouseover ( without you're modification )

     

    jpu83p.jpg

     

    that background is #0e0d0b but i don't wanna change that, i just wanna make it transparent

     

    like this ( i modified the image with gimp )

    xfswzq.png

  12. i have this to files

    http://code.google.com/p/cyby/source/browse/trunk/js/cyber.js and

    http://code.google.com/p/cyby/source/browse/trunk/css/cyber.css

     

    i know this has 2 different topic for each one but together they create a usefull mouseover

     

    what i'm trying to do is to make the mouseover transparent where can i change that

     

    after a google search i know that "opacity:0.4;filter:alpha(opacity=40)" will do the trick but i have no idea where to edit

    any help will be appreciated 

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