-
Posts
88 -
Joined
-
Last visited
Posts posted by cybernet
-
-
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
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
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; }
-
the other sites on my host works perfectly they have the same permision as the current site only the path is changed
the other different things is that this site i wrote it myself .. but the problem is that even as a single page ( without the rest of the site ) the script doesn't work :-\
-
@mikosiko
i checked the first time as you said and was still the same error
somehow
echo $_SERVER['REQUEST_METHOD'];
outputs
Notice: Undefined index: REQUEST_METHOD in /home/postlist/x/view_post.phpi know for sure that i should get this answer
-
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;
-
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
Notice: Undefined index: id in /home/postlist/x/view_post.php on line 12line 12
$id = intval($_GET['id']);
-
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
-
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 specifiederror.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" -
how can i defined it if not like this ?
$id = intval($_GET['id']);
i searched main.php and has no unset problems
i even replace $id with $post_id
still the same result
-
now i added
if(!isset($_GET["id"])) echo "id is not set\n";
and of curse the error is "id is not set"
and i tried to access the page with and without the ?id=
the error is the same ...
-
<?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.phpi intend to inform that formerly the script was running smoothly on lighttpd webserver, now i use nginx
( 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
btw : php version 5.3.x
-
i need a mysql class so i can use it like this
$this->q("SELECT * FROM posts");
something like that
i'm a newbie in smarty and only php basic knoledge
-
<?php $query = "INSERT INTO videos (`src`) VALUES ('$id')";
your signature fits the reply )
sorry for offtopic but i had to say it
-
$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 ?
i have even tried in a template
{if !isset($_POST['title']) } die? {/if}
-
please delete topic
-
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
using smarty 3.1.1, thanks for reading - cybernet
-
thanks for being patient with me
it worked
-
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
-
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
-
i'm having a problem that belongs to javascript forum and css so i posted twice
http://www.phpfreaks.com/forums/index.php?topic=329389.msg1550291#msg1550291
any guy with javascript please read the above link
any help is appreciated
-
thanks for the reply
this is the output of the mouseover ( without you're modification )
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 )
-
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
-
thanks
i will try to find the line that sets $tpl
have a great day,
cybernet
-
what's wrong in this line
$tpl->set('main_content',set_block($heading,'center',$err_tpl->fetch(load_template('error.tpl'))));
-
ok
do you know an example for text insertion like the one above
not google stuff
Mysql LIKE operator not working for safari
in PHP Coding Help
Posted
1st of all i don't know the problem that you're experiencing, but php is executing the SQL statement, not Safari, so the problem is in your code
let me give you a hint
if the $search contains a-Z caracters you can't SELECT text on a numeric field ( int, TINYINT, MEDIUMINT, and BIGINT )