jazzman1
Staff Alumni-
Posts
2,713 -
Joined
-
Last visited
-
Days Won
12
Everything posted by jazzman1
-
Hm.....it's weird Could you echo $check_email before to send a string to database? $check_email = sprintf("SELECT `EMAIL` FROM `subscribers` WHERE `EMAIL` = %s", GetSQLValueString($_POST['email'], "text")); echo $check_email; exit; etc......
-
Just comment a Select statement for a minute: if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { mysql_select_db($database_subscribers, $subscribers); /* $check_email = sprintf("SELECT `EMAIL` FROM `subscribers` WHERE `EMAIL` = %s", GetSQLValueString($_POST['email'], "text")); $result = mysql_query($check_email, $subscribers) or die(mysql_error()); if(mysql_num_rows($result) > 0) { echo 'Sorry, but this email has beed already taken'; return false; } */ $insertSQL = sprintf("INSERT INTO subscribers (`ID`,`EMAIL`) VALUES (NULL, %s)", GetSQLValueString($_POST['email'], "text")); $Result1 = mysql_query($insertSQL, $subscribers) or die(mysql_error()); }
-
Change: $check_email = sprintf("SELECT `EMAIL` FROM `subscribers` WHERE `EMAIL` = '%s'", GetSQLValueString($_POST['email'], "text")); to $check_email = sprintf("SELECT `EMAIL` FROM `subscribers` WHERE `EMAIL` = %s", GetSQLValueString($_POST['email'], "text")); and $insertSQL = sprintf("INSERT INTO subscribers (`EMAIL`) VALUES ('%s')", GetSQLValueString($_POST['email'], "text")) to $insertSQL = sprintf("INSERT INTO subscribers (`ID`,`EMAIL`) VALUES (NULL, %s)", GetSQLValueString($_POST['email'], "text")) Make sure that ID is capital letters
-
Let us see your code.
-
OK, after $insertSQL on the line #69, put it this line of code and give me back the result: $insertSQL = sprintf("INSERT INTO subscribers (EMAIL) VALUES (%s)", GetSQLValueString($_POST['email'], "text")); echo $insertSQL; exit; Also, enclose %s with single quotes. How many numbers of columns you have in table, named: subscribers ? $insertSQL = sprintf("INSERT INTO subscribers (`EMAIL`) VALUES ('%s')", GetSQLValueString($_POST['email'], "text"));
-
Try, <?php include ('Connections/subscribers.php'); date_default_timezone_set('America/Chicago'); if (isset($_POST['Submit'])) { if ($_POST['email'] != "") { $email = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $errors = "$email is <strong>NOT</strong> a valid email address.<br/><br/>"; } } if (isset($errors)) { echo '<div style="color: red">' . $errors . '<br/></div>'; return false; } 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; } } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { mysql_select_db($database_subscribers, $subscribers); $check_email = sprintf("SELECT `EMAIL` FROM `subscribers` WHERE `EMAIL` = '%s'", GetSQLValueString($_POST['email'], "text")); $result = mysql_query($check_email, $subscribers) or die(mysql_error()); if(mysql_num_rows($result) > 0) { echo 'Sorry, but this email has beed already taken'; return false; } $insertSQL = sprintf("INSERT INTO subscribers (EMAIL) VALUES (%s)", GetSQLValueString($_POST['email'], "text")); $Result1 = mysql_query($insertSQL, $subscribers) or die(mysql_error()); } } else { $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } ?> <form action="<?php echo $editFormAction; ?>" name="form1" method="POST"> Email Address: <br/> <input type="text" name="email" value="" size="50"/> <br/><br/> <input type="hidden" name="MM_insert" value="form1" /> <input type="submit" name="Submit" /> </form> <?php } ?> EDIT: I want to know, what action do you get when the form has been submitted? Put it this line of code immediately after if (isset($_POST['Submit'])) and give the result back : if (isset($_POST['Submit'])) { echo '<pre>.print_r($editFormAction, true).'</pre>; exit; etc...........
-
@StevenJacobs, sorry for the delay I had a plumbing issue in my apartment. It could be something like this: <?php include ('Connections/subscribers.php'); date_default_timezone_set('America/Chicago'); if (isset($_POST['Submit'])) { if ($_POST['email'] != "") { $email = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $errors = "$email is <strong>NOT</strong> a valid email address.<br/><br/>"; } } if (isset($errors)) { echo '<div style="color: red">' . $errors . '<br/></div>'; return false; } 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; } } if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { mysql_select_db($database_subscribers, $subscribers); $check_email = sprintf("SELECT `EMAIL` FROM `subscribers` WHERE `EMAIL` = '%s'", GetSQLValueString($_POST['email'], "text")); $result = mysql_query($check_email, $subscribers) or die(mysql_error()); if(mysql_num_rows($result) > 0) { echo 'Sorry, but this email has been already taken'; return false; } $insertSQL = sprintf("INSERT INTO subscribers (EMAIL) VALUES (%s)", GetSQLValueString($_POST['email'], "text")); $Result1 = mysql_query($insertSQL, $subscribers) or die(mysql_error()); } } else { ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" name="form1" method="POST"> Email Address: <br/> <input type="text" name="email" value="<?php echo $_POST['email']; ?>" size="50"/> <br/><br/> <input type="submit" name="Submit" /> <input type="hidden" name="MM_insert" value="form1" /> </form> <?php } ?>
-
Don't use $_SERVER['PHP_SELF']. ChristianF has a good tutorial in that forum how to use it. Try, <?php include ('Connections/subscribers.php'); date_default_timezone_set('America/Chicago'); if (isset($_POST['Submit'])) { if ($_POST['email'] != "") { $email = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $errors = "$email is <strong>NOT</strong> a valid email address.<br/><br/>"; } } if (isset($errors)) { echo '<div style="color: red">' . $errors . '<br/></div>'; return false; } 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; } } if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO subscribers (EMAIL) VALUES (%s)", GetSQLValueString($_POST['email'], "text")); mysql_select_db($database_subscribers, $subscribers); $Result1 = mysql_query($insertSQL, $subscribers) or die(mysql_error()); } } else { ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" name="form1" method="POST"> Email Address: <br/> <input type="text" name="email" value="<?php echo $_POST['email']; ?>" size="50"/> <br/><br/> <input type="submit" name="Submit" /> <input type="hidden" name="MM_insert" value="form1" /> </form> <?php } ?>
-
Run that one and post back the result: <?php require_once('Connections/subscribers.php'); date_default_timezone_set('America/Chicago'); $errors = NULL; if (isset($_POST['Submit'])) { if ($_POST['email'] != "") { $email = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $errors .= "$email is <strong>NOT</strong> a valid email address.<br/><br/>"; } } else { $errors .= 'Please enter your email address.<br/>'; } { echo '<div style="color: red">' . $errors . '<br/></div>'; } } else { 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"] == "form1")) { $insertSQL = sprintf("INSERT INTO subscribers (EMAIL) VALUES (%s)", GetSQLValueString($_POST['email'], "text")); mysql_select_db($database_subscribers, $subscribers); $Result1 = mysql_query($insertSQL, $subscribers) or die(mysql_error()); } } ?> <form action="<?php echo $editFormAction; ?>" name="form1" method="POST"> Email Address: <br/> <input type="text" name="email" value="<?php echo $_POST['email']; ?>" size="50"/> <br/><br/> <input type="submit" name="Submit" /> <input type="hidden" name="MM_insert" value="form1" /> </form> EDIT: Instead of "NULL" use FALSE in your switch statement.
-
Put this line of code on the top of the page and run the script again: error_reporting(-1);
-
Try to use this pattern in your switch statement. $theValue = ($theValue != "") ? "'" . $theValue . "'" : FALSE;
-
I've got a Syntax error: unexpected: $pnds! Did you see that on the line # 27? ///Sub Menu Items Start///<? php
-
Problem With A Php Script Using Mysqldump And Cron Job
jazzman1 replied to azw's topic in MySQL Help
Yep, b/s "/home/XXX/backups/XXX/" is not a part of web root directory, and the user named - "apache" or "www-data" cannot write down outside of its own directory, to do this the best way for me is to create a symbolic link. http://www.cyberciti...hard-links.html -
It does, there are log files into the server. EDIT: By default a php mail function use a linux client called - sendmail.
-
Agreed!
-
@Silvar, is it entire php script to send an email ?
-
Do you get any errors, and if so what errors do you get?
-
Problem With A Php Script Using Mysqldump And Cron Job
jazzman1 replied to azw's topic in MySQL Help
It should be work! You have to change ownership of "/home/XXX/backups/XXX/". Which is a default user in the linux server responsible to run everything in php? -
Problem With A Php Script Using Mysqldump And Cron Job
jazzman1 replied to azw's topic in MySQL Help
My question is, why do you want to use php to do this? In that example I'm using ssh to connect to the remote server and dumping a mysql database into my local machine, every midnight at 2am. Take a look for a minute at this. If you don't understand something about that, don't hesitate to ask me. #!/bin/bash DBUSER=dbUser DBHOST=dbHost DBPASS=dbPass DBNAME=dbName NOW=`/bin/date +%Y%m%d` DIR=$(dirname $0) if [ ! -d $DIR/$NOW ];then mkdir -p $DIR/$NOW;fi ssh hostName@domainName -p 22 mysqldump --host=$DBHOST --user=$DBUSER --password=$DBPASS --protocol=TCP --port=3306 --single-transaction ${DBNAME} > $DIR/$NOW/$NOW.sql tar zcf ${DIR}/db-$NOW.tgz ${DIR}/${NOW}/$NOW.sql rm -rf ${DIR}/${NOW} Cron job: 0 */2 * * * /home/username/db_backUp -
Rid single quotes of surround $directory.
-
Problem With A Php Script Using Mysqldump And Cron Job
jazzman1 replied to azw's topic in MySQL Help
Are you sure that php has permissions to write into "/home/XXX/backups/XXX/" ? -
Hey Christian and thanks for reply I've got it sorted out, here is my simple script: Server' side: #!/bin/bash NAME='userName' PASS='userPass' HIDDEN=`date '+%s'` TIME=`date '+%Y%m%d'` curl --cookie-jar cjar --output /dev/null 'http://www.djtacho.com/member/plugins/protect/new_rewrite/login.php?v=-any&url=/members/' curl --cookie cjar --cookie-jar cjar --data 'amember_login='${NAME} --data 'amember_pass='${PASS} --data 'login_attempt_id='${HIDDEN} --location \ 'http://www.djtacho.com/member/plugins/protect/new_rewrite/login.php?v=-any&url=/members/' curl --cookie cjar --output ~/televizia.html 'http://www.djtacho.com/members/televizia.php' grep -o 'mms://video.djtacho.com/onlineBTV\-hq?token=[a-zA-Z0-9]*' televizia.html > tvFile.txt while read line; do cvlc -vvv $line --loop --sout '#transcode{vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100}:rtp{mux=ts,dst=192.168.1.106,port=8081,sdp=sap://,name="TestStream"}' done < tvFile.txt Client' side code: [jazzman@localhost ~]$ vlc rtp://@:8081 That script works perfectly, but...... there is only one problem! H.264(codec standard) has a very good size/quality ratio but transcoding is much more cpu consuming. What I want to do is, to create a multicast group in the same machine (server), which clients could be have specific permitions to this broadcasting without using transcoding at all. Do you have any idea how to achieve that? I will continue to search solutions and if I found it I'm going to post my solutions here. PS: If someone wants to test the script, it could be run it into a linux terminal (it's a record from Wednesday) Assuming that the ip address to a client machine in the local network is 192.168.1.106 Server: cvlc -vvv 'mms://67.159.54.219/vod/onlineBTV/[bTV] 2012.12.27 -Thursday- (18-00).wmv?token=cc7c9858d94d3d5b119d6ffbd797e9ce' --sout '#transcode{vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100}:rtp{mux=ts,dst=192.168.1.106,port=8081,sdp=sap://,name="TestStream"}' Other machine: vlc rtp://@:8081
-
Hi friends, I know that the question is a quite specific, but maybe someone knows the answer of it. I want to capture a stream file from one mms remote server and restream it without dumping it onto my server. What tools I need to achieve that issue. Any ideas, links, etc.... could be help me. OS's: Centos 6.3 / Red Hat 5 / Centos 5.3 Thanks in advance