Jump to content

TottoBennington

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

TottoBennington's Achievements

Member

Member (2/5)

0

Reputation

  1. Can anyone help me with this error ? Deprecated: Function eregi() is deprecated in C:\wamp\www\phpDetectIE\index.php on line 18 <?php function ObtenerNavegador($user_agent) { $navegadores = array( 'Opera' => 'Opera', 'Mozilla Firefox'=> '(Firebird)|(Firefox)', 'Galeon' => 'Galeon', 'Mozilla'=>'Gecko', 'MyIE'=>'MyIE', 'Lynx' => 'Lynx', 'Netscape' => '(Mozilla/4\.75)|(Netscape6)|(Mozilla/4\.08)|(Mozilla/4\.5)|(Mozilla/4\.6)|(Mozilla/4\.79)', 'Konqueror'=>'Konqueror', 'Internet Explorer 7' => '(MSIE 7\.[0-9]+)', 'Internet Explorer 6' => '(MSIE 6\.[0-9]+)', 'Internet Explorer 5' => '(MSIE 5\.[0-9]+)', 'Internet Explorer 4' => '(MSIE 4\.[0-9]+)', ); foreach($navegadores as $navegador=>$pattern){ if (eregi($pattern, $user_agent)) return $navegador; } return 'Desconocido'; } ?> <?php echo ObtenerNavegador($_SERVER['HTTP_USER_AGENT']) ?>
  2. Here´s the code ... this file is articles.php <?php if(!function_exists('get_articles1')){ function get_articles1() { //error is in this line $articles = array (); $query = mysql_query("SELECT * FROM articles "); while ($row = mysql_fetch_assoc($query)){ $articles[] = array ( 'article_id' => $row ['article_id'], 'article_title' => $row['article_title'], 'article_likes' => $row ['article_likes'], 'article_description' => $row['article_description'], 'article_date' => $row['article_date'], 'article_admin' => $row['article_admin'] ); } return $articles; } } ?> This is my index page code .. i call to the function here : <?php $articles = get_articles1(); ?>
  3. mysql_result() : supplied argument is not a valid result in ..... function previously_liked ($article_id) { $article_id = (int) $article_id; return (mysql_result(mysql_query("SELECT COUNT(`like_id`) FROM `likes` WHERE `like_id` = " .$_SESSION['user_id']. " AND `article_id` = $article_id"), 0) == 0 ) ? false : true; // this is the line with the error. }
  4. Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/tottoswd/public_html/iuw/func/user.func.php on line 4 <?php function user_exists($email) { $email = mysql_real_escape_string($email); $query = mysql_query("SELECT COUNT(´user_id´) FROM ´users_vu´ WHERE ´email´ = '$email'"); return (mysql_result($query, 0) == 1) ? true : false; (THIS IS THE LINE WITH THE ERROR) ?>
  5. Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' <?php function paypal_items() { $num = 0; foreach($_SESSION as $name => $value){ if($value != 0){ if (substr($name, 0, 5) == 'cart_') { $id = substr($name, 5, strlen($name) -5); $get = mysql_query('SELECT id, name, price, shipping FROM products WHERE id='.mysql_real_escape_string((int)$id)); while ($get_row = mysql_fetch_assoc($get)) { $num++; echo '<input type="hidden" name="item_number_'.$num'" value="'.$id.'" />'; echo '<input type="hidden" name="item_name_'.$num.'" value="'.$get_row['name'].'" />'; echo '<input type="hidden" name="amount_'.$num.'" value="'.$get_row['price'].'" />'; echo '<input type="hidden" name="shipping_'.$num.'" value="'.$get_row['shipping'].'" />'; echo '<input type="hidden" name="shipping2_'.$num.'" value="'.$get_row['shipping'].'" />'; echo '<input type="hidden" name="quantity_'.$num.'" value="'.$get_row['quantity'].'" />'; } } } } } ?>
  6. ERROR MESSAGE: Parse error: syntax error, unexpected '(' in C:\xampp\htdocs\cart\cart.php on line 6 <?php function cart() { foreach($_SESSION as $name => $value) { if ($value>0) { if (substr($name, 0, 5) == 'cart_') { $id = substr ($name,5 (strlen($name) -5)); echo $id; } } else { echo 'your cart is empty'; } } } ?> [code/]
  7. Notice: Undefined variable: quantity_row in C:\xampp\htdocs\cart\cart.php on line 12 Notice: Undefined index: cart_1 in C:\xampp\htdocs\cart\cart.php on line 12 Notice: Undefined index: cart_1 in C:\xampp\htdocs\cart\cart.php on line 30 Help me guys <?php session_start(); $page = 'index.php'; mysql_connect('localhost','root','')or die(mysql_error()); mysql_select_db('cart') or die(mysql_error()); if (isset ($_GET['add'])){ $quantity = mysql_query('SELECT id, quantity FROM products WHERE id ='.mysql_real_escape_string( (int)$_GET['add'])); while($quantity_rows = mysql_fetch_assoc($quantity)) { if ($quantity_row['quantity'] != $_SESSION['cart_'.$_GET['add']]) { $_SESSION['cart_'.$_GET['add']] += '1'; } } } function products() { $get = mysql_query('SELECT id, name, description, price FROM products WHERE quantity > 0 ORDER BY id DESC') or die(mysql_error()); if (mysql_num_rows($get) == 0) { echo 'There are no products to display!'; } else { while ($get_row = mysql_fetch_assoc($get)) { echo '<p>'.$get_row['name']. '<br />' .$get_row['description']. '<br />'.number_format( $get_row['price'], 2) . '<a href="cart.php?add='. $get_row['id'].'">Add</a></p>'; } } } echo $_SESSION['cart_1']; ?>
  8. Hi people, I want to do a system in which when the user clicks, add + 1. And when i click to refresh the browser does not erase the values and continue to accumulate. Well the counter works, but when i refresh it returns to 0 . WHAT CAN I DO? <!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> </head> <body> <input type='submit' value='Like' onclick='' id='aa' /> <p style='clear: left;'> <span>0</span> like this. </p> <script> $("#aa").click(function () { var n = parseInt($("span").text(), 10); var a=0; n = n + 1; $("span").text( a = parseInt(a) + parseInt(n)); }); </script> </body> </html>
  9. When i touch the button that i've called "submit", the form dissapear and nothing happens. Later i saw the localhost, but VALUES , are not in the table . $submit = @ $_POST['submit']; if ($submit) { $nombre = strtolower( strip_tags(@ $_POST['nombre'])); $apellido = strtolower( strip_tags( @ $_POST['apellido'])); $tel = strip_tags(@ $_POST['telefono']); $email = strip_tags(@ $_POST['email']); $ubicacion = strtolower( strip_tags( @ $_POST['ubicacion'])); $opcion = @ $_POST['opcion']; $especificacion = strtolower( strip_tags( @ $_POST['especificacion'])); $explicación = strtolower( strip_tags( @ $_POST['explicacion'])); if (!empty($nombre) && !empty($apellido) && !empty($email) && !empty($tel) && !empty($ubicacion) && !empty($opcion) && !empty($especificacion) && !empty($explicacion)) { mysql_connect ("localhost","root","") or die (mysql_error()); mysql_select_db("pedidos") or die (mysql_error()); $date = date ("Y-m-d"); $insert = mysql_query ("INSERT INTO pedidos_recibidos VALUES ('','$nombre','$apellido','$tel','$email','$ubicacion','$opcion','$especificacion','$explicacion','$date')") or die (mysql_error()); echo 'works!'; } else { echo "please fill otu all the fields"; } } ?> <html> <table id='encargo2' > <form action='index.php' method='POST'> <tr> <td> Nombre: </td> <td> <input type='text' name='nombre' value=''> </td> </tr> <tr> <td> Apellido: </td> <td> <input type='text' name='apellido' value=''> </td> </tr> <tr> <td> Telefono: </td> <td> <input type='text' name='apellido' value=''> </td> </tr> <tr> <td> email: </td> <td> <input type='text' name='email' value=''> </td> </tr> <tr> <td> Localidad o ubicación: </td> <td> <input type='text' name='ubicacion'> </td> </tr> <tr> <td> Deseo una web para: </td> <td> <select name='opcion'> <option></option> <option value='almacen'>Almacen o negocio</option> <option value='empresa'>Empresa</option> <option value='club'>Club de barrio</option> <option value='emprendimiento'>Emprendimiento personal</option> <option value='otro'>Otro</option> </select> </td> </tr> <tr> <td> Si eligio opción "Otro",<br /> especifique con detalles para que: </td> <td> <textarea cols='20' rows='5' name='especificacion'></textarea> </td> </tr> <tr> <td> Explique con sus palabras<br /> como quiere que sea la página: </td> <td> <textarea cols='20' rows='5'name='explicacion'></textarea> </td> </tr> </table> <p> <input type='submit' name='submit' value='Enviar Pedido'> </form> </html>
  10. I can't found the error <?php $submit = @ $_POST['submit']; if ($submit) { $nombre = strtolower( strip_tags(@ $_POST['nombre'])); $apellido = strtolower( strip_tags( @ $_POST['apellido'])); $tel = strip_tags(@ $_POST['telefono']); $email = strip_tags(@ $_POST['email']); $ubicacion = strtolower( strip_tags( @ $_POST['ubicacion'])); $opcion = @ $_POST['opcion']; $especificacion = strtolower( strip_tags( @ $_POST['especificacion'])); $explicación = strtolower( strip_tags( @ $_POST['explicacion'])); if (!empty($nombre&&$apellido&&$email&&$tel&&$ubicacion&&$opcion&&$especificacion&&$explicacion)) { mysql_connect ("localhost","root","") or die (mysql_error()); mysql_select_db("pedidos") or die (mysql_error()); $date = date ("Y-m-d"); $insert = mysql_query ("INSERT INTO pedidos_recibidos VALUES ('','$nombre','$apellido','$tel','$email','$ubicacion','$opcion','$especificacion','$explicacion','$date')") or die (mysql_error()); } else { echo "please fill out all the fields"; } } ?>
  11. This code is to active an account by email, but whei i register any user, this message appears: Warning: mail() [function.mail]: Failed to connect to mailserver at "miniRelay" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\RegisterByEmailActivation\register.php on line 42. <?php include 'global.php'; if (@$_POST['register']) { include 'connect.php'; //get form data $username = addslashes (strip_tags($_POST['username'])); $password = addslashes (strip_tags($_POST['password'])); $email = addslashes (strip_tags($_POST['email'])); if (!$username||!$password||!$email) { echo "Please fill out all the fields!"; } else { //encrypt password $password = md5($password); //check if username already taken $check = mysql_query ("SELECT * FROM users WHERE username ='$username'") or die(mysql_error()); if (mysql_num_rows($check)>=1) { echo "Username already taken"; } else { // generate random code $code = rand (11111111,99999999); // send activation email $to = $email; $subject = "Activate your account"; $body = "Hello $username,\n\nYou registered and need to activate your account, click the link below or paste it into the URL var of your browser\n\n http://localhost/RegisterByEmailActivation/activate.php?code=$code\n\nThanks!"; if (!mail($to, $subject, $body)) { echo"We could not sing up at this time, please try again later!"; } else { //register into database $register = mysql_query("INSERT INTO users VALUES ('','$username','$password','$email','$code','0')"); echo "You have been registered successfully! please check your email ($email) to activate your account"; } } } } ?> <html> <form action='register.php' method='POST'> Choose your username:<br /> <input type='text' name='username'><p /> Choose password:<br /> <input type='password' name='password'><p /> Email:<br /> <input type='text' name='email'><p /> <input type='submit' name='register' value='register'> </form> </html> This is my "php.ini" configuration for mail function: [mail function] ; For Win32 only. ; http://php.net/smtp SMTP = localhost ; http://php.net/smtp-port smtp_port = 25 ; For Win32 only. ; http://php.net/sendmail-from sendmail_from = ilovelinkinpark@live.com.ar
  12. The trouble is when i log in later of register an user, it continue saying that my password is incorrect! Is is the form for registration! <?php echo "<h1>REGISTER</h1>"; $submit = @ $_POST['submit']; $fullname = strip_tags ( @ $_POST['fullname']); $username = strtolower(strip_tags ( @ $_POST['username'])); $password = md5( strip_tags ( @ $_POST['password'])); $repeatpassword = md5 ( strip_tags ( @ $_POST['repeatpassword'])); $date = date ("Y-m-d"); if ($submit) { $connect = mysql_connect("localhost","root",""); mysql_select_db("login"); $namecheck = mysql_query("SELECT username FROM users WHERE username='$username'"); $count = mysql_num_rows($namecheck); if ($count !=0) { die ("Username already taken!"); } if ($fullname&&$username&&$password&&$repeatpassword) { if ($password==$repeatpassword) { if (strlen ($username)> 25 || strlen ($fullname)> 25) { echo "Length of username or fullname too long!"; } else { if (strlen ($password)> 100 || strlen ($password)< 5) { echo "Password must be between 5 and 100 characters"; } else { $password = md5 ($password); $repeatpassword = md5 ($repeatpassword); $queryreg = mysql_query ("INSERT INTO users VALUES ( '','$fullname','$username','$password','$date')"); die ("You have been registered! <a href='index.php'>return to index </a>"); } } } else { echo "Your passwords do not match!"; } } else echo "Please fill <b>all</b> of the fields !"; } ?> <html> <p> <form action='register.php' method='POST'> <table> <tr> <td> Your full name: </td> <td> <input type='text' name='fullname' value='<?php echo $fullname; ?>'> </td> </tr> <tr> <td> Choose a username: </td> <td> <input type='text' name='username' value='<?php echo $username; ?>'> </td> </tr> <tr> <td> Choose a password: </td> <td> <input type='password' name='password'> </td> </tr> <tr> <td> Repeat the password: </td> <td> <input type='password' name='repeatpassword'> </td> </tr> </table> <p> <input type='submit' name='submit' value='register'> </form> </html> That's the log in page, i think the trouble is when i compare the passwords. <?php session_start (); $username = @ $_POST['username']; $password = @ $_POST['password']; if($username&&$password) { $connect = mysql_connect ("localhost", "root","") or die ("could not connect"); mysql_select_db ("login") or die ("could not find db"); $query = mysql_query ("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); $numrows = mysql_num_rows ($query); if ($numrows!= 0) { while ($row = mysql_fetch_assoc($query)) { $dbusername = $row ['username']; $dbpassword = $row ['password']; } if ($username == $dbusername && md5 ($password) == $dbpassword) { echo 'you are in! <a href="member.php">click here</a> to go to member page.'; $_SESSION['username'] = $username; } else echo 'Sorry incorrect password, try again <a href="index.php"> return to log in page </a>!'; } else die ("that user doesen´t exist"); } else die ("Please enter username and password!"); ?> HELP ME!
  13. Notice: Undefined index: username in C:\wamp\www\LogInSystem\login.php on line 2 Notice: Undefined index: password in C:\wamp\www\LogInSystem\login.php on line 3 Help me to change this error <?php $username = $_POST['username']; ERROR IS IN THIS LINE $password = $_POST['password']; ERROR IS IN THIS LINE if ($username&&$password){ $connect = mysql_connect ("localhost", "root","") or die ("could not connect"); mysql_select_db ("login") or die ("could not find db"); } else { die ("Please enter username and password!");} ?>
  14. This is the error message : Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\wamp\www\LikeButton\articles.php on line 6 Can anyone help me ? <?php function get_articles() { $articles = array (); $query = mysql_query("SELECT ´article_id´ , ´article_title´ , ´article_likes´ FROM ´articles´ ") ; while (($row = mysql_fetch_assoc($query)) !=false){[size=12pt][u][b] Error is in this line[/b][/u][/size] echo $row ['article_title'] , '<br />'; } } ?>
  15. Can anyone help me? <?php function get_articles() { $articles = array (); $query = mysql_query("SELECT ´article_id´ , ´article_title´ , ´article_likes´ FROM ´articles' "); while (($row = mysql_fetch_assoc($query)) !=false){ echo $row ['article_title'] , '<br />'; } } ?> MOD EDIT: . . . tags added, circus fonts removed.
×
×
  • 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.