Jump to content

redarrow

Members
  • Content count

    7,306
  • Joined

  • Last visited

Community Reputation

1 Neutral

About redarrow

  • Rank
    Prolific Member

Contact Methods

  • Website URL
    http://freesingles.ath.cx

Profile Information

  • Gender
    Male
  • Location
    london
  1. redarrow

    struggling with pdo and php

    my code not working it like the $sql->bindParam all fail please help $user_paypal_email=$_POST['user_paypal_email']; $user_skype_name=$_POST['user_skype_name']; $user_package_type=$_POST['user_package_type']; if( ($user_date_added) && ($user_id) && ($user_paypal_email) && ($user_skype_name) && ($user_package_type) ){ $conn = new PDO("mysql:host=$dbhost; dbname=$dbname", $dbusername, $dbpassword); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = ("INSERT INTO user_add (`user_id`, `user_paypal_email` , `user_skype_name` , `user_package_type` , `user_date_added` ) VALUES (:user_id, :user_paypal_email, :user_skype_name, :user_package_type, :user_date_added )"); $sql->bindParam(':user_id', $user_id, PDO::PARAM_STR); $sql->bindParam(':user_paypal_email', $user_paypal_email, PDO::PARAM_STR); $sql->bindParam(':user_skype_name', $user_skype_name, PDO::PARAM_STR); $sql->bindParam(':user_package_type', $user_package_type, PDO::PARAM_STR); $sql->bindParam(':user_date_added', $user_date_added, PDO::PARAM_STR); $sql->exec($sql);
  2. redarrow

    database not working

    Thank you i am learning thank you for teaching me , i will print it all out and try and understand it all ... Thanks for your help . Regards john ..
  3. redarrow

    comments spilling out of my comment box

    Is the order correct cid should be uid
  4. redarrow

    database not working

    I agree with you but as a one night shit was not bad at all , yes it was a way for me to learn but like i say since i have found a good tutorial i change the code as i go , off course i am not going to use the code online in real life . Can you point out the way your think that a hacker can do wrong ..... Buy the way it was a pdo first go i am just learning pdo , php i am ok on. Dont no how you see only 88 times with my shuffle code .... Ps. If you look at the code you got to have the session set as admin before you can even use the page , so i dont no how anyone can set a session as admin if there not going thru the database and getting the session set , if the session not set then the session can not be set in the url ,,,, unless your saying there a way to set a session in a url but how???
  5. redarrow

    database not working

    If your comming from the old mysql or the old mysqli i suggest a really good tutorail I was having really bad problams understanding All night , the totrial given to me above was to hard to understand , I come across a really good example Know i want throw my computer in the road . http://wiki.hashphp.org/PDO_Tutorial_for_MySQL_Developers#Fetch_Modes The above link is really easy to undestand as it exsplaines from mysql to pdo and it differences Which really helps . Please read it you wont regreat it. http://wiki.hashphp.org/PDO_Tutorial_for_MySQL_Developers#Fetch_Modes My code i posted as solved is not solved in a perfect way , as pdo has a way to stop hackers getting in or changeing info using a ? Place holder so as i learn i will rebuild my code properly and not cry like a child....
  6. redarrow

    database not working

    <?php session_start(); error_reporting(0); @ini_set('display_errors', 0); if(!$_SESSION['username']=="admin"){ header("location: member_login.php"); exit; } $dbhost = "localhost"; $dbname = " "; $dbusername = "root"; $dbpassword = ""; if(isset($_POST['submit'])){ $user_date_added=date('m.d.y'); function randomGen($min, $max, $quantity) { $numbers = range($min, $max); shuffle($numbers); return array_slice($numbers, 0, $quantity); } $num=(randomGen(0,6,6)); $user_id=implode($num); $user_paypal_email=$_POST['user_paypal_email']; $user_skype_name=$_POST['user_skype_name']; $user_package_type=$_POST['user_package_type']; if( ($user_date_added) && ($user_id) && ($user_paypal_email) && ($user_skype_name) && ($user_package_type) ){ $conn = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbusername, $dbpassword); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = "INSERT INTO user_add (`user_id`, `user_paypal_email` , `user_skype_name` , `user_package_type` , `user_date_added` ) VALUES('$user_id', '$user_paypal_email' , '$user_skype_name' , '$user_package_type' , '$user_date_added' )"; // use exec() because no results are returned $conn->exec($sql); echo "Please add another <a href='admin_add_user.php'>HERE</a>"; exit; $conn = null; }else{ echo "Please try agin <a href='admin_add_user.php'>HERE</a>"; exit; } } ?> SOLVED solved it my self........
  7. redarrow

    database not working

    That dont help me at all, i am like a spastic i am trying to post from a form, if i can not add variables ,i might as well throw my pc throw the wall, and burn it in the middle of the road ,then go and find who made pdo and just kill them with a hammer............
  8. redarrow

    database not working

    i don't understand please give me a full example cheers. the top example is fully pdo? are you telling me ever think i no on mysql is gone not here no more at all???????
  9. redarrow

    database not working

    i keep getting database error please help... ! ) Deprecated: mysql_real_escape_string(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in C:\wamp\www\seotoolsgroupbuys\done\admin_add_user.php on line 28 i have tried pdo and mysql and mysqli please help....... <?php $dbhost = "localhost"; $dbname = " "; $dbusername = "root"; $dbpassword = "liononabridge"; $link = new PDO("mysql:host=$dbhost;dbname=$dbname",$dbusername,$dbpassword); $link->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); try { $statement = $link->prepare ("INSERT INTO user_add (`id`, `user_id`, `user_paypal_email`, `user_skype_name`, `user_package_type`, `user_date_added`) ) VALUES(NULL, NULL, 'john@paypal.com', 'nicky@skpe.com', 'Keyword Tool', '22112017')"); $statement->execute(array("Bob","Desaunois",18)); } catch(PDOException $e) { echo $e->getMessage(); } ?> here what i got and still error <?php //Turn the erros off , so when file deleted no php and mysql error..... //error_reporting(0); //@ini_set('display_errors', 0); $servername = "localhost"; $username = "root"; $password = "liononabridge"; $conn = mysqli_connect($servername, $username, $password); if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } if(isset($_POST['submit'])){ // add a date $user_date_added=date('m.d.y'); //post all the varables to the database. $user_paypal_email=mysql_real_escape_string($_POST['user_paypal_email']); $user_skype_name=mysql_real_escape_string($_POST['user_skype_name']); $user_package_type=mysql_real_escape_string($_POST['user_package_type']); mysqli_select_db($conn, "seotoolsgorpbuys_tool"); mysqli_query($conn, "INSERT INTO add_user (`id` , `user_id `, `user_paypal_email` , `user_skype_name` , `user_package_type` , `user_date_added` ) VALUES( NULL , NULL , '$user_paypal_email' , '$user_skype_name' , '$user_package_type' , '$user_date_added' )"); echo "New record created successfully"; exit; } ?> SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') VALUES(NULL, NULL, 'john@paypal.com', 'nicky@skpe.com', 'Keyword Tool', ' at line 1
  10. redarrow

    help finding code sorry

    hi there all i need the code that adds the url to a page like in the new forums cheers. you get a image of that website and the url of the page can anyone help please thank you like if i type www,google.com <<< you get a image and link automaticly..
  11. redarrow

    using PHP sessions with exec() or shell_exec()

    try a different loop then can help. i am still running towards processing power it a processing problem. it works fine fast until it hits the loop that right.
  12. redarrow

    using PHP sessions with exec() or shell_exec()

    what pc you got, maybe it comes down to the processing speed or ram.
  13. redarrow

    [SOLVED] Notepad++

    mchi, But if your working with session's then you need to make sure the browser is closed then reopened. and personally i don't use live preview, as i need all my html/css cross browser compliant, I only use my zend package for debugging php mysql . i would use notepad the same way.
  14. Not tested but the full code....... tincker with it ateast try it......... <?php $db=mysql_connect("localhost","username","password"); $result=mysql_create_db("database_name",$db)or die ('Database connection error'.mysql_errow()); if(isset($_POST['submit'])){ $email=mysql_real_escape_string($_POST['email']); $email=mysql_real_escape_string($_POST['r_email']); $s_info=mysql_real_escape_string($_POST['s_info']); $r=mysql_real_escape_string($_POST['r']); if(!preg_match("/[A-Za-z0-9\_\-]+@[A-Za-z0-9\-\_]+.[a-zA-Z0-9]+/",$email)){ echo"Sorry but your email is not valid"; } if( empty($email) || empty($r_email) || empty($s_info)){ echo"Please fill in all the form!"; } if($email()) if($email==$r_email){ $sql="select * table where email='$email' and s_info='$_info'"; $res=mysql_query($sql)or die('Mysql select error'.mysql_error()); if(mysql_num_rows($res)==1){ $r=rand(0,999999); $password=md5(sha1(md5($r))); $up="update table set password='$password' where email='$email' and s_info='$s_info'"; $res2=mysql_query($up)or die('Mysql update error'.mysql_error()); if(mysql_affected_rows($res)){ $email=$eamil; $pasword=$r; $Messages='Thank you enjoy your new adventure here your password!'; // $to = $email; // set the email address.......... $subject = 'Forgor Password!'; //subject of the email //$mes is using caternation . << a dot $mes = "Hello; $email <br><br> You have recieved an email from us about a new password<br><br>"; $mes .= "This message below is for your convenience. <br><br> ****************************** <br><br>"; $mes .= $email; $mes .= "<br><br>"; $mes .= "Password: "; $mes .= $password; $mes .= "<br><br>"; $mes .= "Message: "; $mes .= $Messages; $mes .= "<br><br>****************************** <br><br>This Is An Automatically Generated Message, Do Not Repond!"; $message = $mes; $headers = 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n"; // we are saying if the email is ent tell us using the email function. if(mail($to, $subject, $message, $headers)){ // message was sent. echo " MAIL WAS SENT TO $to!"; }else{ // message was not sent. echo " SORRY NO MESSAGE SENT TO $to"; } echo"Thank you your new password been updated! <br>please now log in!"; } }else{ echo"Sorry we dont have a account with that info please try agin or join us!"; } }else{ echo"Sorry your emails diidnt match please try agin!"; } } ?> // header.php <center> <form method="POST" action="<?php $_SERVER['PHP_SELF']; ?>"> <br><br> please enter your email address! <br><br> <input type="text" name="email"> <br><br> please re enter your email address! <br><br> <input type="text" name="r_email"> <br><br> please enter your specil info <br><br> <input type="POST" name="s_info"> <br><br> <input type="submit" name="submit" value="Password Request"> </form> </center> //footer.php
  15. Example only ok not tested but somethink to work on........... <?php if(isset($_POST['submit'])){ $email=mysql_real_escape_string($_POST['email']); $s_info=mysql_real_escape_string($_POST['s_info']); $sql="select * table where email='$email' and s_info='$_info'"; $res=mysql_query($sql)or die(mysql_error()); if(mysql_num_rows($res)==1){ $r=rand(0,999999); $password=md5(sha1(md5($r))); $up="update table set password='$password' where email='$email' and s_info='$s_info'"; $res2=mysql_query($up)or die(mysql_error()); if(mysql_affected_rows($res)){ echo"Thank you your new password been updated! <br>please now log in!"; } }else{ echo"Sorry we dont have a account with that info please try agin or join us!"; } } ?> // header.php <center> <form method="POST" action="<?php $_SERVER['PHP_SELF']; ?>"> <br><br> please enter your email address! <br><br> <input type="text" name="email"> <br><br> please enter your specil info <br><br> <input type="POST" name="s_info"> <br><br> <input type="submit" name="submit" value="Password Request"> </form> </center> //footer.php
×

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.